The dirty step by step thumbdrive boot using Syslinux -Aaron Millis 2003.06.02
WARNING: This step by step is written off the cuff and you could seriously damage your setup if something goes wrong.
Use this info at your own risk.
I am going to use win98 and Linux (RH9 since I have it on my laptop) to setup a simple thumbdrive boot.
This is not cigar pro specific and should work on any thumbdrive (or floppy, or usb storage device).
Syslinux (
http://syslinux.zytor.com) is used to boot all sortsa stuff and can give you a lot of flexibility when booting off your removable device.
I like using this so I can choose between different boot options when using my thumb drive.
So, first thing you are going to want is a win98 boot disk. We aren't really going to use this to boot (though it is good to prove the floppy you make does indeed work ahead of time); we just want this to grab the boot sector off of.
Once you've got a 98 boot disk created, the next thing we want to do is pop it in your linux box. We want to extract the 512 byte boot sector off it so we can use it if we want to boot into a 98/dos type OS.
I'm going to assume you only have one floppy, which is usually /dev/fd0.
dd if=/dev/fd0 of=win98.bss bs=512 count=1
Run that. It'll grab your boot sector off whatever's in the floppy and write it to a file in the current directory called win98.bss
(If you've been futzing with linux, you are probably very familiar with DD for disk creation).
That win98.bss is your win98 boot sector from the floppy. You could do the same thing with an old dos6 disk; just use a different file name (dos6.bss sounds good).
Ok, we've got the boot sector; lets grab stuff off the floppy.
Make a directory to hold the win98 files that are on the floppy. I'm going to put mine in ~/win98floppy
Mount your floppy (mount /dev/fd0 should do the trick)
Copy the stuff on the floppy over to your directory (cp /mnt/floppy/* ~/win98floppy)
Unmount the floppy, we are done with it (umount /mnt/floppy)
Ok, now lets go wreck havoc on your beautiful new thumb drive.
I'm going to assume you are using one of the newer linux versions that's got USB support compiled in. I'm not going to go into how to make Linux read usb devices since most of the new stock installs of the most popular kernels will do this.
Go ahead and plug in the Thumbdrive. Assuming you are on an IDE based system with no other SCSI devices, the thumbdrive usually maps at /dev/sda (just like a scsi drive).
You can verify where it went by checking out your messages file in /var/log/messages
What I would do is start a tail on the messages file (tail -f /var/log/messages) and then plug in your device and watch it.
Use ctrl-c to stop tailing the file.
You should see it detect a new USB device and one of the lines will look something like this:
kernel: SCSI device sda: 129024 512-byte hdwr sectors (66mb)
(I am using a 64 mb device for this example).
See the 'device sda' part? Thats what your usb device mapped to. In this case, /dev/sda.
If you already have scsi drives, this would probably be something like sdb or sdc.
First, lets clear off everything thats on the thumbdrive. We are going to use linux Fdisk for this . . .
I can't say it enough; be sure you are comfortable with this stuff, typing the wrong stuff here could cause problems.
Startup fdisk and specify the thumbdrive device name:
fdisk /dev/sda
You will be put at a prompt that says 'Command (m for help):'
First check out the partitions on the device by typing 'p'
You should see something like:
/dev/sda1 1 252 64496 6 FAT16
(the numbers will be different depending on your device).
Whatever is there, we want to get rid of them to start with a nice clean device.
(ie, for some/most thumbdrives you may be ruining the warranty).
This is going to DELETE EVERYTHING ON THE DEVICE.
To delete the partition just hit 'd'.
When you print the partition table with 'p' again, you should see an empty list.
Once you've got it clear, lets make a new FAT16 partition.
Hit 'n' for new partition.
You want a primary partitation 'p'.
You want the partition number to be '1'.
The first cylinder should be '1'.
The last cylinder should be default (the biggest number on the device).
You'll be back at the command prompt, hit 'p' to check out your new partition.
It'll now show /dev/sda1 as an ID83 Linux partition.
We want it to be FAT16, so hit 't' to change the partition system id.
The partition type you want is FAT16 which is code '6'.
When you hit 'p' to print the partition table now, you should see a FAT16 type on /dev/sda1.
Ok, we've got what we want, lets commit the changes (last chance to save your data here).
Hit 'w' to write the partition table.
You'll probably see messages about rereading the partition table and resynching the disks and you'll be back at your shell prompt.
Ok, we've setup a brand spanking new FAT16 partition on the device, lets go setup the file system.
Type: mkfs.msdos /dev/sda1
(this part may be different according to your Linux flavor. If this doesn't work, find out how to make a fat/msdos file system in your flavor).
Ok, we've got a blank thumbdrive, empty file system, and lotsa files, lets make it boot with syslinux.
syslinux is installed by default on most of the popular versions of linux; if you don't have it though, it can be downloaded from syslinux.zytor.com
To install syslinux on the device, just type:
syslinux /dev/sda1
Ok, now lets mount your thumbdrive backup and move some files over to it.
First, make a place to mount it to. I'm going to mount mine at ~/thumb (so, make this directory; mkdir ~/thumb)
Now, mount the drive:
mount /dev/sda1 ~/thumb
If you have problems with the mount command, check to be sure you can mount fat16 file systems with your setup.
Look in the ~/thumb directory, all you should see is a ldlinux.sys file that syslinux put there.
If you don't see that file, you've done something wrong.
Ok, lets copy over our win98 files and the bootsector.
cp ~/win98floppy/* ~/thumb
cp ~/win98.bss ~/thumb
Ok, we are almost there!
Now, we need to configure syslinux to know about the boot sector sitting there for it.
Edit ~/thumb/SYSLINUX.CFG with your favorite editor (i'm going to use pico because I like it; joe, vi, emacs, whatever floats your boat)
This is what you want in the file:
default win98
prompt 1
timeout 600
label win98
kernel win98.bss
Ok, lets test this puppy out.
Unmount the thumbdrive (umount ~/thumb)
Disconnect your device and lets try it in the system you are trying to boot from it.
It should give you something like the following when it starts booting:
SYSLINUX 2.00 2002-10-25 Copyright (C) 1994-2000 H. Peter Anvin
boot:
At that boot prompt, type your label name (win98) or just hit enter to use the default.
You should see it start booting 98.
The hardest part of this all is just *getting* it to give you that syslinux prompt. Once you've got that, you can boot anything you want using more label in your SYSLINUX.CFG file.
(this is one of my current SYSLINUX.CFG files that lets me boot between 98 and various compiles of linux)
default win98
prompt 1
timeout 600
label win98
kernel win98.bss
label linux
kernel vmlinuz
append initrd=initrd.img lang= devfs=nomount ramdisk_size=8192 vga=788
label rh9
kernel vmlinuz2.420
append initrd=initrd2.img lang= devfs=nomount ramdisk_size=8192 vga=788
label linuxnfs
kernel vmlinuz.nfs
append nfsroot=192.168.176.100:/tftpboot/plexi ip=192.168.176.11
Again, none of this is cigarpro specific.
I personally have this working on cigarpros, AVB thumbs, and Butterfly drives;
there isn't any reason it shouldn't work with iomega or linksys type drives too.
Much credit to H. Peter Anvin for syslinux.