概述
下载内核源码:https://www.kernel.org/
卸载内核
1. sudo rm -rf /lib/modules/5.8.5
sudo rm -rf /usr/src/linux-5.8.5
sudo rm -rf /boot/*5.8.5*
sudo rm -rf /var/lib/initramfs-tools/5.8.5
2. sudo update-grub
安装必要依赖
sudo apt-get install gcc make libncurses5-dev openssl libssl-dev
sudo apt-get install build-essential
sudo apt-get install pkg-config
sudo apt-get install libc6-dev
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install libelf-dev
编译安装
cd ~/Desktop/linux-x.xx.xx/
sudo cp /boot/config-x.xx.xx-generic .config # 前者是你本机中自带的,拷贝当前内核配置到当前目录下
sudo make menuconfig # Exit
sudo make -j2 # bzImage
sudo make modules_install # 安装模块
sudo mv ~/Desktop/linux-x.xx.xx /usr/src/ # 前者是新内核
cd /usr/src/linux-x.xx.xx/
sudo make install # 安装内核
sudo mkinitramfs -o /boot/initrd.img-x.xx.xx
sudo update-initramfs -c -k x.xx.xx # 启用内核作为引导
sudo update-grub2 # 更新grub
重启
sudo shutdown -r now
查看内核版本
uname -a
后记
- 之前在虚拟机中安装的增强工具在重启后貌似无用。
- 如果开机没有启动项,那么就对
/etc/default/grub
文件做出如下改动,然后sudo update-grub
。
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
#GRUB_TIMEOUT_STYLE=hidden # here
GRUB_TIMEOUT=10 # here
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
最后
以上就是积极冬瓜为你收集整理的【Ubuntu】Ubuntu 编译安装内核(1)的全部内容,希望文章能够帮你解决【Ubuntu】Ubuntu 编译安装内核(1)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复