下载内核
xz -d linux-5.0.1.tar.xz tar -xvf linux-5.0.1.tar cd linux-5.0.1
下载编译工具
sudo apt install build-essential flex bison libssl-dev libelf-dev libncurses-dev
配置编译内核
make i386_defconfig
升级当前系统内核
sudo make modules_install sudo make install sudo update-grub reboot uname -a
通过QEMU虚拟机加载内核
sudo apt install qemu qemu-system-i386 -kernel linux-5.0.1/arch/x86/boot/bzImage #make i386_defconfig qemu-system-x86_64 -kernel linux-5.0.1/arch/x86_64/boot/bzImage
构造MenuOS
git clone https://github.com/mengning/menu.git cd menu sudo apt-get install libc6-dev-i386 make rootfs cd .. qemu-system-i386 -kernel linux-5.0.1/arch/x86/boot/bzImage -initrd rootfs.img #makei386_defconfig qemu-system-x86_64 -kernel linux-5.0.1/arch/x86_64/boot/bzImage -initrd
启动gdb server
qemu -kernel ../linux-5.0.1/arch/x86/boot/bzImage -initrd ../rootfs.img -append nokaslr -s -S
建立gdb与gdb server连接
gdb file ~/linux-5.0.1/vmlinux target remote:1234 break start_kernel c list
原文:https://www.cnblogs.com/ft-97/p/12031256.html