Skip to content
This repository has been archived by the owner on May 22, 2022. It is now read-only.

Adjust GitHub actions workflow to use an Arch container #13

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9dfbddc
ci: Adjust GitHub actions workflow to use an Arch container
raccube May 6, 2021
57a2347
Run build on pull requests
raccube May 6, 2021
39bf79f
Use archlinux:base-devel container image
raccube May 6, 2021
2c3651d
Fix package name for fdisk
raccube May 6, 2021
dd75bc1
Use --noconfirm
raccube May 6, 2021
db23ba1
Add git
raccube May 6, 2021
8e99189
🤔
raccube May 6, 2021
f40e677
🦝🗑
raccube May 6, 2021
6dc8929
🦝🗑!
raccube May 6, 2021
46750af
Add Python as dependency 🐍
raccube May 6, 2021
d582194
Run with --privileged
raccube May 6, 2021
4ff5892
Ensure build directory exists
raccube May 6, 2021
9a694f0
ci: Add platform parameter
raccube May 8, 2021
a97a78c
ci: Add dosfstools to dependencies
raccube May 8, 2021
6c3c798
ci: [debug] output file type of loop devices
raccube May 8, 2021
c7d8b52
ci: [debug] ???
raccube May 8, 2021
c492592
ci: [debug] ???
raccube May 8, 2021
7c1e783
ci: [debug] ???
raccube May 8, 2021
7d4125d
ci: [debug] ???
raccube May 8, 2021
96680f8
ci: [debug] ???
raccube May 8, 2021
edbd508
ci: [debug] ???
raccube May 8, 2021
4e42295
ci: [debug] ???
raccube May 8, 2021
a72d784
ci: [debug] HACK HACK HACK
raccube May 8, 2021
b178e15
ci: [debug] ???
raccube May 8, 2021
b9770de
ci: [debug] Pass through CI env var
raccube May 8, 2021
adeb14e
ci: [debug] remove env;exit
raccube May 8, 2021
3077adf
ci: [debug] env CI=true
raccube May 8, 2021
fddda94
ci: [debug] mount -o loop
raccube May 8, 2021
9ddfb7c
ci: [debug] oops
raccube May 8, 2021
56fd2d7
ci: [debug] specify fs type
raccube Oct 9, 2021
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
18 changes: 13 additions & 5 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@ on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
options: --privileged
strategy:
matrix:
platform: [odroid, rpi3, rpi4]
steps:
- uses: actions/checkout@v2
- run: echo -e "[aurto]\nSigLevel = Optional\nServer = https://aur.raccube.net/" >> /etc/pacman.conf
- name: Install dependencies
run: sudo apt install -y libarchive-tools curl fdisk qemu-user-static zstd
run: pacman -Syu --noconfirm gptfdisk arch-install-scripts git qemu-user-static-bin archlinuxarm-keyring python dosfstools
- name: Build ODroid image
run: sudo ./build.sh odroid.img
run: sudo ./build.py ${{ matrix.platform }} robot-${{ matrix.platform }}.img
- name: Compress image
run: zstd odroid.img
run: zstd robot-${{ matrix.platform }}.img
- name: Publish compressed image
uses: actions/upload-artifact@v2
with:
name: ODroid Image
path: odroid.img.zst
name: ${{ matrix.platform }}
path: robot-${{ matrix.platform }}.img.zst
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Scripts used to create a system image for SR brain board SD cards.

- bash
- Python 3.8 or newer
- curl
- fdisk
- [arch-install-scripts](https://archlinux.org/packages/extra/any/arch-install-scripts/)
- [archlinuxarm-keyring](http://mirror.archlinuxarm.org/armv6h/core/archlinuxarm-keyring-20140119-1-any.pkg.tar.xz)
Expand Down
2 changes: 2 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def run_stage(stage: Path, environment, build_dir):

print("SR Image Builder")
print(f"Build directory: {args.build_dir}")
Path(args.build_dir).mkdir(parents=True, exist_ok=True)

stages = determine_stage_list()

Expand All @@ -127,6 +128,7 @@ def run_stage(stage: Path, environment, build_dir):
"CACHE_DIR": str(args.cache_dir),
"PLATFORM": args.platform,
}
# TODO: Pass through GITHUB_* environment variables

atexit.register(cleanup, args.build_dir)

Expand Down
20 changes: 15 additions & 5 deletions stage0/00-host_setup-disk.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
set -e
set -x

source ./util.sh

Expand Down Expand Up @@ -34,25 +35,34 @@ info "Partitioning disk image"
echo # last sector (accept default)

echo w # write changes
) | /sbin/fdisk "$IMAGE_OUTPUT_PATH" > /dev/null
) | /sbin/fdisk "$IMAGE_OUTPUT_PATH" #> /dev/null

if [[ "$OUTPUT_DEVICE" =~ ^/dev/loop ]]; then
info "Setting up loop device"
losetup -P "$OUTPUT_DEVICE" "$IMAGE_OUTPUT_PATH"
boot_part="${OUTPUT_DEVICE}p1"
root_part="${OUTPUT_DEVICE}p2"

mkdir -p "$BUILD_DIR"
mount -t ext4 -o loop,offset=413696 "$IMAGE_OUTPUT_PATH" "$BUILD_DIR"
mkdir -p "$BUILD_DIR/boot"
mount -t vfat -o loop,offset=4096 "$IMAGE_OUTPUT_PATH" "$BUILD_DIR/boot"
else
boot_part="${OUTPUT_DEVICE}1"
root_part="${OUTPUT_DEVICE}2"
fi

/sbin/fdisk -l "$IMAGE_OUTPUT_PATH"
file "$IMAGE_OUTPUT_PATH"
losetup
file "$OUTPUT_DEVICE"
file "$boot_part"
file "$root_part"
ls -lRa /dev/

info "Creating boot filesystem"
mkfs.vfat -F 32 "$boot_part"

info "Creating root filesystem"
mkfs.ext4 -q "$root_part"

mkdir -p "$BUILD_DIR"

info "Mounting root partition"
mount -t ext4 -o rw,defaults,noatime "$root_part" "$BUILD_DIR"
Expand Down