Kernel Hacking

I’ve been getting a little frustrated of late with this. Mainly because of turnaround times in rebuilding the kernel etc. I was looking at the kernel sources and sticking in printks here and there to try and make things clearer for me. But the time it took to rebuild the kernel, reinstall it, reboot it and grep for my lines was/is killing me. Plus, if I break the kernel I gotta go back to my working one and do it right this time. It was really difficult to make any progress so I started looking for other ways.

The first thing I thought of was to try and run it on a virtual machine. I tried virtualbox but didn’t stick with it for two reasons.

1. I had used Qemu at Symbian
2. VirtualBox didn’t work 🙂

Two pretty compelling reasons to go with Qemu, particularly the second!

The Qemu IRC channel is pretty dead and I couldn’t find much docs out there. The first thing I did was to just boot a fedora iso disc to see how I get on. The didn’t work because of the following error:

..MP-BIOS bug: 8254 timer not connected to IO-APIC
and then it hangs at:
…trying to set up timer as Virtual Wire IRQ…

So I just went to try and boot the raw kernel image using:

qemu -kernel ‘/boot/vmlinuz-’ -append ‘noapic console=ttyS0’ -initrd ‘/boot/initrd.img-’ /dev/zero -serial stdio -boot d -m 256 -hda ‘/home/stephen/virtual/steo.img’

(Note the append noapic seemed to resolve the issue I just described. )
The console=ttyS0 gets it to use my Current working console for the output.

The steo.img is just an empty disc image created by:

qemu-img create -f qcow steo.img 2G

As this is empty, nothing really boots and it just drops to a shell with the initramdisk:

Gave up waiting for root device. Common problems:
– Boot args (cat /proc/cmdline)
– Check rootdelay= (did the system wait long enough?)
– Check root= (did the system wait for the right device?)
– Missing modules (cat /proc/modules; ls /dev)
ALERT! does not exist. Dropping to a shell!

BusyBox v1.10.2 (Ubuntu 1:1.10.2-2ubuntu6) built-in shell (ash)
Enter ‘help’ for a list of built-in commands.

(initramfs) ls
dev sbin scripts conf init sys tmp
root etc usr bin lib proc var

Pretty cool though, and definately more efficient to develop and poke around with.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s