@@ -1,205 +1,194 | |||
|
1 | 1 | # |
|
2 | 2 | # Setup RPi2/3 config and cmdline |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | if [ "$BUILD_KERNEL" = true ] ; then |
|
9 | 9 | if [ -n "$RPI_FIRMWARE_DIR" ] && [ -d "$RPI_FIRMWARE_DIR" ] ; then |
|
10 | 10 | # Install boot binaries from local directory |
|
11 | 11 | cp "${RPI_FIRMWARE_DIR}"/boot/bootcode.bin "${BOOT_DIR}"/bootcode.bin |
|
12 | 12 | cp "${RPI_FIRMWARE_DIR}"/boot/fixup.dat "${BOOT_DIR}"/fixup.dat |
|
13 | 13 | cp "${RPI_FIRMWARE_DIR}"/boot/fixup_cd.dat "${BOOT_DIR}"/fixup_cd.dat |
|
14 | 14 | cp "${RPI_FIRMWARE_DIR}"/boot/fixup_x.dat "${BOOT_DIR}"/fixup_x.dat |
|
15 | 15 | cp "${RPI_FIRMWARE_DIR}"/boot/start.elf "${BOOT_DIR}"/start.elf |
|
16 | 16 | cp "${RPI_FIRMWARE_DIR}"/boot/start_cd.elf "${BOOT_DIR}"/start_cd.elf |
|
17 | 17 | cp "${RPI_FIRMWARE_DIR}"/boot/start_x.elf "${BOOT_DIR}"/start_x.elf |
|
18 | 18 | else |
|
19 | 19 | # Create temporary directory for boot binaries |
|
20 | 20 | temp_dir=$(as_nobody mktemp -d) |
|
21 | 21 | |
|
22 | 22 | # Install latest boot binaries from raspberry/firmware github |
|
23 | 23 | as_nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin" |
|
24 | 24 | as_nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat" |
|
25 | 25 | as_nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat" |
|
26 | 26 | as_nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat" |
|
27 | 27 | as_nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf" |
|
28 | 28 | as_nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf" |
|
29 | 29 | as_nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf" |
|
30 | 30 | |
|
31 | 31 | # Move downloaded boot binaries |
|
32 | 32 | mv "${temp_dir}/"* "${BOOT_DIR}/" |
|
33 | 33 | |
|
34 | 34 | # Remove temporary directory for boot binaries |
|
35 | 35 | rm -fr "${temp_dir}" |
|
36 | 36 | |
|
37 | 37 | # Set permissions of the boot binaries |
|
38 | 38 | chown -R root:root "${BOOT_DIR}" |
|
39 | 39 | chmod -R 600 "${BOOT_DIR}" |
|
40 | 40 | fi |
|
41 | 41 | fi |
|
42 | 42 | |
|
43 | 43 | # Setup firmware boot cmdline |
|
44 | 44 | if [ "$ENABLE_UBOOTUSB" = true ] ; then |
|
45 | 45 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1" |
|
46 | 46 | else |
|
47 | 47 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
48 | 48 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1" |
|
49 | 49 | else |
|
50 | 50 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline rootwait console=tty1" |
|
51 | 51 | fi |
|
52 | 52 | fi |
|
53 | 53 | |
|
54 | 54 | |
|
55 | 55 | |
|
56 | 56 | # Add encrypted root partition to cmdline.txt |
|
57 | 57 | if [ "$ENABLE_CRYPTFS" = true ] ; then |
|
58 | 58 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
59 | 59 | CMDLINE=$(echo "${CMDLINE}" | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/") |
|
60 | 60 | else |
|
61 | 61 | if [ "$ENABLE_UBOOTUSB" = true ] ; then |
|
62 | 62 | CMDLINE=$(echo "${CMDLINE}" | sed "s/sda2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda2:${CRYPTFS_MAPPING}/") |
|
63 | 63 | else |
|
64 | 64 | CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/") |
|
65 | 65 | fi |
|
66 | 66 | fi |
|
67 | 67 | fi |
|
68 | 68 | |
|
69 | 69 | # Add serial console support |
|
70 | 70 | if [ "$ENABLE_CONSOLE" = true ] ; then |
|
71 | 71 | CMDLINE="${CMDLINE} console=ttyAMA0,115200 kgdboc=ttyAMA0,115200" |
|
72 | 72 | fi |
|
73 | 73 | |
|
74 | 74 | # Remove IPv6 networking support |
|
75 | 75 | if [ "$ENABLE_IPV6" = false ] ; then |
|
76 | 76 | CMDLINE="${CMDLINE} ipv6.disable=1" |
|
77 | 77 | fi |
|
78 | 78 | |
|
79 | 79 | # Automatically assign predictable network interface names |
|
80 | 80 | if [ "$ENABLE_IFNAMES" = false ] ; then |
|
81 | 81 | CMDLINE="${CMDLINE} net.ifnames=0" |
|
82 | 82 | else |
|
83 | 83 | CMDLINE="${CMDLINE} net.ifnames=1" |
|
84 | 84 | fi |
|
85 | 85 | |
|
86 | 86 | # Install firmware boot cmdline |
|
87 | 87 | echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt" |
|
88 | 88 | |
|
89 | 89 | # Install firmware config |
|
90 | 90 | install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt" |
|
91 | 91 | |
|
92 | 92 | # Setup minimal GPU memory allocation size: 16MB (no X) |
|
93 | 93 | if [ "$ENABLE_MINGPU" = true ] ; then |
|
94 | 94 | echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt" |
|
95 | 95 | fi |
|
96 | 96 | |
|
97 | 97 | # Setup boot with initramfs |
|
98 | 98 | if [ "$ENABLE_INITRAMFS" = true ] ; then |
|
99 | 99 | echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt" |
|
100 | 100 | fi |
|
101 | 101 | |
|
102 | 102 | # Disable RPi3 Bluetooth and restore ttyAMA0 serial device |
|
103 | 103 | if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then |
|
104 | 104 | if [ "$ENABLE_CONSOLE" = true ] && [ "$ENABLE_UBOOT" = false ] ; then |
|
105 | 105 | echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt" |
|
106 | 106 | echo "enable_uart=1" >> "${BOOT_DIR}/config.txt" |
|
107 | 107 | else |
|
108 | 108 | # Create temporary directory for Bluetooth sources |
|
109 | 109 | temp_dir=$(as_nobody mktemp -d) |
|
110 | 110 | |
|
111 | 111 | # Fetch Bluetooth sources |
|
112 | 112 | as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}" |
|
113 | 113 | |
|
114 | 114 | # Copy downloaded sources |
|
115 | 115 | mv "${temp_dir}/pi-bluetooth" "${R}/tmp/" |
|
116 | 116 | |
|
117 | 117 | # Raspberry-sys-mod package for /dev/serial device needed by bluetooth service |
|
118 | 118 | wget -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 |
|
119 | 119 | # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/ |
|
120 | 120 | wget -O "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" https://aur.archlinux.org/cgit/aur.git/plain/LICENCE.broadcom_bcm43xx?h=pi-bluetooth |
|
121 | 121 | wget -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth |
|
122 | 122 | |
|
123 | 123 | # Set permissions |
|
124 | 124 | chown -R root:root "${R}/tmp/pi-bluetooth" |
|
125 | 125 | |
|
126 | 126 | # Install files to chroot |
|
127 | 127 | # Install tools |
|
128 | 128 | install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart" |
|
129 | 129 | install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper" |
|
130 | 130 | # Install bluetooth udev rule |
|
131 | 131 | install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules" |
|
132 | 132 | # aur |
|
133 | 133 | # install_readonly "${R}/tmp/pi-bluetooth/50-bluetooth-hci-auto-poweron.rules" "${ETC_DIR}/udev/rules.d/50-bluetooth-hci-auto-poweron.rules" |
|
134 | 134 | # Install Firmware Flash file and apropiate licence |
|
135 | 135 | mkdir "${ETC_DIR}/firmware/" |
|
136 | # Install firmware and licence | |
|
137 | # install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${ETC_DIR}/firmware/LICENCE.broadcom_bcm43xx" | |
|
138 | # install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${ETC_DIR}/firmware/BCM43430A1.hcd" | |
|
139 | 136 |
|
|
140 | 137 | install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${ETC_DIR}/firmware/LICENCE.broadcom_bcm43xx" |
|
141 | # Install systemd service for bluetooth | |
|
142 | # install_readonly "${R}/tmp/pi-bluetooth/brcm43438.service" "${ETC_DIR}/systemd/system/brcm43438.service" | |
|
143 | <<<<<<< HEAD | |
|
144 | 138 | install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service" |
|
145 | 139 | install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service" |
|
146 | 140 | # Install udev rule for bluetooth device |
|
147 | 141 | install_readonly "${R}/tmp/pi-bluetooth/99-com.rules" "${ETC_DIR}/udev/rules.d/99-com.rules" |
|
148 | ======= | |
|
149 | install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service" | |
|
150 | install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service" | |
|
151 | install_readonly "${R}/tmp/pi-bluetooth/99-com.rules" "${ETC_DIR}/udev/rules.d/99-com.rules" | |
|
152 | >>>>>>> bc6d966f8243dd759dfc1c0811528e37879ceb1b | |
|
153 | 142 | |
|
154 | 143 | # Remove temporary directory |
|
155 | 144 | rm -fr "${temp_dir}" |
|
156 | 145 | fi |
|
157 | 146 | fi |
|
158 | 147 | |
|
159 | 148 | # Create firmware configuration and cmdline symlinks |
|
160 | 149 | ln -sf firmware/config.txt "${R}/boot/config.txt" |
|
161 | 150 | ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt" |
|
162 | 151 | |
|
163 | 152 | # Install and setup kernel modules to load at boot |
|
164 | 153 | mkdir -p "${LIB_DIR}/modules-load.d/" |
|
165 | 154 | install_readonly files/modules/rpi2.conf "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
166 | 155 | |
|
167 | 156 | # Load hardware random module at boot |
|
168 | 157 | if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then |
|
169 | 158 | sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
170 | 159 | fi |
|
171 | 160 | |
|
172 | 161 | # Load sound module at boot |
|
173 | 162 | if [ "$ENABLE_SOUND" = true ] ; then |
|
174 | 163 | sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
175 | 164 | else |
|
176 | 165 | echo "dtparam=audio=off" >> "${BOOT_DIR}/config.txt" |
|
177 | 166 | fi |
|
178 | 167 | |
|
179 | 168 | # Enable I2C interface |
|
180 | 169 | if [ "$ENABLE_I2C" = true ] ; then |
|
181 | 170 | echo "dtparam=i2c_arm=on" >> "${BOOT_DIR}/config.txt" |
|
182 | 171 | sed -i "s/^# i2c-bcm2708/i2c-bcm2708/" "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
183 | 172 | sed -i "s/^# i2c-dev/i2c-dev/" "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
184 | 173 | fi |
|
185 | 174 | |
|
186 | 175 | # Enable SPI interface |
|
187 | 176 | if [ "$ENABLE_SPI" = true ] ; then |
|
188 | 177 | echo "dtparam=spi=on" >> "${BOOT_DIR}/config.txt" |
|
189 | 178 | echo "spi-bcm2708" >> "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
190 | 179 | if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]; then |
|
191 | 180 | sed -i "s/spi-bcm2708/spi-bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
192 | 181 | fi |
|
193 | 182 | fi |
|
194 | 183 | |
|
195 | 184 | # Disable RPi2/3 under-voltage warnings |
|
196 | 185 | if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then |
|
197 | 186 | echo "avoid_warnings=${DISABLE_UNDERVOLT_WARNINGS}" >> "${BOOT_DIR}/config.txt" |
|
198 | 187 | fi |
|
199 | 188 | |
|
200 | 189 | # Install kernel modules blacklist |
|
201 | 190 | mkdir -p "${ETC_DIR}/modprobe.d/" |
|
202 | 191 | install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi-blacklist.conf" |
|
203 | 192 | |
|
204 | 193 | # Install sysctl.d configuration files |
|
205 | 194 | 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