Italiano English
Modifica History Actions

debian_kernel_crosscompile

My conf: Debian 8 (Jessie) with Backports, 4 cores, 4Gb RAM.

Target: OrangePi One H3 (AllWinner) armhf, .deb only for a specific board

Install crossbuild packages for the target architecture.

dpkg --add-architecture armhf
apt-get update
apt-get install crossbuild-essential-armhf
apt-get install cross-gcc-dev gcc-arm-none-aebi binutils-arm-linux-gnueabihf 

Install kernel sources

apt-get install linux-source-X.X

Move to your working dir & copy kernel sources.

cd ~
cp /usr/src/linux.source-X.X.tar.xz .

Expand kernel sources

tar xavf linux-source-X.X.tar.xz

Move to sources dir

cd linux-source-X.X 

If you have patches to apply then copy them into linux-source-X.X folder and then for each patch do:

patch -p1 < MYPATCH 

Into arch/arm/ there are all supported boards, choose your board (mine is OrangePi One and it's a sunxi board)

Prepare for configuration, start with a minimum configurations

ARCH=arm CROSS_COMPILE=/usr/bin/arm-none-eabi- make sunxi_defconfig

Now, we probably need more modules because that defconfig is a very minimal configuration

ARCH=arm CROSS_COMPILE=/usr/bin/arm-none-eabi- make menuconfig

Choose your modules.

* In General Setup -> Stack Protector buffer overflow detection set it to None (or build will fail).

Build!

ARCH=arm CROSS_COMPILE=/usr/bin/arm-none-eabi- DEB_BUILD_OPTIONS=nocheck make deb-pkg LOCALVERSION=-YOUR_TARGET_ARCH KDEB_PKGVERSION=$(make kernelversion) -j#num_of_cores

Don't forget to set the target LOCAL_VERSION=-YOUR_TARGET_ARCH (ie: -arm-antani-lpae ), otherwise dpkg will not install the kernel. This is what i did for my OrangePi One:

ARCH=arm CROSS_COMPILE=/usr/bin/arm-none-eabi- DEB_BUILD_OPTIONS=nocheck make deb-pkg LOCALVERSION=-armmp-lpae KDEB_PKGVERSION=$(make kernelversion) -j4

Wait until build process completes; ready to use .debs are in the upper level folder.