当前位置:   article > 正文

kernel编译练习3:ubuntu16升级内核到4.19_ubuntu make oldconfig

ubuntu make oldconfig

前言

编译内核分三步

1)make

2)sudo make modules_install

3)sudo make install

如何需要配置内核,在make之前,执行make menuconfig配置内核。

升级之前注意保存快照。做好备份。

参考遇到的问题。本次只记录遇到的问题是如何解决的。具体如何编译,参考本系列前两篇文章。

问题一

make时的报错。

cc1: out of memory allocating 89674192 bytes after a total of 193392640 bytes
  1. virtual memory exhausted: 无法分配内存
  2. scripts/Makefile.build:303: recipe for target 'drivers/net/ethernet/mellanox/mlx5/core/en_rep.o' failed
  3. make[5]: *** [drivers/net/ethernet/mellanox/mlx5/core/en_rep.o] Error 1
  4. scripts/Makefile.build:544: recipe for target 'drivers/net/ethernet/mellanox/mlx5/core' failed
  5. make[4]: *** [drivers/net/ethernet/mellanox/mlx5/core] Error 2

解决办法1:

提示内存不足,不太可能啊,当前内存是4G,那就将内存提升到8G。

然后...然后就解决了。增加内存以后,其他问题也自动消失了。有点意外啊。

执行sudo make modules_install也很顺利
 

执行 sudo make install时报错了。

问题二 

  1. lkmao@ubuntu:/big/linux-4.19.260/linux-4.19.260$ sudo make install
  2. sh ./arch/x86/boot/install.sh 4.19.260 arch/x86/boot/bzImage \
  3. System.map "/boot"
  4. run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.19.260 /boot/vmlinuz-4.19.260
  5. run-parts: executing /etc/kernel/postinst.d/dkms 4.19.260 /boot/vmlinuz-4.19.260
  6. * dkms: running auto installation service for kernel 4.19.260
  7. Kernel preparation unnecessary for this kernel. Skipping...
  8. Building module:
  9. cleaning build area....(bad exit status: 2)
  10. make KERNELRELEASE=4.19.260 VM_UNAME=4.19.260 MODULEBUILDDIR=/var/lib/dkms/open-vm-tools/10.0.7/build -C vmxnet....(bad exit status: 2)
  11. ERROR (dkms apport): kernel package linux-headers-4.19.260 is not supported
  12. Error! Bad return status for module build on kernel: 4.19.260 (x86_64)
  13. Consult /var/lib/dkms/open-vm-tools/10.0.7/build/make.log for more information.
  14. [ OK ]
  15. run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.19.260 /boot/vmlinuz-4.19.260
  16. update-initramfs: Generating /boot/initrd.img-4.19.260
  17. run-parts: executing /etc/kernel/postinst.d/pm-utils 4.19.260 /boot/vmlinuz-4.19.260
  18. run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.19.260 /boot/vmlinuz-4.19.260
  19. run-parts: executing /etc/kernel/postinst.d/update-notifier 4.19.260 /boot/vmlinuz-4.19.260
  20. run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.19.260 /boot/vmlinuz-4.19.260
  21. Generating grub configuration file ...
  22. Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
  23. Found linux image: /boot/vmlinuz-4.19.260
  24. Found initrd image: /boot/initrd.img-4.19.260
  25. Found linux image: /boot/vmlinuz-4.15.0-142-generic
  26. Found initrd image: /boot/initrd.img-4.15.0-142-generic
  27. Found linux image: /boot/vmlinuz-4.15.0-29-generic
  28. Found initrd image: /boot/initrd.img-4.15.0-29-generic
  29. Found memtest86+ image: /boot/memtest86+.elf
  30. Found memtest86+ image: /boot/memtest86+.bin
  31. done
  32. lkmao@ubuntu:/big/linux-4.19.260/linux-4.19.260$

解决问题:

没看出来什么情况,重启看看有没有升级成功。

查看版本号

cat /proc/version
Linux version 4.19.260 (lkmao@ubuntu) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)) #1 SMP Thu Sep 29 14:19:07 CST 2022

竟然升级成功了。

问题三 对perf命令的支持

执行perf命令时,报错如下所示:

  1. lkmao@ubuntu:/big/linux-4.19.260/linux-4.19.260$ perf
  2. WARNING: perf not found for kernel 4.19.260
  3. You may need to install the following packages for this specific kernel:
  4. linux-tools-4.19.260-4.19.260
  5. linux-cloud-tools-4.19.260-4.19.260
  6. You may also want to install one of the following packages to keep up to date:
  7. linux-tools-4.19.260
  8. linux-cloud-tools-4.19.260
  9. lkmao@ubuntu:/big/linux-4.19.260/linux-4.19.260$

总结

        事情解决的意外简单。

增补:

make oldconfigmake oldconfig与make config类似,但是它的作用是在现有内核设置文件基础上建立一个新的设置文件,只会向用户提问有关新内核特性的问题。在内核升级的过程中,make oldconfig非常有用。用户可以将现有内核的设置文件.config复制到新内核的源码目录中,执行make oldconfig,此时,用户只需要回答那些针对新增特性的问题。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/65116
推荐阅读
相关标签
  

闽ICP备14008679号