##// END OF EJS Templates
Merge pull request #9 from drtyhlpr/master...
burnbabyburn -
r477:96563fea2919 Fusion
parent child
Show More
@@ -0,0 +1,33
1 SUBSYSTEM=="input", GROUP="input", MODE="0660"
2 SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660"
3 SUBSYSTEM=="spidev", GROUP="spi", MODE="0660"
4 SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660"
5
6 SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660"
7 SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\
8 chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\
9 chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\
10 chown -R root:gpio /sys$devpath && chmod -R 770 /sys$devpath\
11 '"
12
13 KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
14 ALIASES=/proc/device-tree/aliases; \
15 if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
16 echo 0;\
17 elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
18 echo 1; \
19 else \
20 exit 1; \
21 fi\
22 '", SYMLINK+="serial%c"
23
24 KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
25 ALIASES=/proc/device-tree/aliases; \
26 if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
27 echo 0; \
28 elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
29 echo 1; \
30 else \
31 exit 1; \
32 fi \
33 '", SYMLINK+="serial%c"
@@ -0,0 +1,1
1 kernel.printk = 3 4 1 3 No newline at end of file
@@ -0,0 +1,5
1 # Configuration template file used by rpi23-gen-image.sh
2 RPI_MODEL=0
3 RELEASE=buster
4 BUILD_KERNEL=true
5 # ENABLE_BLUETOOTH=false
@@ -0,0 +1,5
1 # Configuration template file used by rpi23-gen-image.sh
2 RPI_MODEL=0
3 RELEASE=stretch
4 BUILD_KERNEL=true
5 # ENABLE_BLUETOOTH=false
@@ -0,0 +1,4
1 # Configuration template file used by rpi23-gen-image.sh
2 RPI_MODEL=1P
3 RELEASE=buster
4 BUILD_KERNEL=true
@@ -0,0 +1,4
1 # Configuration template file used by rpi23-gen-image.sh
2 RPI_MODEL=1P
3 RELEASE=stretch
4 BUILD_KERNEL=true
@@ -0,0 +1,4
1 # Configuration template file used by rpi23-gen-image.sh
2 RPI_MODEL=3
3 RELEASE=buster
4 BUILD_KERNEL=true
@@ -0,0 +1,4
1 # Configuration template file used by rpi23-gen-image.sh
2 RPI_MODEL=2
3 RELEASE=stretch
4 BUILD_KERNEL=true
@@ -0,0 +1,6
1 # Configuration template file used by rpi23-gen-image.sh
2 RPI_MODEL=3P
3 RELEASE=buster
4 BUILD_KERNEL=true
5 # ENABLE_WIRELESS=false
6 # ENABLE_BLUETOOTH=false
@@ -0,0 +1,6
1 # Configuration template file used by rpi23-gen-image.sh
2 RPI_MODEL=3P
3 RELEASE=stretch
4 BUILD_KERNEL=true
5 # ENABLE_WIRELESS=false
6 # ENABLE_BLUETOOTH=false
@@ -1,15 +1,15
1 # rpi23-gen-image
1 # rpi23-gen-image
2 ## Introduction
2 ## Introduction
3 `rpi23-gen-image.sh` is an advanced Debian Linux bootstrapping shell script for generating Debian OS images for Raspberry Pi 2 (RPi2) and Raspberry Pi 3 (RPi3) computers. The script at this time supports the bootstrapping of the Debian (armhf) releases `stretch` and `buster`. Raspberry Pi 3 images are generated for 32-bit mode only. Raspberry Pi 3 64-bit images can be generated using custom configuration parameters (```templates/rpi3-stretch-arm64-4.14.y```).
3 `rpi23-gen-image.sh` is an advanced Debian Linux bootstrapping shell script for generating Debian OS images for all Raspberry Pi computers. The script at this time supports the bootstrapping of the Debian (armhf/armel) releases `stretch` and `buster`. Raspberry Pi 0/1/2/3 images are generated for 32-bit mode only. Raspberry Pi 3 supports 64-bit images that can be generated using custom configuration parameters (```templates/rpi3-stretch-arm64-4.14.y```).
4
4
5 ## Build dependencies
5 ## Build dependencies
6 The following list of Debian packages must be installed on the build system because they are essentially required for the bootstrapping process. The script will check if all required packages are installed and missing packages will be installed automatically if confirmed by the user.
6 The following list of Debian packages must be installed on the build system because they are essentially required for the bootstrapping process. The script will check if all required packages are installed and missing packages will be installed automatically if confirmed by the user.
7
7
8 ```debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo```
8 ```debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo```
9
9
10 It is recommended to configure the `rpi23-gen-image.sh` script to build and install the latest Raspberry Pi Linux kernel. For the RPi3 this is mandatory. Kernel compilation and linking will be performed on the build system using an ARM (armhf) cross-compiler toolchain.
10 It is recommended to configure the `rpi23-gen-image.sh` script to build and install the latest Raspberry Pi Linux kernel. For the Raspberry 3 this is mandatory. Kernel compilation and linking will be performed on the build system using an ARM (armhf/armel) cross-compiler toolchain.
11
11
12 The script has been tested using the default `crossbuild-essential-armhf` toolchain meta package on Debian Linux `stretch` build systems. Please check the [Debian CrossToolchains Wiki](https://wiki.debian.org/CrossToolchains) for further information.
12 The script has been tested using the default `crossbuild-essential-armhf` and `crossbuild-essential-armel` toolchain meta packages on Debian Linux `stretch` build systems. Please check the [Debian CrossToolchains Wiki](https://wiki.debian.org/CrossToolchains) for further information.
13
13
14 ## Command-line parameters
14 ## Command-line parameters
15 The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi23-gen-image.sh` script via (simple) shell-variables. Unlike environment shell-variables (simple) shell-variables are defined at the beginning of the command-line call of the `rpi23-gen-image.sh` script.
15 The script accepts certain command-line parameters to enable or disable specific OS features, services and configuration settings. These parameters are passed to the `rpi23-gen-image.sh` script via (simple) shell-variables. Unlike environment shell-variables (simple) shell-variables are defined at the beginning of the command-line call of the `rpi23-gen-image.sh` script.
@@ -49,27 +49,25 Set Debian packages server address. Choose a server from the list of Debian worl
49 Set Proxy server address. Using a local Proxy-Cache like `apt-cacher-ng` will speed-up the bootstrapping process because all required Debian packages will only be downloaded from the Debian mirror site once. If `apt-cacher-ng` is running on default `http://127.0.0.1:3142` it is autodetected and you don't need to set this.
49 Set Proxy server address. Using a local Proxy-Cache like `apt-cacher-ng` will speed-up the bootstrapping process because all required Debian packages will only be downloaded from the Debian mirror site once. If `apt-cacher-ng` is running on default `http://127.0.0.1:3142` it is autodetected and you don't need to set this.
50
50
51 ##### `APT_INCLUDES`=""
51 ##### `APT_INCLUDES`=""
52 A comma separated list of additional packages to be installed by debootstrap during bootstrapping.
52 A comma-separated list of additional packages to be installed by debootstrap during bootstrapping.
53
53
54 ##### `APT_INCLUDES_LATE`=""
54 ##### `APT_INCLUDES_LATE`=""
55 A comma separated list of additional packages to be installed by apt after bootstrapping and after APT sources are set up. This is useful for packages with pre-depends, which debootstrap do not handle well.
55 A comma-separated list of additional packages to be installed by apt after bootstrapping and after APT sources are set up. This is useful for packages with pre-depends, which debootstrap do not handle well.
56
56
57 ---
57 ---
58
58
59 #### General system settings:
59 #### General system settings:
60 ##### `SET_ARCH`=32
60 ##### `SET_ARCH`=32
61 Set Architecture to default 32bit. If you want to to compile 64bit (RPI3 or RPI3+) set it to `64`. This option will set every needed crosscompiler or boeard specific option for a successful build.
61 Set Architecture to default 32bit. If you want to compile 64-bit (RPI3 or RPI3+) set it to `64`. This option will set every needed cross-compiler or board specific option for a successful build.
62 If you want to change e.g. cross-compiler -> Templates always override defaults
63
62
64 ##### `RPI_MODEL`=2
63 ##### `RPI_MODEL`=2
65 Specifiy the target Raspberry Pi hardware model. The script at this time supports the following Raspberry Pi models:
64 Specify the target Raspberry Pi hardware model. The script at this time supports the following Raspberry Pi models:
66 `0` = Used for Raspberry Pi 0 and Raspberry Pi 0 W
65 - `0` = Raspberry Pi 0 and Raspberry Pi 0 W
67 `1` = Used for Pi 1 model A and B
66 - `1` = Raspberry Pi 1 model A and B
68 `1P` = Used for Pi 1 model B+ and A+
67 - `1P` = Raspberry Pi 1 model B+ and A+
69 `2` = Used for Pi 2 model B
68 - `2` = Raspberry Pi 2 model B
70 `3` = Used for Pi 3 model B
69 - `3` = Raspberry Pi 3 model B
71 `3P` = Used for Pi 3 model B+
70 - `3P` = Raspberry Pi 3 model B+
72 `BUILD_KERNEL`=true will automatically be set if the Raspberry Pi model `3` or `3P` is used.
73
71
74 ##### `RELEASE`="buster"
72 ##### `RELEASE`="buster"
75 Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases `stretch` and `buster`.
73 Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases `stretch` and `buster`.
@@ -78,7 +76,7 Set the desired Debian release name. The script at this time supports the bootst
78 Set the desired Debian release architecture.
76 Set the desired Debian release architecture.
79
77
80 ##### `HOSTNAME`="rpi$RPI_MODEL-$RELEASE"
78 ##### `HOSTNAME`="rpi$RPI_MODEL-$RELEASE"
81 Set system host name. It's recommended that the host name is unique in the corresponding subnet.
79 Set system hostname. It's recommended that the hostname is unique in the corresponding subnet.
82
80
83 ##### `PASSWORD`="raspberry"
81 ##### `PASSWORD`="raspberry"
84 Set system `root` password. It's **STRONGLY** recommended that you choose a custom password.
82 Set system `root` password. It's **STRONGLY** recommended that you choose a custom password.
@@ -118,7 +116,7 Set extra xkb configuration options.
118 ---
116 ---
119
117
120 #### Networking settings (DHCP):
118 #### Networking settings (DHCP):
121 This parameter is used to set up networking auto configuration in `/etc/systemd/network/eth.network`. The default location of network configuration files in the Debian `stretch` release was changed to `/lib/systemd/network`.`
119 This parameter is used to set up networking auto-configuration in `/etc/systemd/network/eth.network`. The default location of network configuration files in the Debian `stretch` release was changed to `/lib/systemd/network`.`
122
120
123 ##### `ENABLE_DHCP`=true
121 ##### `ENABLE_DHCP`=true
124 Set the system to use DHCP. This requires an DHCP server.
122 Set the system to use DHCP. This requires an DHCP server.
@@ -141,7 +139,7 Set the IP address for the first DNS server.
141 Set the IP address for the second DNS server.
139 Set the IP address for the second DNS server.
142
140
143 ##### `NET_DNS_DOMAINS`=""
141 ##### `NET_DNS_DOMAINS`=""
144 Set the default DNS search domains to use for non fully qualified host names.
142 Set the default DNS search domains to use for non fully qualified hostnames.
145
143
146 ##### `NET_NTP_1`=""
144 ##### `NET_NTP_1`=""
147 Set the IP address for the first NTP server.
145 Set the IP address for the first NTP server.
@@ -153,13 +151,25 Set the IP address for the second NTP server.
153
151
154 #### Basic system features:
152 #### Basic system features:
155 ##### `ENABLE_CONSOLE`=true
153 ##### `ENABLE_CONSOLE`=true
156 Enable serial console interface. Recommended if no monitor or keyboard is connected to the RPi2/3. In case of problems fe. if the network (auto) configuration failed - the serial console can be used to access the system.
154 Enable serial console interface. Recommended if no monitor or keyboard is connected to the RPi2/3. In case of problems fe. if the network (auto) configuration failed - the serial console can be used to access the system. On RPI `0` `3` `3P` the CPU speed is locked at lowest speed.
155
156 ##### `ENABLE_PRINTK`=false
157 Enables printing kernel messages to konsole. printk is `3 4 1 3` as in raspbian.
158
159 ##### `ENABLE_BLUETOOTH`=false
160 Enable onboard Bluetooth interface on the RPi0/3/3P. See: [Configuring the GPIO serial port on Raspbian jessie and stretch](https://spellfoundry.com/2016/05/29/configuring-gpio-serial-port-raspbian-jessie-including-pi-3/).
161
162 ##### `ENABLE_MINIUART_OVERLAY`=false
163 Enable Bluetooth to use this. Adds overlay to swap UART0 with UART1. Enabling (slower) Bluetooth and full speed serial console. - RPI `0` `3` `3P` have a fast `hardware UART0` (ttyAMA0) and a `mini UART1` (ttyS0)! RPI `1` `1P` `2` only have a `hardware UART0`. `UART0` is considered better, because is faster and more stable than `mini UART1`. By default the Bluetooth modem is mapped to the `hardware UART0` and `mini UART` is used for console. The `mini UART` is a problem for the serial console, because its baudrate depends on the CPU frequency, which is changing on runtime. Resulting in a volatile baudrate and thus in an unusable serial console.
164
165 ##### `ENABLE_TURBO`=false
166 Enable Turbo mode. This setting locks cpu at the highest frequency. As setting ENABLE_CONSOLE=true locks RPI to lowest CPU speed, this is can be used additionally to lock cpu hat max speed. Need a good power supply and probably cooling for the Raspberry PI.
157
167
158 ##### `ENABLE_I2C`=false
168 ##### `ENABLE_I2C`=false
159 Enable I2C interface on the RPi2/3. Please check the [RPi2/3 pinout diagrams](https://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins.
169 Enable I2C interface on the RPi 0/1/2/3. Please check the [RPi 0/1/2/3 pinout diagrams](https://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins.
160
170
161 ##### `ENABLE_SPI`=false
171 ##### `ENABLE_SPI`=false
162 Enable SPI interface on the RPi2/3. Please check the [RPi2/3 pinout diagrams](https://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins.
172 Enable SPI interface on the RPi 0/1/2/3. Please check the [RPi 0/1/2/3 pinout diagrams](https://elinux.org/RPi_Low-level_peripherals) to connect the right GPIO pins.
163
173
164 ##### `ENABLE_IPV6`=true
174 ##### `ENABLE_IPV6`=true
165 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
175 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
@@ -174,14 +184,13 Allow the installation of non-free Debian packages that do not comply with the D
174 Download and install the [closed-source firmware binary blob](https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm) that is required to run the internal wireless interface of the Raspberry Pi model `3`. This parameter is ignored if the specified `RPI_MODEL` is not `3`.
184 Download and install the [closed-source firmware binary blob](https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm) that is required to run the internal wireless interface of the Raspberry Pi model `3`. This parameter is ignored if the specified `RPI_MODEL` is not `3`.
175
185
176 ##### `ENABLE_RSYSLOG`=true
186 ##### `ENABLE_RSYSLOG`=true
177 If set to false, disable and uninstall rsyslog (so logs will be available only
187 If set to false, disable and uninstall rsyslog (so logs will be available only in journal files)
178 in journal files)
179
188
180 ##### `ENABLE_SOUND`=true
189 ##### `ENABLE_SOUND`=true
181 Enable sound hardware and install Advanced Linux Sound Architecture.
190 Enable sound hardware and install Advanced Linux Sound Architecture.
182
191
183 ##### `ENABLE_HWRANDOM`=true
192 ##### `ENABLE_HWRANDOM`=true
184 Enable Hardware Random Number Generator. Strong random numbers are important for most network based communications that use encryption. It's recommended to be enabled.
193 Enable Hardware Random Number Generator. Strong random numbers are important for most network-based communications that use encryption. It's recommended to be enabled.
185
194
186 ##### `ENABLE_MINGPU`=false
195 ##### `ENABLE_MINGPU`=false
187 Minimize the amount of shared memory reserved for the GPU. It doesn't seem to be possible to fully disable the GPU.
196 Minimize the amount of shared memory reserved for the GPU. It doesn't seem to be possible to fully disable the GPU.
@@ -193,7 +202,7 Install and enable D-Bus message bus. Please note that systemd should work witho
193 Install Xorg open-source X Window System.
202 Install Xorg open-source X Window System.
194
203
195 ##### `ENABLE_WM`=""
204 ##### `ENABLE_WM`=""
196 Install a user defined window manager for the X Window System. To make sure all X related package dependencies are getting installed `ENABLE_XORG` will automatically get enabled if `ENABLE_WM` is used. The `rpi23-gen-image.sh` script has been tested with the following list of window managers: `blackbox`, `openbox`, `fluxbox`, `jwm`, `dwm`, `xfce4`, `awesome`.
205 Install a user-defined window manager for the X Window System. To make sure all X related package dependencies are getting installed `ENABLE_XORG` will automatically get enabled if `ENABLE_WM` is used. The `rpi23-gen-image.sh` script has been tested with the following list of window managers: `blackbox`, `openbox`, `fluxbox`, `jwm`, `dwm`, `xfce4`, `awesome`.
197
206
198 ##### `ENABLE_SYSVINIT`=false
207 ##### `ENABLE_SYSVINIT`=false
199 Support for halt,init,poweroff,reboot,runlevel,shutdown,telinit commands
208 Support for halt,init,poweroff,reboot,runlevel,shutdown,telinit commands
@@ -208,7 +217,7 Use debootstrap script variant `minbase` which only includes essential packages
208 Reduce the disk space usage by deleting packages and files. See `REDUCE_*` parameters for detailed information.
217 Reduce the disk space usage by deleting packages and files. See `REDUCE_*` parameters for detailed information.
209
218
210 ##### `ENABLE_UBOOT`=false
219 ##### `ENABLE_UBOOT`=false
211 Replace the default RPi2/3 second stage bootloader (bootcode.bin) with [U-Boot bootloader](https://git.denx.de/?p=u-boot.git;a=summary). U-Boot can boot images via the network using the BOOTP/TFTP protocol.
220 Replace the default RPi 0/1/2/3 second stage bootloader (bootcode.bin) with [U-Boot bootloader](https://git.denx.de/?p=u-boot.git;a=summary). U-Boot can boot images via the network using the BOOTP/TFTP protocol.
212
221
213 ##### `UBOOTSRC_DIR`=""
222 ##### `UBOOTSRC_DIR`=""
214 Path to a directory (`u-boot`) of [U-Boot bootloader sources](https://git.denx.de/?p=u-boot.git;a=summary) that will be copied, configured, build and installed inside the chroot.
223 Path to a directory (`u-boot`) of [U-Boot bootloader sources](https://git.denx.de/?p=u-boot.git;a=summary) that will be copied, configured, build and installed inside the chroot.
@@ -220,16 +229,16 Install and enable the [hardware accelerated Xorg video driver](https://github.c
220 Path to a directory (`xf86-video-fbturbo`) of [hardware accelerated Xorg video driver sources](https://github.com/ssvb/xf86-video-fbturbo) that will be copied, configured, build and installed inside the chroot.
229 Path to a directory (`xf86-video-fbturbo`) of [hardware accelerated Xorg video driver sources](https://github.com/ssvb/xf86-video-fbturbo) that will be copied, configured, build and installed inside the chroot.
221
230
222 ##### `ENABLE_VIDEOCORE`=false
231 ##### `ENABLE_VIDEOCORE`=false
223 Install and enable the [Source code for ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) `vcgencmd`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling.
232 Install and enable the [ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) `vcgencmd`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling.
224
233
225 ##### `VIDEOCORESRC_DIR`=""
234 ##### `VIDEOCORESRC_DIR`=""
226 Path to a directory (`userland`) of [Source code for ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) that will be copied, configured, build and installed inside the chroot.
235 Path to a directory (`userland`) of [ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) that will be copied, configured, build and installed inside the chroot.
227
236
228 ##### `ENABLE_IPTABLES`=false
237 ##### `ENABLE_IPTABLES`=false
229 Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service.
238 Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service.
230
239
231 ##### `ENABLE_USER`=true
240 ##### `ENABLE_USER`=true
232 Create non-root user with password `USER_PASSWORD`=raspberry. Unless overridden with `USER_NAME`=user, username will be `pi`.
241 Create non-root user with password `USER_PASSWORD`=raspberry. Unless overridden with `USER_NAME`=user, the username will be `pi`.
233
242
234 ##### `USER_NAME`=pi
243 ##### `USER_NAME`=pi
235 Non-root user to create. Ignored if `ENABLE_USER`=false
244 Non-root user to create. Ignored if `ENABLE_USER`=false
@@ -259,10 +268,10 Disable RPi2/3 under-voltage warnings and overlays. Setting the parameter to `1`
259
268
260 #### SSH settings:
269 #### SSH settings:
261 ##### `SSH_ENABLE_ROOT`=false
270 ##### `SSH_ENABLE_ROOT`=false
262 Enable password root login via SSH. This may be a security risk with default password, use only in trusted environments. `ENABLE_ROOT` must be set to `true`.
271 Enable password-based root login via SSH. This may be a security risk with the default password set, use only in trusted environments. `ENABLE_ROOT` must be set to `true`.
263
272
264 ##### `SSH_DISABLE_PASSWORD_AUTH`=false
273 ##### `SSH_DISABLE_PASSWORD_AUTH`=false
265 Disable password based SSH authentication. Only public key based SSH (v2) authentication will be supported.
274 Disable password-based SSH authentication. Only public key based SSH (v2) authentication will be supported.
266
275
267 ##### `SSH_LIMIT_USERS`=false
276 ##### `SSH_LIMIT_USERS`=false
268 Limit the users that are allowed to login via SSH. Only allow user `USER_NAME`=pi and root if `SSH_ENABLE_ROOT`=true to login. This parameter will be ignored if `dropbear` SSH is used (`REDUCE_SSHD`=true).
277 Limit the users that are allowed to login via SSH. Only allow user `USER_NAME`=pi and root if `SSH_ENABLE_ROOT`=true to login. This parameter will be ignored if `dropbear` SSH is used (`REDUCE_SSHD`=true).
@@ -277,10 +286,10 Add SSH (v2) public key(s) from specified file to `authorized_keys` file to enab
277
286
278 #### Kernel compilation:
287 #### Kernel compilation:
279 ##### `BUILD_KERNEL`=true
288 ##### `BUILD_KERNEL`=true
280 Build and install the latest RPi2/3 Linux kernel. Currently only the default RPi2/3 kernel configuration is used.
289 Build and install the latest RPi 0/1/2/3 Linux kernel. Currently only the default RPi 0/1/2/3 kernel configuration is used.
281
290
282 ##### `CROSS_COMPILE`="arm-linux-gnueabihf-"
291 ##### `CROSS_COMPILE`="arm-linux-gnueabihf-"
283 This sets the cross compile enviornment for the compiler.
292 This sets the cross-compile environment for the compiler.
284
293
285 ##### `KERNEL_ARCH`="arm"
294 ##### `KERNEL_ARCH`="arm"
286 This sets the kernel architecture for the compiler.
295 This sets the kernel architecture for the compiler.
@@ -298,13 +307,13 Sets the QEMU enviornment for the Debian archive. If not set, `QEMU_BINARY` will
298 Sets the default config for kernel compiling. If not set, `KERNEL_DEFCONFIG` will be set to "bcmrpi3\_defconfig" automatically if building for arm64.
307 Sets the default config for kernel compiling. If not set, `KERNEL_DEFCONFIG` will be set to "bcmrpi3\_defconfig" automatically if building for arm64.
299
308
300 ##### `KERNEL_REDUCE`=false
309 ##### `KERNEL_REDUCE`=false
301 Reduce the size of the generated kernel by removing unwanted device, network and filesystem drivers (experimental).
310 Reduce the size of the generated kernel by removing unwanted devices, network and filesystem drivers (experimental).
302
311
303 ##### `KERNEL_THREADS`=1
312 ##### `KERNEL_THREADS`=1
304 Number of parallel kernel building threads. If the parameter is left untouched the script will automatically determine the number of CPU cores to set the number of parallel threads to speed the kernel compilation.
313 Number of parallel kernel building threads. If the parameter is left untouched the script will automatically determine the number of CPU cores to set the number of parallel threads to speed the kernel compilation.
305
314
306 ##### `KERNEL_HEADERS`=true
315 ##### `KERNEL_HEADERS`=true
307 Install kernel headers with built kernel.
316 Install kernel headers with the built kernel.
308
317
309 ##### `KERNEL_MENUCONFIG`=false
318 ##### `KERNEL_MENUCONFIG`=false
310 Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated.
319 Start `make menuconfig` interactive menu-driven kernel configuration. The script will continue after `make menuconfig` was terminated.
@@ -400,9 +409,9 The functions of this script that are required for the different stages of the b
400 | `10-bootstrap.sh` | Debootstrap basic system |
409 | `10-bootstrap.sh` | Debootstrap basic system |
401 | `11-apt.sh` | Setup APT repositories |
410 | `11-apt.sh` | Setup APT repositories |
402 | `12-locale.sh` | Setup Locales and keyboard settings |
411 | `12-locale.sh` | Setup Locales and keyboard settings |
403 | `13-kernel.sh` | Build and install RPi2/3 Kernel |
412 | `13-kernel.sh` | Build and install RPi 0/1/2/3 Kernel |
404 | `14-fstab.sh` | Setup fstab and initramfs |
413 | `14-fstab.sh` | Setup fstab and initramfs |
405 | `15-rpi-config.sh` | Setup RPi2/3 config and cmdline |
414 | `15-rpi-config.sh` | Setup RPi 0/1/2/3 config and cmdline |
406 | `20-networking.sh` | Setup Networking |
415 | `20-networking.sh` | Setup Networking |
407 | `21-firewall.sh` | Setup Firewall |
416 | `21-firewall.sh` | Setup Firewall |
408 | `30-security.sh` | Setup Users and Security settings |
417 | `30-security.sh` | Setup Users and Security settings |
@@ -410,6 +419,7 The functions of this script that are required for the different stages of the b
410 | `32-sshd.sh` | Setup SSH and public keys |
419 | `32-sshd.sh` | Setup SSH and public keys |
411 | `41-uboot.sh` | Build and Setup U-Boot |
420 | `41-uboot.sh` | Build and Setup U-Boot |
412 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
421 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
422 | `43-videocore.sh` | Build and Setup videocore libraries |
413 | `50-firstboot.sh` | First boot actions |
423 | `50-firstboot.sh` | First boot actions |
414 | `99-reduce.sh` | Reduce the disk space usage |
424 | `99-reduce.sh` | Reduce the disk space usage |
415
425
@@ -418,7 +428,7 All the required configuration files that will be copied to the generated OS ima
418 | Directory | Description |
428 | Directory | Description |
419 | --- | --- |
429 | --- | --- |
420 | `apt` | APT management configuration files |
430 | `apt` | APT management configuration files |
421 | `boot` | Boot and RPi2/3 configuration files |
431 | `boot` | Boot and RPi 0/1/2/3 configuration files |
422 | `dpkg` | Package Manager configuration |
432 | `dpkg` | Package Manager configuration |
423 | `etc` | Configuration files and rc scripts |
433 | `etc` | Configuration files and rc scripts |
424 | `firstboot` | Scripts that get executed on first boot |
434 | `firstboot` | Scripts that get executed on first boot |
@@ -444,7 +454,7 script -c 'APT_SERVER=ftp.de.debian.org ./rpi23-gen-image.sh' ./build.log
444 ```
454 ```
445
455
446 ## Flashing the image file
456 ## Flashing the image file
447 After the image file was successfully created by the `rpi23-gen-image.sh` script it can be copied to the microSD card that will be used by the RPi2/3 computer. This can be performed by using the tools `bmaptool` or `dd`. Using `bmaptool` will probably speed-up the copy process because `bmaptool` copies more wisely than `dd`.
457 After the image file was successfully created by the `rpi23-gen-image.sh` script it can be copied to the microSD card that will be used by the RPi 0/1/2/3 computer. This can be performed by using the tools `bmaptool` or `dd`. Using `bmaptool` will probably speed-up the copy process because `bmaptool` copies more wisely than `dd`.
448
458
449 ##### Flashing examples:
459 ##### Flashing examples:
450 ```shell
460 ```shell
@@ -28,10 +28,10 if [ "$(echo "$APT_INCLUDES" | grep ",locales")" ] ; then
28 chroot_exec update-locale LANG="${DEFLOCAL}"
28 chroot_exec update-locale LANG="${DEFLOCAL}"
29
29
30 # Install and setup default keyboard configuration
30 # Install and setup default keyboard configuration
31 if [ "$XKB_MODEL" != "pc105" ] ; then
31 if [ "$XKB_MODEL" != "" ] ; then
32 sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "${ETC_DIR}/default/keyboard"
32 sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "${ETC_DIR}/default/keyboard"
33 fi
33 fi
34 if [ "$XKB_LAYOUT" != "us" ] ; then
34 if [ "$XKB_LAYOUT" != "" ] ; then
35 sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "${ETC_DIR}/default/keyboard"
35 sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "${ETC_DIR}/default/keyboard"
36 fi
36 fi
37 if [ "$XKB_VARIANT" != "" ] ; then
37 if [ "$XKB_VARIANT" != "" ] ; then
@@ -108,7 +108,7 if [ "$BUILD_KERNEL" = true ] ; then
108 echo "CONFIG_CRYPTO_XTS=y"
108 echo "CONFIG_CRYPTO_XTS=y"
109 echo "CONFIG_CRYPTO_SHA512=y"
109 echo "CONFIG_CRYPTO_SHA512=y"
110 echo "CONFIG_CRYPTO_MANAGER=y"
110 echo "CONFIG_CRYPTO_MANAGER=y"
111 } >> ${KERNEL_DIR}/.config
111 } >> "${KERNEL_DIR}"/.config
112 fi
112 fi
113 fi
113 fi
114
114
@@ -139,7 +139,7 if [ "$BUILD_KERNEL" = true ] ; then
139 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs
139 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs
140
140
141 # Cross compile kernel modules
141 # Cross compile kernel modules
142 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
142 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
143 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules
143 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules
144 fi
144 fi
145 fi
145 fi
@@ -153,16 +153,16 if [ "$BUILD_KERNEL" = true ] ; then
153
153
154 # Install kernel modules
154 # Install kernel modules
155 if [ "$ENABLE_REDUCE" = true ] ; then
155 if [ "$ENABLE_REDUCE" = true ] ; then
156 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
156 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
157 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
157 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
158 fi
158 fi
159 else
159 else
160 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
160 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
161 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
161 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
162 fi
162 fi
163
163
164 # Install kernel firmware
164 # Install kernel firmware
165 if [ "$(grep "^firmware_install:" "${KERNEL_DIR}/Makefile")" ] ; then
165 if grep -q "^firmware_install:" "${KERNEL_DIR}/Makefile" ; then
166 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
166 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
167 fi
167 fi
168 fi
168 fi
@@ -225,8 +225,8 if [ "$BUILD_KERNEL" = true ] ; then
225 rm -fr "${KERNEL_DIR}"
225 rm -fr "${KERNEL_DIR}"
226 else
226 else
227 # Prepare compiled kernel modules
227 # Prepare compiled kernel modules
228 if [ "$(grep "CONFIG_MODULES=y" "${KERNEL_DIR}/.config")" ] ; then
228 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
229 if [ "$(grep "^modules_prepare:" "${KERNEL_DIR}/Makefile")" ] ; then
229 if grep -q "^modules_prepare:" "${KERNEL_DIR}/Makefile" ; then
230 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare
230 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare
231 fi
231 fi
232
232
@@ -56,9 +56,100 if [ "$ENABLE_CRYPTFS" = true ] ; then
56 fi
56 fi
57 fi
57 fi
58
58
59 # Add serial console support
59 #locks cpu at max frequency
60 if [ "$ENABLE_TURBO" = true ] ; then
61 echo "force_turbo=1" >> "${BOOT_DIR}/config.txt"
62 fi
63
64 if [ "$ENABLE_PRINTK" = true ] ; then
65 install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf"
66 fi
67
68 # Install udev rule for serial alias
69 install_readonly files/etc/99-com.rules "${LIB_DIR}/udev/rules.d/99-com.rules"
70
71 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
72
73 # RPI0,3,3P Use default ttyS0 (mini-UART)as serial interface
74 SET_SERIAL="ttyS0"
75
76 # Bluetooth enabled
77 if [ "$ENABLE_BLUETOOTH" = true ] ; then
78 # Create temporary directory for Bluetooth sources
79 temp_dir=$(as_nobody mktemp -d)
80
81 # Fetch Bluetooth sources
82 as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}"
83
84 # Copy downloaded sources
85 mv "${temp_dir}/pi-bluetooth" "${R}/tmp/"
86
87 # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/
88 as_nobody wget -q -O "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" https://aur.archlinux.org/cgit/aur.git/plain/LICENCE.broadcom_bcm43xx?h=pi-bluetooth
89 as_nobody wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth
90
91 # Set permissions
92 chown -R root:root "${R}/tmp/pi-bluetooth"
93
94 # Install tools
95 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart"
96 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper"
97
98 # Install bluetooth udev rule
99 install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules"
100
101 # Install Firmware Flash file and apropiate licence
102 mkdir -p "$BLUETOOTH_FIRMWARE_DIR"
103 install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
104 install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${BLUETOOTH_FIRMWARE_DIR}/LICENCE.broadcom_bcm43xx"
105 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service"
106 install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service"
107
108 # Remove temporary directory
109 rm -fr "${temp_dir}"
110
111 # Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore UART0/ttyAMA0 over GPIOs 14 & 15. Slow Bluetooth and slow cpu. Use /dev/ttyS0 instead of /dev/ttyAMA0
112 if [ "$ENABLE_MINIUART_OVERLAY" = true ] ; then
113 SET_SERIAL="ttyAMA0"
114
115 # set overlay to swap ttyAMA0 and ttyS0
116 echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt"
117
118 # if force_turbo didn't lock cpu at high speed, lock it at low speed (XOR logic) or miniuart will be broken
119 if [ "$ENABLE_TURBO" = false ] ; then
120 echo "core_freq=250" >> "${BOOT_DIR}/config.txt"
121 fi
122
123 # Activate services
124 chroot_exec systemctl enable pi-bluetooth.hciuart.service
125 #chroot_exec systemctl enable pi-bluetooth.bthelper@.service
126 else
127 chroot_exec systemctl enable pi-bluetooth.hciuart.service
128 #chroot_exec systemctl enable pi-bluetooth.bthelper@.service
129 fi
130
131 else # if ENABLE_BLUETOOTH = false
132 # set overlay to disable bluetooth
133 echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt"
134 fi # ENABLE_BLUETOOTH end
135
136 else
137 # RPI1,1P,2 Use default ttyAMA0 (full UART) as serial interface
138 SET_SERIAL="ttyAMA0"
139 fi
140
141 # may need sudo systemctl disable hciuart
60 if [ "$ENABLE_CONSOLE" = true ] ; then
142 if [ "$ENABLE_CONSOLE" = true ] ; then
61 CMDLINE="${CMDLINE} console=ttyAMA0,115200 kgdboc=ttyAMA0,115200"
143 echo "enable_uart=1" >> "${BOOT_DIR}/config.txt"
144 # add string to cmdline
145 CMDLINE="${CMDLINE} console=serial0,115200"
146
147 # Enable serial console systemd style
148 chroot_exec systemctl enable serial-getty\@"$SET_SERIAL".service
149 else
150 echo "enable_uart=0" >> "${BOOT_DIR}/config.txt"
151 # disable serial console systemd style
152 chroot_exec systemctl disable serial-getty\@"$SET_SERIAL".service
62 fi
153 fi
63
154
64 # Remove IPv6 networking support
155 # Remove IPv6 networking support
@@ -89,42 +180,6 if [ "$ENABLE_INITRAMFS" = true ] ; then
89 echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt"
180 echo "initramfs initramfs-${KERNEL_VERSION} followkernel" >> "${BOOT_DIR}/config.txt"
90 fi
181 fi
91
182
92 # Disable RPi3 Bluetooth and restore ttyAMA0 serial device
93 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
94 if [ "$ENABLE_CONSOLE" = true ] && [ "$ENABLE_UBOOT" = false ] ; then
95 echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt"
96 echo "enable_uart=1" >> "${BOOT_DIR}/config.txt"
97 else
98 # Create temporary directory for Bluetooth sources
99 temp_dir=$(as_nobody mktemp -d)
100
101 # Fetch Bluetooth sources
102 as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}"
103
104 # Copy downloaded sources
105 mv "${temp_dir}/pi-bluetooth" "${R}/tmp/"
106
107 # Set permissions
108 chown -R root:root "${R}/tmp/pi-bluetooth"
109
110 # Install tools
111 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart"
112 install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper"
113
114 # Install bluetooth udev rule
115 install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules"
116
117 # Install Firmware Flash file and apropiate licence
118 mkdir "${ETC_DIR}/firmware/"
119
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 wget -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth
122
123 # Get /dev/serial back for compability
124 wget -O "${ETC_DIR}/udev/rules.d/99-com.rules" https://raw.githubusercontent.com/RPi-Distro/raspberrypi-sys-mods/master/etc.armhf/udev/rules.d/99-com.rules
125 fi
126 fi
127
128 # Create firmware configuration and cmdline symlinks
183 # Create firmware configuration and cmdline symlinks
129 ln -sf firmware/config.txt "${R}/boot/config.txt"
184 ln -sf firmware/config.txt "${R}/boot/config.txt"
130 ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt"
185 ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt"
@@ -107,28 +107,26 if [ "$ENABLE_WIRELESS" = true ] ; then
107 as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.bin"
107 as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.bin"
108 as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.txt"
108 as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.txt"
109 as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.clm_blob" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.clm_blob"
109 as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.clm_blob" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.clm_blob"
110
111 # Move downloaded firmware binary blob
112 mv "${temp_dir}/brcmfmac43455-sdio."* "${WLAN_FIRMWARE_DIR}/"
113
114 # Set permissions of the firmware binary blob
115 chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."*
116 chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."*
110 elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then
117 elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then
111 # Fetch firmware binary blob for RPi3
118 # Fetch firmware binary blob for RPi3
112 as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin"
119 as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin"
113 as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt"
120 as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt"
114 fi
121
115
122 # Move downloaded firmware binary blob
116 # Move downloaded firmware binary blob
123 mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/"
117 if [ "$RPI_MODEL" = 3P ] ; then
124
118 mv "${temp_dir}/brcmfmac43455-sdio."* "${WLAN_FIRMWARE_DIR}/"
125 # Set permissions of the firmware binary blob
119 elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then
126 chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."*
120 mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/"
127 chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."*
121 fi
128 fi
122
129
123 # Remove temporary directory for firmware binary blob
130 # Remove temporary directory for firmware binary blob
124 rm -fr "${temp_dir}"
131 rm -fr "${temp_dir}"
125
126 # Set permissions of the firmware binary blob
127 if [ "$RPI_MODEL" = 3P ] ; then
128 chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."*
129 chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."*
130 elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then
131 chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."*
132 chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."*
133 fi
134 fi
132 fi
@@ -11,8 +11,8 ENCRYPTED_USER_PASSWORD=$(mkpasswd -m sha-512 "${USER_PASSWORD}")
11
11
12 # Setup default user
12 # Setup default user
13 if [ "$ENABLE_USER" = true ] ; then
13 if [ "$ENABLE_USER" = true ] ; then
14 chroot_exec adduser --gecos $USER_NAME --add_extra_groups --disabled-password $USER_NAME
14 chroot_exec adduser --gecos "$USER_NAME" --add_extra_groups --disabled-password "$USER_NAME"
15 chroot_exec usermod -a -G sudo -p "${ENCRYPTED_USER_PASSWORD}" $USER_NAME
15 chroot_exec usermod -a -G sudo -p "${ENCRYPTED_USER_PASSWORD}" "$USER_NAME"
16 fi
16 fi
17
17
18 # Setup root password or not
18 # Setup root password or not
@@ -41,7 +41,7 if [ "$ENABLE_UBOOT" = true ] ; then
41
41
42 # Install and setup U-Boot command file
42 # Install and setup U-Boot command file
43 install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage"
43 install_readonly files/boot/uboot.mkimage "${BOOT_DIR}/uboot.mkimage"
44 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
44 printf "# Set the kernel boot command line\nsetenv bootargs \"earlyprintk ${CMDLINE}\"\n\n$(cat "${BOOT_DIR}"/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
45
45
46 if [ "$ENABLE_INITRAMFS" = true ] ; then
46 if [ "$ENABLE_INITRAMFS" = true ] ; then
47 # Convert generated initramfs for U-Boot using mkimage
47 # Convert generated initramfs for U-Boot using mkimage
@@ -51,7 +51,7 if [ "$ENABLE_UBOOT" = true ] ; then
51 rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}"
51 rm -f "${BOOT_DIR}/initramfs-${KERNEL_VERSION}"
52
52
53 # Configure U-Boot to load generated initramfs
53 # Configure U-Boot to load generated initramfs
54 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat ${BOOT_DIR}/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
54 printf "# Set initramfs file\nsetenv initramfs initramfs-${KERNEL_VERSION}.uboot\n\n$(cat "${BOOT_DIR}"/uboot.mkimage)" > "${BOOT_DIR}/uboot.mkimage"
55 printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
55 printf "\nbootz \${kernel_addr_r} \${ramdisk_addr_r} \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
56 else # ENABLE_INITRAMFS=false
56 else # ENABLE_INITRAMFS=false
57 # Remove initramfs from U-Boot mkfile
57 # Remove initramfs from U-Boot mkfile
@@ -65,19 +65,21 if [ "$ENABLE_UBOOT" = true ] ; then
65 printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
65 printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage"
66 fi
66 fi
67 fi
67 fi
68
69 if [ "$KERNEL_ARCH" = "arm64" ] ; then
70 echo "Setting up config.txt to boot 64bit uboot"
71
72 printf "\n# 64bit-mode" >> "${BOOT_DIR}/config.txt"
73 printf "\n# arm_control=0x200 is deprecated https://www.raspberrypi.org/documentation/configuration/config-txt/misc.md" >> "${BOOT_DIR}/config.txt"
74 printf "\narm_64bit=1" >> "${BOOT_DIR}/config.txt"
75
68
69 if [ "$SET_ARCH" = 64 ] ; then
70 echo "Setting up config.txt to boot 64bit uboot"
71 {
72 printf "\n# 64bit-mode"
73 printf "\n# arm_control=0x200 is deprecated https://www.raspberrypi.org/documentation/configuration/config-txt/misc.md"
74 printf "\narm_64bit=1"
75 } >> "${BOOT_DIR}/config.txt"
76
77 #in 64bit uboot booti is used instead of bootz [like in KERNEL_BIN_IMAGE=zImage (armv7)|| Image(armv8)]
76 sed -i "s|bootz|booti|g" "${BOOT_DIR}/uboot.mkimage"
78 sed -i "s|bootz|booti|g" "${BOOT_DIR}/uboot.mkimage"
77 fi
79 fi
78
80
79 # Set mkfile to use the correct dtb file
81 # Set mkfile to use the correct dtb file
80 sed -i "s/^\(setenv dtbfile \).*/\1${DTB_FILE}/" "${BOOT_DIR}/uboot.mkimage"
82 sed -i "s|bcm2709-rpi-2-b.dtb|${DTB_FILE}|" "${BOOT_DIR}/uboot.mkimage"
81
83
82 # Set mkfile to use the correct mach id
84 # Set mkfile to use the correct mach id
83 if [ "$ENABLE_QEMU" = true ] ; then
85 if [ "$ENABLE_QEMU" = true ] ; then
@@ -85,7 +87,7 if [ "$ENABLE_UBOOT" = true ] ; then
85 fi
87 fi
86
88
87 # Set mkfile to use kernel image
89 # Set mkfile to use kernel image
88 sed -i "s/^\(fatload mmc 0:1 \${kernel_addr_r} \).*/\1${KERNEL_IMAGE}/" "${BOOT_DIR}/uboot.mkimage"
90 sed -i "s|kernel7.img|${KERNEL_IMAGE}|" "${BOOT_DIR}/uboot.mkimage"
89
91
90 # Remove all leading blank lines
92 # Remove all leading blank lines
91 sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage"
93 sed -i "/./,\$!d" "${BOOT_DIR}/uboot.mkimage"
@@ -8,16 +8,16
8 if [ "$ENABLE_VIDEOCORE" = true ] ; then
8 if [ "$ENABLE_VIDEOCORE" = true ] ; then
9 # Copy existing videocore sources into chroot directory
9 # Copy existing videocore sources into chroot directory
10 if [ -n "$VIDEOCORESRC_DIR" ] && [ -d "$VIDEOCORESRC_DIR" ] ; then
10 if [ -n "$VIDEOCORESRC_DIR" ] && [ -d "$VIDEOCORESRC_DIR" ] ; then
11 # Copy local U-Boot sources
11 # Copy local videocore sources
12 cp -r "${VIDEOCORESRC_DIR}" "${R}/tmp/userland"
12 cp -r "${VIDEOCORESRC_DIR}" "${R}/tmp/userland"
13 else
13 else
14 # Create temporary directory for U-Boot sources
14 # Create temporary directory for videocore sources
15 temp_dir=$(as_nobody mktemp -d)
15 temp_dir=$(as_nobody mktemp -d)
16
16
17 # Fetch U-Boot sources
17 # Fetch videocore sources
18 as_nobody git -C "${temp_dir}" clone "${VIDEOCORE_URL}"
18 as_nobody git -C "${temp_dir}" clone "${VIDEOCORE_URL}"
19
19
20 # Copy downloaded U-Boot sources
20 # Copy downloaded videocore sources
21 mv "${temp_dir}/userland" "${R}/tmp/"
21 mv "${temp_dir}/userland" "${R}/tmp/"
22
22
23 # Set permissions of the U-Boot sources
23 # Set permissions of the U-Boot sources
@@ -31,7 +31,7 if [ "$ENABLE_VIDEOCORE" = true ] ; then
31 mkdir "${R}"/tmp/userland/build
31 mkdir "${R}"/tmp/userland/build
32
32
33 # push us to build directory
33 # push us to build directory
34 pushd "${R}"/tmp/userland/build
34 cd "${R}"/tmp/userland/build
35
35
36 if [ "$RELEASE_ARCH" = "arm64" ] ; then
36 if [ "$RELEASE_ARCH" = "arm64" ] ; then
37 cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DARM64=ON -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_ASM_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland"
37 cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DARM64=ON -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_ASM_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland"
@@ -48,6 +48,6 if [ "$ENABLE_VIDEOCORE" = true ] ; then
48 #build userland
48 #build userland
49 make -j "$(nproc)"
49 make -j "$(nproc)"
50
50
51 #pop us out of build dir
51 #back to root of scriptdir
52 popd
52 cd "${WORKDIR}"
53 fi
53 fi
@@ -30,22 +30,22 cleanup (){
30
30
31 chroot_exec() {
31 chroot_exec() {
32 # Exec command in chroot
32 # Exec command in chroot
33 LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot ${R} $*
33 LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot "${R}" "$@"
34 }
34 }
35
35
36 as_nobody() {
36 as_nobody() {
37 # Exec command as user nobody
37 # Exec command as user nobody
38 sudo -E -u nobody LANG=C LC_ALL=C $*
38 sudo -E -u nobody LANG=C LC_ALL=C "$@"
39 }
39 }
40
40
41 install_readonly() {
41 install_readonly() {
42 # Install file with user read-only permissions
42 # Install file with user read-only permissions
43 install -o root -g root -m 644 $*
43 install -o root -g root -m 644 "$@"
44 }
44 }
45
45
46 install_exec() {
46 install_exec() {
47 # Install file with root exec permissions
47 # Install file with root exec permissions
48 install -o root -g root -m 744 $*
48 install -o root -g root -m 744 "$@"
49 }
49 }
50
50
51 use_template () {
51 use_template () {
@@ -64,14 +64,14 chroot_install_cc() {
64 if [ -z "${COMPILER_PACKAGES}" ] ; then
64 if [ -z "${COMPILER_PACKAGES}" ] ; then
65 COMPILER_PACKAGES=$(chroot_exec apt-get -s install g++ make bc | grep "^Inst " | awk -v ORS=" " '{ print $2 }')
65 COMPILER_PACKAGES=$(chroot_exec apt-get -s install g++ make bc | grep "^Inst " | awk -v ORS=" " '{ print $2 }')
66 # Install COMPILER_PACKAGES in chroot
66 # Install COMPILER_PACKAGES in chroot
67 chroot_exec apt-get -q -y --allow-unauthenticated --no-install-recommends install ${COMPILER_PACKAGES}
67 chroot_exec apt-get -q -y --allow-unauthenticated --no-install-recommends install "${COMPILER_PACKAGES}"
68 fi
68 fi
69 }
69 }
70
70
71 chroot_remove_cc() {
71 chroot_remove_cc() {
72 # Remove c/c++ build environment from the chroot
72 # Remove c/c++ build environment from the chroot
73 if [ ! -z "${COMPILER_PACKAGES}" ] ; then
73 if [ -n "${COMPILER_PACKAGES}" ] ; then
74 chroot_exec apt-get -qq -y --auto-remove purge ${COMPILER_PACKAGES}
74 chroot_exec apt-get -qq -y --auto-remove purge "${COMPILER_PACKAGES}"
75 COMPILER_PACKAGES=""
75 COMPILER_PACKAGES=""
76 fi
76 fi
77 }
77 }
@@ -2,7 +2,7
2 ########################################################################
2 ########################################################################
3 # rpi23-gen-image.sh 2015-2017
3 # rpi23-gen-image.sh 2015-2017
4 #
4 #
5 # Advanced Debian "stretch" and "buster" bootstrap script for RPi2/3
5 # Advanced Debian "stretch" and "buster" bootstrap script for Raspberry Pi
6 #
6 #
7 # This program is free software; you can redistribute it and/or
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
8 # modify it under the terms of the GNU General Public License
@@ -36,7 +36,7 fi
36
36
37 # Introduce settings
37 # Introduce settings
38 set -e
38 set -e
39 echo -n -e "\n#\n# RPi2/3 Bootstrap Settings\n#\n"
39 echo -n -e "\n#\n# RPi 0/1/2/3 Bootstrap Settings\n#\n"
40 set -x
40 set -x
41
41
42 # Raspberry Pi model configuration
42 # Raspberry Pi model configuration
@@ -59,7 +59,8 VIDEOCORE_URL=${VIDEOCORE_URL:=https://github.com/raspberrypi/userland}
59 BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git}
59 BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git}
60
60
61 # Build directories
61 # Build directories
62 BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}}
62 WORKDIR=$(pwd)
63 BASEDIR=${BASEDIR:=${WORKDIR}/images/${RELEASE}}
63 BUILDDIR="${BASEDIR}/build"
64 BUILDDIR="${BASEDIR}/build"
64
65
65 # Chroot directories
66 # Chroot directories
@@ -69,6 +70,7 LIB_DIR="${R}/lib"
69 BOOT_DIR="${R}/boot/firmware"
70 BOOT_DIR="${R}/boot/firmware"
70 KERNEL_DIR="${R}/usr/src/linux"
71 KERNEL_DIR="${R}/usr/src/linux"
71 WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm"
72 WLAN_FIRMWARE_DIR="${LIB_DIR}/firmware/brcm"
73 BLUETOOTH_FIRMWARE_DIR="${ETC_DIR}/firmware/bt"
72
74
73 # Firmware directory: Blank if download from github
75 # Firmware directory: Blank if download from github
74 RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}
76 RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""}
@@ -105,6 +107,9 APT_PROXY=${APT_PROXY:=""}
105 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
107 APT_SERVER=${APT_SERVER:="ftp.debian.org"}
106
108
107 # Feature settings
109 # Feature settings
110 ENABLE_PRINTK=${ENABLE_PRINTK:=false}
111 ENABLE_BLUETOOTH=${ENABLE_BLUETOOTH:=false}
112 ENABLE_MINIUART_OVERLAY=${ENABLE_MINIUART_OVERLAY:=false}
108 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
113 ENABLE_CONSOLE=${ENABLE_CONSOLE:=true}
109 ENABLE_I2C=${ENABLE_I2C:=false}
114 ENABLE_I2C=${ENABLE_I2C:=false}
110 ENABLE_SPI=${ENABLE_SPI:=false}
115 ENABLE_SPI=${ENABLE_SPI:=false}
@@ -186,7 +191,7 CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""}
186
191
187 # Packages required in the chroot build environment
192 # Packages required in the chroot build environment
188 APT_INCLUDES=${APT_INCLUDES:=""}
193 APT_INCLUDES=${APT_INCLUDES:=""}
189 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup"
194 APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils,locales,keyboard-configuration,console-setup,libnss-systemd"
190
195
191 # Packages to exclude from chroot build environment
196 # Packages to exclude from chroot build environment
192 APT_EXCLUDES=${APT_EXCLUDES:=""}
197 APT_EXCLUDES=${APT_EXCLUDES:=""}
@@ -200,16 +205,22 COMPILER_PACKAGES=""
200
205
201 set +x
206 set +x
202
207
208 #Check if apt-cacher-ng has port 3142 open and set APT_PROXY
209 APT_CACHER_RUNNING=$(lsof -i :3142 | grep apt-cacher-ng | cut -d ' ' -f3 | uniq)
210 if [ -n "${APT_CACHER_RUNNING}" ] ; then
211 APT_PROXY=http://127.0.0.1:3142/
212 fi
213
203 # Setup architecture specific settings
214 # Setup architecture specific settings
204 if [ -n "$SET_ARCH" ] ; then
215 if [ -n "$SET_ARCH" ] ; then
205 # 64 bit configuration
216 # 64-bit configuration
206 if [ "$SET_ARCH" = 64 ] ; then
217 if [ "$SET_ARCH" = 64 ] ; then
207 # General 64 bit depended settings
218 # General 64-bit depended settings
208 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
219 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
209 KERNEL_ARCH=${KERNEL_ARCH:=arm64}
220 KERNEL_ARCH=${KERNEL_ARCH:=arm64}
210 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
221 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
211
222
212 # Board specific settings
223 # Raspberry Pi model specific settings
213 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
224 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
214 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
225 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
215 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
226 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
@@ -217,19 +228,19 if [ -n "$SET_ARCH" ] ; then
217 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
228 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
218 CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
229 CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
219 else
230 else
220 echo "error: Only Raspberry PI 3 and 3B+ support 64 bit"
231 echo "error: Only Raspberry PI 3 and 3B+ support 64-bit"
221 exit 1
232 exit 1
222 fi
233 fi
223 fi
234 fi
224
235
225 # 32 bit configuration
236 # 32-bit configuration
226 if [ "$SET_ARCH" = 32 ] ; then
237 if [ "$SET_ARCH" = 32 ] ; then
227 # General 32 bit dependend settings
238 # General 32-bit dependend settings
228 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
239 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
229 KERNEL_ARCH=${KERNEL_ARCH:=arm}
240 KERNEL_ARCH=${KERNEL_ARCH:=arm}
230 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
241 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
231
242
232 # Hardware specific settings
243 # Raspberry Pi model specific settings
233 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
244 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
234 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
245 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
235 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
246 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
@@ -238,7 +249,7 if [ -n "$SET_ARCH" ] ; then
238 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-}
249 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-}
239 fi
250 fi
240
251
241 # Hardware specific settings
252 # Raspberry Pi model specific settings
242 if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
253 if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
243 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
254 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
244 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
255 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
@@ -252,37 +263,51 else
252 echo "error: Please set '32' or '64' as value for SET_ARCH"
263 echo "error: Please set '32' or '64' as value for SET_ARCH"
253 exit 1
264 exit 1
254 fi
265 fi
255 # Device specific configuration and U-Boot configuration
266 # Device specific configuration and U-Boot configuration
256 case "$RPI_MODEL" in
267 case "$RPI_MODEL" in
257 0)
268 0)
258 DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb}
269 DTB_FILE=${DTB_FILE:=bcm2708-rpi-0-w.dtb}
259 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
270 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
260 ;;
271 ;;
261 1)
272 1)
262 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb}
273 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b.dtb}
263 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
274 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
264 ;;
275 ;;
265 1P)
276 1P)
266 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb}
277 DTB_FILE=${DTB_FILE:=bcm2708-rpi-b-plus.dtb}
267 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
278 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_defconfig}
268 ;;
279 ;;
269 2)
280 2)
270 DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb}
281 DTB_FILE=${DTB_FILE:=bcm2709-rpi-2-b.dtb}
271 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig}
282 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_2_defconfig}
272 ;;
283 ;;
273 3)
284 3)
274 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
285 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
275 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
286 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
276 ;;
287 ;;
277 3P)
288 3P)
278 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
289 DTB_FILE=${DTB_FILE:=bcm2710-rpi-3-b.dtb}
279 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
290 UBOOT_CONFIG=${UBOOT_CONFIG:=rpi_3_defconfig}
280 ;;
291 ;;
281 *)
292 *)
282 echo "error: Raspberry Pi model $RPI_MODEL is not supported!"
293 echo "error: Raspberry Pi model $RPI_MODEL is not supported!"
283 exit 1
294 exit 1
284 ;;
295 ;;
285 esac
296 esac
297
298 # Raspberry PI 0,3,3P with Bluetooth and Wifi onboard
299 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
300 # Include bluetooth packages on supported boards
301 if [ "$ENABLE_BLUETOOTH" = true ] && [ "$ENABLE_CONSOLE" = false ]; then
302 APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez"
303 fi
304 else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard
305 # Check if the internal wireless interface is not supported by the RPi model
306 if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then
307 echo "error: The selected Raspberry Pi model has no integrated interface for wireless or bluetooth"
308 exit 1
309 fi
310 fi
286
311
287 # Prepare date string for default image file name
312 # Prepare date string for default image file name
288 DATE="$(date +%Y-%m-%d)"
313 DATE="$(date +%Y-%m-%d)"
@@ -292,16 +317,6 else
292 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
317 IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}}
293 fi
318 fi
294
319
295 # Check if the internal wireless interface is supported by the RPi model
296 if [ "$ENABLE_WIRELESS" = true ] ; then
297 if [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] || [ "$RPI_MODEL" = 2 ] ; then
298 echo "error: The selected Raspberry Pi model has no internal wireless interface"
299 exit 1
300 else
301 echo "Raspberry Pi $RPI_MODEL has WIFI support"
302 fi
303 fi
304
305 # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported
320 # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported
306 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
321 if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then
307 if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then
322 if [ "$DISABLE_UNDERVOLT_WARNINGS" != 1 ] && [ "$DISABLE_UNDERVOLT_WARNINGS" != 2 ] ; then
@@ -347,6 +362,14 if [ "$ENABLE_UBOOT" = true ] ; then
347 APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc"
362 APT_INCLUDES="${APT_INCLUDES},device-tree-compiler,bison,flex,bc"
348 fi
363 fi
349
364
365 if [ "$ENABLE_BLUETOOTH" = true ] ; then
366 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
367 if [ "$ENABLE_CONSOLE" = false ] ; then
368 APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez"
369 fi
370 fi
371 fi
372
350 # Check if root SSH (v2) public key file exists
373 # Check if root SSH (v2) public key file exists
351 if [ -n "$SSH_ROOT_PUB_KEY" ] ; then
374 if [ -n "$SSH_ROOT_PUB_KEY" ] ; then
352 if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then
375 if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then
@@ -365,7 +388,7 fi
365
388
366 # Check if all required packages are installed on the build system
389 # Check if all required packages are installed on the build system
367 for package in $REQUIRED_PACKAGES ; do
390 for package in $REQUIRED_PACKAGES ; do
368 if [ "$(dpkg-query -W -f='${Status}' $package)" != "install ok installed" ] ; then
391 if [ "$(dpkg-query -W -f='${Status}' "$package")" != "install ok installed" ] ; then
369 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
392 MISSING_PACKAGES="${MISSING_PACKAGES} $package"
370 fi
393 fi
371 done
394 done
@@ -380,7 +403,7 if [ -n "$MISSING_PACKAGES" ] ; then
380 [ "$confirm" != "y" ] && exit 1
403 [ "$confirm" != "y" ] && exit 1
381
404
382 # Make sure all missing required packages are installed
405 # Make sure all missing required packages are installed
383 apt-get -qq -y install "${MISSING_PACKAGES}"
406 apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"`
384 fi
407 fi
385
408
386 # Check if ./bootstrap.d directory exists
409 # Check if ./bootstrap.d directory exists
@@ -1,3 +1,4
1 # Configuration template file used by rpi23-gen-image.sh
1 # Configuration template file used by rpi23-gen-image.sh
2 RPI_MODEL=2
2 RELEASE=stretch
3 RELEASE=stretch
3 BUILD_KERNEL=true
4 BUILD_KERNEL=true
@@ -2,3 +2,5
2 RPI_MODEL=3
2 RPI_MODEL=3
3 RELEASE=buster
3 RELEASE=buster
4 BUILD_KERNEL=true
4 BUILD_KERNEL=true
5 # ENABLE_WIRELESS=false
6 # ENABLE_BLUETOOTH=false
@@ -2,3 +2,5
2 RPI_MODEL=3
2 RPI_MODEL=3
3 RELEASE=stretch
3 RELEASE=stretch
4 BUILD_KERNEL=true
4 BUILD_KERNEL=true
5 # ENABLE_WIRELESS=false
6 # ENABLE_BLUETOOTH=false
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant