Driving on Virtual
QEMU emulates a complete desktop-class PC with system and VGA BIOS code from the Bochs project, peripherals typical of a low-end PC, and linkage to some of the host machine's actual hardware. I used only the video and disk interfaces, although the emulated NIC can access SMB-shared files on the host.
Because pixie's hard-disk image must eventually fit on the CF card, the first step is measuring the card. The command /sbin/fdisk -ul /dev/sdc displays the raw device capacity in bytes: 2,079,350,784 for my card. Note that shiitake has two SATA drives that put the CF card at /dev/sdc, but your system will be different. I stored the CF size in an environment variable CFsize=2079350784 to avoid typos. (Hint: Use your mouse to highlight the value and middle-click-copy to the command line.)
Listing One (a) shows how to create drive images. The count=0 seek=<size> parameters produce a sparse file occupying only the disk space required for nonzero sectors. The initial hard-drive image thus requires essentially no space and the final images will be about half a gig.
(a) dd if=/dev/zero of=develop.hd bs=1 count=0 seek=$CFsize dd if=/dev/zero of=uttpdos.fd bs=1K count=0 seek=1440 (b) /sbin/mkdosfs uttpdos.fd sudo mount -o loop,uid=ed uttpdos.fd /mnt/loop cp uttpfdos.exe /mnt/loop
Listing One (b) shows how to set up a floppy filesystem and copy files using the loopback device. The uid=ed parameter sets the owner to my userid, simplifying the copy. This column's download file contains cfg-devel.fd and cfg-pixie.fd, the floppy-disk images I used to configure those systems, which should save you some typing.
Listing Two (a) shows how to fire up QEMU for the FreeDOS installation. Watching DOS install itself in a Linux window is less weird than watching Windows in a Linux window, but we won't go there. The FreeDOS installation will see a completely blank drive and offer you its disk partitioner; a 10-MB partition suffices for a minimal installation and the ThinkPad utilities.
(a) qemu -kernel-kqemu -fda uttpdos.fd -fdb blank.fd -hda develop.hd -cdrom fdfullcd.iso -boot cdrom (b) qemu -kernel-kqemu -fda cfg-devel.fd -hda develop.hd -cdrom slackware-11.0-install-d1.iso -boot d (c) qemu -kernel-kqemu -fda cfg-devel.fd -hda develop.hd -cdrom slackware-11.0-install-d1.iso -boot d bare.i root=/dev/hda2 noinitrd ro (boot Slackware from hard drive) ctrl-alt-2 (get to QEMU monitor) change cdrom slackware-11.0-install-d2.iso ctrl-alt-1 (return to Slackware install) mount /dev/hdc /mnt/cdrom installpkg /mnt/cdrom/extra/grub/grub-0.97-i486-2.tgz grub-install no-floppy /dev/hda mount /dev/fd0 /mnt/floppy cp /mnt/floppy/config/menu.lst /boot/grub (d) qemu -kernel-kqemu -fda cfg-devel.fd -hda develop.hd
After installing FreeDOS, extract the utilities from their EXE wrapper to "floppy drive b:" using some applied VM magic:
then copy the results to a directory on the equally unreal hard drive with:
mkdir ThinkPad copy b:*.* ThinkPad
Those utilities will not run in the VM, of course, but they'll be ready to configure the real ThinkPad.
When you install Slackware with the QEMU command line in Listing Two (b), use cfdisk to create a pair of 1-GB ext2 partitions for system and image storage; we'll later resize them for pixie. Select ext2 rather than ext3 filesystems, because we don't need a robust journal.
Create a mount point and mount the floppy image before starting the Slackware install program:
mkdir /fd mount /dev/fd0 /fd setup
My cfg-devel.fd floppy image has tagfiles that produce a bare-bones Slackware: Install the A, AP, D, K, L, N, and X groups with the tagpath set to /fd/tagfiles. The floppy has some other config files you'll find useful, including an automatic root login. That actually makes sense here, as you're always doing dangerous system manipulations. Get over it.
I have never had much luck with lilo, Slackware's boot manager of choice, and wasn't surprised when it choked during this installation. Listing Two (c) shows the one-time dance required to start from Slackware CD 1, boot the hard-drive kernel, insert the CD 2 image, install and configure grub, and finally reboot normally. You can back up the hard-drive image by just copying the develop.hd file: A virtual machine makes trial-and-error learning much less painful.
You must shut down Slackware using halt or shutdown, because just quitting QEMU is exactly the same as pulling the plug on a physical system. Filesystem damage is a clear and present danger.
After verifying that the development system boots properly in the VM, do a smoke test. Shut down Slackware, exit QEMU, unmount the CF card, and copy the entire develop.hd image:
sudo dd if=develop.hd of=/dev/sdc bs=1M
The bs=1M parameter dramatically improves throughput, although the USB adapter and CF card may limit the maximum rate. My setup runs at about 10 MB/s with a 50X card.
Pop the CF card and IDE adapter into the ThinkPad's hard-drive connector and turn it on, at which point grub should boot just as it did in the QEMU VM. Fire up FreeDOS and use the ThinkPad PS2 utility to enable Presentation mode and set the serial port to COM1 for use as a console. Reboot to Slackware, which should also behave just as it did in the VM.
At this point you have a functional Slackware system to install the DPF programs and sample images. You'll use the VM for the next steps, but it's comforting to see the ThinkPad track the VM's progress.