This was prompted by my attempt to get something that would boot via the USB port on a Wyse 9450XE. This is fitted with an elderly EPIA mini-ITX motherboard. The BIOS supports USB-HDD and USB-ZIP as boot devices, but no matter how I formatted a Pen Drive I could not create anything that would boot using the USB-HDD setting.
The alternative was to try USB-ZIP....
For an old BIOS using USB-ZIP I understand the Pen Drive has to be set up as follows:
I took the above as my target and haven't tried to see if there are alternatives that also work.
This is quite simple - find a pen drive and decide on the operating system you want to put on to it. In keeping with most of what you'll find here I picked on Tiny Core Linux for the operating system. I also have an old 256MB Pen Drive that I decided to use for this trial.
I decided to use a running Tiny Core system (on the Precedence TCX3) as the environment for creating the bootable Pen Drive. You could probably equally well do it on any Linux system - either running natively or within a virtual machine such as Virtual Box on a Windows or Linux system.
Really fairly straight forward:
Looking at these in turn....
Here I'm using syslinux as the loader so you'll need that. Use the App Browser to download and install the package. The other two important files are the Linux Kernel and ram disk for your operating system.
Note: You could set up a conventional disk environment here, but I wouldn't recommend it. If you are driven to creating a USB-ZIP formatted pen drive then the odds are very much in favour of your target system being OLD. As such the USB ports are likely to be to the USB 1.1 standard and so run at 12Mb/s. I would suggest that you need to boot a RAM-based distribution such as Tiny Core. This will take a while to load (see the performance section at the bottom), but, once up-and-running, will be reasonably responsive. One that subsequently has to load/run applications from the USB drive won't be.
The choice is yours. Anyway hopefully this is just an interim step along the way to getting your desired operating system installed on the internal flash memory of the thin client. Once you've managed that you'll be running at IDE speeds rather than USB1.1 speeds.
As I was creating the Pen Drive on a running Tiny Core system I just used the kernel file and initrd from that system.
Plug in the Pen Drive and do a quick check of the Linux system log to confirm what device it has appeared as. Looking at excerpt from the dmesg listing...
... usb 1-8: new high speed USB device number 2 using ehci_hcd scsi2 : usb-storage 1-8:1.0 scsi 2:0:0:0: Direct-Access USB Flash Disk 5.00 PQ: 0 ANSI: 2 sd 2:0:0:0: Attached scsi generic sg1 type 0 sd 2:0:0:0: [sdb] 501760 512-byte logical blocks: (256 MB/245 MiB) ....
..we can see my 256MB USB drive has appeared as /dev/sdb
Next we need to set up the zip-like partition on it. Research shows that there is a handy tool included with the syslinux package that should make this a doddle - mkdiskimage.
mkdiskimage is actually a perl script, and, if you just load the syslinux.tgz package, it won't run unless you have perl installed as well. If I'd bothered to read it I would have discovered this fact in the syslinux info file.
The next thing I found is that mkdiskimage bombs out thanks to a missing perl module. In getting to the bottom of this I:
That solved the problems.
If-and-when you have a working version of mkdiskimage you find the command line options for it are:
Usage: /usr/local/bin/mkdiskimage [-doFMz4][-i id] file c h s (max: 1024 256 63) -d add DOSEMU header -o print filesystem offset to stdout -F format partition as FAT32 -M "c" argument is megabytes, calculate cylinders -z use zipdisk geometry (h=64 s=32) -4 use partition entry 4 (standard for zipdisks) -i specify the MBR ID -s output a sparse file (don't allocate all blocks)
The command we want to use is:
# mkdiskimage -Mz4 -i usbzip /dev/sdb 20 64 32
This breaks down to:
When it has run you can run fdisk to see the partitioning:
# fisk -l /dev/sdb Disk /dev/sdb: 256 MB, 256901120 bytes 64 heads, 32 sectors/track, 245 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System /dev/sdb4 * 1 20 20464 4 FAT16 <32M
In view of the problems with mkdiskimage it's actually just as easy to do it with fdisk
The first thing is to ensure we have an MBR with boot code on the pen drive. A copy of the MBR comes as part of the syslinux package. We put that on the pen drive using dd:
root@tcx3:~# dd if=/usr/local/share/syslinux/mbr.bin of=/dev/sdb 0+1 records in 0+1 records out 440 bytes (440B) copied, 0.013223 seconds, 32.5KB/s
Now run fdisk with the parameters -H 64 and -S 32 to set the head/sector parameters to what we want.
root@tcx3:~# fdisk -H64 -S32 /dev/sdb Command (m for help):
Delete any existing partitions. Having done that you have an empty drive:
Command (m for help): p Disk /dev/sdb: 256 MB, 256901120 bytes 64 Heads, 32 sectors/track, 245 cylinders Units = clinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System Command (m for help):
Start by creating a 20MB partition in entry 4 in the table, setting the 'bootable' flag and setting the partition type to FAT16:
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 4 First cylinder (1-245, default 1): Last cylinder or +size or +sizeM or +sizeK (1-245, default 245): +20M Command (m for help): a Partition number (1-4): 4 Command (m for help): t Selected partition 4 Hex Code (type L to list codes): 4 Changed system type of partition 4 to 4 (FAT16 <32M) Command (m for help): p Disk /dev/sdb: 256 MB, 256901120 bytes 64 Heads, 32 sectors/track, 245 cylinders Units = clinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System /dev/sdb4 * 1 20 20464 4 FAT16 <32M Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table root@tcx3:~#
Run fdisk to create any additional partitions you may want. In this case I just turned the rest of the pen drive into a single EXT2 partition. When you've done this your pen drive should look something like:
# fdisk -l /dev/sdb Disk /dev/sdb: 256 MB, 256901120 bytes 64 heads, 32 sectors/track, 245 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System /dev/sdb1 21 245 230400 83 Linux /dev/sdb4 * 1 20 20464 4 FAT16 <32M Partition table entries are not in disk order
Next format the partitions. I used the commands:
mkfs.ext2 /dev/sdb1 mkdosfs -F 16 /dev/sdb4
..to get the EXT2 file system on sdb1 and the FAT file system on sdb4.
So at this point we have a formatted pen drive but with no files on it.
This is straight forward. I decided to put the files from my running system (on sda1) in a /boot subdirectory on the pen drive. The first step is mount the newly formatted partition, create a couple of directories and then copy the files over:
root@tcx3:~# mount /dev/sdb4 /mnt/sdb4 root@tcx3:~# mkdir -p /mnt/sdb4/boot/syslinux root@tcx3:~# cd /mnt/sda1/tce/boot root@tcx3:/mnt/sda1/boot/tce# cp core.gz vmlinuz /mnt/sdb4/boot/ root@tcx3:/mnt/sda1/boot/tce#
If you also want to, you can copy over all the installed extensions from the currently running system. Tiny Core automatically searches for a tce directory to find these. Note: As mentioned above, if you do this these applications will be slow to load if you target hardware has a USB1.1 interface.
mount /dev/sdb1 /mnt/sdb1 cp -a /mnt/sda1/tce /mnt/sdb1
You can use any boot loader you like, but here I've picked on syslinux. Installation is simple:
root@tcx3:~# syslinux --directory /boot/syslinux --install /dev/sdb4
If you want you can tell the operating system exactly where to find various system files when it boots - for example you can tell Tiny Core that the /tce directory it is to use is on a particular drive. You do this using the UUID (Universally Unique Identifier) of the drive. The blkid command will tell what these are. On the system I'm creating the pen drive blkid reports:
/dev/sda1: UUID="5c439b45-c2de-438e-8fbd-57f200683239" TYPE="ext2" /dev/sdc1: LABEL="NANO PRO" UUID="4A38-17A0" TYPE="vfat" /dev/loop0: TYPE="squashfs" /dev/loop1: TYPE="squashfs" /dev/loop2: TYPE="squashfs" /dev/loop3: TYPE="squashfs" /dev/loop4: TYPE="squashfs" /dev/loop5: TYPE="squashfs" /dev/loop6: TYPE="squashfs" /dev/loop7: TYPE="squashfs" /dev/zram0: TYPE="swap" /dev/loop8: TYPE="squashfs" /dev/loop9: TYPE="squashfs" /dev/sdb1: UUID="24d39cca-93d5-42f4-80e8-a01479c70a0d" TYPE="ext2" /dev/sdb4: SEC_TYPE="msdos" UUID="3F91-DAB2" TYPE="vfat" /dev/loop10: TYPE="squashfs"
The two items of interest to us here are:
/dev/sdb1: UUID="24d39cca-93d5-42f4-80e8-a01479c70a0d" TYPE="ext2" /dev/sdb4: SEC_TYPE="msdos" UUID="3F91-DAB2" TYPE="vfat"
...which we can use if we wish to ensure that the pen drive OS uses the right directory despite what else might exist on the system it has booted on.
When the system boots the syslinux loader looks for the configuration file syslinux.cfg to find what it has to boot. It searches directories in the following order:
/boot/syslinux/syslinux.cfg /syslinux/syslinux.cfg /syslinux.cfg
Details on exactly what you can put in the file can be found in the syslinux wiki.
Here I just created a very simple file (/boot/syslinux/syslinux.cfg):
Default USBzip Label USBzip kernel /boot/vmlinuz append initrd=/boot/core.gz kmap=qwerty/uk vga=791 host="zippo"
Having created that it should just be a matter of ensuring that the first boot device is set to USB-ZIP in the BIOS, plugging in the Pen Drive - and booting!
With TinyCore 4.6.2 set up I have the kernel file is ~2.5MB and the initrd is ~5.4MB.
Crude timings once the BIOS hands over to the syslinux loader:
Activity Time Total Load vmlinuz : 00:41 00:41 Load initrd : 01:28 02:09 Initialise kernel : 00:11 02:20 Startup scripts : 00:15 02:35 Start GUI : 00:09 02:44
The main thing of note here is that takes 2:20 just to load this small distribution on a machine with a USB1.1 interface.
By comparison, on an HP t5545, (1GHz processor, USB2.0) it takes about 10 seconds to reach a running desktop compared with 2 minutes 45 seconds on the 9450XE!
Any comments? email me. Last update November 2012