From 586127dd1cbb997b711806c4a2ae91f02b6562de Mon Sep 17 00:00:00 2001 From: lucashalbert Date: Tue, 1 Oct 2019 14:38:08 -0400 Subject: [PATCH 01/11] Initial commit for rpi4-buster branch --- Dockerfile | 13 ++++++++----- builder/build.sh | 15 +++++++++++++++ travis-build.sh | 10 +++++----- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index fbaf193..f9a76a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,14 @@ FROM hypriot/image-builder:latest -ENV HYPRIOT_OS_VERSION=v2.1.0 \ - RAW_IMAGE_VERSION=v0.3.1 +ENV HYPRIOT_OS_VERSION=v2.2.1 \ + RAW_IMAGE_VERSION=v0.3.2 #Note that the checksums and build timestamps only apply when fetching missing #artifacts remotely is enabled to validate downloaded remote artifacts ENV FETCH_MISSING_ARTIFACTS=true \ ROOT_FS_ARTIFACT=rootfs-arm64-debian-$HYPRIOT_OS_VERSION.tar.gz \ KERNEL_ARTIFACT=4.19.58-hypriotos-v8.tar.gz \ + RPI4_KERNEL_ARTIFACT=bcm2711-kernel-bis \ BOOTLOADER_ARTIFACT=rpi-bootloader.tar.gz \ RAW_IMAGE_ARTIFACT=rpi-raw.img.zip \ DOCKER_ENGINE_VERSION="5:18.09.7~3-0~debian-stretch" \ @@ -15,16 +16,18 @@ ENV FETCH_MISSING_ARTIFACTS=true \ DOCKER_COMPOSE_VERSION="1.23.1" \ DOCKER_MACHINE_VERSION="0.16.1" \ KERNEL_VERSION="4.19.58" \ - ROOTFS_TAR_CHECKSUM="4437ac3ab8278a4a3994aa9aa36f0f00bc409f80ebdffef23a141dfc0286ecb0" \ - RAW_IMAGE_CHECKSUM="ccff10498fb45fb76c6064988fb01b3543adfdb70ee7e5fb04b51885573684a6" \ + ROOTFS_TAR_CHECKSUM="4745a25a294ac997db2a4ef9c190857178c3708f2af576258a28e197356e3ce7" \ + RAW_IMAGE_CHECKSUM="cd66db11608f910b7b18f0e1d5f7943f10d54bacc1fa1dcc526a442a115c4a5a" \ BOOTLOADER_BUILD="20190713-140339" \ - KERNEL_BUILD="20190715-111025" + KERNEL_BUILD="20190715-111025" \ + RPI4_KERNEL_BUILD="4.19.75.20191001" RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ binfmt-support \ qemu \ qemu-user-static \ + xz-utils \ --no-install-recommends && \ rm -rf /var/lib/apt/lists/* diff --git a/builder/build.sh b/builder/build.sh index d527f9a..d9d4c3a 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -25,6 +25,9 @@ HYPRIOT_IMAGE_VERSION=${VERSION:="dirty"} HYPRIOT_IMAGE_NAME="hypriotos-rpi64-${HYPRIOT_IMAGE_VERSION}.img" export HYPRIOT_IMAGE_VERSION +# Add RPI Kernel +RPI4_KERNEL_ARTIFACT=${RPI4_KERNEL_ARTIFACT}${RPI4_KERNEL_BUILD}.tar.xz + # create build directory for assembling our image filesystem rm -rf ${BUILD_PATH} mkdir ${BUILD_PATH} @@ -72,6 +75,18 @@ if [ ! -f "$FILENAME" ]; then fi tar -xf "$FILENAME" -C "${BUILD_PATH}" +# Add RPI4 Kernel +FILENAME=/workspace/$RPI4_KERNEL_ARTIFACT +if [ ! -f "$FILENAME" ]; then + if [ "$FETCH_MISSING_ARTIFACTS" == "true" ]; then + fetch --repo="https://github.com/sakaki-/bcm2711-kernel-bis" --tag="$RPI4_KERNEL_BUILD" --release-asset="${RPI$_KERNEL_ARTIFACT}-${RPI4_KERNEL_VERSION}.tar.xz" /workspace + else + echo "Missing artifact ${KERNEL_ARTIFACT}" + exit 255 + fi +fi +tar -xJf "$FILENAME" -C "${BUILD_PATH}" + # register qemu-aarch64 with binfmt # to ensure that binaries we use in the chroot # are executed via qemu-aarch64 diff --git a/travis-build.sh b/travis-build.sh index cf30886..5a37c69 100755 --- a/travis-build.sh +++ b/travis-build.sh @@ -12,10 +12,10 @@ if [ -z "$GITHUB_TOKEN" ]; then echo "ABORTING: env GITHUB_TOKEN is missing" exit 1 fi -if [ -z "$GITHUB_OAUTH_TOKEN" ]; then - echo "ABORTING: env GITHUB_OAUTH_TOKEN is missing" - exit 1 -fi +#if [ -z "$GITHUB_OAUTH_TOKEN" ]; then +# echo "ABORTING: env GITHUB_OAUTH_TOKEN is missing" +# exit 1 +#fi # verbose logging set -x @@ -43,4 +43,4 @@ export GIT_RELTEXT="Auto-released by [Travis-CI build #$TRAVIS_BUILD_NUMBER](htt curl -sSL https://github.com/tcnksm/ghr/releases/download/v0.5.4/ghr_v0.5.4_linux_amd64.zip > ghr.zip unzip ghr.zip ./ghr --version -./ghr --debug -u DieterReuter -b "$GIT_RELTEXT" $GIT_TAG builds/$BUILD_NR/ +./ghr --debug -u lucashalbert -b "$GIT_RELTEXT" $GIT_TAG builds/$BUILD_NR/ From e206b75eec5b54603c566daa6412e5a9ac94451e Mon Sep 17 00:00:00 2001 From: lucashalbert Date: Tue, 1 Oct 2019 14:43:21 -0400 Subject: [PATCH 02/11] Fix bad variable wqsubstitution --- builder/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/build.sh b/builder/build.sh index d9d4c3a..ffaa3df 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -26,7 +26,7 @@ HYPRIOT_IMAGE_NAME="hypriotos-rpi64-${HYPRIOT_IMAGE_VERSION}.img" export HYPRIOT_IMAGE_VERSION # Add RPI Kernel -RPI4_KERNEL_ARTIFACT=${RPI4_KERNEL_ARTIFACT}${RPI4_KERNEL_BUILD}.tar.xz +RPI4_KERNEL_ARTIFACT=${RPI4_KERNEL_ARTIFACT}-${RPI4_KERNEL_BUILD}.tar.xz # create build directory for assembling our image filesystem rm -rf ${BUILD_PATH} @@ -79,7 +79,7 @@ tar -xf "$FILENAME" -C "${BUILD_PATH}" FILENAME=/workspace/$RPI4_KERNEL_ARTIFACT if [ ! -f "$FILENAME" ]; then if [ "$FETCH_MISSING_ARTIFACTS" == "true" ]; then - fetch --repo="https://github.com/sakaki-/bcm2711-kernel-bis" --tag="$RPI4_KERNEL_BUILD" --release-asset="${RPI$_KERNEL_ARTIFACT}-${RPI4_KERNEL_VERSION}.tar.xz" /workspace + fetch --repo="https://github.com/sakaki-/bcm2711-kernel-bis" --tag="$RPI4_KERNEL_BUILD" --release-asset="${RPI$_KERNEL_ARTIFACT}" /workspace else echo "Missing artifact ${KERNEL_ARTIFACT}" exit 255 From 29674058b09024e8f37a9166ee9f24709333687a Mon Sep 17 00:00:00 2001 From: lucashalbert Date: Tue, 1 Oct 2019 14:47:11 -0400 Subject: [PATCH 03/11] I really am unable to type --- builder/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/build.sh b/builder/build.sh index ffaa3df..61662e4 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -79,7 +79,7 @@ tar -xf "$FILENAME" -C "${BUILD_PATH}" FILENAME=/workspace/$RPI4_KERNEL_ARTIFACT if [ ! -f "$FILENAME" ]; then if [ "$FETCH_MISSING_ARTIFACTS" == "true" ]; then - fetch --repo="https://github.com/sakaki-/bcm2711-kernel-bis" --tag="$RPI4_KERNEL_BUILD" --release-asset="${RPI$_KERNEL_ARTIFACT}" /workspace + fetch --repo="https://github.com/sakaki-/bcm2711-kernel-bis" --tag="$RPI4_KERNEL_BUILD" --release-asset="${RPI_KERNEL_ARTIFACT}" /workspace else echo "Missing artifact ${KERNEL_ARTIFACT}" exit 255 From 6e5292dd84ad6f0d8ff806f98d9e04ce780009e5 Mon Sep 17 00:00:00 2001 From: lucashalbert Date: Tue, 1 Oct 2019 14:55:05 -0400 Subject: [PATCH 04/11] Apparently I can't read either. --- builder/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/build.sh b/builder/build.sh index 61662e4..f069f7f 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -79,7 +79,7 @@ tar -xf "$FILENAME" -C "${BUILD_PATH}" FILENAME=/workspace/$RPI4_KERNEL_ARTIFACT if [ ! -f "$FILENAME" ]; then if [ "$FETCH_MISSING_ARTIFACTS" == "true" ]; then - fetch --repo="https://github.com/sakaki-/bcm2711-kernel-bis" --tag="$RPI4_KERNEL_BUILD" --release-asset="${RPI_KERNEL_ARTIFACT}" /workspace + fetch --repo="https://github.com/sakaki-/bcm2711-kernel-bis" --tag="$RPI4_KERNEL_BUILD" --release-asset="${RPI4_KERNEL_ARTIFACT}" /workspace else echo "Missing artifact ${KERNEL_ARTIFACT}" exit 255 From f3db84cd317da0cca57a1df8b7d839a7e58b3114 Mon Sep 17 00:00:00 2001 From: lucashalbert Date: Tue, 1 Oct 2019 15:08:36 -0400 Subject: [PATCH 05/11] change docker version to buster --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f9a76a8..aa86892 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ ENV FETCH_MISSING_ARTIFACTS=true \ RPI4_KERNEL_ARTIFACT=bcm2711-kernel-bis \ BOOTLOADER_ARTIFACT=rpi-bootloader.tar.gz \ RAW_IMAGE_ARTIFACT=rpi-raw.img.zip \ - DOCKER_ENGINE_VERSION="5:18.09.7~3-0~debian-stretch" \ + DOCKER_ENGINE_VERSION="5:18.09.7~3-0~debian-buster" \ CONTAINERD_IO_VERSION="1.2.6-3" \ DOCKER_COMPOSE_VERSION="1.23.1" \ DOCKER_MACHINE_VERSION="0.16.1" \ From b6d26690186c38db26d72cea68168a65cdb17574 Mon Sep 17 00:00:00 2001 From: lucashalbert Date: Tue, 1 Oct 2019 16:28:59 -0400 Subject: [PATCH 06/11] Add OS release information and fix rspec --- builder/chroot-script.sh | 15 ++++++++++++++- builder/test/os-release_spec.rb | 14 +++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/builder/chroot-script.sh b/builder/chroot-script.sh index c74360f..c55539a 100644 --- a/builder/chroot-script.sh +++ b/builder/chroot-script.sh @@ -86,7 +86,7 @@ function get_gpg(){ # get_gpg {GPGKEYID|FINGERPRINT} [URL|FILE] # device specific settings -HYPRIOT_DEVICE="Raspberry Pi 3 64bit" +HYPRIOT_DEVICE="Raspberry Pi 3/4 64bit" # set up /etc/resolv.conf DEST=$(readlink -m /etc/resolv.conf) @@ -166,6 +166,17 @@ start_x=0 gpu_mem=16 " >> boot/config.txt +# Add option for custom 64-bit kernel to boot/config.txt +echo " +[pi4] +# Enable DRM VC4 V3D driver on top of the dispmanx display stack +dtoverlay=vc4-fkms-v3d +max_framebuffers=2 +arm_64bit=1 +# differentiate from Pi3 64-bit kernels +kernel=kernel8-p4.img +" >> boot/config.txt + # # /etc/modules # echo "snd_bcm2835 # " >> /etc/modules @@ -288,6 +299,8 @@ HYPRIOT_KERNEL_BUILD="${KERNEL_BUILD}" HYPRIOT_KERNEL_VERSION="${KERNEL_VERSION}" HYPRIOT_DEVICE="$HYPRIOT_DEVICE" HYPRIOT_IMAGE_VERSION="$HYPRIOT_IMAGE_VERSION" +HYPRIOT_OS_VERSION="$HYPRIOT_OS_VERSION" +HYPRIOT_OS="HypriotOS/arm64" EOF else cat <> /etc/os-release diff --git a/builder/test/os-release_spec.rb b/builder/test/os-release_spec.rb index e8a7dfd..26ee359 100644 --- a/builder/test/os-release_spec.rb +++ b/builder/test/os-release_spec.rb @@ -7,11 +7,11 @@ expect(stdout).to contain('debian') end - it "is debian version stretch" do - expect(stdout).to contain('stretch') + it "is debian version buster" do + expect(stdout).to contain('buster') end - it "is a HypriotOS" do + it "is a Hypriot" do expect(stdout).to contain('HypriotOS') end @@ -32,12 +32,12 @@ expect(stdout).to contain('^HYPRIOT_OS="HypriotOS/arm64"$') end - it "is for device 'HYPRIOT_DEVICE=\"Raspberry Pi 3 64bit\"'" do - expect(stdout).to contain('^HYPRIOT_DEVICE="Raspberry Pi 3 64bit"$') + it "is for device 'HYPRIOT_DEVICE=\"Raspberry Pi 3/4 64bit\"'" do + expect(stdout).to contain('^HYPRIOT_DEVICE="Raspberry Pi 3/4 64bit"$') end - it "uses os-rootfs version 'HYPRIOT_OS_VERSION=\"v2.1.0\"'" do - expect(stdout).to contain('^HYPRIOT_OS_VERSION="v2.1.0"$') + it "uses os-rootfs version 'HYPRIOT_OS_VERSION=\"v2.2.1\"'" do + expect(stdout).to contain('^HYPRIOT_OS_VERSION="v2.2.1"$') end if ENV.fetch('TRAVIS_TAG','') != '' From f731b13b1c9b60c1b366107a197f83805ac7daa6 Mon Sep 17 00:00:00 2001 From: lucashalbert Date: Tue, 1 Oct 2019 16:45:50 -0400 Subject: [PATCH 07/11] fix verbage in os-release_spec.rb --- builder/test/os-release_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/test/os-release_spec.rb b/builder/test/os-release_spec.rb index 26ee359..d856fea 100644 --- a/builder/test/os-release_spec.rb +++ b/builder/test/os-release_spec.rb @@ -11,7 +11,7 @@ expect(stdout).to contain('buster') end - it "is a Hypriot" do + it "is a HypriotOS" do expect(stdout).to contain('HypriotOS') end From e435ed27ff6e8ce651bd27ad13fca4d0948dc628 Mon Sep 17 00:00:00 2001 From: lucashalbert Date: Tue, 1 Oct 2019 17:05:11 -0400 Subject: [PATCH 08/11] Re-enable GITHUB_OATH_TOKEN --- travis-build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/travis-build.sh b/travis-build.sh index 5a37c69..294f98b 100755 --- a/travis-build.sh +++ b/travis-build.sh @@ -12,10 +12,10 @@ if [ -z "$GITHUB_TOKEN" ]; then echo "ABORTING: env GITHUB_TOKEN is missing" exit 1 fi -#if [ -z "$GITHUB_OAUTH_TOKEN" ]; then -# echo "ABORTING: env GITHUB_OAUTH_TOKEN is missing" -# exit 1 -#fi +if [ -z "$GITHUB_OAUTH_TOKEN" ]; then + echo "ABORTING: env GITHUB_OAUTH_TOKEN is missing" + exit 1 +fi # verbose logging set -x From 2e615affecd3edcfa82a27bd9d71280215b4f265 Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Thu, 2 Jan 2020 23:08:39 +0100 Subject: [PATCH 09/11] Fixed default_user issue DieterReuter/image-builder-rpi64#113 --- builder/files/etc/cloud/cloud.cfg | 99 +++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 builder/files/etc/cloud/cloud.cfg diff --git a/builder/files/etc/cloud/cloud.cfg b/builder/files/etc/cloud/cloud.cfg new file mode 100644 index 0000000..fd0ce50 --- /dev/null +++ b/builder/files/etc/cloud/cloud.cfg @@ -0,0 +1,99 @@ +# The top level settings are used as module +# and system configuration. + +# A set of users which may be applied and/or used by various modules +# when a 'default' entry is found it will reference the 'default_user' +# from the distro configuration specified below +# users: +# - default + +# If this is set, 'root' will not be able to ssh in and they +# will get a message to login instead as the above $user (debian) +disable_root: true +apt_preserve_sources_list: true + +# This will cause the set+update hostname module to not operate (if true) +preserve_hostname: false + +# Example datasource config +# datasource: +# Ec2: +# metadata_urls: [ 'blah.com' ] +# timeout: 5 # (defaults to 50 seconds) +# max_wait: 10 # (defaults to 120 seconds) +datasource_list: [ NoCloud ] + +# The modules that run in the 'init' stage +cloud_init_modules: + - migrator + - seed_random + - bootcmd + - write-files + - growpart + - resizefs + - disk_setup + - mounts + - set_hostname + - update_hostname + - update_etc_hosts + - ca-certs + - rsyslog + - users-groups + - ssh + +# The modules that run in the 'config' stage +cloud_config_modules: +# Emit the cloud config ready event +# this can be used by upstart jobs for 'start on cloud-config'. + - emit_upstart + - ssh-import-id + - locale + - set-passwords + - grub-dpkg + - apt-pipelining + - apt-configure + - ntp + - timezone + - disable-ec2-metadata + - runcmd + - byobu + +# The modules that run in the 'final' stage +cloud_final_modules: + - package-update-upgrade-install + - fan + - puppet + - chef + - salt-minion + - mcollective + - rightscale_userdata + - scripts-vendor + - scripts-per-once + - scripts-per-boot + - scripts-per-instance + - scripts-user + - ssh-authkey-fingerprints + - keys-to-console + - phone-home + - final-message + - power-state-change + +# System and/or distro specific settings +# (not accessible to handlers/transforms) +system_info: + # This will affect which distro class gets used + distro: debian + # Default user name + that default users groups (if added/used) + default_user: + name: debian + lock_passwd: True + gecos: Debian + groups: [adm, audio, cdrom, dialout, dip, floppy, netdev, plugdev, sudo, video] + sudo: ["ALL=(ALL) NOPASSWD:ALL"] + shell: /bin/bash + # Other config here will be given to the distro class and/or path classes + paths: + cloud_dir: /var/lib/cloud/ + templates_dir: /etc/cloud/templates/ + upstart_dir: /etc/init/ + ssh_svcname: ssh From 019aea4230cc5f2dba1a6937b8850fad3124ea0b Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Thu, 2 Jan 2020 23:09:32 +0100 Subject: [PATCH 10/11] Revert travis change --- travis-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis-build.sh b/travis-build.sh index 294f98b..cf30886 100755 --- a/travis-build.sh +++ b/travis-build.sh @@ -43,4 +43,4 @@ export GIT_RELTEXT="Auto-released by [Travis-CI build #$TRAVIS_BUILD_NUMBER](htt curl -sSL https://github.com/tcnksm/ghr/releases/download/v0.5.4/ghr_v0.5.4_linux_amd64.zip > ghr.zip unzip ghr.zip ./ghr --version -./ghr --debug -u lucashalbert -b "$GIT_RELTEXT" $GIT_TAG builds/$BUILD_NR/ +./ghr --debug -u DieterReuter -b "$GIT_RELTEXT" $GIT_TAG builds/$BUILD_NR/ From 7154b48bf4ae3857e9b6c19d05ad0584b00337b5 Mon Sep 17 00:00:00 2001 From: Jun Matsushita Date: Thu, 2 Jan 2020 23:10:38 +0100 Subject: [PATCH 11/11] Removed warning and added model 4 --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 65c2143..f03452b 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ # image-builder-rpi64 [![Build Status](https://travis-ci.org/DieterReuter/image-builder-rpi64.svg?branch=master)](https://travis-ci.org/DieterReuter/image-builder-rpi64) -**Warning:** This SD image will not work on a Raspberry Pi 4B !!! - -This repo builds the SD card image with HypriotOS for the Raspberry Pi 3 in 64bit. +This repo builds the SD card image with HypriotOS for the Raspberry Pi 3/4 in 64bit. You can find released versions of the SD card image here in the GitHub releases page. To build this SD card image we have to