Qemu can boot the kernel but Grub2 can't?

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
xtricman
Posts: 16
Joined: Wed Mar 12, 2014 9:52 pm

Qemu can boot the kernel but Grub2 can't?

Post 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
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

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

Post 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'
xtricman
Posts: 16
Joined: Wed Mar 12, 2014 9:52 pm

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

Post 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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

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

Post by Combuster »

Not even a next line?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
xtricman
Posts: 16
Joined: Wed Mar 12, 2014 9:52 pm

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

Post 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!
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

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

Post 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.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

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

Post 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:
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
no92
Member
Member
Posts: 307
Joined: Wed Oct 30, 2013 1:57 pm
Libera.chat IRC: no92
Location: Germany
Contact:

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

Post 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.
Post Reply