grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GRUB 1.96 on a USB floppy drive


From: Andy Goth
Subject: GRUB 1.96 on a USB floppy drive
Date: Fri, 26 Sep 2008 01:59:36 -0500 (CDT)

Hi, I have successfully installed GRUB 1.96 on a USB floppy drive.  I used a 
Knoppix 5.1 bootable CD as my operating system.  The floppy shows up as 
/dev/sdc, which causes GRUB and other programs to believe it to be a hard disk 
with partitions and such.  That causes a number of problems.

The first order of business is formatting the floppy.  Without the -I option, 
mkfs.msdos wimps out, saying "Will not try to make filesystem on full-disk 
device".

$ mkfs.msdos -I -F 12 /dev/sdc

Next, I mount the disk.

$ mount /dev/sdc /media/sdc

I then create a device.map to tell GRUB that /dev/sdc is actually a floppy.

$ mkdir -p /media/sdc/boot/grub
$ echo '(fd0) /dev/sdc' > /media/sdc/boot/grub/device.map

Last, I install GRUB on the disk.  grub-probe just freezes on this computer, so 
I bypass it.  I add the -v option to grub-setup so that I can confirm that it 
knows it's writing to a floppy instead of a hard disk.

$ grub-install --modules="fat biosdisk" --grub-probe=true \
--grub-setup="/usr/local/sbin/grub-setup -v" \
--root-directory=/media/sdc /dev/sdc

Before figuring out the trick with device.map, I used this command line:

$ grub-install --modules="fat biosdisk" --grub-probe=true \
--grub-setup="/usr/bin/gdb --args /usr/local/sbin/grub-setup" \
--root-directory=/media/sdc /dev/sdc

I set a breakpoint on grub_device_open, allowed it to finish, then forced 
->disk->has_partitions on the returned object to be 0.  (It's originally set to 
128.)

(gdb) break grub_device_open
(gdb) run
(gdb) finish
(gdb) print $1->disk->has_partitions = 0
(gdb) continue
etc.

If I neither write a custom device.map nor set has_partitions to zero, GRUB 
corrupts the filesystem when it embeds the core image after what it thinks to 
be the MBR.  I suppose I could use the -R option to mkfs.msdos to reserve 
sectors for it.  Sectors are 512 bytes in size, right?  That means I'd need to 
reserve 52 sectors for a 26308-byte core image plus one more for the boot 
sector.  I don't really feel like trying this out, though.

Why does grub-probe lock up?  Well, when I disable "legacy floppy support" in 
the BIOS configuration, grub-probe no longer locks up.  This computer doesn't 
actually have a "real" floppy drive.  My guess is that it has pins for one 
buried in the docking station connector.  It's probably waiting for me to go 
buy a docking station with a floppy drive in it. :^)

The disk I made boots with both a "real" floppy drive (tested in another 
computer) and in this USB floppy drive, which I can access using the biosdisk 
module.  The biosdisk module names the USB floppy drive (fd0) and the mystery 
nonexistent floppy drive (fd1).  Accessing (fd1) causes GRUB to lock up.

After loading pc.mod, I can also read all the files on my hard disk.  However, 
I can't boot using chainloader.  I just get a "disk read error, press 
Ctrl+Alt+Del" message, regardless of which partition or disk I try to chain to. 
 This happens with both biosdisk.mod and ata.mod.

By the way, why does loading ata.mod cause biosdisk.mod to become unloaded or 
disabled?  I lose access to (fd0), (hd0), and others after loading ata.mod.

I can't find the parttype, hide, and unhide commands which were present in old 
GRUB.  What happened to them?

ata.mod is a real godsend for booting a computer I have with an old BIOS that 
doesn't support large hard disks.  I guess I could repartition so that there's 
a boot partition right at the beginning of the disk, but at the time I was 
setting up the machine, I didn't have tools for doing that.  Now I just leave a 
GRUB floppy in the drive all the time.  I just have to be careful to load 
ata.mod last, or else I lose access to (fd0). :^)

-- 
Andy Goth | http://andy.junkdrome.org/
address@hidden,openverse.com}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]