Page 1 of 2
Trouble booting kernel with Grub legacy
Posted: Tue Oct 29, 2013 11:21 am
by depletionmode
I'm trying to boot my kernel based off the Bare Bones tutorial with Grub legacy but I'm getting error 13.
Ive checked the kernel binary and the multi boot header is at 0x1000 (ie 4K)
In my Grub config I've got:
root (hd0,0)
kernel /kernel.bin
I've tried changing the command to:
multiboot /kernel.bin
But I I don't think my version of grub understands the multiboot command.
It boots fine in QEMU with -kernel
I've tried tons of stuff but to no avail. What should I be doing to get grub legacy to boot it?
Re: Trouble booting kernel with Grub legacy
Posted: Tue Oct 29, 2013 12:03 pm
by egos
First of all look at
Grub_Error_13 and show your kernel image/dump of Multiboot header. Also I can try to load your kernel in my environment.
If your kernel is located on the same disk/partition where grub was booted from, try to drop out "root (hd0,0)". For example:
Code: Select all
title Link 0.52
kernel /system/link.os system
module /system/link.fs
Re: Trouble booting kernel with Grub legacy
Posted: Tue Oct 29, 2013 10:15 pm
by depletionmode
Thanks egos, I'd really appreciate you taking a look.
I took a look at that wiki page. My kernel *seems* to conform...
Kernel is attached. It's just a simple kernel with basic PCI and uart-over-pci driver (which most likely doesn't work - it's my first go at it
).
The multiboot header looks like this:
Code: Select all
00001000 02 B0 AD 1B 03 00 00 00 FB 4F 52 E4
Re: Trouble booting kernel with Grub legacy
Posted: Tue Oct 29, 2013 11:40 pm
by egos
Your kernel was loaded successfully in my invironment (except it stops at 0x00000000001002f0>> jmp .-2 (0x001002f0) : EBFE). So I think the problem in the loader. Try
this version of Modified GRUB with Yoda's stage 0/stage 1 boot loaders (search on this forum).
Edited. Link updated.
Re: Trouble booting kernel with Grub legacy
Posted: Wed Oct 30, 2013 3:07 am
by depletionmode
Thanks for testing!
I guess something must be up with the version of Grub I'm using. Issue is it's a dev board and getting a new version of Grub on to it isn't so easy (resident on SPI and needs to be compiled from sources I don't have to support the platform).
Is there any grub command that I can use to get Grub to boot an ISO?
Re: Trouble booting kernel with Grub legacy
Posted: Wed Oct 30, 2013 9:02 am
by egos
Are you interesting exactly in GRUB command? Or just how to get bootable ISO mage with GRUB Legacy/your kernel? If second one then you can use first command (where mkisofs is used) from my post in
this topic.
Re: Trouble booting kernel with Grub legacy
Posted: Wed Oct 30, 2013 9:24 am
by depletionmode
Using Grub command to do it.
I already can get the kernel all packaged up with Grub into an ISO.
What I was thinking was that if I'm having trouble getting this strange custom Grub booting my kernel directly, maybe I can somehow get it to boot the ISO (and thereby pass it off to the Grub instance on the ISO itself which has no trouble booting my kernel.)...
Re: Trouble booting kernel with Grub legacy
Posted: Wed Oct 30, 2013 11:22 am
by egos
GRUB cannot see CD if it's booted not from CD. But you can try to load GRUB 2 (it has Multiboot entry point) by GRUB Legacy, and then to load your kernel by GRUB 2. If it will work I can add Multiboot entry point in my Modified Grub (Legacy) later (to use following boot sequence: GRUB Legacy -> my Modified GRUB Legacy -> your kernel). So put GRUB 2 into /boot/grub/i386-pc and edit configuration files:
menu.lst
Code: Select all
title Run GRUB 2
kernel /boot/grub/i386-pc/core.img
grub.cfg
Code: Select all
menuentry "Run my kernel" {
multiboot /kernel.bin
}
You can take GRUB 2 here:
sys-grubldr-2.13-original-core.zip
sys-grubldr-2.13-compact-add.zip
Edited. Links updated.
Re: Trouble booting kernel with Grub legacy
Posted: Thu Oct 31, 2013 5:22 am
by depletionmode
Thanks. I gave it a go. Have error 13 when trying to load Grub 2's core.img. It seems that they've compiled a version of Grub without multiboot support or something...?
I'm checking with them...
What format is a Linux Kernel in? It seems to boot that fine... Is there any way to get my little kernel to be like that?
Re: Trouble booting kernel with Grub legacy
Posted: Thu Oct 31, 2013 5:52 am
by egos
depletionmode wrote:It seems that they've compiled a version of Grub without multiboot support or something...?
What format is a Linux Kernel in?
Linux kernel
It seems to boot that fine... Is there any way to get my little kernel to be like that?
OK, I will try to convert GRUB into Linux kernel format. Can you build your kernel in raw binary format?
Re: Trouble booting kernel with Grub legacy
Posted: Thu Oct 31, 2013 6:12 am
by depletionmode
egos wrote:OK, I will try to convert GRUB into Linux kernel format. Can you build your kernel in raw binary format?
Thanks! Raw binary as in
http://forum.osdev.org/viewtopic.php?f=1&t=2401?
I'll get that done... What bootloader can load this?
Re: Trouble booting kernel with Grub legacy
Posted: Thu Oct 31, 2013 7:49 am
by egos
Yes. Base address 0x100000 would be preferable too.
What bootloader can load this?
Raw binary can be useful to convert it into Linux kernel format (to load your kernel by your strange boot loader directly).
But check
this image first. Is it loaded by your boot loader?
Re: Trouble booting kernel with Grub legacy
Posted: Sun Nov 03, 2013 7:28 am
by depletionmode
That image doesn't seem to be loaded by my bootloader
"cannot read the linux header"
I've attached the flat kernel @ 0x100000.
Re: Trouble booting kernel with Grub legacy
Posted: Sun Nov 03, 2013 1:03 pm
by egos
Check
this image.
Show first kb of your Linux kernel (that is loaded successfully by your boot loader).
Re: Trouble booting kernel with Grub legacy
Posted: Mon Nov 04, 2013 12:44 am
by depletionmode
I left the board at work so I can't check until tomorrow.
I've attached 1kb of my kernel...