Page 1 of 1

make a grub 2 iso

Posted: Fri Dec 07, 2012 4:33 pm
by CR
hello everyone!
I was trying to boot my kernel with grub 2 on a cd.
I created the iso folder with this structure

Code: Select all

-iso
     -boot
         -grub
              -menu.cfg
         -kernel.bin
and used
grub-mkrescue -o image.iso iso/

i tried to boot the image with bochs bot it stops saying:
CDROM boot failure code: 0009
boot failed: could not read the boot disk


I concluded that it means there's a problem in the boot catalog, I watched with an hex editor and in the byte Boot media type is 0xef.
Does it mean that it's EFI and EFI isn't supported by grub?
if so how can I make a no-emulation eltorito cd?

thank you in advance for your answers

Re: make a grub 2 iso

Posted: Sat Dec 08, 2012 1:49 pm
by egos
Maybe you will try Modified GRUB 2 in SYS format for now. Here is command to make bootable ISO image:

Code: Select all

mkisofs -R -b iso9660.bin -no-emul-boot -hide iso9660.bin -hide boot.catalog -o cdrom.iso grubldr2
You can take iso9660.bin from Yoda's package.

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 8:06 am
by CR
Using the kernel in the system folder it stops after bochs says "0 MB medium detected". It doesn't do anything.
With my kernel it stops at the same point but in the terminal it continues writing "[CPU0 ] prefetch: EIP [00010000] > CS.limit [0000ffff]".

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 9:17 am
by egos
CR wrote:Using the kernel in the system folder it stops after bochs says "0 MB medium detected". It doesn't do anything.
Yes, it doesn't anymore than "jmp $" because it's sample stub.
With my kernel it stops at the same point but in the terminal it continues writing "[CPU0 ] prefetch: EIP [00010000] > CS.limit [0000ffff]".
I think it's not a problem of boot loader. This happens after your kernel gets control.

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 11:52 am
by CR
shouldn't GRUB write something before loading the kernel?

I changed the sample changing

Code: Select all

jmp $
with

Code: Select all

  mov	al,'a'
  out	0xe9,al
  hlt
and bochs didn't wrote anything in the terminal neither the 'a' nor that he reached an hlt

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 12:47 pm
by egos
CR wrote:shouldn't GRUB write something before loading the kernel?
I don't see anything on the screen except cursor.
and bochs didn't wrote anything in the terminal neither the 'a' nor that he reached an hlt
I can see both outputs: "a" in the Bochs console and "WARNING: HLT instruction with IF=0!" in the log file. Try to write something like this:

Code: Select all

  mov word [0B8000h],7 shl 8 + "a"
  jmp $

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 1:24 pm
by egos
Wait! Did you see a boot menu during booting?

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 1:30 pm
by CR
no, it doesn't show the boot menu.

maybe I missed something in creating the iso?
I putted the kernel file and the iso9660.iso in the grubldr2 folder and ran: "mkisofs -R -b iso9660.bin -no-emul-boot -hide iso9660.bin -hide boot.catalog -o image.iso grubldr2"
I had to do something else?

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 1:48 pm
by egos
No, it's enough. If you put your kernel into "grubldr2" (not into "grubldr2/system") you should edit path to your kernel in grub.cfg. Anyway a boot menu should be displayed before your kernel will be loaded.

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 1:57 pm
by CR
so no ideas? :(
and using grub-mkrescue?

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 2:56 pm
by egos
Look at your message box.

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 3:28 pm
by CR
that works!

Re: make a grub 2 iso

Posted: Sun Dec 09, 2012 11:08 pm
by egos
I have made that image by copying iso9660.bin into "grubldr2" and by running the command showed above under Win7/Cygwin. You can use any tool that allows to make bootable CD with Rock Ridge (GRUB requires it).

Re: make a grub 2 iso

Posted: Wed Dec 12, 2012 11:59 am
by CR
sorry but I couldn't answer in these two days.
so what do you suggest to do? what could I use to create the image?

Re: make a grub 2 iso

Posted: Wed Dec 12, 2012 3:40 pm
by egos
Understand the problem of your OS/tool. I had made correct image by the same command under Ubuntu 12.10.