Page 1 of 1
Installing grub2 onto floppy.
Posted: Mon Sep 22, 2014 10:27 pm
by HyperAssembler
Hello,
I used the following code to install grub2 to floppy.
Code: Select all
KERNELFLOPPY=$1
sudo dd if=/dev/zero of=$1 bs=512 count=2880 conv=notrunc
sudo losetup /dev/loop0 $1
sudo mke2fs /dev/loop0
sudo mount -t ext2 /dev/loop0 /mnt/floppy
sudo grub-install --force --root-directory=/mnt/floppy /dev/loop0
sudo umount /mnt/floppy
sudo losetup -d /dev/loop0
It fails with:
Code: Select all
Installing for i386-pc platform.
grub-install: error: cannot open `/mnt/floppy/boot/grub/i386-pc/macbless.mod': No space left on device.
I googled for 2 hours and ended up with nothing but:
Code: Select all
grub-mkimage -O i386-pc -o temp.img
And it turned out that the size of temp.img surpassed 1.44M.
So is there no way to get grub2 on floppy?
Thanks.
Re: Installing grub2 onto floppy.
Posted: Mon Sep 22, 2014 11:56 pm
by SpyderTL
Without even looking,I'm going to say 'no'.
Even if you could, you wouldnt have any room left for an OS...
Re: Installing grub2 onto floppy.
Posted: Tue Sep 23, 2014 12:20 am
by iansjack
SpyderTL wrote:Without even looking,I'm going to say 'no'.
Even if you could, you wouldnt have any room left for an OS...
That's a red herring; the OS doesn't have to reside on the same disk as Grub. Having said that, I believe the only solution is to use a 2.88 floppy.
Re: Installing grub2 onto floppy.
Posted: Tue Sep 23, 2014 1:34 am
by Combuster
Grub legacy certainly is small enough to fit on a floppy together with an OS. I don't have grub2 (I decided to migrate straight to ReFind when the time came), but if you really need it and core isn't that bloated, you might want to look to see what modules it uses and eject about everything except the ext2 and multiboot ones. Maybe you end up with something small enough to fit in a few hundred kb eventually.
Re: Installing grub2 onto floppy.
Posted: Tue Sep 23, 2014 2:32 am
by xenos
I'm not sure about how much space it would need on a floppy, but my GRUB2 CD image has a size of < 600kB - including a 80kB kernel file. It only has minimal GRUB2 modules (i386-pc, biosdisk, iso9660, multiboot, configfile - for a floppy you would want to replace iso9660 with a different file system driver, depending on whether you use fat12 or ext2).
Re: Installing grub2 onto floppy.
Posted: Tue Sep 23, 2014 6:41 am
by HyperAssembler
XenOS wrote:I'm not sure about how much space it would need on a floppy, but my GRUB2 CD image has a size of < 600kB - including a 80kB kernel file. It only has minimal GRUB2 modules (i386-pc, biosdisk, iso9660, multiboot, configfile - for a floppy you would want to replace iso9660 with a different file system driver, depending on whether you use fat12 or ext2).
I tried to specify modules grub2 uses by
Code: Select all
grub-install --boot-directory=/mnt/floppy --modules="normal part_msdos multiboot" /dev/loop0
according to wiki.
Still fails with the same message.
How to specify modules to load?
Re: Installing grub2 onto floppy.
Posted: Tue Sep 23, 2014 6:50 am
by HyperAssembler
iansjack wrote:SpyderTL wrote:Without even looking,I'm going to say 'no'.
Even if you could, you wouldnt have any room left for an OS...
That's a red herring; the OS doesn't have to reside on the same disk as Grub. Having said that, I believe the only solution is to use a 2.88 floppy.
So I tried 2.88Mb by changing count=2880 to count=5760.
It still complains about not enough space.
I noticed that the core.img generated by grub-mkimage is just around 1.9MB so it should fit in 2.88MB floppy.
Does grub2 copy other stuff to floppy?(I assume that all the modules should be packed in core.img since it's generated by grub-mkimage)
Re: Installing grub2 onto floppy.
Posted: Tue Sep 23, 2014 11:18 am
by xenos
HyperAssembler wrote:How to specify modules to load?
Since I'm creating a CD image instead of a floppy image, the command is quite different:
Code: Select all
grub-mkimage -o /tmp/core.img -O i386-pc biosdisk iso9660 multiboot configfile
cat /usr/lib/grub/i386-pc/cdboot.img /tmp/core.img > iso/grub2/eltorito.img
rm /tmp/core.img
genisoimage -R -f -b boot/grub/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table -o run/boot.iso -graft-points nos/=iso/nos/ boot/grub/=iso/grub2/
There are also
floppy instructions for GRUB 2, but I have not tried them.
Re: Installing grub2 onto floppy.
Posted: Wed Sep 24, 2014 7:26 am
by HyperAssembler
Thanks everyone finally get it working.
Re: Installing grub2 onto floppy.
Posted: Wed Sep 24, 2014 1:10 pm
by Combuster
Would you be so kind to post an explanation regarding to the solution? I'm sure there will be future people with the same problem.
Re: Installing grub2 onto floppy.
Posted: Wed Sep 24, 2014 5:51 pm
by HyperAssembler
I actually gave up on floppy.
Even for a 2.88M, there would be few space left for kernel.
So I followed the tutorial
here and made myself an iso.
Simple, convenient and works like a charm.