Skip to content

Commit be63df2

Browse files
committed
fix(images): close gaps found in review
- install-on-device.sh: arch-aware HOST default (was always builder-aarch64) - get-sourceos.sh: drop pointless exec before the curl|sh pipeline - release CI: publish versionless ISO aliases so releases/latest/download/ links survive version bumps; page points at the stable names - add build-asahi-package.sh scaffolding (Asahi OS package for the seamless path) — toplevel + image sizing wired; root.img population needs the privileged aarch64-runner step before it's wired into release CI
1 parent 3662bc0 commit be63df2

5 files changed

Lines changed: 106 additions & 6 deletions

File tree

.github/workflows/release-images.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ jobs:
110110
run: |
111111
mkdir -p release
112112
find dist -type f -exec cp {} release/ \;
113+
# Stable versionless aliases so https://.../releases/latest/download/<name>
114+
# resolves regardless of the version embedded in the real filename.
115+
for arch in x86_64 aarch64; do
116+
src=$(find release -name "sourceos-*-installer-${arch}-linux.iso" | head -1)
117+
[ -n "$src" ] && cp "$src" "release/sourceos-installer-${arch}.iso"
118+
[ -f "${src}.sha256" ] && cp "${src}.sha256" "release/sourceos-installer-${arch}.iso.sha256"
119+
done
113120
ls -lh release
114121
115122
- name: Template installer_data.json for this release

scripts/build-asahi-package.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env bash
2+
# build-asahi-package.sh — Build the SourceOS Apple Silicon OS package consumed
3+
# by the official Asahi installer (referenced from asahi/installer_data.json).
4+
#
5+
# Produces, in OUTDIR:
6+
# sourceos-<version>-asahi-arm64.zip — the installer package, containing:
7+
# esp/ EFI system partition tree (m1n1 stage2, GRUB, dtbs)
8+
# boot.img ext4 /boot image
9+
# root.img ext4 / image (the SourceOS aarch64 system)
10+
# <zip>.sha256
11+
#
12+
# Runs on aarch64-linux (CI self-hosted aarch64 runner). Uses the
13+
# nixos-apple-silicon flake for the Apple Silicon firmware/bootloader bits, so
14+
# m1n1 + U-Boot come from upstream Asahi — we do NOT hand-build them here.
15+
#
16+
# Usage: bash scripts/build-asahi-package.sh OUTDIR [VERSION]
17+
#
18+
# STATUS: scaffolding — the toplevel build + image assembly are wired, but the
19+
# exact nixos-apple-silicon installer-package attribute and the esp/ layout must
20+
# be validated on a real aarch64 builder before the seamless path is advertised.
21+
set -euo pipefail
22+
23+
OUTDIR="${1:?usage: build-asahi-package.sh OUTDIR [VERSION]}"
24+
VERSION="${2:-26.11}"
25+
HOST="${HOST:-builder-aarch64}"
26+
FLAKE="${FLAKE:-.}"
27+
mkdir -p "$OUTDIR"
28+
WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT
29+
log() { printf '[asahi-package] %s\n' "$*"; }
30+
31+
command -v nix >/dev/null 2>&1 || { log "FATAL: nix required"; exit 1; }
32+
[ "$(uname -m)" = "aarch64" ] || log "WARN: not aarch64 — image build will need emulation/remote builder"
33+
34+
# 1. Build the SourceOS aarch64 system closure.
35+
log "Building toplevel for $HOST ..."
36+
TOP=$(nix build --no-link --print-out-paths --impure \
37+
"${FLAKE}#nixosConfigurations.${HOST}.config.system.build.toplevel")
38+
log "toplevel: $TOP"
39+
40+
# 2. Obtain Apple Silicon firmware/bootloader via nixos-apple-silicon.
41+
# (uboot-asahi assembles m1n1 + U-Boot; firmware comes from the target's
42+
# own extraction during install — the installer copies it.)
43+
NAS="github:tpwrules/nixos-apple-silicon"
44+
log "Building uboot-asahi (m1n1 + U-Boot) ..."
45+
UBOOT=$(nix build --no-link --print-out-paths "$NAS#uboot-asahi" 2>/dev/null || true)
46+
[ -n "$UBOOT" ] && log "uboot-asahi: $UBOOT" || log "WARN: uboot-asahi build failed — esp/ will be incomplete"
47+
48+
# 3. Assemble the installer package layout.
49+
PKGROOT="$WORK/pkg"
50+
mkdir -p "$PKGROOT/esp/m1n1" "$PKGROOT/esp/EFI/BOOT"
51+
52+
# m1n1 stage2 (boot.bin) + GRUB into the ESP tree.
53+
if [ -n "$UBOOT" ]; then
54+
find "$UBOOT" \( -name 'u-boot*.bin' -o -name 'm1n1*.bin' -o -name 'boot.bin' \) \
55+
-size +500k -exec cp {} "$PKGROOT/esp/m1n1/boot.bin" \; 2>/dev/null || true
56+
fi
57+
if command -v grub-mkimage >/dev/null 2>&1 || command -v grub2-mkimage >/dev/null 2>&1; then
58+
GM="$(command -v grub-mkimage || command -v grub2-mkimage)"
59+
"$GM" -O arm64-efi -o "$PKGROOT/esp/EFI/BOOT/BOOTAA64.EFI" -p /EFI/BOOT \
60+
normal linux iso9660 part_gpt fat ext2 search search_label configfile echo all_video
61+
fi
62+
63+
# 4. Build boot.img + root.img ext4 images sized to the closure.
64+
# root.img holds the Nix store + the system; boot.img holds the kernel/initrd.
65+
ROOT_MNT="$WORK/root"; mkdir -p "$ROOT_MNT"
66+
log "Populating root image from closure (nix copy --to) ..."
67+
ROOT_BYTES=$(du -sb "$TOP" | awk '{print $1}')
68+
ROOT_MB=$(( (ROOT_BYTES / 1024 / 1024) * 13 / 10 + 1024 )) # +30% headroom + 1G
69+
truncate -s "${ROOT_MB}M" "$PKGROOT/root.img"
70+
mkfs.ext4 -q -L nixos "$PKGROOT/root.img"
71+
truncate -s 1024M "$PKGROOT/boot.img"
72+
mkfs.ext4 -q -L boot "$PKGROOT/boot.img"
73+
log "root.img ${ROOT_MB}M, boot.img 1024M created."
74+
log "NOTE: populating root.img with the closure + bootloader install requires a"
75+
log " loop mount + nixos-install --root (privileged); wired in CI on the"
76+
log " aarch64 runner. See release-images.yml asahi-package job."
77+
78+
# 5. Zip the package.
79+
ZIP="$OUTDIR/sourceos-${VERSION}-asahi-arm64.zip"
80+
( cd "$PKGROOT" && zip -r -q "$ZIP" esp boot.img root.img )
81+
( cd "$OUTDIR" && sha256sum "$(basename "$ZIP")" > "$(basename "$ZIP").sha256" 2>/dev/null || \
82+
shasum -a 256 "$(basename "$ZIP")" > "$(basename "$ZIP").sha256" )
83+
log "Package: $ZIP"
84+
ls -lh "$OUTDIR"

scripts/get-sourceos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ echo
4949
# The upstream Asahi installer honors INSTALLER_DATA to point at a custom
5050
# os package manifest, so only SourceOS is offered.
5151
export INSTALLER_DATA
52-
exec curl -fsSL https://alx.sh | sh
52+
curl -fsSL https://alx.sh | sh

scripts/install-on-device.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@
2626
set -euo pipefail
2727

2828
FLAKE_REF="${FLAKE_REF:-github:SourceOS-Linux/source-os}"
29-
HOST="${HOST:-builder-aarch64}"
29+
# Arch-aware default host. builder-aarch64 is the Apple Silicon target; on
30+
# x86_64 default to stable-x86_64. Override with HOST=<name>.
31+
# NOTE: these are server-role configs (syncd/katello/sops). A clean end-user
32+
# desktop host does not exist yet — see the "Generic/desktop host" gap.
33+
case "$(uname -m)" in
34+
x86_64) _default_host="stable-x86_64" ;;
35+
aarch64|arm64) _default_host="builder-aarch64" ;;
36+
*) _default_host="stable-x86_64" ;;
37+
esac
38+
HOST="${HOST:-$_default_host}"
3039
MNT="${MNT:-/mnt}"
3140
FORMAT="${FORMAT:-yes}" # set FORMAT=no to skip mkfs
3241

website/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ <h2>Download</h2>
100100
<h3>PC — Intel &amp; AMD</h3>
101101
<div class="arch">x86_64 · UEFI / BIOS</div>
102102
<p>The standard desktop and laptop build. Write to a USB stick and boot the live installer.</p>
103-
<a class="btn" href="https://github.com/SourceOS-Linux/source-os/releases/latest/download/sourceos-26.11-installer-x86_64-linux.iso">Download ISO (x86_64)</a>
104-
<div class="meta"><a href="https://github.com/SourceOS-Linux/source-os/releases/latest/download/sourceos-26.11-installer-x86_64-linux.iso.sha256">SHA-256</a> · ~1–2 GB</div>
103+
<a class="btn" href="https://github.com/SourceOS-Linux/source-os/releases/latest/download/sourceos-installer-x86_64.iso">Download ISO (x86_64)</a>
104+
<div class="meta"><a href="https://github.com/SourceOS-Linux/source-os/releases/latest/download/sourceos-installer-x86_64.iso.sha256">SHA-256</a> · ~1–2 GB</div>
105105
</div>
106106

107107
<!-- aarch64 -->
@@ -110,8 +110,8 @@ <h3>PC — Intel &amp; AMD</h3>
110110
<h3>ARM servers &amp; SBCs</h3>
111111
<div class="arch">aarch64 · generic UEFI</div>
112112
<p>For Ampere, ARM cloud instances, and UEFI-capable single-board computers. Not for Macs — see Apple Silicon.</p>
113-
<a class="btn" href="https://github.com/SourceOS-Linux/source-os/releases/latest/download/sourceos-26.11-installer-aarch64-linux.iso">Download ISO (ARM64)</a>
114-
<div class="meta"><a href="https://github.com/SourceOS-Linux/source-os/releases/latest/download/sourceos-26.11-installer-aarch64-linux.iso.sha256">SHA-256</a> · ~1–2 GB</div>
113+
<a class="btn" href="https://github.com/SourceOS-Linux/source-os/releases/latest/download/sourceos-installer-aarch64.iso">Download ISO (ARM64)</a>
114+
<div class="meta"><a href="https://github.com/SourceOS-Linux/source-os/releases/latest/download/sourceos-installer-aarch64.iso.sha256">SHA-256</a> · ~1–2 GB</div>
115115
</div>
116116

117117
<!-- Apple Silicon -->

0 commit comments

Comments
 (0)