##// END OF EJS Templates
Fix filename for BCM43430A1.hcd
Michał Ciołek -
r599:26669307ccf4
parent child
Show More
@@ -1,310 +1,310
1 #
1 #
2 # Setup RPi2/3 config and cmdline
2 # Setup RPi2/3 config and cmdline
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 if [ -n "$RPI_FIRMWARE_DIR" ] && [ -d "$RPI_FIRMWARE_DIR" ] ; then
8 if [ -n "$RPI_FIRMWARE_DIR" ] && [ -d "$RPI_FIRMWARE_DIR" ] ; then
9 # Install boot binaries from local directory
9 # Install boot binaries from local directory
10 cp "${RPI_FIRMWARE_DIR}"/boot/bootcode.bin "${BOOT_DIR}"/bootcode.bin
10 cp "${RPI_FIRMWARE_DIR}"/boot/bootcode.bin "${BOOT_DIR}"/bootcode.bin
11 cp "${RPI_FIRMWARE_DIR}"/boot/fixup.dat "${BOOT_DIR}"/fixup.dat
11 cp "${RPI_FIRMWARE_DIR}"/boot/fixup.dat "${BOOT_DIR}"/fixup.dat
12 cp "${RPI_FIRMWARE_DIR}"/boot/fixup_cd.dat "${BOOT_DIR}"/fixup_cd.dat
12 cp "${RPI_FIRMWARE_DIR}"/boot/fixup_cd.dat "${BOOT_DIR}"/fixup_cd.dat
13 cp "${RPI_FIRMWARE_DIR}"/boot/fixup_x.dat "${BOOT_DIR}"/fixup_x.dat
13 cp "${RPI_FIRMWARE_DIR}"/boot/fixup_x.dat "${BOOT_DIR}"/fixup_x.dat
14 cp "${RPI_FIRMWARE_DIR}"/boot/start.elf "${BOOT_DIR}"/start.elf
14 cp "${RPI_FIRMWARE_DIR}"/boot/start.elf "${BOOT_DIR}"/start.elf
15 cp "${RPI_FIRMWARE_DIR}"/boot/start_cd.elf "${BOOT_DIR}"/start_cd.elf
15 cp "${RPI_FIRMWARE_DIR}"/boot/start_cd.elf "${BOOT_DIR}"/start_cd.elf
16 cp "${RPI_FIRMWARE_DIR}"/boot/start_x.elf "${BOOT_DIR}"/start_x.elf
16 cp "${RPI_FIRMWARE_DIR}"/boot/start_x.elf "${BOOT_DIR}"/start_x.elf
17 else
17 else
18 # Create temporary directory for boot binaries
18 # Create temporary directory for boot binaries
19 temp_dir=$(as_nobody mktemp -d)
19 temp_dir=$(as_nobody mktemp -d)
20
20
21 # Install latest boot binaries from raspberry/firmware github
21 # Install latest boot binaries from raspberry/firmware github
22 as_nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin"
22 as_nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin"
23 as_nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat"
23 as_nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat"
24 as_nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat"
24 as_nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat"
25 as_nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat"
25 as_nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat"
26 as_nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf"
26 as_nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf"
27 as_nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf"
27 as_nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf"
28 as_nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf"
28 as_nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf"
29
29
30 # Move downloaded boot binaries
30 # Move downloaded boot binaries
31 mv "${temp_dir}/"* "${BOOT_DIR}/"
31 mv "${temp_dir}/"* "${BOOT_DIR}/"
32
32
33 # Remove temporary directory for boot binaries
33 # Remove temporary directory for boot binaries
34 rm -fr "${temp_dir}"
34 rm -fr "${temp_dir}"
35
35
36 # Set permissions of the boot binaries
36 # Set permissions of the boot binaries
37 chown -R root:root "${BOOT_DIR}"
37 chown -R root:root "${BOOT_DIR}"
38 chmod -R 600 "${BOOT_DIR}"
38 chmod -R 600 "${BOOT_DIR}"
39 fi
39 fi
40
40
41 if [ "$ENABLE_KEYGEN" = true ] ; then
41 if [ "$ENABLE_KEYGEN" = true ] ; then
42
42
43 # go to chroot/boot/
43 # go to chroot/boot/
44 cd "${BOOT_DIR}/" || exit
44 cd "${BOOT_DIR}/" || exit
45
45
46 # Make a copy of start.elf
46 # Make a copy of start.elf
47 cp start.elf start.elf_backup
47 cp start.elf start.elf_backup
48
48
49 # Remove codec licence checks - thx go to https://github.com/nucular/raspi-keygen - if ENABLE_VIDEOCORE is true, you can check codec status https://elinux.org/RPI_vcgencmd_usage
49 # Remove codec licence checks - thx go to https://github.com/nucular/raspi-keygen - if ENABLE_VIDEOCORE is true, you can check codec status https://elinux.org/RPI_vcgencmd_usage
50 perl -pne 's/\x47\xE9362H\x3C\x18/\x47\xE9362H\x3C\x1F/g' < start.elf_backup > start.elf
50 perl -pne 's/\x47\xE9362H\x3C\x18/\x47\xE9362H\x3C\x1F/g' < start.elf_backup > start.elf
51
51
52 # Back to base dir
52 # Back to base dir
53 cd "${WORKDIR}" || exit
53 cd "${WORKDIR}" || exit
54 fi
54 fi
55
55
56 # Setup firmware boot cmdline
56 # Setup firmware boot cmdline
57 if [ "$ENABLE_USBBOOT" = true ] ; then
57 if [ "$ENABLE_USBBOOT" = true ] ; then
58 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline console=tty1 rootwait init=/bin/systemd"
58 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline console=tty1 rootwait init=/bin/systemd"
59 else
59 else
60 if [ "$ENABLE_SPLITFS" = true ] ; then
60 if [ "$ENABLE_SPLITFS" = true ] ; then
61 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline console=tty1 rootwait init=/bin/systemd"
61 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline console=tty1 rootwait init=/bin/systemd"
62 else
62 else
63 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline console=tty1 rootwait init=/bin/systemd"
63 CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline console=tty1 rootwait init=/bin/systemd"
64 fi
64 fi
65 fi
65 fi
66
66
67 # Add encrypted root partition to cmdline.txt
67 # Add encrypted root partition to cmdline.txt
68 if [ "$ENABLE_CRYPTFS" = true ] ; then
68 if [ "$ENABLE_CRYPTFS" = true ] ; then
69 if [ "$ENABLE_SPLITFS" = true ] ; then
69 if [ "$ENABLE_SPLITFS" = true ] ; then
70 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/")
70 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/")
71 else
71 else
72 if [ "$ENABLE_USBBOOT" = true ] ; then
72 if [ "$ENABLE_USBBOOT" = true ] ; then
73 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda2:${CRYPTFS_MAPPING}/")
73 CMDLINE=$(echo "${CMDLINE}" | sed "s/sda2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda2:${CRYPTFS_MAPPING}/")
74 else
74 else
75 CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/")
75 CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/")
76 fi
76 fi
77 fi
77 fi
78 fi
78 fi
79
79
80 # Enable Kernel messages on standard output
80 # Enable Kernel messages on standard output
81 if [ "$ENABLE_PRINTK" = true ] ; then
81 if [ "$ENABLE_PRINTK" = true ] ; then
82 install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf"
82 install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf"
83 fi
83 fi
84
84
85 # Enable Kernel messages on standard output
85 # Enable Kernel messages on standard output
86 if [ "$KERNEL_SECURITY" = true ] ; then
86 if [ "$KERNEL_SECURITY" = true ] ; then
87 install_readonly files/sysctl.d/84-rpi-ASLR.conf "${ETC_DIR}/sysctl.d/84-rpi-ASLR.conf"
87 install_readonly files/sysctl.d/84-rpi-ASLR.conf "${ETC_DIR}/sysctl.d/84-rpi-ASLR.conf"
88 fi
88 fi
89
89
90 # Install udev rule for serial alias - serial0 = console serial1=bluetooth
90 # Install udev rule for serial alias - serial0 = console serial1=bluetooth
91 install_readonly files/etc/99-com.rules "${LIB_DIR}/udev/rules.d/99-com.rules"
91 install_readonly files/etc/99-com.rules "${LIB_DIR}/udev/rules.d/99-com.rules"
92
92
93 # Remove IPv6 networking support
93 # Remove IPv6 networking support
94 if [ "$ENABLE_IPV6" = false ] ; then
94 if [ "$ENABLE_IPV6" = false ] ; then
95 CMDLINE="${CMDLINE} ipv6.disable=1"
95 CMDLINE="${CMDLINE} ipv6.disable=1"
96 fi
96 fi
97
97
98 # Automatically assign predictable network interface names
98 # Automatically assign predictable network interface names
99 if [ "$ENABLE_IFNAMES" = false ] ; then
99 if [ "$ENABLE_IFNAMES" = false ] ; then
100 CMDLINE="${CMDLINE} net.ifnames=0"
100 CMDLINE="${CMDLINE} net.ifnames=0"
101 else
101 else
102 CMDLINE="${CMDLINE} net.ifnames=1"
102 CMDLINE="${CMDLINE} net.ifnames=1"
103 fi
103 fi
104
104
105 # Disable Raspberry Pi console logo
105 # Disable Raspberry Pi console logo
106 if [ "$ENABLE_LOGO" = false ] ; then
106 if [ "$ENABLE_LOGO" = false ] ; then
107 CMDLINE="${CMDLINE} logo.nologo"
107 CMDLINE="${CMDLINE} logo.nologo"
108 fi
108 fi
109
109
110 # Strictly limit verbosity of boot up console messages
110 # Strictly limit verbosity of boot up console messages
111 if [ "$ENABLE_SILENT_BOOT" = true ] ; then
111 if [ "$ENABLE_SILENT_BOOT" = true ] ; then
112 CMDLINE="${CMDLINE} quiet loglevel=0 rd.systemd.show_status=auto rd.udev.log_priority=0"
112 CMDLINE="${CMDLINE} quiet loglevel=0 rd.systemd.show_status=auto rd.udev.log_priority=0"
113 fi
113 fi
114
114
115 # Install firmware config
115 # Install firmware config
116 install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt"
116 install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt"
117
117
118 # Disable Raspberry Pi console logo
118 # Disable Raspberry Pi console logo
119 if [ "$ENABLE_SLASH" = false ] ; then
119 if [ "$ENABLE_SLASH" = false ] ; then
120 echo "disable_splash=1" >> "${BOOT_DIR}/config.txt"
120 echo "disable_splash=1" >> "${BOOT_DIR}/config.txt"
121 fi
121 fi
122
122
123 # Locks CPU frequency at maximum
123 # Locks CPU frequency at maximum
124 if [ "$ENABLE_TURBO" = true ] ; then
124 if [ "$ENABLE_TURBO" = true ] ; then
125 echo "force_turbo=1" >> "${BOOT_DIR}/config.txt"
125 echo "force_turbo=1" >> "${BOOT_DIR}/config.txt"
126 # helps to avoid sdcard corruption when force_turbo is enabled.
126 # helps to avoid sdcard corruption when force_turbo is enabled.
127 echo "boot_delay=1" >> "${BOOT_DIR}/config.txt"
127 echo "boot_delay=1" >> "${BOOT_DIR}/config.txt"
128 fi
128 fi
129
129
130 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
130 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
131
131
132 # Bluetooth enabled
132 # Bluetooth enabled
133 if [ "$ENABLE_BLUETOOTH" = true ] ; then
133 if [ "$ENABLE_BLUETOOTH" = true ] ; then
134 # Create temporary directory for Bluetooth sources
134 # Create temporary directory for Bluetooth sources
135 temp_dir=$(as_nobody mktemp -d)
135 temp_dir=$(as_nobody mktemp -d)
136
136
137 # Fetch Bluetooth sources
137 # Fetch Bluetooth sources
138 as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}"
138 as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}"
139
139
140 # Copy downloaded sources
140 # Copy downloaded sources
141 mv "${temp_dir}/pi-bluetooth" "${R}/tmp/"
141 mv "${temp_dir}/pi-bluetooth" "${R}/tmp/"
142
142
143 # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/
143 # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/
144 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
144 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
145 as_nobody wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://raw.githubusercontent.com/RPi-Distro/bluez-firmware/master/broadcom/BCM43430A1.hcd
145 as_nobody wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://raw.githubusercontent.com/RPi-Distro/bluez-firmware/master/broadcom/BCM43430A1.hcd
146
146
147 # Set permissions
147 # Set permissions
148 chown -R root:root "${R}/tmp/pi-bluetooth"
148 chown -R root:root "${R}/tmp/pi-bluetooth"
149
149
150 # Install tools
150 # Install tools
151 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart"
151 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart"
152 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper"
152 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper"
153
153
154 # make scripts executable
154 # make scripts executable
155 chmod +x "${R}/usr/bin/bthelper"
155 chmod +x "${R}/usr/bin/bthelper"
156 chmod +x "${R}/usr/bin/btuart"
156 chmod +x "${R}/usr/bin/btuart"
157
157
158 # Install bluetooth udev rule
158 # Install bluetooth udev rule
159 install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules"
159 install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules"
160
160
161 # Install Firmware Flash file and apropiate licence
161 # Install Firmware Flash file and apropiate licence
162 mkdir -p "$BLUETOOTH_FIRMWARE_DIR"
162 mkdir -p "$BLUETOOTH_FIRMWARE_DIR"
163 install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
163 install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
164 install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
164 install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${BLUETOOTH_FIRMWARE_DIR}/BCM43430A1.hcd"
165 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service"
165 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service"
166 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service"
166 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service"
167
167
168 # Remove temporary directories
168 # Remove temporary directories
169 rm -fr "${temp_dir}"
169 rm -fr "${temp_dir}"
170 rm -fr "${R}"/tmp/pi-bluetooth
170 rm -fr "${R}"/tmp/pi-bluetooth
171
171
172 # 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
172 # 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
173 if [ "$ENABLE_MINIUART_OVERLAY" = true ] ; then
173 if [ "$ENABLE_MINIUART_OVERLAY" = true ] ; then
174 # set overlay to swap ttyAMA0 and ttyS0
174 # set overlay to swap ttyAMA0 and ttyS0
175 echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt"
175 echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt"
176
176
177 if [ "$ENABLE_TURBO" = false ] ; then
177 if [ "$ENABLE_TURBO" = false ] ; then
178 echo "core_freq=250" >> "${BOOT_DIR}/config.txt"
178 echo "core_freq=250" >> "${BOOT_DIR}/config.txt"
179 fi
179 fi
180
180
181 fi
181 fi
182
182
183 # Activate services
183 # Activate services
184 chroot_exec systemctl enable pi-bluetooth.hciuart.service
184 chroot_exec systemctl enable pi-bluetooth.hciuart.service
185
185
186 else # if ENABLE_BLUETOOTH = false
186 else # if ENABLE_BLUETOOTH = false
187 # set overlay to disable bluetooth
187 # set overlay to disable bluetooth
188 echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt"
188 echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt"
189 fi # ENABLE_BLUETOOTH end
189 fi # ENABLE_BLUETOOTH end
190 fi
190 fi
191
191
192 # may need sudo systemctl disable hciuart
192 # may need sudo systemctl disable hciuart
193 if [ "$ENABLE_CONSOLE" = true ] ; then
193 if [ "$ENABLE_CONSOLE" = true ] ; then
194 echo "enable_uart=1" >> "${BOOT_DIR}/config.txt"
194 echo "enable_uart=1" >> "${BOOT_DIR}/config.txt"
195 # add string to cmdline
195 # add string to cmdline
196 CMDLINE="${CMDLINE} console=serial0,115200"
196 CMDLINE="${CMDLINE} console=serial0,115200"
197
197
198 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]|| [ "$RPI_MODEL" = 0 ]; then
198 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]|| [ "$RPI_MODEL" = 0 ]; then
199 # if force_turbo didn't lock cpu at high speed, lock it at low speed (XOR logic) or miniuart will be broken
199 # if force_turbo didn't lock cpu at high speed, lock it at low speed (XOR logic) or miniuart will be broken
200 if [ "$ENABLE_TURBO" = false ] ; then
200 if [ "$ENABLE_TURBO" = false ] ; then
201 echo "core_freq=250" >> "${BOOT_DIR}/config.txt"
201 echo "core_freq=250" >> "${BOOT_DIR}/config.txt"
202 fi
202 fi
203 fi
203 fi
204
204
205 # Enable serial console systemd style
205 # Enable serial console systemd style
206 chroot_exec systemctl enable serial-getty@serial0.service
206 chroot_exec systemctl enable serial-getty@serial0.service
207 else
207 else
208 echo "enable_uart=0" >> "${BOOT_DIR}/config.txt"
208 echo "enable_uart=0" >> "${BOOT_DIR}/config.txt"
209 fi
209 fi
210
210
211 if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then
211 if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then
212 # Create temporary directory for systemd-swap sources
212 # Create temporary directory for systemd-swap sources
213 temp_dir=$(as_nobody mktemp -d)
213 temp_dir=$(as_nobody mktemp -d)
214
214
215 # Fetch systemd-swap sources
215 # Fetch systemd-swap sources
216 as_nobody git -C "${temp_dir}" clone "${SYSTEMDSWAP_URL}"
216 as_nobody git -C "${temp_dir}" clone "${SYSTEMDSWAP_URL}"
217
217
218 # Copy downloaded systemd-swap sources
218 # Copy downloaded systemd-swap sources
219 mv "${temp_dir}/systemd-swap" "${R}/tmp/"
219 mv "${temp_dir}/systemd-swap" "${R}/tmp/"
220
220
221 # Change into downloaded src dir
221 # Change into downloaded src dir
222 cd "${R}/tmp/systemd-swap" || exit
222 cd "${R}/tmp/systemd-swap" || exit
223
223
224 # Build package
224 # Build package
225 bash ./package.sh debian
225 bash ./package.sh debian
226
226
227 # Change back into script root dir
227 # Change back into script root dir
228 cd "${WORKDIR}" || exit
228 cd "${WORKDIR}" || exit
229
229
230 # Set permissions of the systemd-swap sources
230 # Set permissions of the systemd-swap sources
231 chown -R root:root "${R}/tmp/systemd-swap"
231 chown -R root:root "${R}/tmp/systemd-swap"
232
232
233 # Install package - IMPROVE AND MAKE IT POSSIBLE WITHOUT VERSION NR.
233 # Install package - IMPROVE AND MAKE IT POSSIBLE WITHOUT VERSION NR.
234 chroot_exec dpkg -i /tmp/systemd-swap/systemd-swap_4.0.1_any.deb
234 chroot_exec dpkg -i /tmp/systemd-swap/systemd-swap_4.0.1_any.deb
235
235
236 # Enable service
236 # Enable service
237 chroot_exec systemctl enable systemd-swap
237 chroot_exec systemctl enable systemd-swap
238
238
239 # Remove temporary directory for systemd-swap sources
239 # Remove temporary directory for systemd-swap sources
240 rm -fr "${temp_dir}"
240 rm -fr "${temp_dir}"
241 else
241 else
242 # Enable ZSWAP in cmdline if systemd-swap is not used
242 # Enable ZSWAP in cmdline if systemd-swap is not used
243 if [ "$KERNEL_ZSWAP" = true ] ; then
243 if [ "$KERNEL_ZSWAP" = true ] ; then
244 CMDLINE="${CMDLINE} zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4"
244 CMDLINE="${CMDLINE} zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4"
245 fi
245 fi
246 fi
246 fi
247 if [ "$KERNEL_SECURITY" = true ] ; then
247 if [ "$KERNEL_SECURITY" = true ] ; then
248 CMDLINE="${CMDLINE} apparmor=1 security=apparmor"
248 CMDLINE="${CMDLINE} apparmor=1 security=apparmor"
249 fi
249 fi
250
250
251 # Install firmware boot cmdline
251 # Install firmware boot cmdline
252 echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt"
252 echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt"
253
253
254 # Setup minimal GPU memory allocation size: 16MB (no X)
254 # Setup minimal GPU memory allocation size: 16MB (no X)
255 if [ "$ENABLE_MINGPU" = true ] ; then
255 if [ "$ENABLE_MINGPU" = true ] ; then
256 echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt"
256 echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt"
257 fi
257 fi
258
258
259 # Setup boot with initramfs
259 # Setup boot with initramfs
260 if [ "$ENABLE_INITRAMFS" = true ] ; then
260 if [ "$ENABLE_INITRAMFS" = true ] ; then
261 echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt"
261 echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt"
262 fi
262 fi
263
263
264 # Create firmware configuration and cmdline symlinks
264 # Create firmware configuration and cmdline symlinks
265 ln -sf firmware/config.txt "${R}/boot/config.txt"
265 ln -sf firmware/config.txt "${R}/boot/config.txt"
266 ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt"
266 ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt"
267
267
268 # Install and setup kernel modules to load at boot
268 # Install and setup kernel modules to load at boot
269 mkdir -p "${LIB_DIR}/modules-load.d/"
269 mkdir -p "${LIB_DIR}/modules-load.d/"
270 install_readonly files/modules/rpi2.conf "${LIB_DIR}/modules-load.d/rpi2.conf"
270 install_readonly files/modules/rpi2.conf "${LIB_DIR}/modules-load.d/rpi2.conf"
271
271
272 # Load hardware random module at boot
272 # Load hardware random module at boot
273 if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then
273 if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then
274 sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${LIB_DIR}/modules-load.d/rpi2.conf"
274 sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${LIB_DIR}/modules-load.d/rpi2.conf"
275 fi
275 fi
276
276
277 # Load sound module at boot
277 # Load sound module at boot
278 if [ "$ENABLE_SOUND" = true ] ; then
278 if [ "$ENABLE_SOUND" = true ] ; then
279 sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf"
279 sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf"
280 else
280 else
281 echo "dtparam=audio=off" >> "${BOOT_DIR}/config.txt"
281 echo "dtparam=audio=off" >> "${BOOT_DIR}/config.txt"
282 fi
282 fi
283
283
284 # Enable I2C interface
284 # Enable I2C interface
285 if [ "$ENABLE_I2C" = true ] ; then
285 if [ "$ENABLE_I2C" = true ] ; then
286 echo "dtparam=i2c_arm=on" >> "${BOOT_DIR}/config.txt"
286 echo "dtparam=i2c_arm=on" >> "${BOOT_DIR}/config.txt"
287 sed -i "s/^# i2c-bcm2708/i2c-bcm2708/" "${LIB_DIR}/modules-load.d/rpi2.conf"
287 sed -i "s/^# i2c-bcm2708/i2c-bcm2708/" "${LIB_DIR}/modules-load.d/rpi2.conf"
288 sed -i "s/^# i2c-dev/i2c-dev/" "${LIB_DIR}/modules-load.d/rpi2.conf"
288 sed -i "s/^# i2c-dev/i2c-dev/" "${LIB_DIR}/modules-load.d/rpi2.conf"
289 fi
289 fi
290
290
291 # Enable SPI interface
291 # Enable SPI interface
292 if [ "$ENABLE_SPI" = true ] ; then
292 if [ "$ENABLE_SPI" = true ] ; then
293 echo "dtparam=spi=on" >> "${BOOT_DIR}/config.txt"
293 echo "dtparam=spi=on" >> "${BOOT_DIR}/config.txt"
294 echo "spi-bcm2708" >> "${LIB_DIR}/modules-load.d/rpi2.conf"
294 echo "spi-bcm2708" >> "${LIB_DIR}/modules-load.d/rpi2.conf"
295 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]; then
295 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]; then
296 sed -i "s/spi-bcm2708/spi-bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf"
296 sed -i "s/spi-bcm2708/spi-bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf"
297 fi
297 fi
298 fi
298 fi
299
299
300 # Disable RPi2/3 under-voltage warnings
300 # Disable RPi2/3 under-voltage warnings
301 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
301 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
302 echo "avoid_warnings=${DISABLE_UNDERVOLT_WARNINGS}" >> "${BOOT_DIR}/config.txt"
302 echo "avoid_warnings=${DISABLE_UNDERVOLT_WARNINGS}" >> "${BOOT_DIR}/config.txt"
303 fi
303 fi
304
304
305 # Install kernel modules blacklist
305 # Install kernel modules blacklist
306 mkdir -p "${ETC_DIR}/modprobe.d/"
306 mkdir -p "${ETC_DIR}/modprobe.d/"
307 install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi-blacklist.conf"
307 install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi-blacklist.conf"
308
308
309 # Install sysctl.d configuration files
309 # Install sysctl.d configuration files
310 install_readonly files/sysctl.d/81-rpi-vm.conf "${ETC_DIR}/sysctl.d/81-rpi-vm.conf"
310 install_readonly files/sysctl.d/81-rpi-vm.conf "${ETC_DIR}/sysctl.d/81-rpi-vm.conf"
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant