KDB is an official version of the Linux kernel code. Therefore, you cannot use the Linux kernel version that comes with ubuntu. You need to download it from the official website.
1. Download The kdbpatch corresponding to the internal code pair from ftp://oss.sgi.com/www/projects/kdb/download,
For example, Linux 2.6.18133, You need to download the kdb-v4.4-2.6.18-common-1.bz2 and kdb-v4.4-2.6.18-i386-1.bz files.
2. After the price is downloaded, store it in the/usr/src directory and decompress the package using Bzip2:
$sudo bzip2 -d kdb-v4.4-2.6.18-common-1.bz2$sudo bzip2 -d kdb-v4.4-2.6.18-i386-1.bz
3. Enter the/usr/src/Linux Directory, which stores kernel code 2.6.18. Patch the kernel code using the patch tool:
$ patch -p1 < ../kdb-v4.4-2.6.18-common-1.bz2$ patch -p1< ../kdb-v4.4-2.6.18-i386-1.bz
If no error is prompted, the operation is successful.
4. Compile the kernel
Update the Ubuntu kernel compilation package:
$sudo apt-get install kernel-package$sudo apt-get install libncurses5-dev$sudo apt-get install fakeroot$sudo apt-get install wget
Then use make oldconfig to import the Kernel configuration to the previous version. After the configuration is imported, use make menuconfig to enter the Kernel configuration interface, go to the kernel hacking menu, open built-in kernel debugger support, then open the KDB off by default and KDB modules options, save and exit.
Next, compile and install the kernel:
$sudo make$sudo make modules_install$sudo make install
After installation, a kernel boot menu of version 2.6.18 is added to the grub boot menu.
Restart the machine and choose to start from kernel 2.6.18.
Open KDB through the/proc file system after startup:
$sudo echo "1" > /proc/sys/kernel/kdb
If no prompt is displayed after you press enter, KDB is successfully enabled.
Press the pause/Break Key To Go To The KDB debugging interface.
When you exit the interface, enter go and press Enter.