##// END OF EJS Templates
Enhance kernel build by headers install, parallelism and cleanup
Filip Pytloun -
r60:dce1256be471
parent child
Show More
@@ -156,6 +156,9 Path to a directory with scripts that should be run in the chroot before the ima
156 156 ##### `BUILD_KERNEL`=false
157 157 Build and install the latest RPi2 linux kernel. Currently only the default RPi2 kernel configuration is used. Detailed configuration parameters for customizing the kernel and minor bug fixes still need to get implemented. feel free to help.
158 158
159 ##### `KERNEL_HEADERS`=true
160 If true, also install kernel headers with built kernel.
161
159 162 ## Logging of the bootstrapping process
160 163 All information related to the bootstrapping process and the commands executed by the `rpi2-gen-image.sh` script can easily be saved into a logfile. The common shell command `script` can be used for this purpose:
161 164
@@ -7,26 +7,31
7 7 # Fetch and build latest raspberry kernel
8 8 if [ "$BUILD_KERNEL" = true ] ; then
9 9 # Fetch current raspberrypi kernel sources
10 git -C $R/tmp clone --depth=1 https://github.com/raspberrypi/linux
10 git -C $R/usr/local/src clone --depth=1 https://github.com/raspberrypi/linux
11 11
12 12 # Load default raspberry kernel configuration
13 make -C $R/tmp/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
13 make -C $R/usr/local/src/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
14 14
15 15 # Cross compile kernel and modules
16 make -C $R/tmp/linux -j 8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
16 make -C $R/usr/local/src/linux -j$(grep -c processor /proc/cpuinfo) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
17 17
18 18 # Install kernel modules
19 make -C $R/tmp/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=../.. modules_install
19 make -C $R/usr/local/src/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=../.. modules_install
20
21 # Install kernel headers
22 if [ "$KERNEL_HEADERS" = true ]; then
23 make -C $R/usr/local/src/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_HDR_PATH=../../usr headers_install
24 fi
20 25
21 26 # Copy and rename compiled kernel to boot directory
22 27 mkdir $R/boot/firmware/
23 $R/tmp/linux/scripts/mkknlimg $R/tmp/linux/arch/arm/boot/zImage $R/boot/firmware/kernel7.img
28 $R/usr/local/src/linux/scripts/mkknlimg $R/usr/local/src/linux/arch/arm/boot/zImage $R/boot/firmware/kernel7.img
24 29
25 30 # Copy dts and dtb device definitions
26 31 mkdir $R/boot/firmware/overlays/
27 cp $R/tmp/linux/arch/arm/boot/dts/*.dtb $R/boot/firmware/
28 cp $R/tmp/linux/arch/arm/boot/dts/overlays/*.dtb* $R/boot/firmware/overlays/
29 cp $R/tmp/linux/arch/arm/boot/dts/overlays/README $R/boot/firmware/overlays/
32 cp $R/usr/local/src/linux/arch/arm/boot/dts/*.dtb $R/boot/firmware/
33 cp $R/usr/local/src/linux/arch/arm/boot/dts/overlays/*.dtb* $R/boot/firmware/overlays/
34 cp $R/usr/local/src/linux/arch/arm/boot/dts/overlays/README $R/boot/firmware/overlays/
30 35
31 36 # Install raspberry bootloader and flash-kernel
32 37 chroot_exec apt-get -qq -y --no-install-recommends install raspberrypi-bootloader-nokernel
@@ -79,6 +79,7 ENABLE_IPTABLES=${ENABLE_IPTABLES:=false}
79 79
80 80 # Kernel compilation settings
81 81 BUILD_KERNEL=${BUILD_KERNEL:=false}
82 KERNEL_HEADERS=${KERNEL_HEADERS:=true}
82 83
83 84 # Image chroot path
84 85 R=${BUILDDIR}/chroot
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant