@@ -1,128 +1,120 | |||
|
1 | 1 | # |
|
2 | 2 | # Setup fstab and initramfs |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | # Install and setup fstab |
|
9 | 9 | install_readonly files/mount/fstab "${ETC_DIR}/fstab" |
|
10 | 10 | |
|
11 | 11 | # Generate initramfs file |
|
12 | 12 | if [ "$ENABLE_INITRAMFS" = true ] ; then |
|
13 | 13 | if [ "$ENABLE_CRYPTFS" = true ] ; then |
|
14 | 14 | |
|
15 | 15 | # Include initramfs scripts to auto expand encrypted root partition |
|
16 | 16 | if [ "$EXPANDROOT" = true ] ; then |
|
17 | 17 | install_exec files/initramfs/expand_encrypted_rootfs "${ETC_DIR}/initramfs-tools/scripts/init-premount/expand_encrypted_rootfs" |
|
18 | 18 | install_exec files/initramfs/expand-premount "${ETC_DIR}/initramfs-tools/scripts/local-premount/expand-premount" |
|
19 | 19 | install_exec files/initramfs/expand-tools "${ETC_DIR}/initramfs-tools/hooks/expand-tools" |
|
20 | 20 | fi |
|
21 | 21 | |
|
22 | 22 | # Replace fstab root partition with encrypted partition mapping |
|
23 | 23 | sed -i "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING}/" "${ETC_DIR}/fstab" |
|
24 | 24 | |
|
25 | 25 | # Add encrypted partition to crypttab and fstab |
|
26 | 26 | install_readonly files/mount/crypttab "${ETC_DIR}/crypttab" |
|
27 | 27 | echo "${CRYPTFS_MAPPING} /dev/mmcblk0p2 none luks,initramfs" >> "${ETC_DIR}/crypttab" |
|
28 | 28 | |
|
29 | 29 | if [ "$ENABLE_USBBOOT" = true ] && [ "$ENABLE_SPLITFS" = false ]; then |
|
30 | 30 | sed -i "s/mmcblk0p1/sda1/" "${ETC_DIR}/fstab" |
|
31 | 31 | # Add usb/sda2 disk to crypttab |
|
32 | 32 | sed -i "s/mmcblk0p2/sda2/" "${ETC_DIR}/crypttab" |
|
33 | 33 | fi |
|
34 | 34 | |
|
35 | 35 | # Add encrypted root partition to fstab and crypttab |
|
36 | 36 | if [ "$ENABLE_SPLITFS" = true ] && [ "$ENABLE_USBBOOT" = false ]; then |
|
37 | 37 | # Add usb/sda1 disk to crypttab |
|
38 | 38 | sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/crypttab" |
|
39 | 39 | fi |
|
40 | 40 | |
|
41 | 41 | if [ "$CRYPTFS_DROPBEAR" = true ]; then |
|
42 | 42 | if [ "$ENABLE_DHCP" = false ] ; then |
|
43 | 43 | # Get cdir from NET_ADDRESS e.g. 24 |
|
44 | 44 | cdir=$(printf "%s" "${NET_ADDRESS}" | cut -d '/' -f2) |
|
45 | 45 | |
|
46 | 46 | # Convert cdir ro netmask e.g. 24 to 255.255.255.0 |
|
47 | 47 | NET_MASK=$(cdr2mask "$cdir") |
|
48 | 48 | |
|
49 | 49 | # Write static ip settings to "${ETC_DIR}"/initramfs-tools/initramfs.conf |
|
50 | 50 | # ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> |
|
51 | 51 | sed -i "\$a\nIP=${NET_ADDRESS}::${NET_GATEWAY}:${NET_MASK}:${HOSTNAME}:" "${ETC_DIR}"/initramfs-tools/initramfs.conf |
|
52 | 52 | else |
|
53 | 53 | sed -i "\$a\nIP=::::${HOSTNAME}::dhcp" "${ETC_DIR}"/initramfs-tools/initramfs.conf |
|
54 | 54 | fi |
|
55 | 55 | |
|
56 | 56 | if [ -n "$CRYPTFS_DROPBEAR_PUBKEY" ] && [ -f "$CRYPTFS_DROPBEAR_PUBKEY" ] ; then |
|
57 | 57 | install_readonly "${CRYPTFS_DROPBEAR_PUBKEY}" "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub |
|
58 | 58 | cat "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub >> "${ETC_DIR}"/dropbear-initramfs/authorized_keys |
|
59 | 59 | else |
|
60 | 60 | # Create key |
|
61 | 61 | chroot_exec /usr/bin/dropbearkey -t rsa -f /etc/dropbear-initramfs/id_rsa.dropbear |
|
62 | 62 | |
|
63 | 63 | # Convert dropbear key to openssh key |
|
64 | 64 | chroot_exec /usr/lib/dropbear/dropbearconvert dropbear openssh /etc/dropbear-initramfs/id_rsa.dropbear /etc/dropbear-initramfs/id_rsa |
|
65 | 65 | |
|
66 | 66 | # Get Public Key Part |
|
67 | 67 | chroot_exec /usr/bin/dropbearkey -y -f /etc/dropbear-initramfs/id_rsa.dropbear | chroot_exec tee /etc/dropbear-initramfs/id_rsa.pub |
|
68 | 68 | |
|
69 | 69 | # Delete unwanted lines |
|
70 | 70 | sed -i '/Public/d' "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub |
|
71 | 71 | sed -i '/Fingerprint/d' "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub |
|
72 | 72 | |
|
73 | 73 | # Trust the new key |
|
74 | 74 | cat "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub > "${ETC_DIR}"/dropbear-initramfs/authorized_keys |
|
75 | 75 | |
|
76 | 76 | # Save Keys - convert with putty from rsa/openssh to puttkey |
|
77 | 77 | cp -f "${ETC_DIR}"/dropbear-initramfs/id_rsa "${BASEDIR}"/dropbear_initramfs_key.rsa |
|
78 | 78 | |
|
79 | 79 | # Get unlock script |
|
80 | 80 | install_exec files/initramfs/crypt_unlock.sh "${ETC_DIR}"/initramfs-tools/hooks/crypt_unlock.sh |
|
81 | 81 | |
|
82 | 82 | # Enable Dropbear inside initramfs |
|
83 | 83 | printf "#\n# DROPBEAR: [ y | n ]\n#\n\nDROPBEAR=y\n" >> "${ETC_DIR}/initramfs-tools/initramfs.conf" |
|
84 | 84 | |
|
85 | 85 | # Enable Dropbear inside initramfs |
|
86 | 86 | sed -i "54 i sleep 5" "${R}"/usr/share/initramfs-tools/scripts/init-premount/dropbear |
|
87 | 87 | fi |
|
88 | 88 | # CRYPTFSDROPBEAR=false |
|
89 | 89 | else |
|
90 | 90 | # Disable SSHD inside initramfs |
|
91 | 91 | printf "#\n# DROPBEAR: [ y | n ]\n#\n\nDROPBEAR=n\n" >> "${ETC_DIR}/initramfs-tools/initramfs.conf" |
|
92 | 92 | fi |
|
93 | 93 | |
|
94 | 94 | # Add cryptsetup modules to initramfs |
|
95 | <<<<<<< HEAD | |
|
96 | printf "#\n# CRYPTSETUP: [ y | n ]\n#\n\nCRYPTSETUP=y\n" >> "${ETC_DIR}/initramfs-tools/conf-hook" | |
|
97 | 95 | #printf "#\n# CRYPTSETUP: [ y | n ]\n#\n\nCRYPTSETUP=y\n" >> "${ETC_DIR}/initramfs-tools/conf-hook" |
|
98 | 96 | |
|
99 | 97 | # Dummy mapping required by mkinitramfs |
|
100 | echo "0 1 crypt $(echo "${CRYPTFS_CIPHER}" | cut -d ':' -f 1) ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0 7:0 4096" | chroot_exec dmsetup create "${CRYPTFS_MAPPING}" | |
|
101 | ======= | |
|
102 | #printf "#\n# CRYPTSETUP: [ y | n ]\n#\n\nCRYPTSETUP=y\n" >> "${ETC_DIR}/initramfs-tools/conf-hook" | |
|
103 | ||
|
104 | # Dummy mapping required by mkinitramfs | |
|
105 | >>>>>>> af203dbe173e4e5ca755058b3284dc61375ca579 | |
|
106 | 98 | echo "0 1 crypt "${CRYPTFS_CIPHER}" ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 0 7:0 4096" | chroot_exec dmsetup create "${CRYPTFS_MAPPING}" |
|
107 | 99 | |
|
108 | 100 | # Generate initramfs with encrypted root partition support |
|
109 | 101 | chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}" |
|
110 | 102 | |
|
111 | 103 | # Remove dummy mapping |
|
112 | 104 | chroot_exec cryptsetup close "${CRYPTFS_MAPPING}" |
|
113 | 105 | # CRYPTFS=false |
|
114 | 106 | else |
|
115 | 107 | #USB BOOT /boot on sda1 / on sda2 |
|
116 | 108 | if [ "$ENABLE_USBBOOT" = true ] ; then |
|
117 | 109 | sed -i "s/mmcblk0p1/sda1/" "${ETC_DIR}/fstab" |
|
118 | 110 | sed -i "s/mmcblk0p2/sda2/" "${ETC_DIR}/fstab" |
|
119 | 111 | fi |
|
120 | 112 | |
|
121 | 113 | # Add usb/sda disk root partition to fstab |
|
122 | 114 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
123 | 115 | sed -i "s/mmcblk0p2/sda1/" "${ETC_DIR}/fstab" |
|
124 | 116 | fi |
|
125 | 117 | # Generate initramfs without encrypted root partition support |
|
126 | 118 | chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}" |
|
127 | 119 | fi |
|
128 | 120 | fi |
@@ -1,332 +1,320 | |||
|
1 | 1 | # |
|
2 | 2 | # Setup RPi2/3/4 config and cmdline |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | if [ -n "$RPI_FIRMWARE_DIR" ] && [ -d "$RPI_FIRMWARE_DIR" ] ; then |
|
9 | 9 | # Install boot binaries from local directory |
|
10 | 10 | cp "${RPI_FIRMWARE_DIR}"/boot/bootcode.bin "${BOOT_DIR}"/bootcode.bin |
|
11 | 11 | cp "${RPI_FIRMWARE_DIR}"/boot/fixup.dat "${BOOT_DIR}"/fixup.dat |
|
12 | 12 | cp "${RPI_FIRMWARE_DIR}"/boot/fixup_cd.dat "${BOOT_DIR}"/fixup_cd.dat |
|
13 | 13 | cp "${RPI_FIRMWARE_DIR}"/boot/fixup_x.dat "${BOOT_DIR}"/fixup_x.dat |
|
14 | 14 | cp "${RPI_FIRMWARE_DIR}"/boot/start.elf "${BOOT_DIR}"/start.elf |
|
15 | 15 | cp "${RPI_FIRMWARE_DIR}"/boot/start_cd.elf "${BOOT_DIR}"/start_cd.elf |
|
16 | 16 | cp "${RPI_FIRMWARE_DIR}"/boot/start_x.elf "${BOOT_DIR}"/start_x.elf |
|
17 | 17 | cp "${RPI_FIRMWARE_DIR}"/boot/fixup4cd.dat "${BOOT_DIR}"/fixup4cd.dat |
|
18 | 18 | cp "${RPI_FIRMWARE_DIR}"/boot/fixup4.dat "${BOOT_DIR}"/fixup4.dat |
|
19 | 19 | cp "${RPI_FIRMWARE_DIR}"/boot/fixup4db.dat "${BOOT_DIR}"/fixup4db.dat |
|
20 | 20 | cp "${RPI_FIRMWARE_DIR}"/boot/fixup4x.dat "${BOOT_DIR}"/fixup4x.dat |
|
21 | 21 | cp "${RPI_FIRMWARE_DIR}"/boot/start4cd.elf "${BOOT_DIR}"/start4cd.elf |
|
22 | 22 | cp "${RPI_FIRMWARE_DIR}"/boot/start4db.elf "${BOOT_DIR}"/start4db.elf |
|
23 | 23 | cp "${RPI_FIRMWARE_DIR}"/boot/start4.elf "${BOOT_DIR}"/start4x.elf |
|
24 | 24 | cp "${RPI_FIRMWARE_DIR}"/boot/start4x.elf "${BOOT_DIR}"/start4x.elf |
|
25 | 25 | else |
|
26 | 26 | # Create temporary directory for boot binaries |
|
27 | 27 | temp_dir=$(as_nobody mktemp -d) |
|
28 | 28 | |
|
29 | 29 | # Install latest boot binaries from raspberry/firmware github |
|
30 | 30 | as_nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin" |
|
31 | 31 | as_nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat" |
|
32 | 32 | as_nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat" |
|
33 | 33 | as_nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat" |
|
34 | 34 | as_nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf" |
|
35 | 35 | as_nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf" |
|
36 | 36 | as_nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf" |
|
37 | 37 | as_nobody wget -q -O "${temp_dir}/fixup4cd.dat" "${FIRMWARE_URL}/fixup4cd.dat" |
|
38 | 38 | as_nobody wget -q -O "${temp_dir}/fixup4.dat" "${FIRMWARE_URL}/fixup4.dat" |
|
39 | 39 | as_nobody wget -q -O "${temp_dir}/fixup4db.dat" "${FIRMWARE_URL}/fixup4db.dat" |
|
40 | 40 | as_nobody wget -q -O "${temp_dir}/fixup4x.dat" "${FIRMWARE_URL}/fixup4x.dat" |
|
41 | 41 | as_nobody wget -q -O "${temp_dir}/start4cd.elf" "${FIRMWARE_URL}/start4cd.elf" |
|
42 | 42 | as_nobody wget -q -O "${temp_dir}/start4db.elf" "${FIRMWARE_URL}/start4db.elf" |
|
43 | 43 | as_nobody wget -q -O "${temp_dir}/start4x.elf" "${FIRMWARE_URL}/start4x.elf" |
|
44 | 44 | as_nobody wget -q -O "${temp_dir}/start4x.elf" "${FIRMWARE_URL}/start4x.elf" |
|
45 | 45 | |
|
46 | 46 | # Move downloaded boot binaries |
|
47 | 47 | mv "${temp_dir}/"* "${BOOT_DIR}/" |
|
48 | 48 | |
|
49 | 49 | # Remove temporary directory for boot binaries |
|
50 | 50 | rm -fr "${temp_dir}" |
|
51 | 51 | |
|
52 | 52 | # Set permissions of the boot binaries |
|
53 | 53 | chown -R root:root "${BOOT_DIR}" |
|
54 | 54 | chmod -R 600 "${BOOT_DIR}" |
|
55 | 55 | fi |
|
56 | 56 | |
|
57 | 57 | # Setup firmware boot cmdline |
|
58 | 58 | if [ "$ENABLE_USBBOOT" = true ] ; then |
|
59 | 59 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline console=tty1 rootwait init=/bin/systemd" |
|
60 | 60 | else |
|
61 | 61 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
62 | 62 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/sda1 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline console=tty1 rootwait init=/bin/systemd" |
|
63 | 63 | else |
|
64 | 64 | CMDLINE="dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=100,data=writeback elevator=deadline console=tty1 rootwait init=/bin/systemd" |
|
65 | 65 | fi |
|
66 | 66 | fi |
|
67 | 67 | |
|
68 | 68 | # Add encrypted root partition to cmdline.txt |
|
69 | 69 | if [ "$ENABLE_CRYPTFS" = true ] ; then |
|
70 | 70 | if [ "$ENABLE_SPLITFS" = true ] ; then |
|
71 | 71 | CMDLINE=$(echo "${CMDLINE}" | sed "s/sda1/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda1:${CRYPTFS_MAPPING}/") |
|
72 | 72 | else |
|
73 | 73 | if [ "$ENABLE_USBBOOT" = true ] ; then |
|
74 | 74 | CMDLINE=$(echo "${CMDLINE}" | sed "s/sda2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/sda2:${CRYPTFS_MAPPING}/") |
|
75 | 75 | else |
|
76 | 76 | CMDLINE=$(echo "${CMDLINE}" | sed "s/mmcblk0p2/mapper\/${CRYPTFS_MAPPING} cryptdevice=\/dev\/mmcblk0p2:${CRYPTFS_MAPPING}/") |
|
77 | 77 | fi |
|
78 | 78 | fi |
|
79 | 79 | fi |
|
80 | 80 | |
|
81 | 81 | # Enable Kernel messages on standard output |
|
82 | 82 | if [ "$ENABLE_PRINTK" = true ] ; then |
|
83 | 83 | install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf" |
|
84 | 84 | fi |
|
85 | 85 | |
|
86 | 86 | # Enable Kernel messages on standard output |
|
87 | 87 | if [ "$KERNEL_SECURITY" = true ] ; then |
|
88 | 88 | install_readonly files/sysctl.d/84-rpi-ASLR.conf "${ETC_DIR}/sysctl.d/84-rpi-ASLR.conf" |
|
89 | 89 | fi |
|
90 | 90 | |
|
91 | 91 | # Install udev rule for serial alias - serial0 = console serial1=bluetooth |
|
92 | 92 | install_readonly files/etc/99-com.rules "${LIB_DIR}/udev/rules.d/99-com.rules" |
|
93 | 93 | |
|
94 | 94 | # Remove IPv6 networking support |
|
95 | 95 | if [ "$ENABLE_IPV6" = false ] ; then |
|
96 | 96 | CMDLINE="${CMDLINE} ipv6.disable=1" |
|
97 | 97 | fi |
|
98 | 98 | |
|
99 | 99 | # Automatically assign predictable network interface names |
|
100 | 100 | if [ "$ENABLE_IFNAMES" = false ] ; then |
|
101 | 101 | CMDLINE="${CMDLINE} net.ifnames=0" |
|
102 | 102 | else |
|
103 | 103 | CMDLINE="${CMDLINE} net.ifnames=1" |
|
104 | 104 | fi |
|
105 | 105 | |
|
106 | 106 | # Disable Raspberry Pi console logo |
|
107 | 107 | if [ "$ENABLE_LOGO" = false ] ; then |
|
108 | 108 | CMDLINE="${CMDLINE} logo.nologo" |
|
109 | 109 | fi |
|
110 | 110 | |
|
111 | 111 | # Strictly limit verbosity of boot up console messages |
|
112 | 112 | if [ "$ENABLE_SILENT_BOOT" = true ] ; then |
|
113 | 113 | CMDLINE="${CMDLINE} quiet loglevel=0 rd.systemd.show_status=auto rd.udev.log_priority=0" |
|
114 | 114 | fi |
|
115 | 115 | |
|
116 | 116 | # Install firmware config |
|
117 | 117 | install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt" |
|
118 | 118 | |
|
119 | 119 | # Disable Raspberry Pi console logo |
|
120 | 120 | if [ "$ENABLE_SLASH" = false ] ; then |
|
121 | 121 | echo "disable_splash=1" >> "${BOOT_DIR}/config.txt" |
|
122 | 122 | fi |
|
123 | 123 | |
|
124 | 124 | # Locks CPU frequency at maximum |
|
125 | 125 | if [ "$ENABLE_TURBO" = true ] ; then |
|
126 | 126 | echo "force_turbo=1" >> "${BOOT_DIR}/config.txt" |
|
127 | 127 | # helps to avoid sdcard corruption when force_turbo is enabled. |
|
128 | 128 | echo "boot_delay=1" >> "${BOOT_DIR}/config.txt" |
|
129 | 129 | fi |
|
130 | 130 | |
|
131 | <<<<<<< HEAD | |
|
132 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |
|
133 | ======= | |
|
134 | >>>>>>> af203dbe173e4e5ca755058b3284dc61375ca579 | |
|
135 | 131 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ]; then |
|
136 | 132 | |
|
137 | 133 | # Bluetooth enabled |
|
138 | 134 | if [ "$ENABLE_BLUETOOTH" = true ] ; then |
|
139 | 135 | # Create temporary directory for Bluetooth sources |
|
140 | 136 | temp_dir=$(as_nobody mktemp -d) |
|
141 | 137 | |
|
142 | 138 | # Fetch Bluetooth sources |
|
143 | 139 | as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}" |
|
144 | 140 | |
|
145 | 141 | # Copy downloaded sources |
|
146 | 142 | mv "${temp_dir}/pi-bluetooth" "${R}/tmp/" |
|
147 | 143 | |
|
148 | 144 | # Set permissions |
|
149 | 145 | chown -R root:root "${R}/tmp/pi-bluetooth" |
|
150 | 146 | |
|
151 | 147 | # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/ |
|
152 | 148 | wget -q -O "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" https://aur.archlinux.org/cgit/aur.git/plain/LICENCE.broadcom_bcm43xx?h=pi-bluetooth |
|
153 | 149 | wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://raw.githubusercontent.com/RPi-Distro/bluez-firmware/master/broadcom/BCM43430A1.hcd |
|
154 | 150 | |
|
155 | 151 | # Install tools |
|
156 | 152 | install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart" |
|
157 | 153 | install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper" |
|
158 | 154 | |
|
159 | 155 | # make scripts executable |
|
160 | 156 | chmod +x "${R}/usr/bin/bthelper" |
|
161 | 157 | chmod +x "${R}/usr/bin/btuart" |
|
162 | 158 | |
|
163 | 159 | # Install bluetooth udev rule |
|
164 | 160 | install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules" |
|
165 | 161 | |
|
166 | 162 | # Install Firmware Flash file and apropiate licence |
|
167 | 163 | mkdir -p "$BLUETOOTH_FIRMWARE_DIR" |
|
168 | 164 | install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx" |
|
169 | 165 | install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${BLUETOOTH_FIRMWARE_DIR}/BCM43430A1.hcd" |
|
170 | 166 | install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service" |
|
171 | 167 | install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service" |
|
172 | 168 | |
|
173 | 169 | # Remove temporary directories |
|
174 | 170 | rm -fr "${temp_dir}" |
|
175 | 171 | rm -fr "${R}"/tmp/pi-bluetooth |
|
176 | 172 | |
|
177 | 173 | # 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 |
|
178 | 174 | if [ "$ENABLE_MINIUART_OVERLAY" = true ] ; then |
|
179 | 175 | # set overlay to swap ttyAMA0 and ttyS0 |
|
180 | 176 | echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt" |
|
181 | 177 | |
|
182 | 178 | if [ "$ENABLE_TURBO" = false ] ; then |
|
183 | 179 | echo "core_freq=250" >> "${BOOT_DIR}/config.txt" |
|
184 | 180 | fi |
|
185 | 181 | |
|
186 | 182 | fi |
|
187 | 183 | |
|
188 | 184 | # Activate services |
|
189 | 185 | chroot_exec systemctl enable pi-bluetooth.hciuart.service |
|
190 | 186 | |
|
191 | 187 | else # if ENABLE_BLUETOOTH = false |
|
192 | 188 | # set overlay to disable bluetooth |
|
193 | 189 | echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt" |
|
194 | 190 | fi # ENABLE_BLUETOOTH end |
|
195 | 191 | fi |
|
196 | 192 | |
|
197 | 193 | # may need sudo systemctl disable hciuart |
|
198 | 194 | if [ "$ENABLE_CONSOLE" = true ] ; then |
|
199 | 195 | echo "enable_uart=1" >> "${BOOT_DIR}/config.txt" |
|
200 | 196 | # add string to cmdline |
|
201 | 197 | CMDLINE="${CMDLINE} console=serial0,115200" |
|
202 | 198 | |
|
203 | 199 | if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]|| [ "$RPI_MODEL" = 0 ]; then |
|
204 | 200 | # if force_turbo didn't lock cpu at high speed, lock it at low speed (XOR logic) or miniuart will be broken |
|
205 | 201 | if [ "$ENABLE_TURBO" = false ] ; then |
|
206 | 202 | echo "core_freq=250" >> "${BOOT_DIR}/config.txt" |
|
207 | 203 | fi |
|
208 | 204 | fi |
|
209 | 205 | |
|
210 | 206 | # Enable serial console systemd style |
|
211 | 207 | chroot_exec systemctl enable serial-getty@serial0.service |
|
212 | 208 | else |
|
213 | 209 | echo "enable_uart=0" >> "${BOOT_DIR}/config.txt" |
|
214 | 210 | fi |
|
215 | 211 | |
|
216 | 212 | # Disable dphys-swapfile service. Will get enabled on first boot |
|
217 | 213 | if [ "$ENABLE_DPHYSSWAP" = true ] ; then |
|
218 | 214 | chroot_exec systemctl disable dphys-swapfile |
|
219 | 215 | fi |
|
220 | 216 | |
|
221 | 217 | if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then |
|
222 | 218 | # Create temporary directory for systemd-swap sources |
|
223 | 219 | temp_dir=$(as_nobody mktemp -d) |
|
224 | 220 | |
|
225 | 221 | # Fetch systemd-swap sources |
|
226 | 222 | as_nobody git -C "${temp_dir}" clone "${SYSTEMDSWAP_URL}" |
|
227 | 223 | |
|
228 | 224 | # Copy downloaded systemd-swap sources |
|
229 | 225 | mv "${temp_dir}/systemd-swap" "${R}/tmp/" |
|
230 | 226 | |
|
231 | 227 | # Change into downloaded src dir |
|
232 | 228 | cd "${R}/tmp/systemd-swap" || exit |
|
233 | <<<<<<< HEAD | |
|
234 | ||
|
235 | ======= | |
|
236 | >>>>>>> af203dbe173e4e5ca755058b3284dc61375ca579 | |
|
237 | 229 | |
|
238 | 230 | # Get Verion |
|
239 | 231 | VERSION=$(git tag | tail -n 1) |
|
240 | 232 | #sed -i "s/DEB_NAME=.*/DEB_NAME=systemd-swap_all/g" "${R}/tmp/systemd-swap/package.sh" |
|
241 | 233 | |
|
242 | 234 | # Build package |
|
243 | 235 | bash ./package.sh debian |
|
244 | 236 | |
|
245 | 237 | # Change back into script root dir |
|
246 | 238 | cd "${WORKDIR}" || exit |
|
247 | 239 | |
|
248 | 240 | # Set permissions of the systemd-swap sources |
|
249 | 241 | chown -R root:root "${R}/tmp/systemd-swap" |
|
250 | 242 | |
|
251 | 243 | # Install package - IMPROVE AND MAKE IT POSSIBLE WITHOUT VERSION NR. |
|
252 | <<<<<<< HEAD | |
|
253 | chroot_exec dpkg -i /tmp/systemd-swap/systemd-swap_4.0.1_any.deb | |
|
254 | ======= | |
|
255 | >>>>>>> af203dbe173e4e5ca755058b3284dc61375ca579 | |
|
256 | 244 | chroot_exec dpkg -i /tmp/systemd-swap/systemd-swap_"$VERSION"_all.deb |
|
257 | 245 | |
|
258 | 246 | # Enable service |
|
259 | 247 | chroot_exec systemctl enable systemd-swap |
|
260 | 248 | |
|
261 | 249 | # Remove temporary directory for systemd-swap sources |
|
262 | 250 | rm -fr "${temp_dir}" |
|
263 | 251 | else |
|
264 | 252 | # Enable ZSWAP in cmdline if systemd-swap is not used |
|
265 | 253 | if [ "$KERNEL_ZSWAP" = true ] ; then |
|
266 | 254 | CMDLINE="${CMDLINE} zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4" |
|
267 | 255 | fi |
|
268 | 256 | fi |
|
269 | 257 | if [ "$KERNEL_SECURITY" = true ] ; then |
|
270 | 258 | CMDLINE="${CMDLINE} apparmor=1 security=apparmor" |
|
271 | 259 | fi |
|
272 | 260 | |
|
273 | 261 | # Install firmware boot cmdline |
|
274 | 262 | echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt" |
|
275 | 263 | |
|
276 | 264 | # Setup minimal GPU memory allocation size: 16MB (no X) |
|
277 | 265 | if [ "$ENABLE_MINGPU" = true ] ; then |
|
278 | 266 | echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt" |
|
279 | 267 | fi |
|
280 | 268 | |
|
281 | 269 | # Setup boot with initramfs |
|
282 | 270 | if [ "$ENABLE_INITRAMFS" = true ] ; then |
|
283 | 271 | echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt" |
|
284 | 272 | fi |
|
285 | 273 | |
|
286 | 274 | # Create firmware configuration and cmdline symlinks |
|
287 | 275 | ln -sf firmware/config.txt "${R}/boot/config.txt" |
|
288 | 276 | ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt" |
|
289 | 277 | |
|
290 | 278 | # Install and setup kernel modules to load at boot |
|
291 | 279 | mkdir -p "${LIB_DIR}/modules-load.d/" |
|
292 | 280 | install_readonly files/modules/rpi2.conf "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
293 | 281 | |
|
294 | 282 | # Load hardware random module at boot |
|
295 | 283 | if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then |
|
296 | 284 | sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
297 | 285 | fi |
|
298 | 286 | |
|
299 | 287 | # Load sound module at boot |
|
300 | 288 | if [ "$ENABLE_SOUND" = true ] ; then |
|
301 | 289 | sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
302 | 290 | else |
|
303 | 291 | echo "dtparam=audio=off" >> "${BOOT_DIR}/config.txt" |
|
304 | 292 | fi |
|
305 | 293 | |
|
306 | 294 | # Enable I2C interface |
|
307 | 295 | if [ "$ENABLE_I2C" = true ] ; then |
|
308 | 296 | echo "dtparam=i2c_arm=on" >> "${BOOT_DIR}/config.txt" |
|
309 | 297 | sed -i "s/^# i2c-bcm2708/i2c-bcm2708/" "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
310 | 298 | sed -i "s/^# i2c-dev/i2c-dev/" "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
311 | 299 | fi |
|
312 | 300 | |
|
313 | 301 | # Enable SPI interface |
|
314 | 302 | if [ "$ENABLE_SPI" = true ] ; then |
|
315 | 303 | echo "dtparam=spi=on" >> "${BOOT_DIR}/config.txt" |
|
316 | 304 | echo "spi-bcm2708" >> "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
317 | 305 | if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]; then |
|
318 | 306 | sed -i "s/spi-bcm2708/spi-bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf" |
|
319 | 307 | fi |
|
320 | 308 | fi |
|
321 | 309 | |
|
322 | 310 | # Disable RPi2/3 under-voltage warnings |
|
323 | 311 | if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then |
|
324 | 312 | echo "avoid_warnings=${DISABLE_UNDERVOLT_WARNINGS}" >> "${BOOT_DIR}/config.txt" |
|
325 | 313 | fi |
|
326 | 314 | |
|
327 | 315 | # Install kernel modules blacklist |
|
328 | 316 | mkdir -p "${ETC_DIR}/modprobe.d/" |
|
329 | 317 | install_readonly files/modules/raspi-blacklist.conf "${ETC_DIR}/modprobe.d/raspi-blacklist.conf" |
|
330 | 318 | |
|
331 | 319 | # Install sysctl.d configuration files |
|
332 | 320 | install_readonly files/sysctl.d/81-rpi-vm.conf "${ETC_DIR}/sysctl.d/81-rpi-vm.conf" |
@@ -1,140 +1,136 | |||
|
1 | 1 | # |
|
2 | 2 | # Setup Networking |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | # Install and setup hostname |
|
9 | 9 | install_readonly files/network/hostname "${ETC_DIR}/hostname" |
|
10 | 10 | sed -i "s/^RaspberryPI/${HOSTNAME}/" "${ETC_DIR}/hostname" |
|
11 | 11 | |
|
12 | 12 | # Install and setup hosts |
|
13 | 13 | install_readonly files/network/hosts "${ETC_DIR}/hosts" |
|
14 | 14 | sed -i "s/RaspberryPI/${HOSTNAME}/" "${ETC_DIR}/hosts" |
|
15 | 15 | |
|
16 | 16 | # Setup hostname entry with static IP |
|
17 | 17 | if [ "$NET_ADDRESS" != "" ] ; then |
|
18 | 18 | NET_IP=$(echo "${NET_ADDRESS}" | cut -f 1 -d'/') |
|
19 | 19 | sed -i "s/^127.0.1.1/${NET_IP}/" "${ETC_DIR}/hosts" |
|
20 | 20 | fi |
|
21 | 21 | |
|
22 | 22 | # Remove IPv6 hosts |
|
23 | 23 | if [ "$ENABLE_IPV6" = false ] ; then |
|
24 | 24 | sed -i -e "/::[1-9]/d" -e "/^$/d" "${ETC_DIR}/hosts" |
|
25 | 25 | fi |
|
26 | 26 | |
|
27 | 27 | # Install hint about network configuration |
|
28 | 28 | install_readonly files/network/interfaces "${ETC_DIR}/network/interfaces" |
|
29 | 29 | |
|
30 | 30 | # Install configuration for interface eth0 |
|
31 | 31 | install_readonly files/network/eth.network "${ETC_DIR}/systemd/network/eth.network" |
|
32 | 32 | |
|
33 | 33 | if [ "$RPI_MODEL" = 3P ] ; then |
|
34 | 34 | printf "\n[Link]\nGenericReceiveOffload=off\nTCPSegmentationOffload=off\nGenericSegmentationOffload=off" >> "${ETC_DIR}/systemd/network/eth.network" |
|
35 | 35 | fi |
|
36 | 36 | |
|
37 | 37 | # Install configuration for interface wl* |
|
38 | 38 | install_readonly files/network/wlan.network "${ETC_DIR}/systemd/network/wlan.network" |
|
39 | 39 | |
|
40 | 40 | #always with dhcp since wpa_supplicant integration is missing |
|
41 | 41 | sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "${ETC_DIR}/systemd/network/wlan.network" |
|
42 | 42 | |
|
43 | 43 | if [ "$ENABLE_DHCP" = true ] ; then |
|
44 | 44 | # Enable DHCP configuration for interface eth0 |
|
45 | 45 | sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "${ETC_DIR}/systemd/network/eth.network" |
|
46 | 46 | |
|
47 | 47 | # Set DHCP configuration to IPv4 only |
|
48 | 48 | if [ "$ENABLE_IPV6" = false ] ; then |
|
49 | 49 | sed -i "s/DHCP=.*/DHCP=v4/" "${ETC_DIR}/systemd/network/eth.network" |
|
50 | 50 | fi |
|
51 | 51 | |
|
52 | 52 | else # ENABLE_DHCP=false |
|
53 | 53 | # Set static network configuration for interface eth0 |
|
54 | 54 | sed -i\ |
|
55 | 55 | -e "s|DHCP=.*|DHCP=no|"\ |
|
56 | 56 | -e "s|Address=\$|Address=${NET_ADDRESS}|"\ |
|
57 | 57 | -e "s|Gateway=\$|Gateway=${NET_GATEWAY}|"\ |
|
58 | 58 | -e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_1}|"\ |
|
59 | 59 | -e "0,/DNS=\$/ s|DNS=\$|DNS=${NET_DNS_2}|"\ |
|
60 | 60 | -e "s|Domains=\$|Domains=${NET_DNS_DOMAINS}|"\ |
|
61 | 61 | -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\ |
|
62 | 62 | -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\ |
|
63 | 63 | "${ETC_DIR}/systemd/network/eth.network" |
|
64 | 64 | fi |
|
65 | 65 | |
|
66 | 66 | # Remove empty settings from network configuration |
|
67 | 67 | sed -i "/.*=\$/d" "${ETC_DIR}/systemd/network/eth.network" |
|
68 | 68 | # Remove empty settings from wlan configuration |
|
69 | 69 | sed -i "/.*=\$/d" "${ETC_DIR}/systemd/network/wlan.network" |
|
70 | 70 | |
|
71 | 71 | # Move systemd network configuration if required by Debian release |
|
72 | 72 | mv -v "${ETC_DIR}/systemd/network/eth.network" "${LIB_DIR}/systemd/network/10-eth.network" |
|
73 | 73 | # If WLAN is enabled copy wlan configuration too |
|
74 | 74 | if [ "$ENABLE_WIRELESS" = true ] ; then |
|
75 | 75 | mv -v "${ETC_DIR}/systemd/network/wlan.network" "${LIB_DIR}/systemd/network/11-wlan.network" |
|
76 | 76 | fi |
|
77 | 77 | rm -fr "${ETC_DIR}/systemd/network" |
|
78 | 78 | |
|
79 | 79 | # Enable systemd-networkd service |
|
80 | 80 | chroot_exec systemctl enable systemd-networkd |
|
81 | 81 | |
|
82 | 82 | # Install host.conf resolver configuration |
|
83 | 83 | install_readonly files/network/host.conf "${ETC_DIR}/host.conf" |
|
84 | 84 | |
|
85 | 85 | # Enable network stack hardening |
|
86 | 86 | if [ "$ENABLE_HARDNET" = true ] ; then |
|
87 | 87 | # Install sysctl.d configuration files |
|
88 | 88 | install_readonly files/sysctl.d/82-rpi-net-hardening.conf "${ETC_DIR}/sysctl.d/82-rpi-net-hardening.conf" |
|
89 | 89 | |
|
90 | 90 | # Setup resolver warnings about spoofed addresses |
|
91 | 91 | sed -i "s/^# spoof warn/spoof warn/" "${ETC_DIR}/host.conf" |
|
92 | 92 | fi |
|
93 | 93 | |
|
94 | 94 | # Enable time sync |
|
95 | 95 | if [ "$NET_NTP_1" != "" ] ; then |
|
96 | 96 | chroot_exec systemctl enable systemd-timesyncd.service |
|
97 | 97 | fi |
|
98 | 98 | |
|
99 | 99 | # Download the firmware binary blob required to use the RPi3 wireless interface |
|
100 | 100 | if [ "$ENABLE_WIRELESS" = true ] ; then |
|
101 | 101 | if [ ! -d "${WLAN_FIRMWARE_DIR}" ] ; then |
|
102 | 102 | mkdir -p "${WLAN_FIRMWARE_DIR}" |
|
103 | 103 | fi |
|
104 | 104 | |
|
105 | 105 | # Create temporary directory for firmware binary blob |
|
106 | 106 | temp_dir=$(as_nobody mktemp -d) |
|
107 | 107 | |
|
108 | # Fetch firmware binary blob for RPI3B+ | |
|
109 | <<<<<<< HEAD | |
|
110 | if [ "$RPI_MODEL" = 3P ] ; then | |
|
111 | ======= | |
|
112 | >>>>>>> af203dbe173e4e5ca755058b3284dc61375ca579 | |
|
108 | # Fetch firmware binary blob for RPI3B+ or Pi4 | |
|
113 | 109 | if [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then |
|
114 | 110 | # Fetch firmware binary blob for RPi3P |
|
115 | 111 | as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.bin" |
|
116 | 112 | as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.txt" |
|
117 | 113 | as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.clm_blob" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.clm_blob" |
|
118 | 114 | |
|
119 | 115 | # Move downloaded firmware binary blob |
|
120 | 116 | mv "${temp_dir}/brcmfmac43455-sdio."* "${WLAN_FIRMWARE_DIR}/" |
|
121 | 117 | |
|
122 | 118 | # Set permissions of the firmware binary blob |
|
123 | 119 | chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* |
|
124 | 120 | chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* |
|
125 | 121 | elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then |
|
126 | 122 | # Fetch firmware binary blob for RPi3 |
|
127 | 123 | as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin" |
|
128 | 124 | as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt" |
|
129 | 125 | |
|
130 | 126 | # Move downloaded firmware binary blob |
|
131 | 127 | mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/" |
|
132 | 128 | |
|
133 | 129 | # Set permissions of the firmware binary blob |
|
134 | 130 | chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* |
|
135 | 131 | chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* |
|
136 | 132 | fi |
|
137 | 133 | |
|
138 | 134 | # Remove temporary directory for firmware binary blob |
|
139 | 135 | rm -fr "${temp_dir}" |
|
140 | 136 | fi |
@@ -1,64 +1,56 | |||
|
1 | 1 | # |
|
2 | 2 | # Setup videocore - Raspberry Userland |
|
3 | 3 | # |
|
4 | 4 | |
|
5 | 5 | # Load utility functions |
|
6 | 6 | . ./functions.sh |
|
7 | 7 | |
|
8 | 8 | if [ "$ENABLE_VIDEOCORE" = true ] ; then |
|
9 | 9 | # Copy existing videocore sources into chroot directory |
|
10 | 10 | if [ -n "$VIDEOCORESRC_DIR" ] && [ -d "$VIDEOCORESRC_DIR" ] ; then |
|
11 | 11 | # Copy local videocore sources |
|
12 | 12 | cp -r "${VIDEOCORESRC_DIR}" "${R}/tmp/userland" |
|
13 | 13 | else |
|
14 | 14 | # Create temporary directory for videocore sources |
|
15 | 15 | temp_dir=$(as_nobody mktemp -d) |
|
16 | 16 | |
|
17 | 17 | # Fetch videocore sources |
|
18 | 18 | as_nobody git -C "${temp_dir}" clone "${VIDEOCORE_URL}" |
|
19 | 19 | |
|
20 | 20 | # Copy downloaded videocore sources |
|
21 | 21 | mv "${temp_dir}/userland" "${R}/tmp/" |
|
22 | 22 | |
|
23 | 23 | # Set permissions of the U-Boot sources |
|
24 | 24 | chown -R root:root "${R}/tmp/userland" |
|
25 | 25 | |
|
26 | 26 | # Remove temporary directory for U-Boot sources |
|
27 | 27 | rm -fr "${temp_dir}" |
|
28 | 28 | fi |
|
29 | 29 | |
|
30 | 30 | # Create build dir |
|
31 | 31 | mkdir "${R}"/tmp/userland/build |
|
32 | 32 | |
|
33 | 33 | # push us to build directory |
|
34 | 34 | cd "${R}"/tmp/userland/build |
|
35 | 35 | |
|
36 | 36 | if [ "$RELEASE_ARCH" = "arm64" ] ; then |
|
37 | <<<<<<< HEAD | |
|
38 | 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" | |
|
39 | ======= | |
|
40 | >>>>>>> af203dbe173e4e5ca755058b3284dc61375ca579 | |
|
41 | 37 | cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DCMAKE_TOOLCHAIN_FILE="${R}"/tmp/userland/makefiles/cmake/toolchains/aarch64-linux-gnu.cmake -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" |
|
42 | 38 | fi |
|
43 | 39 | |
|
44 | 40 | if [ "$RELEASE_ARCH" = "armel" ] ; then |
|
45 | <<<<<<< HEAD | |
|
46 | cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-g++ -DCMAKE_ASM_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DCMAKE_SYSTEM_PROCESSOR="arm" -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland" | |
|
47 | ======= | |
|
48 | >>>>>>> af203dbe173e4e5ca755058b3284dc61375ca579 | |
|
49 | 41 | cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DCMAKE_TOOLCHAIN_FILE="${R}"/tmp/userland/makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake -DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-g++ -DCMAKE_ASM_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DCMAKE_SYSTEM_PROCESSOR="arm" -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland" |
|
50 | 42 | fi |
|
51 | 43 | |
|
52 | 44 | if [ "$RELEASE_ARCH" = "armhf" ] ; then |
|
53 | 45 | cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DCMAKE_TOOLCHAIN_FILE="${R}"/tmp/userland/makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland" |
|
54 | 46 | fi |
|
55 | 47 | |
|
56 | 48 | #build userland |
|
57 | 49 | make -j "$(nproc)" |
|
58 | 50 | |
|
59 | 51 | #back to root of scriptdir |
|
60 | 52 | cd "${WORKDIR}" |
|
61 | 53 | |
|
62 | 54 | # Remove videocore sources |
|
63 | 55 | rm -fr "${R}"/tmp/userland/ |
|
64 | 56 | fi |
@@ -1,101 +1,97 | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | # |
|
3 | 3 | # Build and Setup nexmon with monitor mode patch |
|
4 | 4 | # |
|
5 | 5 | |
|
6 | 6 | # Load utility functions |
|
7 | 7 | . ./functions.sh |
|
8 | 8 | |
|
9 | 9 | if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then |
|
10 | 10 | # Copy existing nexmon sources into chroot directory |
|
11 | 11 | if [ -n "$NEXMONSRC_DIR" ] && [ -d "$NEXMONSRC_DIR" ] ; then |
|
12 | 12 | # Copy local U-Boot sources |
|
13 | 13 | cp -r "${NEXMONSRC_DIR}" "${R}/tmp" |
|
14 | 14 | else |
|
15 | 15 | # Create temporary directory for nexmon sources |
|
16 | 16 | temp_dir=$(as_nobody mktemp -d) |
|
17 | 17 | |
|
18 | 18 | # Fetch nexmon sources |
|
19 | 19 | as_nobody git -C "${temp_dir}" clone "${NEXMON_URL}" |
|
20 | 20 | |
|
21 | 21 | # Copy downloaded nexmon sources |
|
22 | 22 | mv "${temp_dir}/nexmon" "${R}"/tmp/ |
|
23 | 23 | |
|
24 | 24 | # Set permissions of the nexmon sources |
|
25 | 25 | chown -R root:root "${R}"/tmp/nexmon |
|
26 | 26 | |
|
27 | 27 | # Remove temporary directory for nexmon sources |
|
28 | 28 | rm -fr "${temp_dir}" |
|
29 | 29 | fi |
|
30 | 30 | |
|
31 | 31 | # Set script Root |
|
32 | 32 | export NEXMON_ROOT="${R}"/tmp/nexmon |
|
33 | 33 | |
|
34 | 34 | # Build nexmon firmware outside the build system, if we can. |
|
35 | 35 | cd "${NEXMON_ROOT}" || exit |
|
36 | 36 | |
|
37 | 37 | # Make ancient isl build |
|
38 | 38 | cd buildtools/isl-0.10 || exit |
|
39 | 39 | ./configure |
|
40 | 40 | make |
|
41 | 41 | cd ../.. || exit |
|
42 | 42 | |
|
43 | 43 | # Disable statistics |
|
44 | 44 | touch DISABLE_STATISTICS |
|
45 | 45 | |
|
46 | 46 | # Setup Enviroment: see https://github.com/NoobieDog/nexmon/blob/master/setup_env.sh |
|
47 | 47 | export KERNEL="${KERNEL_IMAGE}" |
|
48 | 48 | export ARCH=arm |
|
49 | 49 | export SUBARCH=arm |
|
50 | 50 | export CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- |
|
51 | 51 | export CC="${CC}"gcc |
|
52 | 52 | export CCPLUGIN="${NEXMON_ROOT}"/buildtools/gcc-nexmon-plugin/nexmon.so |
|
53 | 53 | export ZLIBFLATE="zlib-flate -compress" |
|
54 | 54 | export Q=@ |
|
55 | 55 | export NEXMON_SETUP_ENV=1 |
|
56 | 56 | export HOSTUNAME=$(uname -s) |
|
57 | 57 | export PLATFORMUNAME=$(uname -m) |
|
58 | 58 | |
|
59 | 59 | # Make nexmon |
|
60 | 60 | make |
|
61 | 61 | |
|
62 | 62 | # build patches |
|
63 | 63 | if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] ; then |
|
64 | 64 | cd "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon || exit |
|
65 | 65 | sed -i -e 's/all:.*/all: $(RAM_FILE)/g' ${NEXMON_ROOT}/patches/bcm43430a1/7_45_41_46/nexmon/Makefile |
|
66 | 66 | make clean |
|
67 | 67 | |
|
68 | 68 | # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. |
|
69 | 69 | LD_LIBRARY_PATH="${NEXMON_ROOT}"/buildtools/isl-0.10/.libs make ARCH="${KERNEL_ARCH}" CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- |
|
70 | 70 | |
|
71 | 71 | # copy RPi0W & RPi3 firmware |
|
72 | 72 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.org.bin |
|
73 | 73 | cp "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.nexmon.bin |
|
74 | 74 | cp -f "${NEXMON_ROOT}"/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43430-sdio.bin |
|
75 | 75 | fi |
|
76 | 76 | |
|
77 | <<<<<<< HEAD | |
|
78 | if [ "$RPI_MODEL" = 3P ] ; then | |
|
79 | ======= | |
|
80 | >>>>>>> af203dbe173e4e5ca755058b3284dc61375ca579 | |
|
81 | 77 | if [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ] ; then |
|
82 | 78 | cd "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon || exit |
|
83 | 79 | sed -i -e 's/all:.*/all: $(RAM_FILE)/g' ${NEXMON_ROOT}/patches/bcm43455c0/7_45_154/nexmon/Makefile |
|
84 | 80 | make clean |
|
85 | 81 | |
|
86 | 82 | # We do this so we don't have to install the ancient isl version into /usr/local/lib on systems. |
|
87 | 83 | LD_LIBRARY_PATH=${NEXMON_ROOT}/buildtools/isl-0.10/.libs make ARCH="${KERNEL_ARCH}" CC="${NEXMON_ROOT}"/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/bin/arm-none-eabi- |
|
88 | 84 | |
|
89 | 85 | # RPi3B+ firmware |
|
90 | 86 | mv "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.org.bin |
|
91 | 87 | cp "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.nexmon.bin |
|
92 | 88 | cp -f "${NEXMON_ROOT}"/patches/bcm43455c0/7_45_154/nexmon/brcmfmac43455-sdio.bin "${WLAN_FIRMWARE_DIR}"/brcmfmac43455-sdio.bin |
|
93 | 89 | fi |
|
94 | 90 | |
|
95 | 91 | #Revert to previous directory |
|
96 | 92 | cd "${WORKDIR}" || exit |
|
97 | 93 | |
|
98 | 94 | # Remove nexmon sources |
|
99 | 95 | rm -fr "${NEXMON_ROOT}" |
|
100 | 96 | |
|
101 | 97 | fi |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant