Build cross-compiled kernel debian package – Sysmic.org

Build cross-compiled kernel debian package

Par Jérôme Pouiller le vendredi, octobre 29 2010, 09:37 – Lien permanent

As you may know, you have juste to add options ARCH and if necessary CROSS_COMPILE to command line:

make ARCH=powerpc CROSS_COMPILE=ppc-linux-gnu- XXX_defconfig

make ARCH=powerpc CROSS_COMPILE=ppc-linux-gnu- XImage

My primary concern is to compile an x86 32bits kernel in 64bits environement. So my compilation line is:

make ARCH=i386 i386_defconfig

make ARCH=i386 bzImage

As you also may know, rule deb-pkg of kernel Makefile is able to create a debian package. You should use fakeroot to be able to create package with a non-root user:

fakeroot make deb-pkg

Nevertheless, it will always create a package for current architecture. So this line will create a package for powerpc:

fakeroot make ARCH=powerpc CROSS_COMPILE=ppc-linux-gnu- deb-pkg

To correct this behavior, you can use DEB_HOST_ARCH variable:

fakeroot make DEB_HOST_ARCH=powerpc ARCH=powerpc CROSS_COMPILE=ppc-linux-gnu- deb-pkg

To summary, to quickly create an x86 32bits kernel debian package in 64bits environement. I do:

mkdir build

make ARCH=i386 O=build i386_defconfig

fakeroot make -j4 DEB_HOST_ARCH=i386 ARCH=i386 O=build deb-pkg

viaBuild cross-compiled kernel debian package – Sysmic.org.