##// END OF EJS Templates
Merge branch 'master' into 0
drtyhlpr -
r464:2cb5f5fcd7e0 Fusion
parent child
Show More
@@ -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.
@@ -59,7 +59,6 A comma separated list of additional packages to be installed by apt after boots
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 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 ##### `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 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 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.
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 ##### `ENABLE_I2C`=false
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 ##### `ENABLE_SPI`=false
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 ##### `ENABLE_IPV6`=true
175 ##### `ENABLE_IPV6`=true
177 Enable IPv6 support. The network interface configuration is managed via systemd-networkd.
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 Reduce the disk space usage by deleting packages and files. See `REDUCE_*` parameters for detailed information.
218 Reduce the disk space usage by deleting packages and files. See `REDUCE_*` parameters for detailed information.
220
219
221 ##### `ENABLE_UBOOT`=false
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 ##### `UBOOTSRC_DIR`=""
223 ##### `UBOOTSRC_DIR`=""
225 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.
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 #### Kernel compilation:
288 #### Kernel compilation:
290 ##### `BUILD_KERNEL`=true
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 ##### `CROSS_COMPILE`="arm-linux-gnueabihf-"
292 ##### `CROSS_COMPILE`="arm-linux-gnueabihf-"
294 This sets the cross compile enviornment for the compiler.
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 | `10-bootstrap.sh` | Debootstrap basic system |
410 | `10-bootstrap.sh` | Debootstrap basic system |
412 | `11-apt.sh` | Setup APT repositories |
411 | `11-apt.sh` | Setup APT repositories |
413 | `12-locale.sh` | Setup Locales and keyboard settings |
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 | `14-fstab.sh` | Setup fstab and initramfs |
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 | `20-networking.sh` | Setup Networking |
416 | `20-networking.sh` | Setup Networking |
418 | `21-firewall.sh` | Setup Firewall |
417 | `21-firewall.sh` | Setup Firewall |
419 | `30-security.sh` | Setup Users and Security settings |
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 | `32-sshd.sh` | Setup SSH and public keys |
420 | `32-sshd.sh` | Setup SSH and public keys |
422 | `41-uboot.sh` | Build and Setup U-Boot |
421 | `41-uboot.sh` | Build and Setup U-Boot |
423 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
422 | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver |
423 | `43-videocore.sh` | Build and Setup videocore libraries |
424 | `50-firstboot.sh` | First boot actions |
424 | `50-firstboot.sh` | First boot actions |
425 | `99-reduce.sh` | Reduce the disk space usage |
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 | Directory | Description |
429 | Directory | Description |
430 | --- | --- |
430 | --- | --- |
431 | `apt` | APT management configuration files |
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 | `dpkg` | Package Manager configuration |
433 | `dpkg` | Package Manager configuration |
434 | `etc` | Configuration files and rc scripts |
434 | `etc` | Configuration files and rc scripts |
435 | `firstboot` | Scripts that get executed on first boot |
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 ## Flashing the image file
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 ##### Flashing examples:
460 ##### Flashing examples:
461 ```shell
461 ```shell
@@ -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
@@ -213,14 +213,14 fi
213
213
214 # Setup architecture specific settings
214 # Setup architecture specific settings
215 if [ -n "$SET_ARCH" ] ; then
215 if [ -n "$SET_ARCH" ] ; then
216 # 64 bit configuration
216 # 64-bit configuration
217 if [ "$SET_ARCH" = 64 ] ; then
217 if [ "$SET_ARCH" = 64 ] ; then
218 # General 64 bit depended settings
218 # General 64-bit depended settings
219 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
219 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static}
220 KERNEL_ARCH=${KERNEL_ARCH:=arm64}
220 KERNEL_ARCH=${KERNEL_ARCH:=arm64}
221 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
221 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"}
222
222
223 # Board specific settings
223 # Raspberry Pi model specific settings
224 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
224 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
225 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
225 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64"
226 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
226 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig}
@@ -228,19 +228,19 if [ -n "$SET_ARCH" ] ; then
228 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
228 KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img}
229 CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
229 CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-}
230 else
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 exit 1
232 exit 1
233 fi
233 fi
234 fi
234 fi
235
235
236 # 32 bit configuration
236 # 32-bit configuration
237 if [ "$SET_ARCH" = 32 ] ; then
237 if [ "$SET_ARCH" = 32 ] ; then
238 # General 32 bit dependend settings
238 # General 32-bit dependend settings
239 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
239 QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static}
240 KERNEL_ARCH=${KERNEL_ARCH:=arm}
240 KERNEL_ARCH=${KERNEL_ARCH:=arm}
241 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
241 KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"}
242
242
243 # Hardware specific settings
243 # Raspberry Pi model specific settings
244 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
244 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then
245 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
245 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel"
246 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
246 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig}
@@ -249,7 +249,7 if [ -n "$SET_ARCH" ] ; then
249 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-}
249 CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-}
250 fi
250 fi
251
251
252 # Hardware specific settings
252 # Raspberry Pi model specific settings
253 if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
253 if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
254 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
254 REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf"
255 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
255 KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig}
@@ -403,7 +403,7 if [ -n "$MISSING_PACKAGES" ] ; then
403 [ "$confirm" != "y" ] && exit 1
403 [ "$confirm" != "y" ] && exit 1
404
404
405 # Make sure all missing required packages are installed
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 fi
407 fi
408
408
409 # Check if ./bootstrap.d directory exists
409 # Check if ./bootstrap.d directory exists
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant