Skip to content

Raspberry Pi 4 Support with upgrade to buster [FIXED] #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
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" \
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" \
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/*

Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# image-builder-rpi64
[![CircleCI](https://circleci.com/gh/DieterReuter/image-builder-rpi64.svg?style=svg)](https://circleci.com/gh/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

Expand Down
15 changes: 15 additions & 0 deletions builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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="${RPI4_KERNEL_ARTIFACT}" /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
Expand Down
15 changes: 14 additions & 1 deletion builder/chroot-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 <<EOF >> /etc/os-release
Expand Down
99 changes: 99 additions & 0 deletions builder/files/etc/cloud/cloud.cfg
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions builder/test/os-release_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
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
Expand All @@ -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('CIRCLE_TAG','') != ''
Expand Down