Page 1 of 1

Qemu can boot the kernel but Grub2 can't?

Posted: Mon Apr 07, 2014 8:54 am
by xtricman

Code: Select all

qemu-system-i386 -kernel kernel.elf
can boot my kernel but grub2 can't boot my kernel using multiboot instruction?

I do have a multiboot header.And when I use multiboot only qemu can boot it ,but when I use multiboot2 header I can never boot my kernel.

Code: Select all

.section .text
.global start
multiboot_header:
	.long 0x1BADB002
	.long 0x00000003
	.long -(0x1BADB002 + 0x00000003)
start:
	.skip 16384
stack:
	movl $stack, %esp
	cli
	push %ebx
	call kernel_main

Re: Qemu can boot the kernel but Grub2 can't?

Posted: Mon Apr 07, 2014 9:22 am
by zhiayang
You do know that you just posted a multiboot1 header right? While I can't find anything wrong with it at a glance, somebody else might.
Besides, post your multiboot2 header as well since that seems to be the problem you have.

Finally, just taking a random guess here, are you using the right commands with GRUB2? It needs 'multiboot' for MB1 kernels and 'multiboot2' for MB2 kernels IIRC.

Also, try posting the exact error messages that GRUB outputs, besides 'it doesn't work'

Re: Qemu can boot the kernel but Grub2 can't?

Posted: Mon Apr 07, 2014 11:19 am
by xtricman
requimrar wrote:Also, try posting the exact error messages that GRUB outputs, besides 'it doesn't work'
Can't get any message,just doesn't work.
I'm in the grub2 command line.I entered:

Code: Select all

multiboot kernel.elf
then nothing happened.just like I press enter on my keyboard, nothing happend.

Re: Qemu can boot the kernel but Grub2 can't?

Posted: Mon Apr 07, 2014 11:27 am
by Combuster
Not even a next line?

Re: Qemu can boot the kernel but Grub2 can't?

Posted: Mon Apr 07, 2014 9:17 pm
by xtricman
Combuster wrote:Not even a next line?
Of course I get a next line.I said "just like I press the enter on my keyboard".You guys think that I can't tell a program ends or still running from the command line but you can?How clever you are!

Re: Qemu can boot the kernel but Grub2 can't?

Posted: Mon Apr 07, 2014 9:23 pm
by thepowersgang
In that case I believe that you fail the required knowledge (or at least, required expirence with grub).

When running from the grub command line, you have to explicitly tell it to boot with the 'boot' command.

Re: Qemu can boot the kernel but Grub2 can't?

Posted: Tue Apr 08, 2014 5:12 am
by Bender
If you again have any such queries about GRUB, please bother to check the GRUB Manual (for 2.00) and if you don't find a solution there (which is most likely not possible) then post it on the forums.
You guys think that I can't tell a program ends or still running from the command line but you can?
?????
/me confused.
How clever you are!
If you're talking about Combuster, yes, but there are a lot of people who aren't. :wink:

Re: Qemu can boot the kernel but Grub2 can't?

Posted: Tue Apr 08, 2014 12:30 pm
by no92
The only things that can be wrong are the multiboot header and the path to the executable. Don't know how GRUB2 handles paths, but I think it should be

Code: Select all

multiboot /kernel.elf
Also, double check the path. The code above means that kernel.elf is in the root directory of your GRUB2 image.