ubuntu 更换内核

想debug一下内核,用/boot 目录下的 vmlinuz 解压到 vmlinux 却一直失败,只好自己动手编译一下内核

解压vmlinuz

过程

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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值