Trouble booting kernel with Grub legacy

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

Re: Trouble booting kernel with Grub legacy

Post by egos »

depletionmode wrote:I left the board at work so I can't check until tomorrow.
OK. This stub is based on the component of the project that I have found. If this stub will work you can try to build GRUB Legacy in Linux kernel format. Here are patched binaries of that project (I have cleaned them from some bugs):
loadbin-0.1-bin-win32-patched.zip

Usage:

Code: Select all

mkimage -d 0x80,0 ldgrub.bin stage2 grub.bin
I've attached 1kb of my kernel...
Well, I see Linux kernel format header v. 2.12.
If you have seen bad English in my words, tell me what's wrong, please.
depletionmode
Posts: 16
Joined: Sun Oct 20, 2013 1:28 pm

Re: Trouble booting kernel with Grub legacy

Post by depletionmode »

Same story with the latest stub "Cannot read linux header".

It must differ in some way with the Linux kernel header that does work...
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Trouble booting kernel with Grub legacy

Post by egos »

Well, I will make a stub with header v. 2.12 used.
If you have seen bad English in my words, tell me what's wrong, please.
depletionmode
Posts: 16
Joined: Sun Oct 20, 2013 1:28 pm

Re: Trouble booting kernel with Grub legacy

Post by depletionmode »

Thanks so much!
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Trouble booting kernel with Grub legacy

Post by egos »

I've taken a look on lnxboot.img from GRUB 2. It still uses the header v. 2.03. So the problem could be in my linuxstub(s). Try to load both binaries from this archive by your boot loader.
If you have seen bad English in my words, tell me what's wrong, please.
depletionmode
Posts: 16
Joined: Sun Oct 20, 2013 1:28 pm

Re: Trouble booting kernel with Grub legacy

Post by depletionmode »

WHOOHOO Grub seems to like them both! Thanks!
Hard to know if they're being executed properly but at least Grub seems to be loading them ok.

How do I convert my flat kernel into this format?
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Trouble booting kernel with Grub legacy

Post by egos »

depletionmode wrote:How do I convert my flat kernel into this format?
I'm thinking about it. Meanwhile you can use following boot sequence: your boot loader -> GRUB Legacy (or GRUB 2) in Linux kernel format -> your kernel in ELF format (with short Multiboot header).

File lnxgrub.bin from archive is a complete stage2 of GRUB Legacy. You can use it right now. Just edit boot disk number (offset 0x260), boot partition number (offset 0x261, use value 0xFF for whole disks), config file name (offset 0x617, it's zero-terminated string) if it is need. I used following command to build this image:

Code: Select all

mkimage -d 0x80,0 ldgrub.bin stage2 lnxgrub.bin
File lnxgrub2.bin from archive is a core of GRUB 2. To use it you should put additional modules and other files into /boot/grub/i386-pc (you can find a minimal file collection in sys-grubldr-2.13-compact-add.zip). You can edit boot disk number and boot partition number in same way as mentioned above. But config file name is fixed: /boot/grub/grub.cfg. I used following command to build this image:

Code: Select all

copy /b lnxboot.img+core.img lnxgrub2.bin
Project loadbin contains ldgrub2.bin too but I should check this file first to include it into loadbin-0.1-bin-win32-patched.zip.

Edited. Links deleted.
Last edited by egos on Sun Apr 20, 2014 2:18 am, edited 1 time in total.
If you have seen bad English in my words, tell me what's wrong, please.
rajask89
Posts: 1
Joined: Fri Feb 07, 2014 2:03 pm

Re: Trouble booting kernel with Grub legacy

Post by rajask89 »

Pardon my ignorance, but what exactly do you guys mean when you say Linux kernel header v2.12 ?
Even I am having the same issues as mentioned above, if any one of you have had any progress, some information would really be appreciated.

Thanks.
Post Reply