diff options
author | Filip Pytloun <filip@pytloun.cz> | 2016-03-11 10:00:15 +0100 |
---|---|---|
committer | Filip Pytloun <filip@pytloun.cz> | 2016-03-11 12:08:36 +0100 |
commit | dce1256be47163751696ad93237a0aa5155c03ef (patch) | |
tree | a73eaa816f6eba42f35f822da7a428a8393ae788 /bootstrap.d | |
parent | a1508536fc6e1d31692e42945a7bc8191892615f (diff) | |
download | rpi2-gen-image-dce1256be47163751696ad93237a0aa5155c03ef.tar.gz rpi2-gen-image-dce1256be47163751696ad93237a0aa5155c03ef.tar.bz2 rpi2-gen-image-dce1256be47163751696ad93237a0aa5155c03ef.zip |
Enhance kernel build by headers install, parallelism and cleanup
Diffstat (limited to 'bootstrap.d')
-rw-r--r-- | bootstrap.d/13-kernel.sh | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/bootstrap.d/13-kernel.sh b/bootstrap.d/13-kernel.sh index 633d993..508d070 100644 --- a/bootstrap.d/13-kernel.sh +++ b/bootstrap.d/13-kernel.sh @@ -7,26 +7,31 @@ # Fetch and build latest raspberry kernel if [ "$BUILD_KERNEL" = true ] ; then # Fetch current raspberrypi kernel sources - git -C $R/tmp clone --depth=1 https://github.com/raspberrypi/linux + git -C $R/usr/local/src clone --depth=1 https://github.com/raspberrypi/linux # Load default raspberry kernel configuration - make -C $R/tmp/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig + make -C $R/usr/local/src/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig # Cross compile kernel and modules - make -C $R/tmp/linux -j 8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs + make -C $R/usr/local/src/linux -j$(grep -c processor /proc/cpuinfo) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs # Install kernel modules - make -C $R/tmp/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=../.. modules_install + make -C $R/usr/local/src/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=../.. modules_install + + # Install kernel headers + if [ "$KERNEL_HEADERS" = true ]; then + make -C $R/usr/local/src/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_HDR_PATH=../../usr headers_install + fi # Copy and rename compiled kernel to boot directory mkdir $R/boot/firmware/ - $R/tmp/linux/scripts/mkknlimg $R/tmp/linux/arch/arm/boot/zImage $R/boot/firmware/kernel7.img + $R/usr/local/src/linux/scripts/mkknlimg $R/usr/local/src/linux/arch/arm/boot/zImage $R/boot/firmware/kernel7.img # Copy dts and dtb device definitions mkdir $R/boot/firmware/overlays/ - cp $R/tmp/linux/arch/arm/boot/dts/*.dtb $R/boot/firmware/ - cp $R/tmp/linux/arch/arm/boot/dts/overlays/*.dtb* $R/boot/firmware/overlays/ - cp $R/tmp/linux/arch/arm/boot/dts/overlays/README $R/boot/firmware/overlays/ + cp $R/usr/local/src/linux/arch/arm/boot/dts/*.dtb $R/boot/firmware/ + cp $R/usr/local/src/linux/arch/arm/boot/dts/overlays/*.dtb* $R/boot/firmware/overlays/ + cp $R/usr/local/src/linux/arch/arm/boot/dts/overlays/README $R/boot/firmware/overlays/ # Install raspberry bootloader and flash-kernel chroot_exec apt-get -qq -y --no-install-recommends install raspberrypi-bootloader-nokernel |