diff --git a/README.md b/README.md index f409aab..54f2aab 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 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 `jessie` and `stretch`. Raspberry Pi 3 images are currently generated for 32-bit mode only. +`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 `jessie` and `stretch`. 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.11.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. @@ -23,7 +23,7 @@ apt-get update ## 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. -#####Command-line examples: +##### Command-line examples: ```shell ENABLE_UBOOT=true ./rpi23-gen-image.sh ENABLE_CONSOLE=false ENABLE_IPV6=false ./rpi23-gen-image.sh @@ -43,7 +43,7 @@ RELEASE=stretch RPI_MODEL=3 ENABLE_WIRELESS=true ENABLE_MINBASE=true BUILD_KERNE ## Configuration template files To avoid long lists of command-line parameters and to help to store the favourite parameter configurations the `rpi23-gen-image.sh` script supports so called configuration template files (`CONFIG_TEMPLATE`=template). These are simple text files located in the `./templates` directory that contain the list of configuration parameters that will be used. New configuration template files can be added to the `./templates` directory. -#####Command-line examples: +##### Command-line examples: ```shell CONFIG_TEMPLATE=rpi3stretch ./rpi23-gen-image.sh CONFIG_TEMPLATE=rpi2stretch ./rpi23-gen-image.sh @@ -58,7 +58,10 @@ Set Debian packages server address. Choose a server from the list of Debian worl 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. ##### `APT_INCLUDES`="" -A comma separated list of additional packages to be installed during bootstrapping. +A comma separated list of additional packages to be installed by debootstrap during bootstrapping. + +##### `APT_INCLUDES_LATE`="" +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. --- @@ -69,6 +72,9 @@ Specifiy the target Raspberry Pi hardware model. The script at this time support ##### `RELEASE`="jessie" Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases "jessie" and "stretch". `BUILD_KERNEL`=true will automatically be set if the Debian release `stretch` is used. +##### `RELEASE_ARCH`="armhf" +Set the desired Debian release architecture. + ##### `HOSTNAME`="rpi$RPI_MODEL-$RELEASE" Set system host name. It's recommended that the host name is unique in the corresponding subnet. @@ -89,7 +95,7 @@ Expand the root partition and filesystem automatically on first boot. --- -#### Keyboard settings: +#### Keyboard settings: These options are used to configure keyboard layout in `/etc/default/keyboard` for console and Xorg. These settings can also be changed inside the running OS using the `dpkg-reconfigure keyboard-configuration` command. ##### `XKB_MODEL`="" @@ -109,7 +115,7 @@ Set extra xkb configuration options. #### Networking settings (DHCP): 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`.` -#####`ENABLE_DHCP`=true +##### `ENABLE_DHCP`=true Set the system to use DHCP. This requires an DHCP server. --- @@ -117,25 +123,25 @@ Set the system to use DHCP. This requires an DHCP server. #### Networking settings (static): These parameters are used to set up a static networking configuration in `/etc/systemd/network/eth.network`. The following static networking parameters are only supported if `ENABLE_DHCP` was set to `false`. The default location of network configuration files in the Debian `stretch` release was changed to `/lib/systemd/network`. -#####`NET_ADDRESS`="" +##### `NET_ADDRESS`="" Set a static IPv4 or IPv6 address and its prefix, separated by "/", eg. "192.169.0.3/24". -#####`NET_GATEWAY`="" +##### `NET_GATEWAY`="" Set the IP address for the default gateway. -#####`NET_DNS_1`="" +##### `NET_DNS_1`="" Set the IP address for the first DNS server. -#####`NET_DNS_2`="" +##### `NET_DNS_2`="" Set the IP address for the second DNS server. -#####`NET_DNS_DOMAINS`="" +##### `NET_DNS_DOMAINS`="" Set the default DNS search domains to use for non fully qualified host names. -#####`NET_NTP_1`="" +##### `NET_NTP_1`="" Set the IP address for the first NTP server. -#####`NET_NTP_2`="" +##### `NET_NTP_2`="" Set the IP address for the second NTP server. --- @@ -259,6 +265,24 @@ Add SSH (v2) public key(s) from specified file to `authorized_keys` file to enab ##### `BUILD_KERNEL`=false Build and install the latest RPi2/3 Linux kernel. Currently only the default RPi2/3 kernel configuration is used. `BUILD_KERNEL`=true will automatically be set if the Raspberry Pi model `3` is used. +##### `CROSS_COMPILE`="arm-linux-gnueabihf-" +This sets the cross compile enviornment for the compiler. + +##### `KERNEL_ARCH`="arm" +This sets the kernel architecture for the compiler. + +##### `KERNEL_IMAGE`="kernel7.img" +Name of the image file in the boot partition. If not set, `KERNEL_IMAGE` will be set to "kernel8.img" automatically if building for arm64. + +##### `KERNEL_BRANCH`="" +Name of the requested branch from the GIT location for the RPi Kernel. Default is using the current default branch from the GIT site. + +##### `QEMU_BINARY`="/usr/bin/qemu-arm-static" +Sets the QEMU enviornment for the Debian archive. If not set, `QEMU_BINARY` will be set to "/usr/bin/qemu-aarch64-static" automatically if building for arm64. + +##### `KERNEL_DEFCONFIG`="bcm2709_defconfig" +Sets the default config for kernel compiling. If not set, `KERNEL_DEFCONFIG` will be set to "bcmrpi3\_defconfig" automatically if building for arm64. + ##### `KERNEL_REDUCE`=false Reduce the size of the generated kernel by removing unwanted device, network and filesystem drivers (experimental). @@ -345,8 +369,8 @@ Sets key size in bits. The argument has to be a multiple of 8. ##### `BASEDIR`=$(pwd)/images/${RELEASE} Set a path to a working directory used by the script to generate an image. -##### `IMAGE_NAME`=${BASEDIR}/${DATE}-rpi${RPI_MODEL}-${RELEASE} -Set a filename for the output file(s). Note: the script will create $IMAGE_NAME.img if `ENABLE_SPLITFS`=false or $IMAGE_NAME-frmw.img and $IMAGE_NAME-root.img if `ENABLE_SPLITFS`=true. +##### `IMAGE_NAME`=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH} +Set a filename for the output file(s). Note: the script will create $IMAGE_NAME.img if `ENABLE_SPLITFS`=false or $IMAGE_NAME-frmw.img and $IMAGE_NAME-root.img if `ENABLE_SPLITFS`=true. Note 2: If the KERNEL_BRANCH is not set, the word "CURRENT" is used. ## Understanding the script The functions of this script that are required for the different stages of the bootstrapping are split up into single files located inside the `bootstrap.d` directory. During the bootstrapping every script in this directory gets executed in lexicographical order: @@ -402,7 +426,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`. -#####Flashing examples: +##### Flashing examples: ```shell bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie.img /dev/mmcblk0 dd bs=4M if=./images/jessie/2017-01-23-rpi3-jessie.img of=/dev/mmcblk0 @@ -412,6 +436,9 @@ If you have set `ENABLE_SPLITFS`, copy the `-frmw` image on the microSD card, th bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie-frmw.img /dev/mmcblk0 bmaptool copy ./images/jessie/2017-01-23-rpi3-jessie-root.img /dev/sdc ``` +## Weekly image builds +The image files are provided by JRWR'S I/O PORT and are built once a Sunday at midnight UTC! +* [Debian Stretch Raspberry Pi2/3 Weekly Image Builds](https://jrwr.io/doku.php?id=projects:debianpi) ## External links and references * [Debian worldwide mirror sites](https://www.debian.org/mirror/list) diff --git a/bootstrap.d/10-bootstrap.sh b/bootstrap.d/10-bootstrap.sh index e395437..e04335b 100644 --- a/bootstrap.d/10-bootstrap.sh +++ b/bootstrap.d/10-bootstrap.sh @@ -28,7 +28,7 @@ fi http_proxy=${APT_PROXY} debootstrap ${EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" # Copy qemu emulator binary to chroot -install_exec "${QEMU_BINARY}" "${R}${QEMU_BINARY}" +install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}" # Copy debian-archive-keyring.pgp mkdir -p "${R}/usr/share/keyrings" diff --git a/bootstrap.d/11-apt.sh b/bootstrap.d/11-apt.sh index a3870bd..3c9b2a0 100644 --- a/bootstrap.d/11-apt.sh +++ b/bootstrap.d/11-apt.sh @@ -40,6 +40,10 @@ fi chroot_exec apt-get -qq -y update chroot_exec apt-get -qq -y -u dist-upgrade +if [ "$APT_INCLUDES_LATE" ] ; then + chroot_exec apt-get -qq -y install $(echo $APT_INCLUDES_LATE |tr , ' ') +fi + if [ -d packages ] ; then for package in packages/*.deb ; do cp $package ${R}/tmp diff --git a/bootstrap.d/13-kernel.sh b/bootstrap.d/13-kernel.sh index 919cea8..9946c81 100644 --- a/bootstrap.d/13-kernel.sh +++ b/bootstrap.d/13-kernel.sh @@ -21,11 +21,15 @@ if [ "$BUILD_KERNEL" = true ] ; then fi else # KERNELSRC_DIR="" # Create temporary directory for kernel sources - temp_dir=$(sudo -u nobody mktemp -d) + temp_dir=$(as_nobody mktemp -d) # Fetch current RPi2/3 kernel sources - sudo -u nobody git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" - + if [ -z "${KERNEL_BRANCH}" ] ; then + as_nobody -u nobody git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" + else + as_nobody -u nobody git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" + fi + # Copy downloaded kernel sources mv "${temp_dir}/linux" "${R}/usr/src/" @@ -94,12 +98,12 @@ if [ "$BUILD_KERNEL" = true ] ; then fi # Cross compile kernel and modules - make -C "${KERNEL_DIR}" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" zImage modules dtbs + make -C "${KERNEL_DIR}" -j${KERNEL_THREADS} ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_BIN_IMAGE}" modules dtbs fi # Check if kernel compilation was successful - if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/zImage" ] ; then - echo "error: kernel compilation failed! (zImage not found)" + if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then + echo "error: kernel compilation failed! (kernel image not found)" cleanup exit 1 fi @@ -130,16 +134,23 @@ if [ "$BUILD_KERNEL" = true ] ; then # Copy dts and dtb device tree sources and binaries mkdir "${BOOT_DIR}/overlays" - install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb "${BOOT_DIR}/" + + # Ensure the proper .dtb is located + if [ "$KERNEL_ARCH" = "arm" ] ; then + install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb "${BOOT_DIR}/" + else + install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/broadcom/"*.dtb "${BOOT_DIR}/" + fi + install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtb* "${BOOT_DIR}/overlays/" install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README" if [ "$ENABLE_UBOOT" = false ] ; then - # Convert and copy zImage kernel to the boot directory - "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/zImage" "${BOOT_DIR}/${KERNEL_IMAGE}" + # Convert and copy kernel image to the boot directory + "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}" else - # Copy zImage kernel to the boot directory - install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/zImage" "${BOOT_DIR}/${KERNEL_IMAGE}" + # Copy kernel image to the boot directory + install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}" fi # Remove kernel sources @@ -149,8 +160,8 @@ if [ "$BUILD_KERNEL" = true ] ; then make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare # Create symlinks for kernel modules - ln -sf "${KERNEL_DIR}" "${R}/lib/modules/${KERNEL_VERSION}/build" - ln -sf "${KERNEL_DIR}" "${R}/lib/modules/${KERNEL_VERSION}/source" + chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/build" + chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source" fi else # BUILD_KERNEL=false diff --git a/bootstrap.d/15-rpi-config.sh b/bootstrap.d/15-rpi-config.sh index 37834cd..0c2368a 100644 --- a/bootstrap.d/15-rpi-config.sh +++ b/bootstrap.d/15-rpi-config.sh @@ -17,16 +17,16 @@ if [ "$BUILD_KERNEL" = true ] ; then cp ${RPI_FIRMWARE_DIR}/boot/start_x.elf ${BOOT_DIR}/start_x.elf else # Create temporary directory for boot binaries - temp_dir=$(sudo -u nobody mktemp -d) + temp_dir=$(as_nobody mktemp -d) # Install latest boot binaries from raspberry/firmware github - sudo -u nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin" - sudo -u nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat" - sudo -u nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat" - sudo -u nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat" - sudo -u nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf" - sudo -u nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf" - sudo -u nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf" + as_nobody wget -q -O "${temp_dir}/bootcode.bin" "${FIRMWARE_URL}/bootcode.bin" + as_nobody wget -q -O "${temp_dir}/fixup.dat" "${FIRMWARE_URL}/fixup.dat" + as_nobody wget -q -O "${temp_dir}/fixup_cd.dat" "${FIRMWARE_URL}/fixup_cd.dat" + as_nobody wget -q -O "${temp_dir}/fixup_x.dat" "${FIRMWARE_URL}/fixup_x.dat" + as_nobody wget -q -O "${temp_dir}/start.elf" "${FIRMWARE_URL}/start.elf" + as_nobody wget -q -O "${temp_dir}/start_cd.elf" "${FIRMWARE_URL}/start_cd.elf" + as_nobody wget -q -O "${temp_dir}/start_x.elf" "${FIRMWARE_URL}/start_x.elf" # Move downloaded boot binaries mv "${temp_dir}/"* "${BOOT_DIR}/" diff --git a/bootstrap.d/20-networking.sh b/bootstrap.d/20-networking.sh index bd3ce0a..673b2d5 100644 --- a/bootstrap.d/20-networking.sh +++ b/bootstrap.d/20-networking.sh @@ -89,11 +89,11 @@ if [ "$ENABLE_WIRELESS" = true ] ; then fi # Create temporary directory for firmware binary blob - temp_dir=$(sudo -u nobody mktemp -d) + temp_dir=$(as_nobody mktemp -d) # Fetch firmware binary blob - sudo -u nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin" - sudo -u nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt" + as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin" + as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt" # Move downloaded firmware binary blob mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/" diff --git a/bootstrap.d/41-uboot.sh b/bootstrap.d/41-uboot.sh index 68198ec..cd9e67b 100644 --- a/bootstrap.d/41-uboot.sh +++ b/bootstrap.d/41-uboot.sh @@ -16,10 +16,10 @@ if [ "$ENABLE_UBOOT" = true ] ; then cp -r "${UBOOTSRC_DIR}" "${R}/tmp" else # Create temporary directory for U-Boot sources - temp_dir=$(sudo -u nobody mktemp -d) + temp_dir=$(as_nobody mktemp -d) # Fetch U-Boot sources - sudo -u nobody git -C "${temp_dir}" clone "${UBOOT_URL}" + as_nobody git -C "${temp_dir}" clone "${UBOOT_URL}" # Copy downloaded U-Boot sources mv "${temp_dir}/u-boot" "${R}/tmp/" diff --git a/bootstrap.d/42-fbturbo.sh b/bootstrap.d/42-fbturbo.sh index 0e8b064..ae65126 100644 --- a/bootstrap.d/42-fbturbo.sh +++ b/bootstrap.d/42-fbturbo.sh @@ -15,10 +15,10 @@ if [ "$ENABLE_FBTURBO" = true ] ; then cp -r "${FBTURBOSRC_DIR}" "${R}/tmp" else # Create temporary directory for fbturbo sources - temp_dir=$(sudo -u nobody mktemp -d) + temp_dir=$(as_nobody mktemp -d) # Fetch fbturbo sources - sudo -u nobody git -C "${temp_dir}" clone "${FBTURBO_URL}" + as_nobody git -C "${temp_dir}" clone "${FBTURBO_URL}" # Move downloaded fbturbo sources mv "${temp_dir}/xf86-video-fbturbo" "${R}/tmp/" diff --git a/functions.sh b/functions.sh index 52f9c35..1ad716c 100644 --- a/functions.sh +++ b/functions.sh @@ -33,6 +33,11 @@ chroot_exec() { LANG=C LC_ALL=C DEBIAN_FRONTEND=noninteractive chroot ${R} $* } +as_nobody() { + # Exec command as user nobody + sudo -E -u nobody LANG=C LC_ALL=C $* +} + install_readonly() { # Install file with user read-only permissions install -o root -g root -m 644 $* diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 51a9dcb..25bbdc7 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -53,9 +53,19 @@ KERNEL_ARCH=${KERNEL_ARCH:=arm} RELEASE_ARCH=${RELEASE_ARCH:=armhf} CROSS_COMPILE=${CROSS_COMPILE:=arm-linux-gnueabihf-} COLLABORA_KERNEL=${COLLABORA_KERNEL:=3.18.0-trunk-rpi2} -KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} -KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img} -QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} +if [ "$KERNEL_ARCH" = "arm64" ] ; then + KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcmrpi3_defconfig} + KERNEL_IMAGE=${KERNEL_IMAGE:=kernel8.img} +else + KERNEL_DEFCONFIG=${KERNEL_DEFCONFIG:=bcm2709_defconfig} + KERNEL_IMAGE=${KERNEL_IMAGE:=kernel7.img} +fi +if [ "$RELEASE_ARCH" = "arm64" ] ; then + QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-aarch64-static} +else + QEMU_BINARY=${QEMU_BINARY:=/usr/bin/qemu-arm-static} +fi +KERNEL_BRANCH=${KERNEL_BRANCH:=""} # URLs KERNEL_URL=${KERNEL_URL:=https://github.com/raspberrypi/linux} @@ -68,9 +78,14 @@ UBOOT_URL=${UBOOT_URL:=git://git.denx.de/u-boot.git} # Build directories BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}} BUILDDIR="${BASEDIR}/build" + # Prepare date string for default image file name DATE="$(date +%Y-%m-%d)" -IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-rpi${RPI_MODEL}-${RELEASE}} +if [ -z "$KERNEL_BRANCH" ] ; then + IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-CURRENT-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} +else + IMAGE_NAME=${IMAGE_NAME:=${BASEDIR}/${DATE}-${KERNEL_ARCH}-${KERNEL_BRANCH}-rpi${RPI_MODEL}-${RELEASE}-${RELEASE_ARCH}} +fi # Chroot directories R="${BUILDDIR}/chroot" @@ -160,6 +175,11 @@ KERNEL_THREADS=${KERNEL_THREADS:=1} KERNEL_HEADERS=${KERNEL_HEADERS:=true} KERNEL_MENUCONFIG=${KERNEL_MENUCONFIG:=false} KERNEL_REMOVESRC=${KERNEL_REMOVESRC:=true} +if [ "$KERNEL_ARCH" = "arm64" ] ; then + KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="Image"} +else + KERNEL_BIN_IMAGE=${KERNEL_BIN_IMAGE:="zImage"} +fi # Kernel compilation from source directory settings KERNELSRC_DIR=${KERNELSRC_DIR:=""} @@ -237,7 +257,11 @@ fi # Add packages required for kernel cross compilation if [ "$BUILD_KERNEL" = true ] ; then - REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" + if [ "$KERNEL_ARCH" = "arm" ] ; then + REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" + else + REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64" + fi fi # Add libncurses5 to enable kernel menuconfig diff --git a/templates/rpi3-stretch-arm64-4.11.y b/templates/rpi3-stretch-arm64-4.11.y new file mode 100644 index 0000000..0523a0b --- /dev/null +++ b/templates/rpi3-stretch-arm64-4.11.y @@ -0,0 +1,15 @@ +# Configuration template file used by rpi23-gen-image.sh +# Debian Stretch using the Arm64 for kernel compilation and Debian distribution. + +RPI_MODEL=3 +RELEASE=stretch +BUILD_KERNEL=true +KERNEL_ARCH=arm64 +RELEASE_ARCH=arm64 +CROSS_COMPILE=aarch64-linux-gnu- +QEMU_BINARY=/usr/bin/qemu-aarch64-static +KERNEL_DEFCONFIG=bcmrpi3_defconfig +KERNEL_BIN_IMAGE=Image +KERNEL_IMAGE=kernel8.img +KERNEL_BRANCH=rpi-4.11.y +ENABLE_WIRELESS=true