[Galaxy Tab 3 10.1 Android Development] r2d23cpo:
First Part of Tutorial => "Part1-Compiling an uncompress Kernel for debugging"

Second Part of Tutorial => "Part2-Kernel debugging on Eclipse"

Continuation

Debugging the Linux kernel using Eclipse/CDT and Qemu

Part3-Debug the custom kernel with included Virtual intramfs

The following is C&P of h__p://issaris.blogspot.com/2007/12/download-linux-kernel-sourcecode-from.html with some modifications.

That is in fact and old blog. That uses old eclipse, Linux and old kernel version "linux-2.6.29.6" Current eclipse and linux version (Ubuntu 14.04) prevent me from doing exact steps. So here is what I did different.

I read a lot of Tutorial for doing Minimal Linux File System. Many are good.

Using buildroot to create initramfs => h__ps://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/

Using busybox to create initramfs => h__p://minimal.linux-bg.org/

A Minimal Linux System from Scratch => h__ps://sites.google.com/site/4utils/articles/minimal_linux_system/minimal-linux-system-from-scratch

Now in the future for Android we may just stick with a recovery partition for more compatibility.

The simplest and quickest method is Minimal Linux Live. In fact you can just download a ready made i386 binary from their download section

h__p://minimal.linux-bg.org/download/minimal_linux_live_07-Feb-2015_32-bit.iso

and test it with your new quemu installation

qemu-system-i386 -m 512M -cdrom minimal_linux_live_07-Feb-2015_32-bit.iso

But I selected buildroot for it simplicity at the time to called quemu and eclipse. Why because it will keep kernel separated from the initramfs. We will not have to worry about updating the iso image when we change the kernel.

You can go ahead and build youself a copy using buildroot tutorial. But to simply the process

I will attached the initramdisk I build. it is called "rootfs.ext2".

Downloading rootfs.ext2

Go ahead and download the attachment.

Now do

cp $HOME/Downloads/rootfs.ext2.tar.bz2 $HOME/bin/build/linux-3.4.34
cd $HOME/bin/build/linux-3.4.34
tar xvjf rootfs.ext2.tar.bz2

Executing Qemu emulator alone

Now to call the quemu with its new initramfs just do. Note: Keep in mind this command asumed you already build "kernel $HOME/bin/build/linux-3.4.34/arch/x86/boot/bzImage"

qemu-system-i386 -hda $HOME/bin/build/linux-3.4.34/rootfs.ext2 -append "root=/dev/sda rw" -kernel $HOME/bin/build/linux-3.4.34/arch/x86/boot/bzImage

Your new minimum Linux system will boot to a prompt asking you to enter

Welcome to Buildroot
buildroot login:root

Just enter root [Enter]

Now you will be in "/root" directory. But by default it is empty. So if you do "ls" it will not display anything. But you can do " ls .." and you will see the minimum Linux system.

Executing Qemu emulator for Eclipse debug

But for Eclipse Debugging do

qemu-system-i386 -s -S -hda $HOME/bin/build/linux-3.4.34/rootfs.ext2 -append "root=/dev/sda rw" -kernel $HOME/bin/build/linux-3.4.34/arch/x86/boot/bzImage

Then you can continue debugging in Eclipse using what was learn in tutorial part 2.

Now just see that your new Virtual Linux machine is pretty small

20.7 mbits rootfs.ext2

4.4 mbits bzImage

25.1 mibit compressed

doing df -h reports an uncompress tmpfs of 58.9 mbits and a /dev/root set of 20.4 mbits. around 80 mbits total. nice.

Next I will try to apply what was learn to an Android Kernel.

Nice will be if we can Run Eclipse in the Desktop and run quemu in the Tab so that all /proc /dev /sys etc get populated with the real thing. Is not easy without a usb-serial-console cable. I witch we can do something.