Page 1 of 1

Grub2 El-Torito CD

Posted: Fri Jun 18, 2010 7:01 pm
by BJRowlett
I'm trying to make a Grub2 El-Torito CD, the first thing I do is copy all the files I use from grub (cdboot.img, modules) into ./Image/iso9660/boot/grub (I don't know if this is required, but...)

Then I make an image of Grub with

Code: Select all

grub-mkimage --prefix=/boot --config=./Image/iso9660/boot/grub/grub.cfg --output=./Image/iso9660/boot/grub/core.img biosdisk iso9660 multiboot sh
I then create the padding file so cdboot.img + core.img + padding = 1.44mb (Otherwise mkisofs complains)

Code: Select all

dd if=/dev/zero of=./Image/iso9660/boot/grub/padding bs=1 count=$(shell expr 1474560 - $(shell stat --format=%s ./Image/iso9660/boot/grub/cdboot.img) - $(shell stat --format=%s ./Image/iso9660/boot/grub/core.img))
I combine cdboot.img, core.img, and padding

Code: Select all

cat ./Image/iso9660/boot/grub/cdboot.img ./Image/iso9660/boot/grub/core.img ./Image/iso9660/boot/grub/padding > ./Image/iso9660/eltorito.img
Finally, I make the iso with

Code: Select all

mkisofs -eltorito-boot eltorito.img -input-charset utf-8 -output ./Image/CdImage.iso ./Image/iso9660
When I pop it in an emulator, it says

Code: Select all

Booting from CD-ROM...
3MB medium detected
no boot info
What am I doing wrong?

Re: Grub2 El-Torito CD

Posted: Tue Jun 22, 2010 2:56 pm
by BJRowlett
Well, I finally got my iso to boot, but when I try to load my kernel, I get the error:

Code: Select all

multiboot /boot/kernel.bin
error: Couldn't open file
I tried to list the drives in grub, and it found (fd0), when I try to ls -l, I get "unknown filesystem"

I had been reading online about these problems, and decided to try grub-mkrescue (which produces an iso directly) instead of grub-mkimage + mkisofs.
This time, when I boot it loads grub right away, but I still see "Couldn't open file" when I try to boot my kernel.

Any Ideas?

Re: Grub2 El-Torito CD

Posted: Tue Jun 22, 2010 9:23 pm
by NickJohnson
I'm not sure about the grub-mkimage command - what filesystem does it create in the image? And is cdboot.img designed for El Torito CDs or normal CDs? Everything past that is the same as what I do, so I assume those first couple commands are the problem. Does the produced floppy image (core.img) work when loaded as a floppy instead of as an El Torito CD?

What I usually do is create a 1.44 MB file, format it as FAT, loopback mount it, install GRUB as if to a real floppy, (I save the produced image once GRUB is installed for time reasons) then copy over the files, and use that image as the El Torito floppy image. It's more complicated, but I can at least assure you it's a working set of steps.