Skip to content
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

add 64bit Raspberry Pi OS Lite base image for RPi5 #161

Merged
merged 4 commits into from
Jan 13, 2025
Merged
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
4 changes: 4 additions & 0 deletions .github/workflows/amd64-image-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: amd64-image-build

concurrency:
group: amd64-image-build-${{ github.head_ref }}
cancel-in-progress: true

on:
push:
branches: [ "master" ]
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/arm64-rpi-image-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: arm64-rpi-image-build

concurrency:
group: arm64-rpi-image-build-${{ github.head_ref }}
cancel-in-progress: true

on:
push:
branches: [ "master" ]
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/arm64-rpi5-image-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: arm64-rpi5-image-build

concurrency:
group: arm64-rpi5-image-build-${{ github.head_ref }}
cancel-in-progress: true

on:
push:
branches: [ "master" ]
paths-ignore:
- '*.md'
- '.gitignore'
- 'images'
- 'ci/amd64/**'
- 'scripts/jam-remote'
- 'Makefile'
pull_request:
branches: [ "master" ]
paths-ignore:
- '*.md'
- '.gitignore'
- 'images'
- 'ci/amd64/**'
- 'scripts/jam-remote'
- 'Makefile'
workflow_dispatch:

jobs:
arm64-rpi5-image-build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Set values
id: set_values
run: |
echo "BUILD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
echo "BUILD_VERSION=$(git describe --always --tags)" >> $GITHUB_ENV
if [[ "${{github.event_name}}" == "pull_request" ]]; then
echo "::set-output name=github_user::${{github.event.pull_request.head.repo.owner.login}}"
else
echo "::set-output name=github_user::$(echo ${{github.repository}} | cut -d'/' -f1)"
fi

- name: Display the build name
run: echo "Building the joininbox-arm64-rpi5-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}"

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64

- name: Run the build script
run: |
echo "Running with: ${{steps.set_values.outputs.github_user}} $GITHUB_HEAD_REF"
cd ci/arm64-rpi
bash arm64-rpi5.sh ${{steps.set_values.outputs.github_user}} $GITHUB_HEAD_REF

- name: Compute checksum of the raw image
run: |
cd ci/arm64-rpi
sha256sum joininbox-arm64-rpi5.img > joininbox-arm64-rpi5.img.sha256

- name: Compress image
run: |
cd ci/arm64-rpi
gzip -v9 joininbox-arm64-rpi5.img

- name: Compute checksum of the compressed image
run: |
cd ci/arm64-rpi
sha256sum joininbox-arm64-rpi5.img.gz > joininbox-arm64-rpi5.img.gz.sha256

- name: Upload the image and checksums
uses: actions/upload-artifact@v3
with:
name: joininbox-arm64-rpi5-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}
path: |
${{ github.workspace }}/ci/arm64-rpi/joininbox-arm64-rpi5.img.sha256
${{ github.workspace }}/ci/arm64-rpi/joininbox-arm64-rpi5.img.gz
${{ github.workspace }}/ci/arm64-rpi/joininbox-arm64-rpi5.img.gz.sha256
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,20 @@ arm64-rpi-image:
# Compute checksum of the compressed image
cd ci/arm64-rpi && \
sha256sum joininbox-arm64-rpi.img.gz > joininbox-arm64-rpi.img.gz.sha256

arm64-rpi5-image:
# build image
cd ci/arm64-rpi && \
bash arm64-rpi5.sh $(GITHUB_USER) $(CURRENT_BRANCH)

# Compute checksum of the raw image
cd ci/arm64-rpi && \
sha256sum joininbox-arm64-rpi5.img > joininbox-arm64-rpi5.img.sha256

# Compress image
cd ci/arm64-rpi && \
gzip -v9 joininbox-arm64-rpi5.img

# Compute checksum of the compressed image
cd ci/arm64-rpi && \
sha256sum joininbox-arm64-rpi5.img.gz > joininbox-arm64-rpi5.img.gz.sha256
2 changes: 1 addition & 1 deletion ci/amd64/packer.build.amd64-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# install packer
if ! packer version 2>/dev/null; then
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-add-repository -y "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update
echo -e "\nInstalling packer..."
sudo apt-get install -y packer
Expand Down
60 changes: 60 additions & 0 deletions ci/arm64-rpi/arm64-rpi5.pkr.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
variable "github_user" {}
variable "branch" {}

source "arm" "joininbox-arm64-rpi5" {
file_checksum_type = "sha256"
file_checksum = "6ac3a10a1f144c7e9d1f8e568d75ca809288280a593eb6ca053e49b539f465a4"
file_target_extension = "xz"
file_unarchive_cmd = ["xz", "--decompress", "$ARCHIVE_PATH"]
file_urls = ["https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-11-19/2024-11-19-raspios-bookworm-arm64-lite.img.xz"]
image_build_method = "resize"
image_chroot_env = ["PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"]
image_partitions {
filesystem = "vfat"
mountpoint = "/boot"
name = "boot"
size = "256M"
start_sector = "8192"
type = "c"
}
image_partitions {
filesystem = "ext4"
mountpoint = "/"
name = "root"
size = "0"
start_sector = "532480"
type = "83"
}
image_path = "joininbox-arm64-rpi5.img"
image_size = "8G"
image_type = "dos"
qemu_binary_destination_path = "/usr/bin/qemu-aarch64-static"
qemu_binary_source_path = "/usr/bin/qemu-aarch64-static"
}

build {
sources = ["source.arm.joininbox-arm64-rpi5"]

provisioner "shell" {
inline = [
"echo 'nameserver 1.1.1.1' >/etc/resolv.conf",
"echo 'nameserver 8.8.8.8' >>/etc/resolv.conf",
"echo $(hostname -I | awk '{print $1}') $(hostname) >>/etc/hosts",
"echo 127.0.1.1 $(hostname) >>/etc/hosts",
"echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections",
"apt-get update",
"apt-get install -y sudo wget",
"apt-get -y autoremove",
"apt-get -y clean",
]
}

provisioner "shell" {
environment_vars = [
"github_user=${var.github_user}",
"branch=${var.branch}"
]
script = "./joininbox.sh"
}

}
20 changes: 20 additions & 0 deletions ci/arm64-rpi/arm64-rpi5.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -e

if [ $# -gt 0 ]; then
github_user=$1
else
github_user=openoms
fi

if [ $# -gt 1 ]; then
branch=$2
else
branch=master
fi

# Build the image in docker
echo -e "\nBuild Packer image..."
# from https://hub.docker.com/r/mkaczanowski/packer-builder-arm/tags
docker run --rm --privileged -v /dev:/dev -v ${PWD}:/build \
mkaczanowski/packer-builder-arm:1.0.4@sha256:df09a8e249a292f10ca9b8cfd73420f5b987b6ac337d4ef28b6f4a8e61118822 \
build -var "github_user=${github_user}" -var "branch=${branch}" arm64-rpi5.pkr.hcl
Loading