Following steps describes the build of an realtime kernel (preemption patch) for a debian based distribution for embedded systems, as example we compile the kernel for an apollo lake (x86_64) and a beagle bone (armhf) board.
x86_64 Version:
This workflow uses also Debian 8.6 Jessie as host/development operating system.
Install following packages:
$ sudo apt-get install kernel-package build-essential linux-source fakeroot libncurses5-dev libssl-dev
get the linux kernel using wget or git:
$ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.39.tar.xz $ tar -xJf linux-4.4.39.tar.xz or $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git $ cd linux-stable $ git checkout linux-4.4.y $ cd ..
Preemptive Patch:
$ wget https://www.kernel.org/pub/linux/kernel/projects/rt/4.4/patch-4.4.39-rt50.patch.xz $ xz -d patch-4.4.39-rt50.patch.xz $ cd linux-4.4.39 or $ cd linux-stable $ cat ../patch-4.4.39-rt50.patch | patch -p1
configure the kernel:
$ make menuconfig ARCH=x86_64
compile the kernel to get a debian package and install it:
$ fakeroot make-kpkg --initrd --revision=1.0.mahdevel kernel_image $ cd .. $ dpkg -i linux-image-4.4.39-rt50_1.0.mahdevel_amd64.deb
or compile it without make-kpkg:
make -j `getconf _NPROCESSORS_ONLN` deb-pkg LOCALVERSION=mhaag
compile custom realtime kernel for Debian 8.6 (Jessie)