《Linux 内核揭秘》:https://cntofu.com/book/104/index.html
tar源码包方式
编译内核:make -jx (x为cpu核数)
安装内核到指定目录:make INSTALL_PATH=./kernel_path install
安装内核模块到指定目录:make INSTALL_MOD_PATH=./kernel_mod_path modules_install
手动替换内核
内核替换:cp ./arch/x86_64/boot/bzImage /boot/vmlinuz-xxx
cp -rf ./kernel_mod_path/.../xxx /lib/modules/xxx
手动添加模块(模块和内核版本需要匹配)
cp psmouse.ko /lib/modules/xxx/...
depmod
dracut -f -k /lib/modules/xxx
reboot
rpm包方式
rpm -ivh kernel-xxx.rpm
cd ~/rpmbuild/SPEC/
rpmbuild -ba --with baseonly --without debug --without debuginfo --without kabichk kernel.spec