make a grub 2 iso

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
CR
Posts: 12
Joined: Fri Dec 07, 2012 4:04 pm

make a grub 2 iso

Post 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
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: make a grub 2 iso

Post 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.
If you have seen bad English in my words, tell me what's wrong, please.
CR
Posts: 12
Joined: Fri Dec 07, 2012 4:04 pm

Re: make a grub 2 iso

Post 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]".
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: make a grub 2 iso

Post 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.
If you have seen bad English in my words, tell me what's wrong, please.
CR
Posts: 12
Joined: Fri Dec 07, 2012 4:04 pm

Re: make a grub 2 iso

Post 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
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: make a grub 2 iso

Post 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 $
If you have seen bad English in my words, tell me what's wrong, please.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: make a grub 2 iso

Post by egos »

Wait! Did you see a boot menu during booting?
If you have seen bad English in my words, tell me what's wrong, please.
CR
Posts: 12
Joined: Fri Dec 07, 2012 4:04 pm

Re: make a grub 2 iso

Post 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?
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: make a grub 2 iso

Post 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.
If you have seen bad English in my words, tell me what's wrong, please.
CR
Posts: 12
Joined: Fri Dec 07, 2012 4:04 pm

Re: make a grub 2 iso

Post by CR »

so no ideas? :(
and using grub-mkrescue?
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: make a grub 2 iso

Post by egos »

Look at your message box.
If you have seen bad English in my words, tell me what's wrong, please.
CR
Posts: 12
Joined: Fri Dec 07, 2012 4:04 pm

Re: make a grub 2 iso

Post by CR »

that works!
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: make a grub 2 iso

Post 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).
If you have seen bad English in my words, tell me what's wrong, please.
CR
Posts: 12
Joined: Fri Dec 07, 2012 4:04 pm

Re: make a grub 2 iso

Post 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?
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: make a grub 2 iso

Post by egos »

Understand the problem of your OS/tool. I had made correct image by the same command under Ubuntu 12.10.
If you have seen bad English in my words, tell me what's wrong, please.
Post Reply