编译一个可以用Qemu进行Debug的Linux Kernel:

1. Download the Kernel Source Code

2. Unpacket it with:

xz -d ***.tar.xz
tar -xvf  ***.tar

Here ‘-d’and ‘-x’ means decompress, 'v' means printing the detail info on screen.

3. Generate the default configuration file .config with:

Make defconfig

The .comfig is a hidden file, you can see it with

ls -a

4. Since I want to debug the kernel, the debug info should be allowed before compiling. There are two way to modify this option.

   One is using the configuration menu. To launch it with command

Make menuconfig

   we need to have package ncurses-devel. But this package cannot be install with only apt-get. After     searching online, I found a solution:

apt-get install libncurses*

   So the configuration menu can be launch now and we can go to option 'kernel hacking' and select the     option 'compile kernel with debug info'.

   Another way is to open the .config file using vim and search for CONFIG_DEBUG_INFO and set it to     'y'.

   After set this option, there will be a new .config file and the orginal one will be renamed as .config.old

5. Compile the Kernel now with make or make bzImage.

   But I had a problem in this step since the Ubuntu I used is installed with Wubi and I didn't assign too much space for it, so there is error reported with No Enough Space.

你可能感兴趣的:(debug,ubuntu,kernel,qemu)