Files
guix-router/build-mt6000-root.sh
ssmithxandClaude Opus 5.5 5de6046e8d MT6000: kernel, system, root image and FIT boot image
linux-mt6000: Nonguix linux 6.17 with ARCH_MEDIATEK and the MT7986
drivers, OpenWrt's block NVMEM provider and mac-base patches (WiFi
calibration and MACs from the eMMC factory partition), bootargs-append,
and OpenWrt's GL-MT6000 device tree.

mt6000.scm: the Pi's OpenWrt userland on the MT6000 (lan1-5 + WiFi in
br-lan, eth1 WAN).  Shared pieces move to packages/router-base.scm;
the Pi's system is unchanged.

build-mt6000-root.sh builds the ext4 root for the rootfs partition and,
with scripts/mt6000-fit.sh, the FIT that GL's U-Boot boots from the
kernel partition -- for the system inside the image, whose root is the
partition's UUID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 19:37:33 -04:00

26 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build the GL-MT6000's root file system and FIT boot image:
# mt6000-root.ext4 ext4 "Guix" with the system, for the `rootfs' partition
# mt6000-boot.itb the FIT for the `kernel' partition (scripts/mt6000-fit.sh)
# Cross-compiled from x86_64 (mt6000-image.scm's platform is aarch64).
set -euo pipefail
cd "$(dirname "$0")"
export GUIX_PACKAGE_PATH="$PWD/packages:$HOME/channels/nonguix"
img=$(guix system image mt6000-image.scm "$@" | tail -1)
echo "image: $img"
# The partition starts at 1 MiB (mt6000-image.scm); MBR, so it runs to the
# end of the image.
dd if="$img" of=mt6000-root.ext4 bs=1M skip=1 conv=sparse status=none
echo "root: $PWD/mt6000-root.ext4 ($(stat -c %s mt6000-root.ext4) bytes)"
# The FIT boots the system in the image -- not `guix system build`'s: the
# image's has the root partition's UUID in place of the "Guix" label.
debugfs=$(guix build e2fsprogs | grep -E -- '-e2fsprogs-[0-9][^-]*$')/sbin/debugfs
sys=$("$debugfs" -R 'stat /var/guix/profiles/system-1-link' mt6000-root.ext4 2>/dev/null |
sed -n 's/^Fast link dest: "\(.*\)"$/\1/p')
[ -d "$sys" ] || { echo "no system in mt6000-root.ext4" >&2; exit 1; }
echo "system: $sys"
scripts/mt6000-fit.sh "$sys" mt6000-boot.itb