##// END OF EJS Templates
fixes and shellcheck
Unknown -
r382:68c10636851d
parent child
Show More
@@ -86,13 +86,12 if [ "$BUILD_KERNEL" = true ] ; then
86 86 if [ "$KERNELSRC_CONFIG" = true ] ; then
87 87 # Load default raspberry kernel configuration
88 88 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
89
90 #Switch to KERNELSRC_DIR
91 pushd "${KERNEL_DIR}"
89 #Switch to KERNELSRC_DIR
90 pushd "${KERNEL_DIR}"
92 91
93 # GPL v2.0
94 #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh
95 if [ "$KERNEL_ZSWAP" = true ] && ( [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ) ; then
92 # GPL v2.0
93 #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh
94 if [ "$KERNEL_ZSWAP" = true ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then
96 95 # enable ZSWAP support for better performance during large builds etc.
97 96 # requires activation via kernel parameter or sysfs
98 97 # see e.g. https://askubuntu.com/a/472227 for a summary of ZSWAP (vs ZRAM etc.)
@@ -105,7 +104,7 if [ "$BUILD_KERNEL" = true ] ; then
105 104 set_kernel_config PGTABLE_MAPPING y
106 105 fi
107 106
108 if [ "$KERNEL_VIRT" = true ] && ( [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ) ; then
107 if [ "$KERNEL_VIRT" = true ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then
109 108 # enable basic KVM support; see e.g.
110 109 # https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=210546&start=25#p1300453
111 110 set_kernel_config VIRTUALIZATION y
@@ -115,7 +114,7 if [ "$BUILD_KERNEL" = true ] ; then
115 114 fi
116 115 #See https://github.com/raspberrypi/linux/issues/2177#issuecomment-354647406
117 116 # Netfilter kernel support
118 if [ "$KERNEL_NF" = true ] && ( [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ) ; then
117 if [ "$KERNEL_NF" = true ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then
119 118 set_kernel_config CONFIG_NETFILTER_XTABLES m
120 119 set_kernel_config CONFIG_NF_DUP_NETDEV m
121 120 set_kernel_config CONFIG_NF_NAT_SIP m
@@ -209,7 +208,7 if [ "$BUILD_KERNEL" = true ] ; then
209 208 #https://groups.google.com/forum/#!topic/linux.gentoo.user/_2aSc_ztGpA
210 209 #https://github.com/torvalds/linux/blob/master/init/Kconfig#L848
211 210 # Enables BPF syscall for systemd-journald
212 if [ "$KERNEL_BPF" = true ] && ( [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ) ; then
211 if [ "$KERNEL_BPF" = true ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then
213 212 set_kernel_config CONFIG_BPF_SYSCALL y
214 213 set_kernel_config CONFIG_CGROUP_BPF y
215 214 fi
@@ -238,7 +237,7 if [ "$BUILD_KERNEL" = true ] ; then
238 237 echo "CONFIG_CRYPTO_XTS=y"
239 238 echo "CONFIG_CRYPTO_SHA512=y"
240 239 echo "CONFIG_CRYPTO_MANAGER=y"
241 } >> ${KERNEL_DIR}/.config
240 } >> "${KERNEL_DIR}/.config"
242 241 fi
243 242 fi
244 243
@@ -269,7 +268,7 if [ "$BUILD_KERNEL" = true ] ; then
269 268 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs
270 269
271 270 # Cross compile kernel modules
272 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
271 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
273 272 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules
274 273 fi
275 274 fi
@@ -283,16 +282,16 if [ "$BUILD_KERNEL" = true ] ; then
283 282
284 283 # Install kernel modules
285 284 if [ "$ENABLE_REDUCE" = true ] ; then
286 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
285 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
287 286 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
288 287 fi
289 288 else
290 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
289 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
291 290 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
292 291 fi
293 292
294 293 # Install kernel firmware
295 if [ "$(grep "^firmware_install:" "${KERNEL_DIR}/Makefile")" ] ; then
294 if grep -q "^firmware_install:" "${KERNEL_DIR}/Makefile" ; then
296 295 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
297 296 fi
298 297 fi
@@ -360,8 +359,8 if [ "$BUILD_KERNEL" = true ] ; then
360 359 rm -fr "${KERNEL_DIR}"
361 360 else
362 361 # Prepare compiled kernel modules
363 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
364 if [ "$(grep "^modules_prepare:" "${KERNEL_DIR}/Makefile")" ] ; then
362 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
363 if grep -q "^modules_prepare:" "${KERNEL_DIR}/Makefile" ; then
365 364 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare
366 365 fi
367 366
@@ -372,29 +371,26 if [ "$BUILD_KERNEL" = true ] ; then
372 371 fi
373 372
374 373 else # BUILD_KERNEL=false
375 # echo " Install precompiled kernel..."
376 # echo "error: not implemented"
377 if [ "$KERNEL_ARCH" = arm64 ] && ( [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ) ; then
374 # echo Install precompiled kernel...
375 # echo error: not implemented
376 if [ "$KERNEL_ARCH" = arm64 ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then
378 377 # Create temporary directory for dl
379 378 temp_dir=$(as_nobody mktemp -d)
380 379
381 # Fetch kernel dl
382 as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI3_64_KERNEL_URL"
383 #extract download
380 # Fetch kernel dl
381 as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI3_64_KERNEL_URL"
382 #extract download
384 383 tar -xJf "${temp_dir}"/kernel.tar.xz -C "${R}"
385
386 384 # Remove temporary directory for kernel sources
387 385 rm -fr "${temp_dir}"
388
389 386 # Set permissions of the kernel sources
390 mkdir "${R}/boot/firmware"
391 cp -r "${R}/boot/ "${R}/boot/firmware"
387 mkdir "${R}/boot/firmware"
388 cp -r "${R}/boot/" "${R}/boot/firmware"
392 389 chown -R root:root "${R}/boot/firmware"
393 chown -R root:root "${R}/lib"
394
395 #Create cmdline.txt
396 touch "${BOOT_DIR}/cmdline.txt"
397 fi
390 chown -R root:root "${R}/lib"
391 #Create cmdline.txt
392 touch "${BOOT_DIR}/cmdline.txt"
393 fi
398 394
399 395 # Check if kernel installation was successful
400 396 KERNEL="$(ls -1 "${R}"/boot/kernel* | sort | tail -n 1)"
@@ -403,5 +399,4 fi
403 399 cleanup
404 400 exit 1
405 401 fi
406
407 fi No newline at end of file
402 fi
@@ -11,8 +11,8 ENCRYPTED_USER_PASSWORD=$(mkpasswd -m sha-512 "${USER_PASSWORD}")
11 11
12 12 # Setup default user
13 13 if [ "$ENABLE_USER" = true ] ; then
14 chroot_exec adduser --gecos $USER_NAME --add_extra_groups --disabled-password $USER_NAME
15 chroot_exec usermod -a -G sudo -p "${ENCRYPTED_USER_PASSWORD}" $USER_NAME
14 chroot_exec adduser --gecos "$USER_NAME" --add_extra_groups --disabled-password "$USER_NAME"
15 chroot_exec usermod -a -G sudo -p "${ENCRYPTED_USER_PASSWORD}" "$USER_NAME"
16 16 fi
17 17
18 18 # Setup root password or not
@@ -41,7 +41,7 if [ "$ENABLE_UBOOT" = true ] ; then
41 41
42 42 # Install and setup U-Boot command file
43 43 install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage"
44 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
44 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat "${BOOT_DIR}"/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
45 45
46 46 if [ "$ENABLE_INITRAMFS" = true ] ; then
47 47 # Convert generated initramfs for U-Boot using mkimage
@@ -51,7 +51,7 if [ "$ENABLE_UBOOT" = true ] ; then
51 51 rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}"
52 52
53 53 # Configure U-Boot to load generated initramfs
54 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
54 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat "${BOOT_DIR}"/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
55 55 printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
56 56 else # ENABLE_INITRAMFS=false
57 57 # Remove initramfs from U-Boot mkfile
@@ -68,10 +68,12 if [ "$ENABLE_UBOOT" = true ] ; then
68 68
69 69 if [ "$SET_ARCH" = 64 ] ; then
70 70 echo "Setting up config.txt to boot 64bit uboot"
71
72 printf "\n# 64bit-mode" >> "${BOOT_DIR}/config.txt"
73 printf "\n# arm_control=0x200 is deprecated https://www.raspberrypi.org/documentation/configuration/config-txt/misc.md" >> "${BOOT_DIR}/config.txt"
74 printf "\narm_64bit=1" >> "${BOOT_DIR}/config.txt"
71 {
72 printf "\n# 64bit-mode"
73 printf "\n# arm_control=0x200 is deprecated https://www.raspberrypi.org/documentation/configuration/config-txt/misc.md"
74 printf "\narm_64bit=1"
75 } >> "${BOOT_DIR}/config.txt"
76
75 77 #in 64bit uboot booti is used instead of bootz [like in KERNEL_BIN_IMAGE=zImage (armv7)|| Image(armv8)]
76 78 sed -i "s|bootz|booti|g" "${BOOT_DIR}/uboot.mkimage"
77 79 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant