1,$git clone git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack -b v4.14.87 v4.14.87
2,接着在kernel.ubuntu.com/~kernel-ppa/mainline/v4.14.87/下载7个补丁:
0001-base-packaging.patch
0002-UBUNTU-SAUCE-add-vmlinux.strip-to-BOOT_TARGETS1-on-p.patch
0003-UBUNTU-SAUCE-tools-hv-lsvmbus-add-manual-page.patch
0004-adhoc-from-__future__-import-syncconfig.patch
0005-UBUNTU-SAUCE-no-up-disable-pie-when-gcc-has-it-enabl.patch
0006-debian-changelog.patch
0007-configs-based-on-Ubuntu-4.14.0-11.13.patch
3,
$patch -p1 < ../0001-base-packaging.patch
$patch -p1 < ../0002-UBUNTU-SAUCE-add-vmlinux.strip-to-BOOT_TARGETS1-on-p.patch
$patch -p1 < ../0003-UBUNTU-SAUCE-tools-hv-lsvmbus-add-manual-page.patch
$patch -p1 < ../0004-adhoc-from-__future__-import-syncconfig.patch
$patch -p1 < ../0005-UBUNTU-SAUCE-no-up-disable-pie-when-gcc-has-it-enabl.patch
$patch -p1 < ../0006-debian-changelog.patch
$patch -p1 < ../0007-configs-based-on-Ubuntu-4.14.0-11.13.patch
4,在kernel.ubuntu.com/~kernel-ppa/mainline/v4.14.87下载文件:
linux-image-unsigned-4.14.87-041487-generic_4.14.87-041487.201812080833_amd64.deb
$dpkg -x linux-modules-4.14.87-041487-generic_4.14.87-041487.201812080833_amd64.deb ./config_file
这样做的目的是获取解压linux-modules-4.14.87-041487-generic_4.14.87-041487.201812080833_amd64.deb后config_file/boot目录下的v4.14.87版内核的配置文件config-4.14.87-041487-generic
5,下载Preempt Rt补丁
在https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/4.14/下载patch-4.14.87-rt49.patch.xz
$xzcat ../patch-4.14.87-rt49.patch.xz | patch -p1
6,
$cp ./config_file/boot/config-4.14.87-041487-generic ./v4.14.87/.config
7,配置内核
$cd ./v4.14.87
$make menuconfig
Processor type and features —>
Preemption Model (Fully Preemptible Kernel (RT)) —>
(X) Fully Preemptible Kernel (RT)
8,编译
$fakeroot make -j8 deb-pkg
结果生成(我的老联想V450花了7/8个小时):
linux-4.14.87-rt49+_4.14.87-rt49+-2_amd64.changes
linux-4.14.87-rt49+_4.14.87-rt49+-2.debian.tar.gz
linux-4.14.87-rt49+_4.14.87-rt49+-2.dsc
linux-4.14.87-rt49+_4.14.87-rt49+.orig.tar.gz
inux-headers-4.14.87-rt49+_4.14.87-rt49+-2_amd64.deb
linux-image-4.14.87-rt49+_4.14.87-rt49+-2_amd64.deb
linux-image-4.14.87-rt49+-dbg_4.14.87-rt49+-2_amd64.deb
linux-libc-dev_4.14.87-rt49+-2_amd64.deb
9,安装:
$sudo dpkg -i inux-headers-4.14.87-rt49+_4.14.87-rt49+-2_amd64.deb
$sudo dpkg -i linux-image-4.14.87-rt49+_4.14.87-rt49+-2_amd64.deb
$sudo update-grub