@@ -0,0 +1,33 | |||||
|
1 | SUBSYSTEM=="input", GROUP="input", MODE="0660" | |||
|
2 | SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660" | |||
|
3 | SUBSYSTEM=="spidev", GROUP="spi", MODE="0660" | |||
|
4 | SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660" | |||
|
5 | ||||
|
6 | SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660" | |||
|
7 | SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\ | |||
|
8 | chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\ | |||
|
9 | chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\ | |||
|
10 | chown -R root:gpio /sys$devpath && chmod -R 770 /sys$devpath\ | |||
|
11 | '" | |||
|
12 | ||||
|
13 | KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\ | |||
|
14 | ALIASES=/proc/device-tree/aliases; \ | |||
|
15 | if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \ | |||
|
16 | echo 0;\ | |||
|
17 | elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \ | |||
|
18 | echo 1; \ | |||
|
19 | else \ | |||
|
20 | exit 1; \ | |||
|
21 | fi\ | |||
|
22 | '", SYMLINK+="serial%c" | |||
|
23 | ||||
|
24 | KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\ | |||
|
25 | ALIASES=/proc/device-tree/aliases; \ | |||
|
26 | if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \ | |||
|
27 | echo 0; \ | |||
|
28 | elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \ | |||
|
29 | echo 1; \ | |||
|
30 | else \ | |||
|
31 | exit 1; \ | |||
|
32 | fi \ | |||
|
33 | '", SYMLINK+="serial%c" |
@@ -0,0 +1,1 | |||||
|
1 | kernel.printk = 3 4 1 3 No newline at end of file |
@@ -61,19 +61,14 A comma separated list of additional packages to be installed by apt after boots | |||||
61 | Set Architecture to default 32bit. If you want to to compile 64bit (RPI3 or RPI3+) set it to `64`. This option will set every needed crosscompiler or boeard specific option for a successful build. |
|
61 | Set Architecture to default 32bit. If you want to to compile 64bit (RPI3 or RPI3+) set it to `64`. This option will set every needed crosscompiler or boeard specific option for a successful build. | |
62 |
|
62 | |||
63 | ##### `RPI_MODEL`=2 |
|
63 | ##### `RPI_MODEL`=2 | |
64 |
Specifiy the target Raspberry Pi hardware model. The script at this time supports the following Raspberry Pi models |
|
64 | Specifiy the target Raspberry Pi hardware model. The script at this time supports the following Raspberry Pi models: | |
65 |
|
65 | - `0` = Used for Raspberry Pi 0 and Raspberry Pi 0 W | ||
66 | `0` = Used for Raspberry Pi 0 and Raspberry Pi 0 W |
|
66 | - `1` = Used for Pi 1 model A and B | |
67 |
|
67 | - `1P` = Used for Pi 1 model B+ and A+ | ||
68 |
|
|
68 | - `2` = Used for Pi 2 model B | |
69 |
|
69 | - `3` = Used for Pi 3 model B | ||
70 |
|
|
70 | - `3P` = Used for Pi 3 model B+ | |
71 |
|
71 | - `BUILD_KERNEL`=true will automatically be set if the Raspberry Pi model `3` or `3P` is used. | ||
72 | `2` = Used for Raspberry Pi 2 model B |
|
|||
73 |
|
||||
74 | `3` = Used for Raspberry Pi 3 model B |
|
|||
75 |
|
||||
76 | `3P` = Used for Raspberry Pi 3 model B+ |
|
|||
77 |
|
72 | |||
78 | ##### `RELEASE`="buster" |
|
73 | ##### `RELEASE`="buster" | |
79 | Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases `stretch` and `buster`. |
|
74 | Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases `stretch` and `buster`. | |
@@ -157,7 +152,19 Set the IP address for the second NTP server. | |||||
157 |
|
152 | |||
158 | #### Basic system features: |
|
153 | #### Basic system features: | |
159 | ##### `ENABLE_CONSOLE`=true |
|
154 | ##### `ENABLE_CONSOLE`=true | |
160 |
Enable serial console interface. Recommended if no monitor or keyboard is connected to the RPi |
|
155 | Enable serial console interface. Recommended if no monitor or keyboard is connected to the RPi2/3. In case of problems fe. if the network (auto) configuration failed - the serial console can be used to access the system. On RPI `0` `3` `3P` the CPU speed is locked at lowest speed. | |
|
156 | ||||
|
157 | ##### `ENABLE_PRINTK`=false | |||
|
158 | Enables printing kernel messages to konsole. printk is `3 4 1 3` as in raspbian. | |||
|
159 | ||||
|
160 | ##### `ENABLE_BLUETOOTH`=false | |||
|
161 | Enable onboard Bluetooth interface on the RPi0/3/3P. See: https://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/ | |||
|
162 | ||||
|
163 | ##### `ENABLE_MINIUART_OVERLAY`=false | |||
|
164 | Enable Bluetooth to use this. Adds overlay to swap UART0 with UART1. Enabling (slower) Bluetooth and full speed serial console. - RPI `0` `3` `3P` have a fast `hardware UART0` (ttyAMA0) and a `mini UART1` (ttyS0)! RPI `1` `1P` `2` only have a `hardware UART0`. `UART0` is considered better, because is faster and more stable than `mini UART1`. By default the Bluetooth modem is mapped to the `hardware UART0` and `mini UART` is used for console. The `mini UART` is a problem for the serial console, because its baudrate depends on the cpu frequency, which is changing on runtime. Resulting in a volatile baudrate and thus in an unusable serial console. | |||
|
165 | ||||
|
166 | ##### `ENABLE_TURBO`=false | |||
|
167 | Enable Turbo mode. This setting locks cpu at highest frequency. As setting ENABLE_CONSOLE=true locks RPI to lowest CPU speed, this is can be used additionally to lock cpu hat max speed. Need a good power supply and probably cooling for the Raspberry PI. | |||
161 |
|
168 | |||
162 | ##### `ENABLE_I2C`=false |
|
169 | ##### `ENABLE_I2C`=false | |
163 | Enable I2C interface on the RPi 0/1/2/3. Please check the [RPi 0/1/2/3 pinout diagrams](https://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins. |
|
170 | Enable I2C interface on the RPi 0/1/2/3. Please check the [RPi 0/1/2/3 pinout diagrams](https://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins. | |
@@ -178,8 +185,7 Allow the installation of non-free Debian packages that do not comply with the D | |||||
178 | Download and install the [closed-source firmware binary blob](https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm) that is required to run the internal wireless interface of the Raspberry Pi model `3`. This parameter is ignored if the specified `RPI_MODEL` is not `3`. |
|
185 | Download and install the [closed-source firmware binary blob](https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm) that is required to run the internal wireless interface of the Raspberry Pi model `3`. This parameter is ignored if the specified `RPI_MODEL` is not `3`. | |
179 |
|
186 | |||
180 | ##### `ENABLE_RSYSLOG`=true |
|
187 | ##### `ENABLE_RSYSLOG`=true | |
181 | If set to false, disable and uninstall rsyslog (so logs will be available only |
|
188 | If set to false, disable and uninstall rsyslog (so logs will be available only in journal files) | |
182 | in journal files) |
|
|||
183 |
|
189 | |||
184 | ##### `ENABLE_SOUND`=true |
|
190 | ##### `ENABLE_SOUND`=true | |
185 | Enable sound hardware and install Advanced Linux Sound Architecture. |
|
191 | Enable sound hardware and install Advanced Linux Sound Architecture. |
@@ -28,10 +28,10 if [ "$(echo "$APT_INCLUDES" | grep ",locales")" ] ; then | |||||
28 | chroot_exec update-locale LANG="${DEFLOCAL}" |
|
28 | chroot_exec update-locale LANG="${DEFLOCAL}" | |
29 |
|
29 | |||
30 | # Install and setup default keyboard configuration |
|
30 | # Install and setup default keyboard configuration | |
31 |
if [ "$XKB_MODEL" != " |
|
31 | if [ "$XKB_MODEL" != "" ] ; then | |
32 | sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "${ETC_DIR}/default/keyboard" |
|
32 | sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "${ETC_DIR}/default/keyboard" | |
33 | fi |
|
33 | fi | |
34 |
if [ "$XKB_LAYOUT" != " |
|
34 | if [ "$XKB_LAYOUT" != "" ] ; then | |
35 | sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "${ETC_DIR}/default/keyboard" |
|
35 | sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "${ETC_DIR}/default/keyboard" | |
36 | fi |
|
36 | fi | |
37 | if [ "$XKB_VARIANT" != "" ] ; then |
|
37 | if [ "$XKB_VARIANT" != "" ] ; then |
@@ -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 |
@@ -56,45 +56,25 if [ "$ENABLE_CRYPTFS" = true ] ; then | |||||
56 | fi |
|
56 | fi | |
57 | fi |
|
57 | fi | |
58 |
|
58 | |||
59 | # Add serial console support |
|
59 | #locks cpu at max frequency | |
60 |
if [ "$ENABLE_ |
|
60 | if [ "$ENABLE_TURBO" = true ] ; then | |
61 | CMDLINE="${CMDLINE} console=ttyAMA0,115200 kgdboc=ttyAMA0,115200" |
|
61 | echo "force_turbo=1" >> "${BOOT_DIR}/config.txt" | |
62 | fi |
|
62 | fi | |
63 |
|
63 | |||
64 | # Remove IPv6 networking support |
|
64 | if [ "$ENABLE_PRINTK" = true ] ; then | |
65 | if [ "$ENABLE_IPV6" = false ] ; then |
|
65 | install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf" | |
66 | CMDLINE="${CMDLINE} ipv6.disable=1" |
|
|||
67 | fi |
|
66 | fi | |
68 |
|
67 | |||
69 | # Automatically assign predictable network interface names |
|
68 | # Install udev rule for serial alias | |
70 | if [ "$ENABLE_IFNAMES" = false ] ; then |
|
69 | install_readonly files/etc/99-com.rules "${LIB_DIR}/udev/rules.d/99-com.rules" | |
71 | CMDLINE="${CMDLINE} net.ifnames=0" |
|
|||
72 | else |
|
|||
73 | CMDLINE="${CMDLINE} net.ifnames=1" |
|
|||
74 | fi |
|
|||
75 |
|
70 | |||
76 | # Install firmware boot cmdline |
|
71 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |
77 | echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt" |
|
|||
78 |
|
||||
79 | # Install firmware config |
|
|||
80 | install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt" |
|
|||
81 |
|
72 | |||
82 | # Setup minimal GPU memory allocation size: 16MB (no X) |
|
73 | # RPI0,3,3P Use default ttyS0 (mini-UART)as serial interface | |
83 | if [ "$ENABLE_MINGPU" = true ] ; then |
|
74 | SET_SERIAL="ttyS0" | |
84 | echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt" |
|
|||
85 | fi |
|
|||
86 |
|
75 | |||
87 | # Setup boot with initramfs |
|
76 | # Bluetooth enabled | |
88 |
if [ "$ENABLE_ |
|
77 | if [ "$ENABLE_BLUETOOTH" = true ] ; then | |
89 | echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt" |
|
|||
90 | fi |
|
|||
91 |
|
||||
92 | # Disable RPi3 Bluetooth and restore ttyAMA0 serial device |
|
|||
93 | if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then |
|
|||
94 | if [ "$ENABLE_CONSOLE" = true ] && [ "$ENABLE_UBOOT" = false ] ; then |
|
|||
95 | echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt" |
|
|||
96 | echo "enable_uart=1" >> "${BOOT_DIR}/config.txt" |
|
|||
97 | else |
|
|||
98 | # Create temporary directory for Bluetooth sources |
|
78 | # Create temporary directory for Bluetooth sources | |
99 | temp_dir=$(as_nobody mktemp -d) |
|
79 | temp_dir=$(as_nobody mktemp -d) | |
100 |
|
80 | |||
@@ -104,6 +84,10 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |||||
104 | # Copy downloaded sources |
|
84 | # Copy downloaded sources | |
105 | mv "${temp_dir}/pi-bluetooth" "${R}/tmp/" |
|
85 | mv "${temp_dir}/pi-bluetooth" "${R}/tmp/" | |
106 |
|
86 | |||
|
87 | # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/ | |||
|
88 | 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 | |||
|
89 | as_nobody wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth | |||
|
90 | ||||
107 | # Set permissions |
|
91 | # Set permissions | |
108 | chown -R root:root "${R}/tmp/pi-bluetooth" |
|
92 | chown -R root:root "${R}/tmp/pi-bluetooth" | |
109 |
|
93 | |||
@@ -115,14 +99,85 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |||||
115 | install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules" |
|
99 | install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules" | |
116 |
|
100 | |||
117 | # Install Firmware Flash file and apropiate licence |
|
101 | # Install Firmware Flash file and apropiate licence | |
118 | mkdir "${ETC_DIR}/firmware/" |
|
102 | mkdir -p "$BLUETOOTH_FIRMWARE_DIR" | |
|
103 | install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx" | |||
|
104 | install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx" | |||
|
105 | install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service" | |||
|
106 | install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service" | |||
|
107 | ||||
|
108 | # Remove temporary directory | |||
|
109 | rm -fr "${temp_dir}" | |||
119 |
|
110 | |||
120 | wget -O "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" https://aur.archlinux.org/cgit/aur.git/plain/LICENCE.broadcom_bcm43xx?h=pi-bluetooth |
|
111 | # Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore UART0/ttyAMA0 over GPIOs 14 & 15. Slow Bluetooth and slow cpu. Use /dev/ttyS0 instead of /dev/ttyAMA0 | |
121 | wget -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth |
|
112 | if [ "$ENABLE_MINIUART_OVERLAY" = true ] ; then | |
|
113 | SET_SERIAL="ttyAMA0" | |||
122 |
|
114 | |||
123 | # Get /dev/serial back for compability |
|
115 | # set overlay to swap ttyAMA0 and ttyS0 | |
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 |
|
116 | echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt" | |
|
117 | ||||
|
118 | # if force_turbo didn't lock cpu at high speed, lock it at low speed (XOR logic) or miniuart will be broken | |||
|
119 | if [ "$ENABLE_TURBO" = false ] ; then | |||
|
120 | echo "core_freq=250" >> "${BOOT_DIR}/config.txt" | |||
125 | fi |
|
121 | fi | |
|
122 | ||||
|
123 | # Activate services | |||
|
124 | chroot_exec systemctl enable pi-bluetooth.hciuart.service | |||
|
125 | #chroot_exec systemctl enable pi-bluetooth.bthelper@.service | |||
|
126 | else | |||
|
127 | chroot_exec systemctl enable pi-bluetooth.hciuart.service | |||
|
128 | #chroot_exec systemctl enable pi-bluetooth.bthelper@.service | |||
|
129 | fi | |||
|
130 | ||||
|
131 | else # if ENABLE_BLUETOOTH = false | |||
|
132 | # set overlay to disable bluetooth | |||
|
133 | echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt" | |||
|
134 | fi # ENABLE_BLUETOOTH end | |||
|
135 | ||||
|
136 | else | |||
|
137 | # RPI1,1P,2 Use default ttyAMA0 (full UART) as serial interface | |||
|
138 | SET_SERIAL="ttyAMA0" | |||
|
139 | fi | |||
|
140 | ||||
|
141 | # may need sudo systemctl disable hciuart | |||
|
142 | if [ "$ENABLE_CONSOLE" = true ] ; then | |||
|
143 | echo "enable_uart=1" >> "${BOOT_DIR}/config.txt" | |||
|
144 | # add string to cmdline | |||
|
145 | CMDLINE="${CMDLINE} console=serial0,115200" | |||
|
146 | ||||
|
147 | # Enable serial console systemd style | |||
|
148 | chroot_exec systemctl enable serial-getty\@"$SET_SERIAL".service | |||
|
149 | else | |||
|
150 | echo "enable_uart=0" >> "${BOOT_DIR}/config.txt" | |||
|
151 | # disable serial console systemd style | |||
|
152 | chroot_exec systemctl disable serial-getty\@"$SET_SERIAL".service | |||
|
153 | fi | |||
|
154 | ||||
|
155 | # Remove IPv6 networking support | |||
|
156 | if [ "$ENABLE_IPV6" = false ] ; then | |||
|
157 | CMDLINE="${CMDLINE} ipv6.disable=1" | |||
|
158 | fi | |||
|
159 | ||||
|
160 | # Automatically assign predictable network interface names | |||
|
161 | if [ "$ENABLE_IFNAMES" = false ] ; then | |||
|
162 | CMDLINE="${CMDLINE} net.ifnames=0" | |||
|
163 | else | |||
|
164 | CMDLINE="${CMDLINE} net.ifnames=1" | |||
|
165 | fi | |||
|
166 | ||||
|
167 | # Install firmware boot cmdline | |||
|
168 | echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt" | |||
|
169 | ||||
|
170 | # Install firmware config | |||
|
171 | install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt" | |||
|
172 | ||||
|
173 | # Setup minimal GPU memory allocation size: 16MB (no X) | |||
|
174 | if [ "$ENABLE_MINGPU" = true ] ; then | |||
|
175 | echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt" | |||
|
176 | fi | |||
|
177 | ||||
|
178 | # Setup boot with initramfs | |||
|
179 | if [ "$ENABLE_INITRAMFS" = true ] ; then | |||
|
180 | echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt" | |||
126 | fi |
|
181 | fi | |
127 |
|
182 | |||
128 | # Create firmware configuration and cmdline symlinks |
|
183 | # Create firmware configuration and cmdline symlinks |
@@ -107,28 +107,26 if [ "$ENABLE_WIRELESS" = true ] ; then | |||||
107 | as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.bin" |
|
107 | as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.bin" | |
108 | as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.txt" |
|
108 | as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.txt" | |
109 | as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.clm_blob" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.clm_blob" |
|
109 | as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.clm_blob" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.clm_blob" | |
|
110 | ||||
|
111 | # Move downloaded firmware binary blob | |||
|
112 | mv "${temp_dir}/brcmfmac43455-sdio."* "${WLAN_FIRMWARE_DIR}/" | |||
|
113 | ||||
|
114 | # Set permissions of the firmware binary blob | |||
|
115 | chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* | |||
|
116 | chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* | |||
110 | elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then |
|
117 | elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then | |
111 | # Fetch firmware binary blob for RPi3 |
|
118 | # Fetch firmware binary blob for RPi3 | |
112 | as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin" |
|
119 | as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin" | |
113 | as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt" |
|
120 | as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt" | |
114 | fi |
|
|||
115 |
|
121 | |||
116 |
|
|
122 | # Move downloaded firmware binary blob | |
117 | if [ "$RPI_MODEL" = 3P ] ; then |
|
|||
118 | mv "${temp_dir}/brcmfmac43455-sdio."* "${WLAN_FIRMWARE_DIR}/" |
|
|||
119 | elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then |
|
|||
120 |
|
|
123 | mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/" | |
121 | fi |
|
|||
122 |
|
||||
123 | # Remove temporary directory for firmware binary blob |
|
|||
124 | rm -fr "${temp_dir}" |
|
|||
125 |
|
124 | |||
126 |
|
|
125 | # Set permissions of the firmware binary blob | |
127 | if [ "$RPI_MODEL" = 3P ] ; then |
|
|||
128 | chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* |
|
|||
129 | chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* |
|
|||
130 | elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then |
|
|||
131 |
|
|
126 | chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* | |
132 | chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* |
|
127 | chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* | |
133 | fi |
|
128 | fi | |
|
129 | ||||
|
130 | # Remove temporary directory for firmware binary blob | |||
|
131 | rm -fr "${temp_dir}" | |||
134 | fi |
|
132 | fi |
@@ -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 | |
@@ -66,18 +66,20 if [ "$ENABLE_UBOOT" = true ] ; then | |||||
66 | fi |
|
66 | fi | |
67 | fi |
|
67 | fi | |
68 |
|
68 | |||
69 |
if [ "$ |
|
69 | if [ "$SET_ARCH" = 64 ] ; then | |
70 | echo "Setting up config.txt to boot 64bit uboot" |
|
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" | |||
71 |
|
76 | |||
72 | printf "\n# 64bit-mode" >> "${BOOT_DIR}/config.txt" |
|
77 | #in 64bit uboot booti is used instead of bootz [like in KERNEL_BIN_IMAGE=zImage (armv7)|| Image(armv8)] | |
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 |
|
||||
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 | |||
79 | # Set mkfile to use the correct dtb file |
|
81 | # Set mkfile to use the correct dtb file | |
80 |
sed -i "s |
|
82 | sed -i "s|bcm2709-rpi-2-b.dtb|${DTB_FILE}|" "${BOOT_DIR}/uboot.mkimage" | |
81 |
|
83 | |||
82 | # Set mkfile to use the correct mach id |
|
84 | # Set mkfile to use the correct mach id | |
83 | if [ "$ENABLE_QEMU" = true ] ; then |
|
85 | if [ "$ENABLE_QEMU" = true ] ; then | |
@@ -85,7 +87,7 if [ "$ENABLE_UBOOT" = true ] ; then | |||||
85 | fi |
|
87 | fi | |
86 |
|
88 | |||
87 | # Set mkfile to use kernel image |
|
89 | # Set mkfile to use kernel image | |
88 |
sed -i "s |
|
90 | sed -i "s|kernel7.img|${KERNEL_IMAGE}|" "${BOOT_DIR}/uboot.mkimage" | |
89 |
|
91 | |||
90 | # Remove all leading blank lines |
|
92 | # Remove all leading blank lines | |
91 | sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage" |
|
93 | sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage" |
@@ -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 | } |
@@ -59,7 +59,8 VIDEOCORE_URL=${VIDEOCORE_URL:=https://github.com/raspberrypi/userland} | |||||
59 | BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git} |
|
59 | BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git} | |
60 |
|
60 | |||
61 | # Build directories |
|
61 | # Build directories | |
62 | BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}} |
|
62 | WORKDIR=$(pwd) | |
|
63 | BASEDIR=${BASEDIR:=${WORKDIR}/images/${RELEASE}} | |||
63 | BUILDDIR="${BASEDIR}/build" |
|
64 | BUILDDIR="${BASEDIR}/build" | |
64 |
|
65 | |||
65 | # Chroot directories |
|
66 | # Chroot directories | |
@@ -69,6 +70,7 LIB_DIR="${R}/lib" | |||||
69 | BOOT_DIR="${R}/boot/firmware" |
|
70 | BOOT_DIR="${R}/boot/firmware" | |
70 | KERNEL_DIR="${R}/usr/src/linux" |
|
71 | KERNEL_DIR="${R}/usr/src/linux" | |
71 | WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm" |
|
72 | WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm" | |
|
73 | BLUETOOTH_FIRMWARE_DIR="${ETC_DIR}/firmware/bt" | |||
72 |
|
74 | |||
73 | # Firmware directory: Blank if download from github |
|
75 | # Firmware directory: Blank if download from github | |
74 | RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""} |
|
76 | RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""} | |
@@ -105,6 +107,9 APT_PROXY=${APT_PROXY:=""} | |||||
105 | APT_SERVER=${APT_SERVER:="ftp.debian.org"} |
|
107 | APT_SERVER=${APT_SERVER:="ftp.debian.org"} | |
106 |
|
108 | |||
107 | # Feature settings |
|
109 | # Feature settings | |
|
110 | ENABLE_PRINTK=${ENABLE_PRINTK:=false} | |||
|
111 | ENABLE_BLUETOOTH=${ENABLE_BLUETOOTH:=false} | |||
|
112 | ENABLE_MINIUART_OVERLAY=${ENABLE_MINIUART_OVERLAY:=false} | |||
108 | ENABLE_CONSOLE=${ENABLE_CONSOLE:=true} |
|
113 | ENABLE_CONSOLE=${ENABLE_CONSOLE:=true} | |
109 | ENABLE_I2C=${ENABLE_I2C:=false} |
|
114 | ENABLE_I2C=${ENABLE_I2C:=false} | |
110 | ENABLE_SPI=${ENABLE_SPI:=false} |
|
115 | ENABLE_SPI=${ENABLE_SPI:=false} | |
@@ -186,7 +191,7 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""} | |||||
186 |
|
191 | |||
187 | # Packages required in the chroot build environment |
|
192 | # Packages required in the chroot build environment | |
188 | APT_INCLUDES=${APT_INCLUDES:=""} |
|
193 | APT_INCLUDES=${APT_INCLUDES:=""} | |
189 | APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup" |
|
194 | APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup,libnss-systemd" | |
190 |
|
195 | |||
191 | # Packages to exclude from chroot build environment |
|
196 | # Packages to exclude from chroot build environment | |
192 | APT_EXCLUDES=${APT_EXCLUDES:=""} |
|
197 | APT_EXCLUDES=${APT_EXCLUDES:=""} | |
@@ -200,6 +205,12 COMPILER_PACKAGES="" | |||||
200 |
|
205 | |||
201 | set +x |
|
206 | set +x | |
202 |
|
207 | |||
|
208 | #Check if apt-cacher-ng has port 3142 open and set APT_PROXY | |||
|
209 | APT_CACHER_RUNNING=$(lsof -i :3142 | grep apt-cacher-ng | cut -d ' ' -f3 | uniq) | |||
|
210 | if [ -n "${APT_CACHER_RUNNING}" ] ; then | |||
|
211 | APT_PROXY=http://127.0.0.1:3142/ | |||
|
212 | fi | |||
|
213 | ||||
203 | # Setup architecture specific settings |
|
214 | # Setup architecture specific settings | |
204 | if [ -n "$SET_ARCH" ] ; then |
|
215 | if [ -n "$SET_ARCH" ] ; then | |
205 | # 64-bit configuration |
|
216 | # 64-bit configuration | |
@@ -284,6 +295,20 fi | |||||
284 |
|
|
295 | ;; | |
285 |
|
|
296 | esac | |
286 |
|
297 | |||
|
298 | # Raspberry PI 0,3,3P with Bluetooth and Wifi onboard | |||
|
299 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |||
|
300 | # Include bluetooth packages on supported boards | |||
|
301 | if [ "$ENABLE_BLUETOOTH" = true ] && [ "$ENABLE_CONSOLE" = false ]; then | |||
|
302 | APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez" | |||
|
303 | fi | |||
|
304 | else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard | |||
|
305 | # Check if the internal wireless interface is not supported by the RPi model | |||
|
306 | if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then | |||
|
307 | echo "error: The selected Raspberry Pi model has no integrated interface for wireless or bluetooth" | |||
|
308 | exit 1 | |||
|
309 | fi | |||
|
310 | fi | |||
|
311 | ||||
287 | # Prepare date string for default image file name |
|
312 | # Prepare date string for default image file name | |
288 | DATE="$(date +%Y-%m-%d)" |
|
313 | DATE="$(date +%Y-%m-%d)" | |
289 | if [ -z "$KERNEL_BRANCH" ] ; then |
|
314 | if [ -z "$KERNEL_BRANCH" ] ; then | |
@@ -292,16 +317,6 else | |||||
292 | IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} |
|
317 | IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} | |
293 | fi |
|
318 | fi | |
294 |
|
319 | |||
295 | # Check if the internal wireless interface is supported by the RPi model |
|
|||
296 | if [ "$ENABLE_WIRELESS" = true ] ; then |
|
|||
297 | if [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] || [ "$RPI_MODEL" = 2 ] ; then |
|
|||
298 | echo "error: The selected Raspberry Pi model has no internal wireless interface" |
|
|||
299 | exit 1 |
|
|||
300 | else |
|
|||
301 | echo "Raspberry Pi $RPI_MODEL has WIFI support" |
|
|||
302 | fi |
|
|||
303 | fi |
|
|||
304 |
|
||||
305 | # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported |
|
320 | # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported | |
306 | if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then |
|
321 | if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then | |
307 | if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then |
|
322 | if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then | |
@@ -347,6 +362,14 if [ "$ENABLE_UBOOT" = true ] ; then | |||||
347 | APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc" |
|
362 | APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc" | |
348 | fi |
|
363 | fi | |
349 |
|
364 | |||
|
365 | if [ "$ENABLE_BLUETOOTH" = true ] ; then | |||
|
366 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |||
|
367 | if [ "$ENABLE_CONSOLE" = false ] ; then | |||
|
368 | APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez" | |||
|
369 | fi | |||
|
370 | fi | |||
|
371 | fi | |||
|
372 | ||||
350 | # Check if root SSH (v2) public key file exists |
|
373 | # Check if root SSH (v2) public key file exists | |
351 | if [ -n "$SSH_ROOT_PUB_KEY" ] ; then |
|
374 | if [ -n "$SSH_ROOT_PUB_KEY" ] ; then | |
352 | if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then |
|
375 | if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then | |
@@ -365,7 +388,7 fi | |||||
365 |
|
388 | |||
366 | # Check if all required packages are installed on the build system |
|
389 | # Check if all required packages are installed on the build system | |
367 | for package in $REQUIRED_PACKAGES ; do |
|
390 | for package in $REQUIRED_PACKAGES ; do | |
368 | if [ "$(dpkg-query -W -f='${Status}' $package)" != "install ok installed" ] ; then |
|
391 | if [ "$(dpkg-query -W -f='${Status}' "$package")" != "install ok installed" ] ; then | |
369 | MISSING_PACKAGES="${MISSING_PACKAGES} $package" |
|
392 | MISSING_PACKAGES="${MISSING_PACKAGES} $package" | |
370 | fi |
|
393 | fi | |
371 | done |
|
394 | done |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant