Grub2 El-Torito CD

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
BJRowlett
Posts: 2
Joined: Mon Sep 29, 2008 2:05 pm

Grub2 El-Torito CD

Post 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?
~BJRowlett
BJRowlett
Posts: 2
Joined: Mon Sep 29, 2008 2:05 pm

Re: Grub2 El-Torito CD

Post 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?
~BJRowlett
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: Grub2 El-Torito CD

Post 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.
Post Reply