From 2cb5f5fcd7e0c877ab4f6fa5988070274214ee9b 2018-11-26 09:31:52 From: drtyhlpr Date: 2018-11-26 09:31:52 Subject: [PATCH] Merge branch 'master' into 0 --- diff --git a/README.md b/README.md index 1f329c5..6dd392f 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ # rpi23-gen-image ## Introduction -`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```). +`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```). ## Build dependencies 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. ```debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo``` -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. +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. -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. +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. ## Command-line parameters 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 #### General system settings: ##### `SET_ARCH`=32 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. -If you want to change e.g. cross-compiler -> Templates always override defaults ##### `RPI_MODEL`=2 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 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. ##### `ENABLE_I2C`=false -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. +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. ##### `ENABLE_SPI`=false -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. +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. ##### `ENABLE_IPV6`=true 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 Reduce the disk space usage by deleting packages and files. See `REDUCE_*` parameters for detailed information. ##### `ENABLE_UBOOT`=false -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. +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. ##### `UBOOTSRC_DIR`="" 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 #### Kernel compilation: ##### `BUILD_KERNEL`=true -Build and install the latest RPi2/3 Linux kernel. Currently only the default RPi2/3 kernel configuration is used. +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. ##### `CROSS_COMPILE`="arm-linux-gnueabihf-" 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 | `10-bootstrap.sh` | Debootstrap basic system | | `11-apt.sh` | Setup APT repositories | | `12-locale.sh` | Setup Locales and keyboard settings | -| `13-kernel.sh` | Build and install RPi2/3 Kernel | +| `13-kernel.sh` | Build and install RPi 0/1/2/3 Kernel | | `14-fstab.sh` | Setup fstab and initramfs | -| `15-rpi-config.sh` | Setup RPi2/3 config and cmdline | +| `15-rpi-config.sh` | Setup RPi 0/1/2/3 config and cmdline | | `20-networking.sh` | Setup Networking | | `21-firewall.sh` | Setup Firewall | | `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 | `32-sshd.sh` | Setup SSH and public keys | | `41-uboot.sh` | Build and Setup U-Boot | | `42-fbturbo.sh` | Build and Setup fbturbo Xorg driver | +| `43-videocore.sh` | Build and Setup videocore libraries | | `50-firstboot.sh` | First boot actions | | `99-reduce.sh` | Reduce the disk space usage | @@ -429,7 +429,7 @@ All the required configuration files that will be copied to the generated OS ima | Directory | Description | | --- | --- | | `apt` | APT management configuration files | -| `boot` | Boot and RPi2/3 configuration files | +| `boot` | Boot and RPi 0/1/2/3 configuration files | | `dpkg` | Package Manager configuration | | `etc` | Configuration files and rc scripts | | `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 ``` ## Flashing the image file -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`. +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`. ##### Flashing examples: ```shell diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 48d7810..575252a 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -2,7 +2,7 @@ ######################################################################## # rpi23-gen-image.sh 2015-2017 # -# Advanced Debian "stretch" and "buster" bootstrap script for RPi2/3 +# Advanced Debian "stretch" and "buster" bootstrap script for Raspberry Pi # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -36,7 +36,7 @@ fi # Introduce settings set -e -echo -n -e "\n#\n# RPi2/3 Bootstrap Settings\n#\n" +echo -n -e "\n#\n# RPi 0/1/2/3 Bootstrap Settings\n#\n" set -x # Raspberry Pi model configuration @@ -213,14 +213,14 @@ fi # Setup architecture specific settings if [ -n "$SET_ARCH" ] ; then - # 64 bit configuration + # 64-bit configuration if [ "$SET_ARCH" = 64 ] ; then - # General 64 bit depended settings + # General 64-bit depended settings QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static} KERNEL_ARCH=${KERNEL_ARCH:=arm64} KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"} - # Board specific settings + # Raspberry Pi model specific settings if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64" KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig} @@ -228,19 +228,19 @@ if [ -n "$SET_ARCH" ] ; then KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img} CROSS_COMPILE=${CROSS_COMPILE:=aarch64-linux-gnu-} else - echo "error: Only Raspberry PI 3 and 3B+ support 64 bit" + echo "error: Only Raspberry PI 3 and 3B+ support 64-bit" exit 1 fi fi - # 32 bit configuration + # 32-bit configuration if [ "$SET_ARCH" = 32 ] ; then - # General 32 bit dependend settings + # General 32-bit dependend settings QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} KERNEL_ARCH=${KERNEL_ARCH:=arm} KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"} - # Hardware specific settings + # Raspberry Pi model specific settings if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 1 ] || [ "$RPI_MODEL" = 1P ] ; then REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armel" KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi_defconfig} @@ -249,7 +249,7 @@ if [ -n "$SET_ARCH" ] ; then CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabi-} fi - # Hardware specific settings + # Raspberry Pi model specific settings if [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} @@ -403,7 +403,7 @@ if [ -n "$MISSING_PACKAGES" ] ; then [ "$confirm" != "y" ] && exit 1 # Make sure all missing required packages are installed - apt-get -qq -y install "${MISSING_PACKAGES}" + apt-get -qq -y install `echo "${MISSING_PACKAGES}" | sed "s/ //"` fi # Check if ./bootstrap.d directory exists