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