Skip to content

Commit 5df41ca

Browse files
authored
Merge pull request #90 from thin-edge/feat-rugix
feat: update to rugix
2 parents b7471a7 + 5341ab5 commit 5df41ca

20 files changed

+416
-372
lines changed

.github/workflows/bake-image.yml

Lines changed: 101 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
pull_request:
66
workflow_dispatch:
77
push:
8+
branches: [feat-rugix]
89
tags:
910
- "*"
1011

@@ -36,58 +37,130 @@ jobs:
3637
echo "version=$version" >> "$GITHUB_OUTPUT"
3738
3839
bake-image:
39-
name: Bake Image ${{ matrix.job.image }}
40-
runs-on: ubuntu-latest
40+
name: Bake ${{ matrix.job.system }}
41+
runs-on: ${{ matrix.job.runner }}
4142
needs: info
43+
env:
44+
IMAGE_NAME: ${{ matrix.job.system }}_${{ needs.info.outputs.version }}
45+
VERSION: ${{needs.info.outputs.version}}
4246
strategy:
4347
fail-fast: false
4448
matrix:
4549
job:
46-
- { image: rpi-tryboot }
47-
- { image: rpi-tryboot-containers }
48-
- { image: rpi-tryboot-pi4 }
49-
- { image: rpi-u-boot }
50-
- { image: rpi-u-boot-containers }
51-
- { image: rpi-u-boot-armhf }
52-
- { image: rpi-u-boot-armhf-containers }
53-
- { image: debian-arm64 }
54-
- { image: debian-amd64 }
50+
- { system: tedge-debian-12-efi-arm64, runner: ubuntu-24.04-arm }
51+
- { system: tedge-debian-12-efi-amd64, runner: ubuntu-latest }
52+
- { system: tedge-raspios-arm64-tryboot-pi4, runner: ubuntu-24.04-arm }
53+
- { system: tedge-raspios-arm64-tryboot, runner: ubuntu-24.04-arm }
54+
- { system: tedge-raspios-arm64, runner: ubuntu-24.04-arm }
55+
- { system: tedge-raspios-armhf, runner: ubuntu-latest }
5556
steps:
5657
- uses: actions/checkout@v4
5758
with:
5859
submodules: recursive
60+
5961
- uses: taiki-e/install-action@just
60-
- name: Install dependencies
61-
run: just setup
62-
- id: info
63-
env:
64-
VERSION: ${{needs.info.outputs.version}}
65-
run: |
66-
source <(just show)
67-
echo "PREFIX=$PREFIX" >> "$GITHUB_OUTPUT"
62+
6863
- name: Configure .env
6964
env:
7065
IMAGE_CONFIG: ${{secrets.IMAGE_CONFIG || ''}}
7166
run: |
72-
echo "IMAGE_NAME=${{ steps.info.outputs.PREFIX }}${{ matrix.job.image }}_${{ needs.info.outputs.version }}" > ".env"
67+
echo "Adding github repo owner (${{ github.repository_owner }}) to 'SSH_GITHUB_OWNER' variable to load any publish ssh keys if they exist"
68+
echo "SSH_GITHUB_OWNER=${{ github.repository_owner }}" >> .env
69+
7370
if [ -n "$IMAGE_CONFIG" ]; then
7471
echo "Adding custom IMAGE_CONFIG settings to .env"
75-
echo "$IMAGE_CONFIG" >> ".env"
72+
echo "$IMAGE_CONFIG" >> .env
7673
fi
7774
7875
- name: Build image
79-
env:
80-
VERSION: ${{needs.info.outputs.version}}
8176
run: |
82-
just IMAGE=${{ matrix.job.image }} build
77+
just SYSTEM=${{ matrix.job.system }} build-image
78+
79+
- name: Rename artifacts
80+
run: |
81+
sudo cp build/${{ matrix.job.system }}/system.img build/${{ matrix.job.system }}/${{ env.IMAGE_NAME }}.img
82+
sudo cp build/${{ matrix.job.system }}/artifacts/sbom.txt build/${{ matrix.job.system }}/artifacts/${{ env.IMAGE_NAME }}.sbom.txt
83+
ls -l build/${{ matrix.job.system }}/
84+
ls -l build/${{ matrix.job.system }}/artifacts/
85+
86+
- name: Upload SBOM
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: ${{ env.IMAGE_NAME }}.sbom.txt
90+
if-no-files-found: error
91+
path: |
92+
build/${{ matrix.job.system }}/artifacts/${{ env.IMAGE_NAME }}.sbom.txt
8393
94+
- name: Compress Image (xz)
95+
run: |
96+
sudo xz -v "build/${{ matrix.job.system }}/${{ env.IMAGE_NAME }}.img"
97+
8498
- name: Upload Image
8599
uses: actions/upload-artifact@v4
100+
id: image-upload-step
101+
with:
102+
name: ${{ env.IMAGE_NAME }}.img.xz
103+
if-no-files-found: error
104+
compression-level: 0
105+
path: |
106+
build/${{ matrix.job.system }}/${{ env.IMAGE_NAME }}.img.xz
107+
108+
- name: Build bundle
109+
run: |
110+
just SYSTEM=${{ matrix.job.system }} build-bundle ${{ env.IMAGE_NAME }}.rugixb
111+
112+
- name: Upload Update Bundle
113+
uses: actions/upload-artifact@v4
114+
id: bundle-upload-step
86115
with:
87-
name: ${{ steps.info.outputs.PREFIX }}${{ matrix.job.image }}_${{ needs.info.outputs.version }}
116+
name: ${{ env.IMAGE_NAME }}.rugixb
117+
if-no-files-found: error
118+
# rugixb is already compressed
119+
compression-level: 0
88120
path: |
89-
build/
90-
*.sbom.txt
121+
build/${{ matrix.job.system }}/${{ env.IMAGE_NAME }}.rugixb
122+
123+
- uses: reubenmiller/setup-go-c8y-cli@main
124+
- name: Publish firmware to c8y
125+
if: ${{ github.repository_owner == 'thin-edge' }}
126+
env:
127+
C8Y_HOST: '${{ secrets.C8Y_HOST }}'
128+
C8Y_USER: '${{ secrets.C8Y_USER }}'
129+
C8Y_PASSWORD: '${{ secrets.C8Y_PASSWORD }}'
130+
run: |
131+
publish_firmware_version() {
132+
FIRMWARE_NAME="$1"
133+
FIRMWARE_VERSION="$2"
134+
ARTIFACT_URL="$3"
135+
136+
FIRMWARE_ID=$(
137+
c8y firmware get -n --id "$FIRMWARE_NAME" --silentStatusCodes 404 --select id -o csv ||
138+
c8y firmware create -n --name "$FIRMWARE_NAME" --select id -o csv
139+
)
140+
ARTIFACT_ID=$(echo "$ARTIFACT_URL" | rev | cut -d/ -f1 | rev)
141+
FIRMWARE_URL="https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${ARTIFACT_ID}/zip"
142+
c8y firmware versions create \
143+
-n \
144+
--firmware "$FIRMWARE_ID" \
145+
--version "$FIRMWARE_VERSION" \
146+
--url "$FIRMWARE_URL" \
147+
--template "{
148+
github: {
149+
ref: '${{ github.ref }}',
150+
repository: '${{ github.repository }}',
151+
run_id: '${{ github.run_id }}',
152+
sha: '${{ github.sha }}',
153+
artifactUrl: '$ARTIFACT_URL',
154+
}
155+
}"
156+
}
157+
158+
# bundle
159+
publish_firmware_version "${{ matrix.job.system }}" "${{ env.VERSION }}" "${{ steps.bundle-upload-step.outputs.artifact-url }}"
160+
161+
# image (only used for migrating from a rugpi image to rugix)
162+
publish_firmware_version "${{ matrix.job.system }}" "${{ env.VERSION }}-img" "${{ steps.image-upload-step.outputs.artifact-url }}"
163+
91164
92165
release:
93166
name: Release
@@ -105,7 +178,7 @@ jobs:
105178
- name: Show release artifacts
106179
run: ls -l release/*/*
107180
- name: Release
108-
uses: softprops/action-gh-release@v1
181+
uses: softprops/action-gh-release@v2
109182
env:
110183
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111184
with:

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/.rugpi
2+
/.rugix
23
/build
4+
build.log
35
.image
46
*.sbom.txt
57
*.log
6-
*.env
8+
*.env
9+
10+
# test keys
11+
id_rsa
12+
id_rsa.pub

README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
# thin-edge.io image using Rugpi
1+
# thin-edge.io image using Rugix
22

3-
The repository can be used to build custom Raspberry Pi images with thin-edge.io and [Rugpi](https://oss.silitics.com/rugpi/) for robust OTA Operating System updates.
3+
The repository can be used to build custom device images with thin-edge.io and [Rugix](https://oss.silitics.com/rugix/) for robust Over-The-Air (OTA) Operating System updates.
44

55
## Compatible devices
66

7+
Rugix can support building images for other devices than just Raspberry Pi's, however the thin-edge.io integration is currently only tested for Raspberry Pi devices. Please reach out for support if you are looking into integrating with other devices, or contact [Silitics](https://oss.silitics.com/rugix/commercial-support), the authors of Rugix.
8+
79
**Using u-boot**
810

911
* Raspberry PI 1B
@@ -18,19 +20,19 @@ The repository can be used to build custom Raspberry Pi images with thin-edge.io
1820
* Raspberry Pi 5
1921

2022

21-
## Images
23+
## System Images
2224

23-
The following images are included in this repository.
25+
The following system images are included in this repository.
2426

2527
|Image|Description|
2628
|-------|-----------|
27-
|rpi-tryboot|Image for Raspberry Pi 4 and 5 devices which use the tryboot bootloader|
28-
|rpi-tryboot-containers|Image for Raspberry Pi 4 and 5 devices which use the tryboot bootloader and with docker pre-installed|
29-
|rpi-tryboot-rpi4|Raspberry Pi 4 image which includes the firmware to enable tryboot bootloader|
30-
|rpi-u-boot|Image for Raspberry Pi 2, 3, zero 2W|
31-
|rpi-u-boot-containers|Image for Raspberry Pi 2, 3, zero 2W with docker pre-installed|
32-
|rpi-u-boot-armhf|Image for Raspberry Pi 1 and zero|
33-
|rpi-u-boot-armhf-containers|Image for Raspberry Pi 1 and zero with docker pre-installed|
29+
|tedge-raspios-arm64-tryboot|Image for Raspberry Pi 4 and 5 devices which use the tryboot bootloader|
30+
|tedge-raspios-arm64-tryboot-pi4|Raspberry Pi 4 image which includes the firmware to enable tryboot bootloader|
31+
|tedge-raspios-arm64|Image for Raspberry Pi 3 and zero 2W|
32+
|tedge-raspios-armhf|Image for Raspberry Pi 1, 2 and zero|
33+
|tedge-raspios-armhf|Image for Raspberry Pi 1, 2 and zero|
34+
|tedge-debian-12-efi-arm64|Image for an EFI enabled device with arm64|
35+
|tedge-debian-12-efi-amd64|Image for an EFI enabled device with amd64|
3436

3537
## Building
3638

@@ -41,7 +43,7 @@ To run the build tasks, install [just](https://just.systems/man/en/chapter_5.htm
4143
1. Clone the repository
4244

4345
```sh
44-
git clone https://github.com/thin-edge/tedge-rugpi-image.git
46+
git clone https://github.com/thin-edge/tedge-rugix-image.git
4547
```
4648

4749
2. Create a custom `.env` file which will be used to store secrets
@@ -60,6 +62,9 @@ To run the build tasks, install [just](https://just.systems/man/en/chapter_5.htm
6062
SECRETS_WIFI_SSID=example
6163
SECRETS_WIFI_PASSWORD=yoursecurepassword
6264
SSH_KEYS_bootstrap="ssh-rsa xxxxxxx"
65+
66+
# Include ssh keys from github user profiles
67+
SSH_GITHUB_USERS=myuser
6368
```
6469

6570
**Note**
@@ -68,30 +73,26 @@ To run the build tasks, install [just](https://just.systems/man/en/chapter_5.htm
6873
6974
If an image has Wifi credentials baked in, then you should not make this image public, as it would expose your credentials!
7075
71-
4. Create the image (including downloading the supported base Raspberry Pi image) using:
76+
4. Create the image
7277
7378
```sh
74-
just build-pi4
79+
just SYSTEM=tedge-raspios-arm64-tryboot build-image
7580
```
7681
77-
Alternatively, you can use any of the image names defined in the `rugpi-bakery.toml` file, where the image name is part of the `images.*` key. For example, for `images.rpi-tryboot-containers`, the `IMAGE` name would be `rpi-tryboot`. You can then build the image using the following command:
78-
79-
```sh
80-
just IMAGE=rpi-tryboot-containers build
81-
```
82+
5. Using the path to the image shown in the console to flash the image to the device.
8283
83-
5. Using the path to the image shown in the console to flash the image to the Raspberry Pi.
84+
6. Build the update bundle for Over-the-Air Updates
8485
85-
6. Subsequent A/B updates can be done using Cumulocity IoT or the local Rugpi interface on (localhost:8088)
86-
87-
**Notes**
86+
```
87+
just SYSTEM=tedge-raspios-arm64-tryboot build-bundle
88+
```
8889
89-
You can apply image updates via the device's localhost:8088 interface, however you will have to expand the `.xz` image file to a `.img` file.
90+
**Note:** A Rugix update bundle will have the `.rugixb` suffix in its filename
9091
91-
For further information on Rugpi, checkout the [quick start guide](https://oss.silitics.com/rugpi/docs/getting-started).
92+
For further information on Rugix, checkout the [quick start guide](https://oss.silitics.com/rugix/docs/getting-started).
9293
9394
94-
### Building images including thin-edge.io main
95+
### Building images/bundles including thin-edge.io main
9596
9697
To build an image with the latest pre-release version from the [main channel](https://thin-edge.github.io/thin-edge.io/contribute/package-hosting/#pre-releases), set the following environment variable in the `.env` file in your project:
9798
@@ -107,25 +108,25 @@ The different image options can be confusing, so to help users a few device spec
107108
#### Raspberry Pi 1
108109
109110
```sh
110-
just build-pi1
111+
just SYSTEM=tedge-raspios-armhf build-image
111112
```
112113
113114
#### Raspberry Pi 2
114115
115116
```sh
116-
just build-pi2
117+
just SYSTEM=tedge-raspios-armhf build-image
117118
```
118119
119120
#### Raspberry Pi 3
120121
121122
```sh
122-
just build-pi3
123+
just SYSTEM=tedge-raspios-arm64 build-image
123124
```
124125
125126
#### Raspberry Pi 4 / 400
126127
127128
```sh
128-
just build-pi4
129+
just SYSTEM=tedge-raspios-arm64 build-image
129130
```
130131
131132
**Note**
@@ -135,25 +136,25 @@ All Raspberry Pi 4 and 400 don't support tryboot by default, and need their firm
135136
You can build an image which also includes the firmware used to enable tryboot. Afterwards you can switch back to using an image without the firmware included in it.
136137

137138
```sh
138-
just build-pi4-include-firmware
139+
just SYSTEM=tedge-raspios-arm64-tryboot-pi4 build-image
139140
```
140141

141142
#### Raspberry Pi 5
142143

143144
```sh
144-
just build-pi5
145+
just SYSTEM=tedge-raspios-arm64 build-image
145146
```
146147

147148
#### Raspberry Pi Zero
148149

149150
```sh
150-
just build-pizero
151+
just SYSTEM=tedge-raspios-armhf build-image
151152
```
152153

153154
#### Raspberry Pi Zero 2W
154155

155156
```sh
156-
just build-pizero2w
157+
just SYSTEM=tedge-raspios-arm64 build-image
157158
```
158159

159160
## Project Tasks
@@ -178,7 +179,6 @@ just build-pizero2w
178179

179180
**Optional: Public images to Cumulocity IoT**
180181

181-
182182
You will need [go-c8y-cli](https://goc8ycli.netlify.app/) and [gh](https://cli.github.com/) tools for this!
183183

184184
1. In the console, using go-c8y-cli, set your session to the tenant where you want to upload the firmware to

env.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ SSH_KEYS_bootstrap="ssh-rsa xxxxxxx"
88
#SSH_KEYS_user1="ssh-rsa xxxxxxx"
99
#SSH_KEYS_user2="ssh-rsa xxxxxxx"
1010

11+
# List of github user ids to fetch their public ssh keys from
12+
#SSH_GITHUB_USERS=
13+
1114
# thin-edge.io settings
1215
# thin-edge.io install channel. Options: "main", "release" (latest official release)
1316
#TEDGE_INSTALL_CHANNEL=main

0 commit comments

Comments
 (0)