想debug一下内核,用/boot 目录下的 vmlinuz 解压到 vmlinux 却一直失败,只好自己动手编译一下内核
过程
1. 首先下载内核代码 apt install linux-source,一般在 /usr/src/目录,里面有之前安装的内核的投建见,但是没有源码
2. tar -xjvf xx.tar.bz2
3. 将 .config copy过来
4. make menuconfig
5. make -j8 #耗时很多
6. sudo make modules_install
7. sudo make install
8. sudo update-initramfs -c -k 5.3.10
9. sudo update-grub
10. sudo vi /etc/default/grub
更换之后之前安装的 perf工具不能使用了
需要重新安装 perf工具
1. 到 kernel/tools/perf/ 目录
2. make install 即可
同时大概率会遇到启动很卡的问题,原因是 ramdisk变大了,导致启动变慢
I found out that the slow boot comes from a large initrd. I also found out that at that point the system is relying on a slow but reliable access method from the BIOS to load the kernel. That all makes sense now. To fix the problem you can edit /etc/initramfs-tools/initramfs.conf and set "MODULES=dep". Then run "sudo update-initramfs -u". This reduced initrd from 245 MB to 5.4M. I'm not sure why it is larger or some systems. Maybe it is usually this large these days and some systems have a much slower BIOS disk access routine. Now this phase of boot takes less than 2 seconds.