##// END OF EJS Templates
Fix custom cmdline
Filip Pytloun -
r61:64a7766237c3
parent child
Show More
@@ -1,102 +1,102
1 #
1 #
2 # Kernel installation
2 # Kernel installation
3 #
3 #
4
4
5 . ./functions.sh
5 . ./functions.sh
6
6
7 # Fetch and build latest raspberry kernel
7 # Fetch and build latest raspberry kernel
8 if [ "$BUILD_KERNEL" = true ] ; then
8 if [ "$BUILD_KERNEL" = true ] ; then
9 # Fetch current raspberrypi kernel sources
9 # Fetch current raspberrypi kernel sources
10 git -C $R/usr/local/src 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 # Load default raspberry kernel configuration
12 # Load default raspberry kernel configuration
13 make -C $R/usr/local/src/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 # Cross compile kernel and modules
15 # Cross compile kernel and modules
16 make -C $R/usr/local/src/linux -j$(grep -c processor /proc/cpuinfo) 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 # Install kernel modules
18 # Install kernel modules
19 make -C $R/usr/local/src/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
20
21 # Install kernel headers
21 # Install kernel headers
22 if [ "$KERNEL_HEADERS" = true ]; then
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
23 make -C $R/usr/local/src/linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_HDR_PATH=../../usr headers_install
24 fi
24 fi
25
25
26 # Copy and rename compiled kernel to boot directory
26 # Copy and rename compiled kernel to boot directory
27 mkdir $R/boot/firmware/
27 mkdir $R/boot/firmware/
28 $R/usr/local/src/linux/scripts/mkknlimg $R/usr/local/src/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
29
29
30 # Copy dts and dtb device definitions
30 # Copy dts and dtb device definitions
31 mkdir $R/boot/firmware/overlays/
31 mkdir $R/boot/firmware/overlays/
32 cp $R/usr/local/src/linux/arch/arm/boot/dts/*.dtb $R/boot/firmware/
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/
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/
34 cp $R/usr/local/src/linux/arch/arm/boot/dts/overlays/README $R/boot/firmware/overlays/
35
35
36 # Install raspberry bootloader and flash-kernel
36 # Install raspberry bootloader and flash-kernel
37 chroot_exec apt-get -qq -y --no-install-recommends install raspberrypi-bootloader-nokernel
37 chroot_exec apt-get -qq -y --no-install-recommends install raspberrypi-bootloader-nokernel
38 else
38 else
39 # Kernel installation
39 # Kernel installation
40 chroot_exec apt-get -qq -y --no-install-recommends install linux-image-${KERNEL} raspberrypi-bootloader-nokernel
40 chroot_exec apt-get -qq -y --no-install-recommends install linux-image-${KERNEL} raspberrypi-bootloader-nokernel
41
41
42 # Install flash-kernel last so it doesn't try (and fail) to detect the platform in the chroot
42 # Install flash-kernel last so it doesn't try (and fail) to detect the platform in the chroot
43 chroot_exec apt-get -qq -y install flash-kernel
43 chroot_exec apt-get -qq -y install flash-kernel
44
44
45 VMLINUZ="$(ls -1 $R/boot/vmlinuz-* | sort | tail -n 1)"
45 VMLINUZ="$(ls -1 $R/boot/vmlinuz-* | sort | tail -n 1)"
46 [ -z "$VMLINUZ" ] && exit 1
46 [ -z "$VMLINUZ" ] && exit 1
47 cp $VMLINUZ $R/boot/firmware/kernel7.img
47 cp $VMLINUZ $R/boot/firmware/kernel7.img
48 fi
48 fi
49
49
50 # Set up firmware boot cmdline
50 # Set up firmware boot cmdline
51 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait net.ifnames=1 console=tty1"
51 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait net.ifnames=1 console=tty1 ${CMDLINE}"
52
52
53 # Set up serial console support (if requested)
53 # Set up serial console support (if requested)
54 if [ "$ENABLE_CONSOLE" = true ] ; then
54 if [ "$ENABLE_CONSOLE" = true ] ; then
55 CMDLINE="${CMDLINE} console=ttyAMA0,115200 kgdboc=ttyAMA0,115200"
55 CMDLINE="${CMDLINE} console=ttyAMA0,115200 kgdboc=ttyAMA0,115200"
56 fi
56 fi
57
57
58 # Set up IPv6 networking support
58 # Set up IPv6 networking support
59 if [ "$ENABLE_IPV6" = false ] ; then
59 if [ "$ENABLE_IPV6" = false ] ; then
60 CMDLINE="${CMDLINE} ipv6.disable=1"
60 CMDLINE="${CMDLINE} ipv6.disable=1"
61 fi
61 fi
62
62
63 echo "${CMDLINE}" >$R/boot/firmware/cmdline.txt
63 echo "${CMDLINE}" >$R/boot/firmware/cmdline.txt
64
64
65 # Set up firmware config
65 # Set up firmware config
66 install -o root -g root -m 644 files/config.txt $R/boot/firmware/config.txt
66 install -o root -g root -m 644 files/config.txt $R/boot/firmware/config.txt
67
67
68 # Load snd_bcm2835 kernel module at boot time
68 # Load snd_bcm2835 kernel module at boot time
69 if [ "$ENABLE_SOUND" = true ] ; then
69 if [ "$ENABLE_SOUND" = true ] ; then
70 echo "snd_bcm2835" >>$R/etc/modules
70 echo "snd_bcm2835" >>$R/etc/modules
71 fi
71 fi
72
72
73 # Set smallest possible GPU memory allocation size: 16MB (no X)
73 # Set smallest possible GPU memory allocation size: 16MB (no X)
74 if [ "$ENABLE_MINGPU" = true ] ; then
74 if [ "$ENABLE_MINGPU" = true ] ; then
75 echo "gpu_mem=16" >>$R/boot/firmware/config.txt
75 echo "gpu_mem=16" >>$R/boot/firmware/config.txt
76 fi
76 fi
77
77
78 # Create symlinks
78 # Create symlinks
79 ln -sf firmware/config.txt $R/boot/config.txt
79 ln -sf firmware/config.txt $R/boot/config.txt
80 ln -sf firmware/cmdline.txt $R/boot/cmdline.txt
80 ln -sf firmware/cmdline.txt $R/boot/cmdline.txt
81
81
82 # Prepare modules-load.d directory
82 # Prepare modules-load.d directory
83 mkdir -p $R/lib/modules-load.d/
83 mkdir -p $R/lib/modules-load.d/
84
84
85 # Load random module on boot
85 # Load random module on boot
86 if [ "$ENABLE_HWRANDOM" = true ] ; then
86 if [ "$ENABLE_HWRANDOM" = true ] ; then
87 cat <<EOM >$R/lib/modules-load.d/rpi2.conf
87 cat <<EOM >$R/lib/modules-load.d/rpi2.conf
88 bcm2708_rng
88 bcm2708_rng
89 EOM
89 EOM
90 fi
90 fi
91
91
92 # Prepare modprobe.d directory
92 # Prepare modprobe.d directory
93 mkdir -p $R/etc/modprobe.d/
93 mkdir -p $R/etc/modprobe.d/
94
94
95 # Blacklist sound modules
95 # Blacklist sound modules
96 install -o root -g root -m 644 files/modprobe.d/raspi-blacklist.conf $R/etc/modprobe.d/raspi-blacklist.conf
96 install -o root -g root -m 644 files/modprobe.d/raspi-blacklist.conf $R/etc/modprobe.d/raspi-blacklist.conf
97
97
98 # Create default fstab
98 # Create default fstab
99 install -o root -g root -m 644 files/fstab $R/etc/fstab
99 install -o root -g root -m 644 files/fstab $R/etc/fstab
100
100
101 # Avoid swapping and increase cache sizes
101 # Avoid swapping and increase cache sizes
102 install -o root -g root -m 644 files/sysctl.d/81-rpi-vm.conf $R/etc/sysctl.d/81-rpi-vm.conf
102 install -o root -g root -m 644 files/sysctl.d/81-rpi-vm.conf $R/etc/sysctl.d/81-rpi-vm.conf
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant