howto: centos 7 upgrade kernel 4.19 LTS

kernel=4.19.76
workdir=/app/build
mkdir -p $workdir
cd $workdir


sudo yum install -y elfutils-libelf-devel ncurses-devel

wget -P $workdir -c https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-$kernel.tar.xz
tar Jxf linux-$kernel.tar.xz
cd linux-$kernel
cp /boot/config-$(uname -r)  $workdir/linux-$kernel/.config

cat >> .config < /lib/modules/upgrade-kernel.sh <<-EOF
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-set-default 0
EOF
chmod 755 /lib/modules/upgrade-kernel.sh

PKG=rpm
fpm -s dir -t ${PKG} -n ${APP} -v ${VERSION} --epoch 0 --rpm-user=root -p ${APP}-${VERSION}.${PKG} \
--after-install /lib/modules/upgrade-kernel.sh \
--exclude  /lib/modules/$VERSION/build --exclude  /lib/modules/$VERSION/source \
/boot/*$VERSION*  /lib/modules/$VERSION  

# no need for /lib/firmware/$VERSION






常见问题:系统启动不来报错:/dev/centos/root does not exist dracut

make install
make modules_install
dracut -f /boot/initramfs-vmlinuz-4.19.76.img vmlinuz-4.19.76

ref:
https://www.tecmint.com/compile-linux-kernel-on-centos-7/
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.0_release_notes/RHEL-8_0_0_release#kernel_technology_preview

你可能感兴趣的:(howto: centos 7 upgrade kernel 4.19 LTS)