Skip to content

Commit

Permalink
feat: support rpi1 and zero (#12)
Browse files Browse the repository at this point in the history
* add support for raspberry pi 1

* detect firmware name from file

* add note for rpi zero

* update supported devices section
  • Loading branch information
reubenmiller authored Dec 3, 2023
1 parent b9f85a9 commit 2c8d61f
Show file tree
Hide file tree
Showing 9 changed files with 739 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bake-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: extractions/setup-just@v1

- name: Install QEMU
run: docker run --privileged --rm tonistiigi/binfmt --install arm64
run: docker run --privileged --rm tonistiigi/binfmt --install arm64,armhf

- name: Set image version
run: echo "VERSION=$(just generate_version)" >> $GITHUB_ENV
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ The repository can be used to build custom Raspberry Pi images with thin-edge.io

## Compatible devices

**Using u-boot bootloader**
**Using u-boot**

* Raspberry PI 1B
* Raspberry PI 2B Rev 1.2
* Raspberry PI Zero
* Raspberry PI Zero 2 W
* Raspberry PI 3

**Using tryboot bootloader**
**Using tryboot**

* Raspberry Pi 4 (using tryboot)
* Raspberry Pi 5 (using tryboot)
* Raspberry Pi 4
* Raspberry Pi 5


## Images
Expand Down Expand Up @@ -86,3 +88,9 @@ The default WIFI credentials are as follows, though it assumes that the given WI
* pi45
This profile will use pre-baked credentials for the WIFI which are defined in [profiles/wifi.toml](profiles/wifi.toml).
### Building for Raspberry 1 or Zero
```sh
just IMAGE_ARCH=armhf PROFILE=armhf VARIANT=pi01 build-all
```
6 changes: 6 additions & 0 deletions images/pi01.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
architecture = "armhf"

boot_flow = "u-boot"

# Make image generic so it can be used for pi4 and pi5
include_firmware = "none"
13 changes: 11 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

export IMAGE_URL := "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-10-10/2023-10-10-raspios-bookworm-arm64-lite.img.xz"
export IMAGE_URL_ARM64 := "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-10-10/2023-10-10-raspios-bookworm-arm64-lite.img.xz"
export IMAGE_URL_ARMHF := "https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2023-10-10/2023-10-10-raspios-bookworm-armhf-lite.img.xz"

export IMAGE_ARCH := "arm64"

export IMAGE_URL := if IMAGE_ARCH != "armhf" { IMAGE_URL_ARM64 } else { IMAGE_URL_ARMHF }
export RUGPI_IMAGE := "ghcr.io/silitics/rugpi-bakery:latest"

export PREFIX := "tedge_rugpi_"
Expand Down Expand Up @@ -35,6 +40,10 @@ show:
@echo "VERSION: {{VERSION}}"
@echo "BUILD_INFO: {{BUILD_INFO}}"

# Setup binfmt tools
setup:
docker run --privileged --rm tonistiigi/binfmt --install arm64,armhf

# Clean build
clean:
@rm -Rf build/
Expand Down Expand Up @@ -68,7 +77,7 @@ bake:
@echo ""

# Build the entire image
build-all: extract customize bake
build-all: setup extract customize bake

# Build the image from an already downloaded image
build-local: customize bake
Expand Down
26 changes: 26 additions & 0 deletions profiles/armhf.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
recipes = [
"persist-root-home",
"ssh",
"zsh",
"persist-overlay",
"tedge-firmware-update",
"set-wifi",
]
exclude = ["mosquitto"]
architecture = "armhf"

[parameters.apt-cleanup]
autoremove = true

[parameters.ssh]
root_authorized_keys = """
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfhQGWWw73ponAokdNSRZ5cQc9/CIX1TLQgYlr+BtObKoO4UNFP1YSbgK03GjhjeUid+QPmV+UURqxQTqLQoYWqUFP2CYkILFccVPmTvx9HLwupI+6QQKWfMDx9Djfph9GzInymaA5fT7hKppqittFrC/l3lkKgKTX5ohEOGshIbRgtgOYIaW3ByTx3urnaBbYCIgOyOZzSIyS0dUkwsiLu3XjPspgmn3Fs/+vofT/yhBe1carW0UM3ivV0JFfJzrxbCl/F7I2qwfjZXsypjkwlpNupUMuo3xPMi8YvNvyEu4d+IEAqO1dCcdGcxlkiHxrdITIpVLt5mjJ2LauHE/H bootstrap
"""

[parameters.set-wifi]
# These values should be modified if you want to enable default wifi credentials in the image
ssid = "onboarding_jail"
password = "onboarding_jail"

[parameters.rugpi-ctrl]
rugpi_admin = true # Enable Rugpi Admin.
7 changes: 5 additions & 2 deletions recipes/tedge-bootstrap/files/tedge-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ set_hostname() {
fi
echo "$host_name" | tee /etc/hostname
sed -i -E 's/^127.0.1.1.*/127.0.1.1\t'"$host_name"'/' /etc/hosts
hostnamectl set-hostname "$host_name"
systemctl restart avahi-daemon 2>/dev/null ||:
if ! hostnamectl set-hostname "$host_name"; then
log "hostnamectl failed, falling back to writing to /etc/hostname"
echo "$host_name" > /etc/hostname
fi
systemctl restart avahi-daemon --no-block 2>/dev/null ||:
}

if [ $# -gt 0 ]; then
Expand Down
Loading

0 comments on commit 2c8d61f

Please sign in to comment.