@@ -108,7 +108,7 if [ "$BUILD_KERNEL" = true ] ; then | |||||
108 | echo "CONFIG_CRYPTO_XTS=y" |
|
108 | echo "CONFIG_CRYPTO_XTS=y" | |
109 | echo "CONFIG_CRYPTO_SHA512=y" |
|
109 | echo "CONFIG_CRYPTO_SHA512=y" | |
110 | echo "CONFIG_CRYPTO_MANAGER=y" |
|
110 | echo "CONFIG_CRYPTO_MANAGER=y" | |
111 | } >> ${KERNEL_DIR}/.config |
|
111 | } >> "${KERNEL_DIR}"/.config | |
112 | fi |
|
112 | fi | |
113 | fi |
|
113 | fi | |
114 |
|
114 | |||
@@ -139,7 +139,7 if [ "$BUILD_KERNEL" = true ] ; then | |||||
139 | make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs |
|
139 | make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs | |
140 |
|
140 | |||
141 | # Cross compile kernel modules |
|
141 | # Cross compile kernel modules | |
142 |
if |
|
142 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then | |
143 | make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules |
|
143 | make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules | |
144 | fi |
|
144 | fi | |
145 | fi |
|
145 | fi | |
@@ -153,16 +153,16 if [ "$BUILD_KERNEL" = true ] ; then | |||||
153 |
|
153 | |||
154 | # Install kernel modules |
|
154 | # Install kernel modules | |
155 | if [ "$ENABLE_REDUCE" = true ] ; then |
|
155 | if [ "$ENABLE_REDUCE" = true ] ; then | |
156 |
if |
|
156 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then | |
157 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install |
|
157 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install | |
158 | fi |
|
158 | fi | |
159 | else |
|
159 | else | |
160 |
if |
|
160 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then | |
161 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install |
|
161 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install | |
162 | fi |
|
162 | fi | |
163 |
|
163 | |||
164 | # Install kernel firmware |
|
164 | # Install kernel firmware | |
165 |
if |
|
165 | if grep -q "^firmware_install:" "${KERNEL_DIR}/Makefile" ; then | |
166 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install |
|
166 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install | |
167 | fi |
|
167 | fi | |
168 | fi |
|
168 | fi | |
@@ -225,8 +225,8 if [ "$BUILD_KERNEL" = true ] ; then | |||||
225 | rm -fr "${KERNEL_DIR}" |
|
225 | rm -fr "${KERNEL_DIR}" | |
226 | else |
|
226 | else | |
227 | # Prepare compiled kernel modules |
|
227 | # Prepare compiled kernel modules | |
228 |
if |
|
228 | if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then | |
229 |
if |
|
229 | if grep -q "^modules_prepare:" "${KERNEL_DIR}/Makefile" ; then | |
230 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare |
|
230 | make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare | |
231 | fi |
|
231 | fi | |
232 |
|
232 |
@@ -104,6 +104,12 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |||||
104 | # Copy downloaded sources |
|
104 | # Copy downloaded sources | |
105 | mv "${temp_dir}/pi-bluetooth" "${R}/tmp/" |
|
105 | mv "${temp_dir}/pi-bluetooth" "${R}/tmp/" | |
106 |
|
106 | |||
|
107 | # Raspberry-sys-mod package for /dev/serial device needed by bluetooth service | |||
|
108 | as_nobody wget -q -O "${R}/tmp/pi-bluetooth/99-com.rules" https://raw.githubusercontent.com/RPi-Distro/raspberrypi-sys-mods/master/etc.armhf/udev/rules.d/99-com.rules | |||
|
109 | # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/ | |||
|
110 | as_nobody wget -q -O "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" https://aur.archlinux.org/cgit/aur.git/plain/LICENCE.broadcom_bcm43xx?h=pi-bluetooth | |||
|
111 | as_nobody wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth | |||
|
112 | ||||
107 | # Set permissions |
|
113 | # Set permissions | |
108 | chown -R root:root "${R}/tmp/pi-bluetooth" |
|
114 | chown -R root:root "${R}/tmp/pi-bluetooth" | |
109 |
|
115 | |||
@@ -116,12 +122,15 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |||||
116 |
|
122 | |||
117 | # Install Firmware Flash file and apropiate licence |
|
123 | # Install Firmware Flash file and apropiate licence | |
118 | mkdir "${ETC_DIR}/firmware/" |
|
124 | mkdir "${ETC_DIR}/firmware/" | |
119 |
|
125 | install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${ETC_DIR}/firmware/LICENCE.broadcom_bcm43xx" | ||
120 | wget -O "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" https://aur.archlinux.org/cgit/aur.git/plain/LICENCE.broadcom_bcm43xx?h=pi-bluetooth |
|
126 | install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${ETC_DIR}/firmware/LICENCE.broadcom_bcm43xx" | |
121 | wget -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth |
|
127 | install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service" | |
122 |
|
128 | install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service" | ||
123 | # Get /dev/serial back for compability |
|
129 | # Install udev rule for bluetooth device | |
124 | wget -O "${ETC_DIR}/udev/rules.d/99-com.rules" https://raw.githubusercontent.com/RPi-Distro/raspberrypi-sys-mods/master/etc.armhf/udev/rules.d/99-com.rules |
|
130 | install_readonly "${R}/tmp/pi-bluetooth/99-com.rules" "${ETC_DIR}/udev/rules.d/99-com.rules" | |
|
131 | ||||
|
132 | # Remove temporary directory | |||
|
133 | rm -fr "${temp_dir}" | |||
125 | fi |
|
134 | fi | |
126 | fi |
|
135 | fi | |
127 |
|
136 |
@@ -11,8 +11,8 ENCRYPTED_USER_PASSWORD=$(mkpasswd -m sha-512 "${USER_PASSWORD}") | |||||
11 |
|
11 | |||
12 | # Setup default user |
|
12 | # Setup default user | |
13 | if [ "$ENABLE_USER" = true ] ; then |
|
13 | if [ "$ENABLE_USER" = true ] ; then | |
14 | chroot_exec adduser --gecos $USER_NAME --add_extra_groups --disabled-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 |
|
15 | chroot_exec usermod -a -G sudo -p "${ENCRYPTED_USER_PASSWORD}" "$USER_NAME" | |
16 | fi |
|
16 | fi | |
17 |
|
17 | |||
18 | # Setup root password or not |
|
18 | # Setup root password or not |
@@ -41,7 +41,7 if [ "$ENABLE_UBOOT" = true ] ; then | |||||
41 |
|
41 | |||
42 | # Install and setup U-Boot command file |
|
42 | # Install and setup U-Boot command file | |
43 | install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage" |
|
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 | if [ "$ENABLE_INITRAMFS" = true ] ; then |
|
46 | if [ "$ENABLE_INITRAMFS" = true ] ; then | |
47 | # Convert generated initramfs for U-Boot using mkimage |
|
47 | # Convert generated initramfs for U-Boot using mkimage | |
@@ -51,7 +51,7 if [ "$ENABLE_UBOOT" = true ] ; then | |||||
51 | rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" |
|
51 | rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}" | |
52 |
|
52 | |||
53 | # Configure U-Boot to load generated initramfs |
|
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 | printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage" |
|
55 | printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage" | |
56 | else # ENABLE_INITRAMFS=false |
|
56 | else # ENABLE_INITRAMFS=false | |
57 | # Remove initramfs from U-Boot mkfile |
|
57 | # Remove initramfs from U-Boot mkfile | |
@@ -65,14 +65,16 if [ "$ENABLE_UBOOT" = true ] ; then | |||||
65 | printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage" |
|
65 | printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage" | |
66 | fi |
|
66 | fi | |
67 | fi |
|
67 | fi | |
68 |
|
||||
69 | if [ "$KERNEL_ARCH" = "arm64" ] ; then |
|
|||
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" |
|
|||
75 |
|
68 | |||
|
69 | if [ "$SET_ARCH" = 64 ] ; then | |||
|
70 | echo "Setting up config.txt to boot 64bit uboot" | |||
|
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 | ||||
|
77 | #in 64bit uboot booti is used instead of bootz [like in KERNEL_BIN_IMAGE=zImage (armv7)|| Image(armv8)] | |||
76 | sed -i "s|bootz|booti|g" "${BOOT_DIR}/uboot.mkimage" |
|
78 | sed -i "s|bootz|booti|g" "${BOOT_DIR}/uboot.mkimage" | |
77 | fi |
|
79 | fi | |
78 |
|
80 |
@@ -8,16 +8,16 | |||||
8 | if [ "$ENABLE_VIDEOCORE" = true ] ; then |
|
8 | if [ "$ENABLE_VIDEOCORE" = true ] ; then | |
9 | # Copy existing videocore sources into chroot directory |
|
9 | # Copy existing videocore sources into chroot directory | |
10 | if [ -n "$VIDEOCORESRC_DIR" ] && [ -d "$VIDEOCORESRC_DIR" ] ; then |
|
10 | if [ -n "$VIDEOCORESRC_DIR" ] && [ -d "$VIDEOCORESRC_DIR" ] ; then | |
11 |
# Copy local |
|
11 | # Copy local videocore sources | |
12 | cp -r "${VIDEOCORESRC_DIR}" "${R}/tmp/userland" |
|
12 | cp -r "${VIDEOCORESRC_DIR}" "${R}/tmp/userland" | |
13 | else |
|
13 | else | |
14 |
# Create temporary directory for |
|
14 | # Create temporary directory for videocore sources | |
15 | temp_dir=$(as_nobody mktemp -d) |
|
15 | temp_dir=$(as_nobody mktemp -d) | |
16 |
|
16 | |||
17 |
# Fetch |
|
17 | # Fetch videocore sources | |
18 | as_nobody git -C "${temp_dir}" clone "${VIDEOCORE_URL}" |
|
18 | as_nobody git -C "${temp_dir}" clone "${VIDEOCORE_URL}" | |
19 |
|
19 | |||
20 |
# Copy downloaded |
|
20 | # Copy downloaded videocore sources | |
21 | mv "${temp_dir}/userland" "${R}/tmp/" |
|
21 | mv "${temp_dir}/userland" "${R}/tmp/" | |
22 |
|
22 | |||
23 | # Set permissions of the U-Boot sources |
|
23 | # Set permissions of the U-Boot sources | |
@@ -31,7 +31,7 if [ "$ENABLE_VIDEOCORE" = true ] ; then | |||||
31 | mkdir "${R}"/tmp/userland/build |
|
31 | mkdir "${R}"/tmp/userland/build | |
32 |
|
32 | |||
33 | # push us to build directory |
|
33 | # push us to build directory | |
34 |
|
|
34 | cd "${R}"/tmp/userland/build | |
35 |
|
35 | |||
36 | if [ "$RELEASE_ARCH" = "arm64" ] ; then |
|
36 | if [ "$RELEASE_ARCH" = "arm64" ] ; then | |
37 | cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DARM64=ON -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_ASM_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland" |
|
37 | cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DARM64=ON -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_ASM_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland" | |
@@ -48,6 +48,6 if [ "$ENABLE_VIDEOCORE" = true ] ; then | |||||
48 | #build userland |
|
48 | #build userland | |
49 | make -j "$(nproc)" |
|
49 | make -j "$(nproc)" | |
50 |
|
50 | |||
51 | #pop us out of build dir |
|
51 | #back to root of scriptdir | |
52 | popd |
|
52 | cd "${WORKDIR}" | |
53 | fi |
|
53 | fi |
@@ -30,22 +30,22 cleanup (){ | |||||
30 |
|
30 | |||
31 | chroot_exec() { |
|
31 | chroot_exec() { | |
32 | # Exec command in chroot |
|
32 | # Exec command in chroot | |
33 |
LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot ${R} |
|
33 | LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot "${R}" "$@" | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | as_nobody() { |
|
36 | as_nobody() { | |
37 | # Exec command as user nobody |
|
37 | # Exec command as user nobody | |
38 |
sudo -E -u nobody LANG=C LC_ALL=C |
|
38 | sudo -E -u nobody LANG=C LC_ALL=C "$@" | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | install_readonly() { |
|
41 | install_readonly() { | |
42 | # Install file with user read-only permissions |
|
42 | # Install file with user read-only permissions | |
43 |
install -o root -g root -m 644 |
|
43 | install -o root -g root -m 644 "$@" | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | install_exec() { |
|
46 | install_exec() { | |
47 | # Install file with root exec permissions |
|
47 | # Install file with root exec permissions | |
48 |
install -o root -g root -m 744 |
|
48 | install -o root -g root -m 744 "$@" | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | use_template () { |
|
51 | use_template () { | |
@@ -64,14 +64,14 chroot_install_cc() { | |||||
64 | if [ -z "${COMPILER_PACKAGES}" ] ; then |
|
64 | if [ -z "${COMPILER_PACKAGES}" ] ; then | |
65 | COMPILER_PACKAGES=$(chroot_exec apt-get -s install g++ make bc | grep "^Inst " | awk -v ORS=" " '{ print $2 }') |
|
65 | COMPILER_PACKAGES=$(chroot_exec apt-get -s install g++ make bc | grep "^Inst " | awk -v ORS=" " '{ print $2 }') | |
66 | # Install COMPILER_PACKAGES in chroot |
|
66 | # Install COMPILER_PACKAGES in chroot | |
67 | chroot_exec apt-get -q -y --allow-unauthenticated --no-install-recommends install ${COMPILER_PACKAGES} |
|
67 | chroot_exec apt-get -q -y --allow-unauthenticated --no-install-recommends install "${COMPILER_PACKAGES}" | |
68 | fi |
|
68 | fi | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | chroot_remove_cc() { |
|
71 | chroot_remove_cc() { | |
72 | # Remove c/c++ build environment from the chroot |
|
72 | # Remove c/c++ build environment from the chroot | |
73 |
if [ |
|
73 | if [ -n "${COMPILER_PACKAGES}" ] ; then | |
74 | chroot_exec apt-get -qq -y --auto-remove purge ${COMPILER_PACKAGES} |
|
74 | chroot_exec apt-get -qq -y --auto-remove purge "${COMPILER_PACKAGES}" | |
75 | COMPILER_PACKAGES="" |
|
75 | COMPILER_PACKAGES="" | |
76 | fi |
|
76 | fi | |
77 | } |
|
77 | } |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant