Linux 内核编译(Ubuntu 环境)
下载内核代码
https://www.kernel.org/
安装依赖
sudo apt update
sudo apt install -y \
gcc \
make \
libncurses5-dev \
openssl \
libssl-dev \
build-essential \
pkg-config \
libc6-dev \
bison \
flex \
libelf-dev
准备.config和自定义配置
cd {Download}/linux-5.4.32/
sudo cp /boot/config-{uname -r} .config
sudo make menuconfig
编译内核
# 编译内核
sudo make
sudo make modules_install
安装内核
sudo mv {Download}/linux-5.4.32 /usr/src/
cd /usr/src/linux-5.4.32/
sudo make install
sudo mkinitramfs -o /boot/initrd.img-5.4.32
sudo update-initramfs -c -k 5.4.32
sudo update-grub2
验证
sudo reboot
uname -a