Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Embedded Systems

Virtualization: Up Against the Wall


Tweaking the Code

The entire third partition, hda3, of the laptop's hard drive holds the JPG images, and I've included some NASA space scenery to get you started. However, because the loopback device can't handle a partition table, you can't mount the hard drive image like a floppy. Listing Three (a) shows how to do it.

(a) 
/sbin/fdisk -ul develop.ha  (my hd3 is at 2209536 sectors)
sudo mount -o loop,offset=$((512*2209536)) develop.hd /mnt/loop
sudo cp images/*jpg /mnt/loop
sudo umount /mnt/loop

(b) 
cp /mnt/floppy/fbida-2.06.tar.gz /tmp
cd /tmp/
tar zxvf fbida-2.06.tar.gz
cd fbida-2.06
make
make install
fbi -u -t 3 -noverbose -readahead -autozoom /media/images/*jpg
Listing Three

Use fdisk -ul to list the start of each partition in units of 512-byte sectors; you can tuck those values into variables to save typing. Next, feed the third partition's starting address into the mount command's offset parameter and mount it on /mnt/loop. Then you can copy the files into the image and unmount it, using sudo as needed for root privileges. You could adjust the partition's ownership and permissions if you prefer.

Copy the fbi viewer's tar.gz file to a floppy image and follow Listing Three (3) to install it. Depending on the GCC version, remove the -Wno-pointer-sign CFLAGS option near the top of its GNUmakefile. The download file has notes on some other tweaks.

I recompiled the kernel to use the ThinkPad's Pentium II CPU, add built-in APM support, and omit unused modules and features. My .config file leaves only the floppy and CD support needed for the VM, but you may want to add networking and other creature comforts.

Recompiling and building modules for that configuration takes 321 seconds on a 2.8-GHz Pentium 4 HT using KQEMU's kernel acceleration and 330 seconds without. Omitting the KQEMU module entirely slows the VM to 1954 seconds. Recompiling from the same disk image on the ThinkPad's 233-MHz Pentium II provides 1218 seconds to do something else. I cannot provide a "native" compilation on button for comparison, as setting up cross-compilation was what drove me to QEMU in the first place.

Unaccelerated QEMU thus converts a peppy P4 into a 145-MHz P2, but with full acceleration the VM chugs along like an 884-MHz P2. QEMU claims to run at nearly native speed and I suppose the 3x I found is close enough. Remember that the compiler and kernel run with the 486 instruction set, so further optimization is obviously possible.

Incidentally, switching to a blank console with Ctrl-Alt-F2 dramatically speeds kernel compilation by not scrolling torrents of 2.4 kernel messages across the VESA framebuffer.

The kernel accelerator only works for x86 code, so I'd expect the QEMU ARM or MIPS VM to run at a tiny fraction of "native" speed. On the other hand, those microcontrollers have relatively low performance and you may find the VM produces similar wall-clock results.

Putting a development system into a VM won't solve all your problems, but it does remove much of the configuration complexity. In particular, a virtual network to a file server can eliminate the floppy shuffle, let you use your normal desktop hardware, and make the whole process relatively painless.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.