Debian sid / Ubuntu xenial
安装必要的工具软件
$ sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils kernel-package patch libncurses5-dev
如要使用LLVM編譯
$ sudo apt-get install llvm clang
RT補釘只有4.4.4版, 為避免補釘錯誤, 編譯4.4.4核心比較保險.
Debian 本身也有發佈RT核心 https://packages.debian.org/sid/linux-image-rt-amd64
下載Linux核心原始碼
$ wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.4.tar.xz
下載RT補釘
$ wget https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patch-4.4.4-rt11.patch.gz
解壓縮Linux原始碼
$ tar xvf linux-4.4.4.tar.xz
解壓縮RT補釘
$ gunzip patch-4.4.4-rt11.patch.gz
RT補釘
$ cd linux-4.4.4
$ patch -p1 < ../patch-4.4.4-rt11.patch
設定Linux核心
$ cd linux-4.4.4
使用預設組態
$ make defconfig
或
根據硬體架構載入設定(精簡化驅動,只包含支援你電腦的驅動)
$ make localmodconfig
選單界面編輯
$ make menuconfig
RT選項: 選擇「Fully Preemptible Kernel (RT)」
Processor type and features --->
Preemption Model
( X ) Fully Preemptible Kernel (RT)
去除 Staging drivers
Device Drivers --->
[ ] Staging drivers ----
編譯並打包DEB
$ sudo fakeroot make-kpkg --initrd --revision=4.4.4-0 kernel_image kernel_headers