OSDev.org
https://forum.osdev.org/

Grub2 El-Torito CD
https://forum.osdev.org/viewtopic.php?f=1&t=22169
Page 1 of 1

Author:  BJRowlett [ Fri Jun 18, 2010 7:01 pm ]
Post subject:  Grub2 El-Torito CD

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:
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:
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:
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:
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:
Booting from CD-ROM...
3MB medium detected
no boot info


What am I doing wrong?

Author:  BJRowlett [ Tue Jun 22, 2010 2:56 pm ]
Post subject:  Re: Grub2 El-Torito CD

Well, I finally got my iso to boot, but when I try to load my kernel, I get the error:
Code:
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?

Author:  NickJohnson [ Tue Jun 22, 2010 9:23 pm ]
Post subject:  Re: Grub2 El-Torito CD

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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/