cd linux-4.4.1 make x86_64_defconfig # 加载默认config make menuconfig # 自定义config
要进行打断点调试,需要关闭系统的随机化和开启调试信息:
1 2 3 4 5 6 7 8 9 10 11 12
Processor type and features ---> [ ] Build a relocatable kernel [ ] Randomize the address of the kernel image (KASLR) (NEW)
Kernel hacking ---> Compile-time checks and compiler options ---> [*] Compile the kernel with debug info [ ] Reduce debugging information [ ] Produce split debuginfo in .dwo files [*] Generate dwarf4 debuginfo [*] Provide GDB scripts for kernel debugging
之后进行编译
1
make -j32
如果遇到编译错误cc1: error: code model kernel does not support PIC mode,则在MakeFile中的KBUILD_CFLAGS选项中加入-fno-pie