LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Bootable USB Device with USB-ZIP BIOS (https://www.linuxquestions.org/questions/slackware-14/bootable-usb-device-with-usb-zip-bios-752269/)

oxblood 09-02-2009 11:10 PM

Bootable USB Device with USB-ZIP BIOS
 
Hi,

Previously I asked about the actual creations of boot disk with USB which I intend to write what obstacles I encountered during the creation of bootable execution image and copying of the image onto the USB key [using USB Installer for Slackware script provided by Hameleers] -- I've already overcome these steps by the way. unfortunately, it turns out that I have a bigger problem to overcome first and that is to get the USB device (OCZ Diesel 4GB) to be recognized by the BIOS.

I used Mr. Hameleers' script to create a bootable image along with Slackware CD which were copied onto the USB device accordingly (there is nothing wrong with the scripts by the way). His USB bootable installer creates two partitions, one on partition "1" execution bootable files (i.e. /dev/sda1) and the other on partition "2" (i.e. /dev/sda2), the regular Slackware DVD/CD data. However, what I found out was that my motherboard's BIOS (ASUS P4S333, BIOS AWARD) only has support for "USB-ZIP" but not "USB-HDD" -- ARGH!

Then a gentleman (danielldaniell) pointed out to me that a document, /usr/doc/syslinux-3.52/README.usbkey, offers some explanation of my situation. So I read about the geometry of ZIP drives for USB-ZIP option and how they are viewed in such BIOS'. The description states that the partition must have 64 head and 32 sector in addition to having the linux bootable files on a single partition "4." So I made an endeavor to just do that (fdisk -C2048 -H64 -S32 /dev/sda) and created the "bootable" partition on 4 (i.e. /dev/sda4) and data on 2 (i.e. /dev/sda2) -- the data partition doesn't matter where it sits, partition 1, 2, or 3. The partition 4, /dev/sda4, was formatted with mkdosfs -F16 (vfat) and /dev/sda2 with mke2fs (ext2). Let me just add that Hamelee's USB installer script by default creates the bootable partition on "1" (i.e. /dev/sda1) and data on "2" (/dev/sda2). By the way, allow me to extend my gratitude to Mr. Hameleers for his hard work on this matter (and also recent Slackware 64-bit port).

I have installed the bootable system images, once on partition 1 (script's default) and also on 4 (my modified version for address USB-ZIP concern) but with neither of the settings I was able to boot from the USB key. I even forgo of Slackware data partition and simply made a single bootable partition with system image on partition 4 (i.e. /dev/sda4) with 64(header)/32(sector) geometry -- no result. Then I changed the cylinder numbers on the bootable partition from 2048 to 1024 (fdisk -C1024 -H64 -S32...) assuming that was the culprit; still a blank page when I boot with USB.

I just don't know what else I am left to do. My question is, for USB-ZIP, what geometry size I need to set my bootable partition on to have it boot from USB?

Sincerely,

uppman 09-03-2009 01:07 AM

You might try to format the stick as a "superfloppy" without any partitions. This has worked for me with a similar BIOS which doesn't support booting from USB-HD.

Something like this, assuming /dev/sdc is the stick:

mkdosfs -IF32 /dev/sdc

mount /dev/sdc /mnt/tmp

mkdir /mnt/tmp/syslinux

cp /boot/initrd.gz /mnt/tmp/syslinux
cp /boot/vmlinuz /mnt/tmp/syslinux

kedit /mnt/tmp/syslinux/syslinux.cfg

Add:
default vmlinuz initrd=initrd.gz

umount /mnt/tmp

syslinux /dev/sdc

Read more at:
http://linuxconfig.dyndns.org/lazy/L.../Boot/Syslinux

Good luck!

moonfrog 09-03-2009 01:08 AM

Hello,

Your 4th partition isn't going to help you if your bios doesn't know what to do with the 1st.

There are two ways around that that I can think of.
The sure bet would be to get the Super Grub CD, if you can burn and boot from CD.
The other that I'm 90% sure about would be to write a fragment of your 4th partition to your 1st with:

Code:

dd if=/dev/sda4 of=/dev/sda1 bs=512 count=1
I've never tried that on usb, so you might want to research it and wait for a guru to come along and confirm it. I'm very tired right now and may have missed a detail in your post, but I think this could give you a direction to look in.

gnashley 09-03-2009 05:10 AM

I think you may need to use the tool called 'makebootfat' -it can create a bootable drive for any (or all) of the formats: USB-HD, USB-ZIP and USB-FD

oxblood 09-03-2009 06:04 PM

Quote:

Originally Posted by uppman (Post 3667785)
You might try to format the stick as a "superfloppy" without any partitions. This has worked for me with a similar BIOS which doesn't support booting from USB-HD.

Read more at:
http://linuxconfig.dyndns.org/lazy/L.../Boot/Syslinux

I tried the suggested link but I get "Boot error" which is an improvement from a blank page before. Thank you for your suggestion though.

oxblood 09-03-2009 06:11 PM

Quote:

Originally Posted by gnashley (Post 3668007)
I think you may need to use the tool called 'makebootfat' -it can create a bootable drive for any (or all) of the formats: USB-HD, USB-ZIP and USB-FD

I am trying to play around with the suggested tool, makebootfat, which supposedly should address my needs. However, I'm stuck in feeding all the options it requires. First, what sort of MBR is it asking (mbr.bin)? Is it the USB stick's or the hard drive? Second, how can I produce ldlinux.bss? When `syslinux' is run on the USB drive (i.e. /dev/sda), it only outputs syslinux.cfg, ldlinux.sys. The `initrd.img' is the same as initrd.gz created by the `mkinitrd', right? Do I need to look out for any flag when I run mkinitrd? This is getting a bit complicated...

Sincerely,

uppman 09-04-2009 01:16 AM

Quote:

Originally Posted by oxblood (Post 3668874)
I tried the suggested link but I get "Boot error" which is an improvement from a blank page before. Thank you for your suggestion though.

I forgot to mention that you also need a bootloader in the MBR, IIRC..

cat /usr/lib/syslinux/mbr.bin > /dev/sdc

or

http://www.slackware.com/~alien/slackbuilds/ms-sys/pkg/

installpkg ms-sys-2.1.2-i486-1.tgz

ms-sys --mbr95b /dev/sdc

oxblood 09-04-2009 10:21 AM

Quote:

Originally Posted by uppman (Post 3669231)
installpkg ms-sys-2.1.2-i486-1.tgz

ms-sys --mbr95b /dev/sdc

Still not having a bootable USB. Let me go through the steps one by one:

1) Apparently after following the tutorial you offered, the partition table would look something like the following:

Quote:

$> fdisk -l /dev/sda

Disk /dev/sda: 4009 MB, 4009754624 bytes
124 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Disk identifier: 0xb0bcd68e

This doesn't look like a partition table
Probably you selected the wrong device.

Device Boot Start End Blocks Id System
/dev/sda1 ? 419273 451359 123339962 78 Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(518, 102, 15) logical=(419272, 58, 50)
Partition 1 has different physical/logical endings:
phys=(743, 0, 62) logical=(451358, 103, 15)
Partition 1 does not end on cylinder boundary.
/dev/sda2 ? 56305 157201 387841909+ 10 OPUS
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(205, 7, 0) logical=(56304, 96, 14)
Partition 2 has different physical/logical endings:
phys=(920, 235, 50) logical=(157200, 21, 34)
Partition 2 does not end on cylinder boundary.
/dev/sda3 ? 243180 492820 959615034 8b Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(260, 125, 54) logical=(243179, 38, 56)
Partition 3 has different physical/logical endings:
phys=(893, 46, 60) logical=(492819, 2, 35)
Partition 3 does not end on cylinder boundary.
/dev/sda4 ? 172706 173789 4161536 a OS/2 Boot Manager
Partition 4 has different physical/logical beginnings (non-Linux?):
phys=(269, 111, 50) logical=(172705, 53, 35)
Partition 4 has different physical/logical endings:
phys=(0, 0, 0) logical=(173788, 4, 40)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order
So just to be sure, I wipe everything clean to start from the scratch (deleting all four partitions).


2) Then run `mkdosfs' (-I creates a "superfloppy" on the USB):

Quote:

$> umount /mnt/usb # make sure it's unmounted
$> mkdosfs -IF32 /dev/sda
mkdosfs 2.11 (12 Mar 2005)
`fdisk' reports the following:

Quote:

4> fdisk -l /dev/sda

Disk /dev/sda: 4009 MB, 4009754624 bytes
124 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System

3) Continuing with the procedure:

Quote:

$> mount /dev/sda /mnt/tmp/
$> mkdir /mnt/tmp/syslinux
$> cp /boot/initrd.gz /mnt/tmp/syslinux/
$> cp /boot/vmlinuz-custom-2.6.27.7-custom /mnt/tmp/syslinux/vmlinuz
* I am creating my initrd with the following options (my /lib/module is 2.6.27.7-custom by the way) :

Quote:

boot/$> mkinitrd -c -k 2.6.27.7-custom
I have "JFS" on all my filesystems including the root parition. Do I need to apply any other flag (-f or -r) with `mkinitrd'? Continuing with the procedure:

Quote:

$> emacs /mnt/tmp/syslinux/syslinux.cfg

default vmlinuz initrd=initrd.gz

$> umount /mnt/tmp

4) Working with `makebootfat' recommended by gnashley, I realized that the `syslinux' bootloader package installed on ALL slackwares (12.0 - current (32/64)), version "3.52" is utilized which is at least a few year-old package. So I grabbed the newest version of Syslinux (3.82) from kernel.org website.

As a side Note: Interestingly, the old document that I had read before (/usr/doc/syslinux-3.52/README.usbkey) mentioned of use of `mkdiskimage' which wasn't working properly but apparently the newer version does comply to its contracted obligation (i.e. actually creating the table on partition 4). The newer version (syslinux-3.82) also provides several other images, i.e. syslinux-3.82/core/ldlinux.bss | ldlinux.sys and syslinux-3.82/mbr/mbr.bin). But I digress.

Quote:

$> /tmp/syslinux-3.82/linux/syslinux /dev/sda
Using the 3.82 rather than 3.52. Also using ms-sys 2.1.3 (available on 12.1/2) rather than 2.1.2 (available for 12.0):

Quote:

$> ms-sys --mbr95b /dev/sda
Windows 95B/98/98SE/ME master boot record successfully written to /dev/sda
* There are other MBR flags, mbr, mbrdos, mbrsyslinux...

And the `fdisk':

Quote:

$> fdisk -l /dev/sda

Disk /dev/sda: 4009 MB, 4009754624 bytes
124 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Disk identifier: 0xb0bcd68e

This doesn't look like a partition table
Probably you selected the wrong device.

Device Boot Start End Blocks Id System
/dev/sda1 ? 419273 451359 123339962 78 Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(518, 102, 15) logical=(419272, 58, 50)
Partition 1 has different physical/logical endings:
phys=(743, 0, 62) logical=(451358, 103, 15)
Partition 1 does not end on cylinder boundary.
/dev/sda2 ? 56305 157201 387841909+ 10 OPUS
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(205, 7, 0) logical=(56304, 96, 14)
Partition 2 has different physical/logical endings:
phys=(920, 235, 50) logical=(157200, 21, 34)
Partition 2 does not end on cylinder boundary.
/dev/sda3 ? 243180 492820 959615034 8b Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(260, 125, 54) logical=(243179, 38, 56)
Partition 3 has different physical/logical endings:
phys=(893, 46, 60) logical=(492819, 2, 35)
Partition 3 does not end on cylinder boundary.
/dev/sda4 ? 172638 173720 4161536 a OS/2 Boot Manager
Partition 4 has different physical/logical beginnings (non-Linux?):
phys=(269, 111, 50) logical=(172637, 29, 19)
Partition 4 has different physical/logical endings:
phys=(0, 0, 0) logical=(173719, 104, 24)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order

Upon the reboot, once USB-ZIP is selected in BIOS, I receive the following message:

Quote:

PRESS A KEY TO REBOOT
And trust me when I say, it keeps its promise -- it does reboot :)

Of course, there is no way I can mount the USB now because I don't know what filesystem should I mounted with (looking at the fdisk -l doesn't help). Any idea why this is not working?

P.S. I'm going to write about `makebootfat' steps later on.

gnashley 09-04-2009 10:55 AM

ms-sys is douing much the same as using syslinux -that is, it is creating an MBR which makes the drive appear as a hard drive. If you use mkdosfs, then it makes the drive appear as a floppy drive. This is why you may need makebootfat -it can write the MBR so that it appears to be a bootable zip drive. To be honest, I do not know exactly what the difference is -I mean I don't know what the ZIP drive 'presents' to make the BIOS understand that it is a zip drive. As an aside, most bootable cdrom's also appear as a 'super-floppy' -that means there is no partition table at all -the first data on the disk is boot code and the data is located in the following sectors.

Edit:
I was just reading the syslinux document you linked to. It looks to me like you need to create *only* partition 4. If you create 1,2 or 3 then it will not appear as a zip drive. This means that all your data and system would need to go in the that single partition.

Edit:
I just found a great resource for understanding disk structures, starting here:
http://thestarman.pcministry.com/asm/mbr/index.html

oxblood 09-04-2009 10:45 PM

Quote:

Originally Posted by gnashley (Post 3669793)
If you use mkdosfs, then it makes the drive appear as a floppy drive.

Actually, the "-I" switch makes it appear as a superfloppy but yes, you are right in that context. I wonder if I should try USB-FDD in the BIOS setting then? Alright, I just did and "PRESS A KEY TO REBOOT" message came up again.

Quote:

Originally Posted by gnashley (Post 3669793)
makebootfat -it can write the MBR so that it appears to be a bootable zip drive. To be honest, I do not know exactly what the difference is -I mean I don't know what the ZIP drive 'presents' to make the BIOS understand that it is a zip drive.

`makebootfat' should supposedly accomplish this task but the man page is vague regarding the flags. Not vague per se, more of being non-descriptive for an uninformed user like me. As I describe in the next reply, when I feed the tool with "-Z" flag, which incidentally should create a proper bootable USB disk for USB-ZIP devices, that is, according to the man page, "If possible force the ZIP-Disk compatibility. It sets a geometry of 32 sectors and 64 heads. It also uses the 4'th partition entry in the partition table. It's required to boot also in USB-ZIP mode," it does not just do that -- no partition "4" and no proper header and sector configuration.

Quote:

Originally Posted by gnashley (Post 3669793)
I was just reading the syslinux document you linked to. It looks to me like you need to create *only* partition 4. If you create 1,2 or 3 then it will not appear as a zip drive. This means that all your data and system would need to go in the that single partition.

Indeed, that's the same document I was offered to by some other user on this forum which led me to try `mkdiskimage' but unfortunately, the version supplied with Slackware was old enough that didn't really comply with the command line flags instructed in the document.

After downloading the latest release of Syslinux (3.82), I ran the script (`mkdiskimage' is actually a Perl script) with the following flags (I deleted all the previously created partitions before starting these steps):

(I tried to place the command lines in "code" blocks but the Firefox displays them with horizontal scroller bar. That's why I'm using a "quote" block)

Quote:

$> fdisk -l /dev/sda

Disk /dev/sda: 4009 MB, 4009754624 bytes
124 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Disk identifier: 0xb0bcd68e

Device Boot Start End Blocks Id System

$> /tmp/syslinux-3.82/utils/mkdiskimage -4 -z /dev/sda 1024

Which is an equivalent of the following command:

Quote:

$> /tmp/syslinux-3.82/utils/mkdiskimage -4 /dev/sda 1024 64 32

You could also assign "0" instead of "1024" to determine the size of the cylinder but let's go with the recommended 1024 for now.

Quote:

$> fdisk -l /dev/sda

Disk /dev/sda: 4009 MB, 4009754624 bytes
64 heads, 32 sectors/track, 3824 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x837f93ac

Device Boot Start End Blocks Id System
/dev/sda4 * 1 1024 1048560 6 FAT16
What do you know, it really did create a boot-set flag, FAT16 on partition 4. Now, I do not know whether I should have created FAT32 with "-F" flag but oh well. Running the previously suggested steps to have a `syslinux' bootloader:

Quote:

$> mount /dev/sda /mnt/tmp
$> mkdir /mnt/tmp/syslinux
$> cp /boot/initrd.gz /mnt/tmp/syslinux
$> cp /boot/vmlinuz-custom-2.6.27.7-custom /mnt/tmp/syslinux/vmlinuz
$> emacs /mnt/tmp/syslinux/syslinux.cfg
default vmlinuz initrd=initrd.gz
$> umount /mnt/tmp
$> /tmp/syslinux-3.82/linux/syslinux /dev/sda4
Checking to see everything's there (notice /sda4):

Quote:


$> mount -t vfat /dev/sda4 /mnt/usb
$> ls -la /mnt/usb
ldlinux.sys*
syslinux/
$> ls -la /mnt/usb/syslinux/
initrd.gz*
syslinux.cfg*
vmlinuz*

After another boot from USB, once again I get "PRESS A KEY TO REBOOT". Next, I'll write about `makebootfat' (I'm down with a flu and pills have made me extremely lethargic and soporific, so I might as well inscribe it tomorrow but not for now). Meanwhile, if anyone sees a discrepancy or has a suggestion, please let me know.

P.S. Loved the line by line Lilo assembly code examination of the linked tutorial on MBR and boot records you shared. Thank you. I got to start mass-bookmarking these links before I lose them. Perhaps, it is one of my motivations to post everything here just for my own future reference if I manage to get something working out of all this.

oxblood 09-05-2009 12:36 PM

As promised, I'm going to share step by step the process I undertook to invoke `makebootfat' program to create a bootable USB device.

Quote:

$> mkdir /tmp/mkbd && cd /tmp/mkbd
$> cp /tmp/syslinux-3.82/core/ldlinux.bss ./
$> cp /tmp/syslinux-3.82/core/ldlinux.sys ./
$> cp /tmp/syslinux-3.82/mbr/mbr.bin ./
$> cp /boot/initrd.gz ./
$> cp /boot/vmlinuz-custom-2.6.27.7-custom ./vmlinuz
$> emacs syslinux.cfg

DEFAULT usbboot
PROMPT 1
TIMEOUT 1200

LABEL usbboot
KERNEL vmlinuz
APPEND ro root=/dev/sda4 initrd=initrd.gz

$> mkdir /tmp/mkbd/image
$> chmod +x ./*

Before running `makebootfat', I wipe the partitions off of the USB device:

Quote:

fdisk -l /dev/sda

Disk /dev/sda: 4009 MB, 4009754624 bytes
124 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Disk identifier: 0x837f93ac

Device Boot Start End Blocks Id System

I dump the description of those makebootfat flags I'll be using to invoke the tool below:


Quote:

-Y, --syslinux3
Enforce the syslinux 3.xx FAT support. Syslinux 3.00 supports all the FAT types and sizes but it requires a special customisation of the boot sector and of the file `ldlinux.sys'. This option does this customisation without the need to use the syslinux installer if the `ldlinux.sys' file is copied on disk with the -c option.

-Z, --zip
If possible force the ZIP-Disk compatibility. It sets a geometry of 32 sectors and 64 heads. It also uses the 4'th partition entry in the partition table. It's required to boot also in USB-ZIP mode.

-m, --mbr FILE
Specify the MBR sector image to use. If this option is specified a partition table is created on the disk. Otherwise the disk is filled without a partition table like a floppy disk.

IMAGE
Directory image to copy on the disk. All the files and subdirectories present in this directory are copied on the disk.

And finally run makebootfat 1.4 but since it depends on `syslinux' and I didn't have a good run with Slackware's syslinux package, I installed the the newest version, 3.82.

Quote:

$> cp /tmp/syslinux-3.82/linux/syslinux /usr/local/sbin/
$> cp /tmp/syslinux-3.82/linux/syslinux-nomtools /usr/local/sbin/

$> makebootfat -o usb -Y -Z -b ldlinux.bss -m mbr.bin -c ldlinux.sys -c syslinux.cfg -c vmlinuz -c initrd.gz image

$> fdisk -l /dev/sda

Disk /dev/sda: 4009 MB, 4009754624 bytes
84 heads, 22 sectors/track, 4237 cylinders
Units = cylinders of 1848 * 512 = 946176 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sda1 * 1 4238 3915745 b W95 FAT32

Oh, look, not only it didn't create it on the partition 4, neither the head and sector match the advertised obligation mentioned in "-Z" flag description.

Time to reboot and... "PRESS A KEY TO REBOOT" message once again. Examining the content of the USB key:

Quote:

$> mount -t vfat /dev/sda1 /mnt/usb
$> ls -la /mnt/usb
total 2512

-r-xr-xr-x 1 root root 789424 initrd.gz*
-r-xr-xr-x 1 root root 14918 ldlinux.sys*
-r-xr-xr-x 1 root root 114 syslinux.cfg*
-r-xr-xr-x 1 root root 1733168 vmlinuz*

$> cat /mnt/usb/syslinux.cfg
DEFAULT usbboot
PROMPT 1
TIMEOUT 1200

LABEL usbboot
KERNEL vmlinuz
APPEND ro root=/dev/sda4 initrd=initrd.gz

So let me change that to "sda1" and reboot... "PRESS A KEY TO REBOOT" message pops once again. *sigh*

Can any of you gurus tell me what I'm doing wrong?

Sincerely,

gnashley 09-05-2009 01:50 PM

Have a look here:
http://advancemame.sourceforge.net/doc-makebootfat.html

Excerpt:
7 Multi Standard USB Booting
The BIOS USB boot support is generally differentiated in three categories: USB-HDD, USB-FDD and USB-ZIP.

The USB-HDD (Hard Disk Drive) standard is the preferred choice and it requires the presence of a partition table in the first sector of the disk. You can create this type of disk using the -m option.

The USB-FDD (Floppy Disk Drive) standard requires the presence of a filesystem starting from the first sector of the disk without a partition table. You can create this type of disk without using the -m option.

The USB-ZIP (ZIP Drive) standard requires the presence of a device with a very specific geometry. Specifically, it requires a geometry with 32 sectors and 64 heads. It also requires the presence of a partition table with only a bootable partition in the fourth entry. You can create this type of disk using the -m and -Z option.

Generally these standards are incompatible, but using the -m, -F and -Z options you can create a disk compatible with all of them.

To use the -F option, the MBR image specified must follow the constrains:
It must start with a standard FAT 3 bytes jump instruction.
It must have the bytes from address 3 to 89 (included) unused.

And example of such image is in the `mbrfat.bin' file.

For example to create a syslinux image:
makebootfat -o usb \
-Y \
-Z \
-b ldlinux.bss -m mbrfat.bin -F \
-c ldlinux.sys -c syslinux.cfg \
-c linux -c initrd.img \
image

# End of excerpt

The way I read it, to create a USB-ZIP-only device, you'd leave out the -m option and use the -Z option alone. But the multi-standard device may give the best chance of being usable. mbr.bin is a hard-disk MBR. mbrfat.bin appears to be a super-floppy MBR. A regular floppy device would not use the -m option at all.

The fact that the sectors and heads are not being correctly created is probably due to the 4GB size of your device (1GB drive seems to work most reliably). You may have to manually create the device using the normal tools in order to set the needed geometry. Or, use the above method and then use fdisk or sfdisk to adjust the geometry to the correct values.

Also see here:
http://puppylinux.com/news/news400a5-400a7.htm
Excerpt:
'ComboFormat' added to Universal Installer
March 3rd, 2008

I have a PC that is extremely fussy about what USB stick will boot on it. The BIOS setup has USB-FLOPPY, USB-HDD and USB-ZIP settings but I can only get the last one to work, and even that is very fussy. I can't get 1GB and larger sticks to boot, so I experimented with a combination of small FAT16 partition and a ext2 partition to fill the rest of the drive. This works, with the USB-ZIP setting.

I couldn't think of any better name, so I named this dual-partition setup "ComboFormat" and have added this to the Universal Installer.

Note that this is very much under development. JustGreg is doing a lot of work getting USB drives to boot. The "ComboFormat" solution that I have devised so far is not a universal solution, as it won't boot on my Classmate laptop (another extremely fussy PC for USB booting).

I appreciate you following up by posting what you are trying.

oxblood 09-05-2009 05:25 PM

Quote:

Originally Posted by gnashley (Post 3671166)
Have a look here:
http://advancemame.sourceforge.net/doc-makebootfat.html

Excerpt:
7 Multi Standard USB Booting
The USB-ZIP (ZIP Drive) standard requires the presence of a device with a very specific geometry. Specifically, it requires a geometry with 32 sectors and 64 heads. It also requires the presence of a partition table with only a bootable partition in the fourth entry. You can create this type of disk using the -m and -Z option.

Generally these standards are incompatible, but using the -m, -F and -Z options you can create a disk compatible with all of them.

To use the -F option, the MBR image specified must follow the constrains:
It must start with a standard FAT 3 bytes jump instruction.
It must have the bytes from address 3 to 89 (included) unused.

And example of such image is in the `mbrfat.bin' file.

Quote:

$> cp /tmp/makebootfat-1.4-src-1/mbrfat.bin /tmp/mkbd
$> makebootfat -o usb -Y -Z -b ldlinux.bss -m mbrfat.bin -F -c ldlinux.sys -c syslinux.cfg -c vmlinuz -c initrd.gz image
Booting from the USB constructed by the flags above:

Quote:

FDD
No Operating System

Well, that's a new one. I tried to boot with either USB-FDD and USB-ZIP options selected in the BIOS, same result. Interestingly, as I was checking the POST message, I realized that the BIOS is reporting the following:

Quote:

USB Storage Device: DIESEL
Trend ChipAwayVirus(R) on Guard
"Diesel" is my OCZ 4GB USB drive so it's being recognized in the BIOS boot phase.


Quote:

Originally Posted by gnashley (Post 3671166)
The way I read it, to create a USB-ZIP-only device, you'd leave out the -m option and use the -Z option alone. But the multi-standard device may give the best chance of being usable. mbr.bin is a hard-disk MBR. mbrfat.bin appears to be a super-floppy MBR. A regular floppy device would not use the -m option at all.

But that's exactly what the man page suggest, that is, to include both -Z and -m (highlighted above in the excerpt). But allow me to run `makebootfat' without -m option:

Quote:

$> makebootfat -o usb -Y -Z -b ldlinux.bss -F -c ldlinux.sys -c syslinux.cfg -c vmlinuz -c initrd.gz image
$> fdisk -l /dev/sda
Disk /dev/sda: 4009 MB, 4009754624 bytes
124 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Disk identifier: 0xb0bcd68e

This doesn't look like a partition table
Probably you selected the wrong device.

Device Boot Start End Blocks Id System
/dev/sda1 ? 419273 451359 123339962 78 Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(518, 102, 15) logical=(419272, 58, 50)
Partition 1 has different physical/logical endings:
phys=(743, 0, 62) logical=(451358, 103, 15)
Partition 1 does not end on cylinder boundary.
/dev/sda2 ? 56305 157201 387841909+ 10 OPUS
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(205, 7, 0) logical=(56304, 96, 14)
Partition 2 has different physical/logical endings:
phys=(920, 235, 50) logical=(157200, 21, 34)
Partition 2 does not end on cylinder boundary.
/dev/sda3 ? 243180 492820 959615034 8b Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(260, 125, 54) logical=(243179, 38, 56)
Partition 3 has different physical/logical endings:
phys=(893, 46, 60) logical=(492819, 2, 35)
Partition 3 does not end on cylinder boundary.
/dev/sda4 ? 32999 34081 4161536 a OS/2 Boot Manager
Partition 4 has different physical/logical beginnings (non-Linux?):
phys=(269, 111, 50) logical=(32998, 19, 55)
Partition 4 has different physical/logical endings:
phys=(0, 0, 0) logical=(34080, 94, 60)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order

Of course, I can't mount it now but booting from this particular USB result in:

Quote:

Boot Error
Not so encouraging.


Quote:

Originally Posted by gnashley (Post 3671166)
The fact that the sectors and heads are not being correctly created is probably due to the 4GB size of your device (1GB drive seems to work most reliably). You may have to manually create the device using the normal tools in order to set the needed geometry. Or, use the above method and then use fdisk or sfdisk to adjust the geometry to the correct values.

I might just do that. I'll try different settings and keep updating this reply. Ok reverting back to -m -F, and -Z option, then adjusting the geometry of the USB partitions accordingly. Alright, I can change the geometry of the device using fdisk but how can I change the partition table? Wasn't `makebootfat' responsible for all that? *sigh*

gnashley 09-06-2009 02:29 AM

"how can I change the partition table?" Use the advanced features of fdisk to reset the geometry, then delete the existing partitions. Create a new partition giving "4" as the number to use. Let is span the whole device. Set the bootable flag for the new partition.
Again, the 4GB size is probably a problem. To work around it, you could create a smaller file (504MB may be the ideal size). Then use losetup to partition it and do the other operations. Then use dd or cat to write the whole thing to the raw device. This will ensure the smaller size.

I'm sure you are having lots of fun with all this -even if losing a bit of hair!

oxblood 09-06-2009 09:09 AM

Quote:

Originally Posted by gnashley (Post 3671590)
"how can I change the partition table?" Use the advanced features of fdisk to reset the geometry, then delete the existing partitions. Create a new partition giving "4" as the number to use. Let is span the whole device. Set the bootable flag for the new partition.
Again, the 4GB size is probably a problem. To work around it, you could create a smaller file (504MB may be the ideal size). Then use losetup to partition it and do the other operations. Then use dd or cat to write the whole thing to the raw device. This will ensure the smaller size.


Creating a USB boot disk with "-m -Z, and -F" options:

Quote:

$> makebootfat -o /dev/sda -Y -Z -b ldlinux.bss -m mbrfat.bin -F -c ldlinux.sys -c syslinux.cfg -c vmlinuz -c initrd.gz image
$> fdisk -l /dev/sda
Disk /dev/sda: 4009 MB, 4009754624 bytes
84 heads, 22 sectors/track, 4237 cylinders
Units = cylinders of 1848 * 512 = 946176 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sda1 * 1 4238 3915745 b W95 FAT32
Writing the USB image onto the hard drive (the BLOCK count didn't do 1GB for some reason and it takes an hour to read and 2 hours to write, so I was a bit lazy to correct the mistake so rather read 4GB, oh well. I'm sure I'll regret it later on). And I entirely forgotten about creating and mounting partition on a loop device -- maybe next try:

Quote:

$> dd if=/dev/sda1 of=usb.img count=1024M
7831490+0 records in
7831490+0 records out
4009722880 bytes (4.0 GB) copied, 3892.85 s, 1.0 MB/s
Changing the USB device geometry (I wanted to set "-C1024" but I had read 4GB from the USB already, argh!):

Quote:

$> fdisk -H64 -S32 /dev/sda

The number of cylinders for this disk is set to 3824.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 4009 MB, 4009754624 bytes
64 heads, 32 sectors/track, 3824 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 4
First cylinder (1-3824, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-3824, default 3824):
Using default value 3824

Command (m for help): t
Selected partition 4
Hex code (type L to list codes): b
Changed system type of partition 4 to b (W95 FAT32)

Command (m for help): a
Partition number (1-4): 4

Command (m for help): p

Disk /dev/sda: 4009 MB, 4009754624 bytes
64 heads, 32 sectors/track, 3824 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sda4 * 1 3824 3915760 b W95 FAT32

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.


Writing the image back from the hard drive onto the USB:

Quote:


$> dd if=usb.img of=/dev/sda4
7831490+0 records in
7831490+0 records out
4009722880 bytes (4.0 GB) copied, 14821.4 s, 271 kB/s

Yup, 4 hrs 10 mins on USB 1.1 and the results...

Quote:

FDD
No Operating System

Quote:

Originally Posted by gnashley (Post 3671590)
I'm sure you are having lots of fun with all this -even if losing a bit of hair!

Actually I've given up all hopes a while back, so my lowered expectation has kept my sanity so far.


All times are GMT -5. The time now is 04:40 PM.