Help me to load my OS with Grub

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
cxsnew

Help me to load my OS with Grub

Post by cxsnew »

All,
I have installed Grub on the USB disk,and copy my OS image to the root system of that USB disk. After that, I can boot from the USB disk and the stage2 also can find my OS image file in the USB,BUT Grub complained that the OS image file type is not supported or invalid.This make me very suprize,because Grub manul tell me that Grub can recognize many file system and many file format.
The root system in my USB disk is ext2,and my OS image file format is elf(the first 2 lines in my link script is :
OUTPUT_FORMAT("elf32-i386","elf32-i386","elf32-i386")
OUTPUT_ARCH(i386)
).
When I replace my OS image file with the Linux kernel image itself in my USB disk,then Grub will load the Linux image and start it.The Linux kernel will be executed until mount_root, that correct,because USB device has not been initialized at that time.

Can some body give some suggestion? Thanks!
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Help me to load my OS with Grub

Post by Pype.Clicker »

i suggest you give a look at Bare Bones in http://www.osdev.org/osfaq2/.
Among other things, if your kernel has no multiboot header and is not recognized as a Linux Kernel, GRUB cannot load it, be it an ELF or not ...
cxsnew

Re:Help me to load my OS with Grub

Post by cxsnew »

Yes,you are right, I just haven't insert a multiboot header to my OS image. I have fixed this problem.
Post Reply