Booting custom kernel in qemu
Hello,
I'm trying to boot a custom linux kernel in qemu, and I plan to contribute the necessary work to make it work (this is the first step I'm taking to add OS support in qemu). I'm totally new to qemu, and I haven't found enough information to know how to start debugging the thing, so I thought of asking here.
I wanted to launch the kernel in a terminal for practical purposes, so I tried:
qemu -kernel bzImage -append console=ttyS0
There still was no output in the terminal after that, so I'm planning to attach qemu to gdb, and try to debug it that way.
Can you please provide some help on how to debug the kernel in qemu ?
Signature · 1 line
Apelete
Quoted 8 lines · Apelete Seketeli
Hello,
I'm trying to boot a custom linux kernel in qemu, and I plan to contribute the necessary work to make it work (this is the first step I'm taking to add OS support in qemu). I'm totally new to qemu, and I haven't found enough information to know how to start debugging the thing, so I thought of asking here.
Quoted 4 lines
I wanted to launch the kernel in a terminal for practical purposes, so I tried:
qemu -kernel bzImage -append console=ttyS0
Add -serial stdio to get those logs.
Amit
Quoted 9 lines · Amit Shah
Quoted 8 lines · Apelete Seketeli
Hello,
I'm trying to boot a custom linux kernel in qemu, and I plan to contribute the necessary work to make it work (this is the first step I'm taking to add OS support in qemu). I'm totally new to qemu, and I haven't found enough information to know how to start debugging the thing, so I thought of asking here.
Quoted 6 lines
Quoted 4 lines
I wanted to launch the kernel in a terminal for practical purposes, so I tried:
qemu -kernel bzImage -append console=ttyS0
Add -serial stdio to get those logs.
Well,
qemu -kernel bzImage -append console=ttyS0 -serial stdio
does not give me any output, I guess it's because the thing get stuck early during the boot process. For the time being I'm using
qemu -kernel bzImage -append console=ttyS0 -S -nographic
in order to launch gdbserver in the monitor and attach a gdb in the host; I hope I'll be able to follow the boot process in the debugger and understand qemu inner workings.
I have a question though:
$ qemu -S -kernel arch/x86/boot/bzImage -append console=ttyS0 -nographic -serial stdio chardev: opening backend "stdio" failed qemu: could not open serial device 'stdio': No such file or directory
Why do I get an error since stdio is (according to the manual) the standard device in non graphical mode ?
Signature · 1 line
Apelete
Am 28.05.2011 um 22:05 schrieb Apelete Seketeli:
Quoted 7 lines · Amit Shah
Quoted 6 lines · Apelete Seketeli
Quoted 4 lines
I wanted to launch the kernel in a terminal for practical purposes, so I tried:
qemu -kernel bzImage -append console=ttyS0
Quoted 8 lines
Quoted 1 line
Add -serial stdio to get those logs.
[...] For the time being I'm using
qemu -kernel bzImage -append console=ttyS0 -S -nographic
in order to launch gdbserver in the monitor and attach a gdb in the host; [...]
You can use -S -s or -S -gdb ... for that.
Quoted 6 lines
$ qemu -S -kernel arch/x86/boot/bzImage -append console=ttyS0 -nographic -serial stdio chardev: opening backend "stdio" failed qemu: could not open serial device 'stdio': No such file or directoryWhy do I get an error since stdio is (according to the manual) the standard device in non graphical mode ?
-nographic implies -serial stdio, so it's redundant. When using SDL or Cocoa, -serial stdio gives you serial on the console in addition to the graphical window. -nographic just gives you the console output.
HTH,
Andreas