##// END OF EJS Templates
Merge branch 'master' into 0
drtyhlpr -
r464:2cb5f5fcd7e0 Fusion
parent child
Show More
@@ -1,15 +1,15
1 1 # rpi23-gen-image
2 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 5 ## Build dependencies
6 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 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 14 ## Command-line parameters
15 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.
@@ -59,7 +59,6 A comma separated list of additional packages to be installed by apt after boots
59 59 #### General system settings:
60 60 ##### `SET_ARCH`=32
61 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.
62 If you want to change e.g. cross-compiler -> Templates always override defaults
63 62
64 63 ##### `RPI_MODEL`=2
65 64 Specifiy the target Raspberry Pi hardware model. The script at this time supports the following Raspberry Pi models:
@@ -168,10 +167,10 Enable Bluetooth to use this. Adds overlay to swap UART0 with UART1. Enabling (s
168 167 Enable Turbo mode. This setting locks cpu at 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.
169 168
170 169 ##### `ENABLE_I2C`=false
171 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.
170 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.
172 171
173 172 ##### `ENABLE_SPI`=false
174 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.
173 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.
175 174
176 175 ##### `ENABLE_IPV6`=true
177 176 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
@@ -219,7 +218,7 Use debootstrap script variant `minbase` which only includes essential packages
219 218 Reduce the disk space usage by deleting packages and files. See `REDUCE_*` parameters for detailed information.
220 219
221 220 ##### `ENABLE_UBOOT`=false
222 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.
221 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.
223 222
224 223 ##### `UBOOTSRC_DIR`=""
225 224 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.
@@ -288,7 +287,7 Add SSH (v2) public key(s) from specified file to `authorized_keys` file to enab
288 287
289 288 #### Kernel compilation:
290 289 ##### `BUILD_KERNEL`=true
291 Build and install the latest RPi2/3 Linux kernel. Currently only the default RPi2/3 kernel configuration is used.
290 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.
292 291
293 292 ##### `CROSS_COMPILE`="arm-linux-gnueabihf-"
294 293 This sets the cross compile enviornment for the compiler.
@@ -411,9 +410,9 The functions of this script that are required for the different stages of the b
411 410 | `10-bootstrap.sh` | Debootstrap basic system |
412 411 | `11-apt.sh` | Setup APT repositories |
413 412 | `12-locale.sh` | Setup Locales and keyboard settings |
414 | `13-kernel.sh` | Build and install RPi2/3 Kernel |
413 | `13-kernel.sh` | Build and install RPi 0/1/2/3 Kernel |
415 414 | `14-fstab.sh` | Setup fstab and initramfs |
416 | `15-rpi-config.sh` | Setup RPi2/3 config and cmdline |
415 | `15-rpi-config.sh` | Setup RPi 0/1/2/3 config and cmdline |
417 416 | `20-networking.sh` | Setup Networking |
418 417 | `21-firewall.sh` | Setup Firewall |
419 418 | `30-security.sh` | Setup Users and Security settings |
@@ -421,6 +420,7 The functions of this script that are required for the different stages of the b
421 420 | `32-sshd.sh` | Setup SSH and public keys |
422 421 | `41-uboot.sh` | Build and Setup U-Boot |
423 422 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
423 | `43-videocore.sh` | Build and Setup videocore libraries |
424 424 | `50-firstboot.sh` | First boot actions |
425 425 | `99-reduce.sh` | Reduce the disk space usage |
426 426
@@ -429,7 +429,7 All the required configuration files that will be copied to the generated OS ima
429 429 | Directory | Description |
430 430 | --- | --- |
431 431 | `apt` | APT management configuration files |
432 | `boot` | Boot and RPi2/3 configuration files |
432 | `boot` | Boot and RPi 0/1/2/3 configuration files |
433 433 | `dpkg` | Package Manager configuration |
434 434 | `etc` | Configuration files and rc scripts |
435 435 | `firstboot` | Scripts that get executed on first boot |
@@ -455,7 +455,7 script -c 'APT_SERVER=ftp.de.debian.org ./rpi23-gen-image.sh' ./build.log
455 455 ```
456 456
457 457 ## Flashing the image file
458 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`.
458 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`.
459 459
460 460 ##### Flashing examples:
461 461 ```shell
@@ -2,7 +2,7
2 2 ########################################################################
3 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 7 # This program is free software; you can redistribute it and/or
8 8 # modify it under the terms of the GNU General Public License
@@ -36,7 +36,7 fi
36 36
37 37 # Introduce settings
38 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 40 set -x
41 41
42 42 # Raspberry Pi model configuration
@@ -213,14 +213,14 fi
213 213
214 214 # Setup architecture specific settings
215 215 if [ -n "$SET_ARCH" ] ; then
216 # 64 bit configuration
216 # 64-bit configuration
217 217 if [ "$SET_ARCH" = 64 ] ; then
218 # General 64 bit depended settings
218 # General 64-bit depended settings
219 219 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
220 220 KERNEL_ARCH=${KERNEL_ARCH:=arm64}
221 221 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
222 222
223 # Board specific settings
223 # Raspberry Pi model specific settings
224 224 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
225 225 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
226 226 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
@@ -228,19 +228,19 if [ -n "$SET_ARCH" ] ; then
228 228 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
229 229 CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
230 230 else
231 echo "error: Only Raspberry PI 3 and 3B+ support 64 bit"
231 echo "error: Only Raspberry PI 3 and 3B+ support 64-bit"
232 232 exit 1
233 233 fi
234 234 fi
235 235
236 # 32 bit configuration
236 # 32-bit configuration
237 237 if [ "$SET_ARCH" = 32 ] ; then
238 # General 32 bit dependend settings
238 # General 32-bit dependend settings
239 239 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
240 240 KERNEL_ARCH=${KERNEL_ARCH:=arm}
241 241 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
242 242
243 # Hardware specific settings
243 # Raspberry Pi model specific settings
244 244 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
245 245 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
246 246 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
@@ -249,7 +249,7 if [ -n "$SET_ARCH" ] ; then
249 249 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-}
250 250 fi
251 251
252 # Hardware specific settings
252 # Raspberry Pi model specific settings
253 253 if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
254 254 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
255 255 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
@@ -403,7 +403,7 if [ -n "$MISSING_PACKAGES" ] ; then
403 403 [ "$confirm" != "y" ] && exit 1
404 404
405 405 # Make sure all missing required packages are installed
406 apt-get -qq -y install "${MISSING_PACKAGES}"
406 apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"`
407 407 fi
408 408
409 409 # Check if ./bootstrap.d directory exists
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant