Setting up development environment using QEMU.

Aft nix aftnix at gmail.com
Sat Jun 9 10:19:02 EDT 2012


On Sat, Jun 9, 2012 at 8:01 PM, Adam Lee <adam8157 at gmail.com> wrote:
> On Sat, Jun 09, 2012 at 04:19:15PM +0600, Aft nix wrote:
>> Thank you for the tips. qemu is booting the kernel now. But it stops
>> with a kernel panic.
>>
>> >From qemu console,
>>
>> [    2.209887] EXT3-fs (sda): mounted filesystem with writeback data mode
>> [    2.210566] VFS: Mounted root (ext3 filesystem) readonly on device 8:0.
>> [    2.211393] Freeing unused kernel memory: 456k freed
>> [    2.242325] Write protecting the kernel text: 6240k
>> [    2.242614] Write protecting the kernel read-only data: 1820k
>> [    2.248007] Kernel panic - not syncing: No init found.  Try passing
>> init= option to kernel. See Linux Documentation/init.txt for guidance.
>> [    2.248492] Pid: 1, comm: swapper/0 Not tainted 3.4.0+ #3
>> [    2.248596] Call Trace:
>> [    2.249743]  [<c160db4f>] panic+0x81/0x17e
>> [    2.249843]  [<c10012d5>] init_post+0x75/0xb0
>> [    2.249942]  [<c183a61a>] kernel_init+0x1e0/0x1ea
>> [    2.250028]  [<c183a3df>] ? parse_early_options+0x35/0x35
>> [    2.250237]  [<c183a43a>] ? repair_env_string+0x5b/0x5b
>> [    2.250326]  [<c1616cd6>] kernel_thread_helper+0x6/0xd
>> ...
>> My understanding is i have to put the init binary in my root fs. But
>> i'm clueless about how to do that?
>
> You need a full system, kernel is just the core.
>
> I suggest you using Debian stable images for QEMU at
> http://people.debian.org/~aurel32/qemu
> (ref: http://wiki.debian.org/QEMU)
>
> Or, use busybox to build rootfs like what I am doing:
> https://github.com/adam8157/kernel-studio
>

Hi Adam

Thanks for the reply. Googling revealed other ways of debugging. I was
not aware that KGDB was merged with linux in 2.6.26. I was under the
impression that Linux does not allow kernel debugger in kernel source
tree. If i compile a kernel with KGDB , and if i'm not developing for
"other" archs like ppc/arm then there is little gain in qemu's gdb
stub. Instead i can fire up a full distro in Virtualbox, configure a
virtual serial console and "socat" from the host.

This link : http://www.linuxforu.com/2011/03/kgdb-with-virtualbox-debug-live-kernel/

I'm trying to follow this link instead.

I'm not experienced in this field, so my reasoning might be wrong. If
it is, please comment on my approach.

Cheers.
> --
> Regards,
> Adam Lee
> --------------------------------
> E-mail: adam8157 at gmail.com
> Website: http://adam8157.info
> --------------------------------



-- 
-aft



More information about the Kernelnewbies mailing list