Remaster the official OpenWrt armsr/armv8 rootfs.tar.gz into a bootable multi-partition image for Amlogic/Rockchip/Allwinner boxes. Board models, DTB, and u-boot facts are always taken from the board database and the ophub kernel packages; when uncertain, stop—do not fabricate.
Determine Task Type
- Remaster image: given an existing rootfs.tar.gz, produce
.img.gz— follow §Workflow. - Customize firmware contents(add packages/change config): use Image Builder
FILES=to produce a custom rootfs.tar.gz and feed it to remake; do not modify themake-openwrt/openwrt-files/inside the remake repo (zero-commit discipline, see Pitfalls). - Board model/kernel/eMMC consultation: answers must land on a board database row, a kernel package, or upstream documentation; read the corresponding reference before answering.
- Build error troubleshooting: locate the failing stage against the 6-step pipeline, then read the reference.
Prerequisites / Preflight
Verify each item at runtime; if any is missing, stop:
- Linux x86_64/arm64 + root: the script self-checks
id -u == 0(remake L1356). Verifyuname -m、cat /etc/os-release。 - toolchain is complete:
for c in losetup parted mkfs.vfat mkfs.btrfs btrfs mkfs.ext4 tar curl git sha256sum; do command -v $c; done(required throughout the make_image/extract/replace stages). - Free disk space: a single board with a single kernel needs several GiB; remake skips that board's build when ≤3 GiB remains (L1325-1332), so do not start at the 3 GiB edge.
- macOS/Windows cannot run directly: depends on losetup/btrfs/mount, with no host equivalent. Routing: container emulation
fw-emulation, or upstream GitHub Actions (action.yml runs L114 withsudo ./remake; input conventionopenwrt/bin/targets/*/*/*rootfs.tar.gzL12)。 - Input files in place:
openwrt-armsr/*rootfs.tar.gz— find_openwrt only recognizes that directory and that glob (remake L56-57, L436-446); putting it elsewhere is the same as not putting it there at all.
Offline Baseline
- OpenWrt upstream-refs:25.12.5(read-through 2026-09-02, not automatically updated).
- ophub/amlogic-s9xxx-openwrt: upstream HEAD
c593d56(2026-08-27, read-through 2026-09-02). All line numbers in this document refer to that version of theremakescript. - Default kernel line:
stable_kernel=("6.12.y" "6.18.y")(L93); for the default values of the other lines, see references/kernel-lines.md. - Default partitions: boot 384 MiB / root 1280 MiB (L121-122).
Contracts (no fabrication when uncertain)
- Input contract:
openwrt-armsr/*rootfs.tar.gzcontainsetc/openwrt_release; remake readsDISTRIB_SOURCEREPO/SOURCECODE/SOURCEBRANCHfor naming and the Amlogic box download tag (L449-465). - Board model contract: the board id can only be taken from
model_database.confcolumn 14 BOARD. The board id of N1 iss905d, notn1(conf L52). FDTFILE/UBOOT_OVERLOAD/MAINLINE_UBOOT/BOOTLOADER_IMG/KERNEL_TAGS/BOOT_CONF are all based on that row — see references/board-database.md for details. - Partition contract (Amlogic): 4 MiB reserved at the head + msdos table + p1 FAT32 (BOOT) + p2 btrfs (ROOTFS,
compress=zstd:6)(L762-766、L801-826、L164)。Rockchip=16 MiB+GPT+ext4 boot;Allwinner=16 MiB+msdos+FAT32(L767-776)。 - u-boot contract (Amlogic): two dd segments at the head of the image (
bs=1 count=444andbs=512 skip=1 seek=1, L832-837); for files, prefer MAINLINE_UBOOT, fall back to BOOTLOADER_IMG; bootfs also holds the entire set of overload files (L933-941). - Kernel contract: the three ophub packages
boot-*.tar.gz/dtb-<platform>-*.tar.gz/modules-*.tar.gz, and if sha256sums is present, verify each file (L952-957, L613-627). FDTFILE must be verifiable within the dtb package — if the DTB filename or partition offset is uncertain, stop。 - Installation contract: eMMC installation capability comes from luci-app-amlogic (Amlogic Box) injected at packaging time (L85, L551-566); the remake process itself does not perform eMMC installation — see references/emmc-install.md.
Capability Boundaries + Hand-off
Not doing: compiling OpenWrt rootfs from source; generating or modifying DTB; local builds on macOS; developing an eMMC installer; real-device acceptance.
| User Intent | Assigned To |
|---|---|
Build armsr rootfs.tar.gz, IB package selection,FILES= injection customization |
openwrt-image-build |
| No Linux environment but want to emulate running remake, QEMU image verification | fw-emulation |
| Serial/first-boot/HIL real-device verification after flashing | fw-hil-testing |
Workflow
-
Determine board model: grep the model/alias in the board model library → get BOARD, FDTFILE, BOOT_CONF, KERNEL_TAGS. read-when: the user gives a product name/alias, or asks "can this one be flashed" → read board-database。
-
Determine kernel line: read-when: involves
-u/-k/-aparameters or "which kernel version to use" → read kernel-lines。 -
Group commands(expected form):
sudo ./remake -b s905d -k 6.12.y # -u flippy 换内核 tag 线(自动剥 kernel_ 前缀) # -s 512/2560 boot/root 容量(boot≥256、root≥1024,L293-294) # -p 192.168.2.1 改默认 LAN IP(正则校验,L247-254) # -n <name> 构建者签名(写入 banner 与 release 文件) -
Execute: the six-step pipeline executes in sequence, and failure at any step means exit 1 (loop_make L1335-1340):
make_image → extract_openwrt → replace_kernel → refactor_bootfs → refactor_rootfs → clean_tmp -
Collect artifacts:
openwrt/out/openwrt_[official_]amlogic_s905d_k6.12.y_YYYY.MM.DD.img.gz(naming rule L794; pigz preferred, fallback to gzip, L1294-1299).- At the pattern level: this is the release naming template for "
<源码别名>_<平台>_<板型>_<内核线>_<日期>"; each release process can extend segments on this pattern, and the template itself is not bound to a specific project.
- At the pattern level: this is the release naming template for "
-
To change content: go back to
openwrt-image-buildand use IBFILES=to regenerate rootfs.tar.gz, then feed it to remake — do not modify this repository's openwrt-files (see Pitfalls).
Validation Gates
Layer by evidence strength; mark whichever layer is missing, and do not skip levels to declare success:
- Artifact exists:
ls openwrt/out/*.img.gz;gzip -t *.img.gzpasses;fileshows gzip data. - Structural spot check(Linux): after extraction,
fdisk -lshould show FAT32 p1 + btrfs p2;losetup -Pmount and verify that/boot/uEnv.txtdtb matches the board model library FDTFILE, andetc/flippy-openwrt-releaseBOARD/KERNEL_VERSION are correct. - Real-device acceptance: USB boot → LuCI reachable → Amlogic Box install to eMMC → reboot and boot from eMMC. Only after reaching this step can "usable" be declared; if only 1-2 are completed, mark Build Verification Only, and if real-device evidence is missing, mark Pending HIL。
- Failure path: any step
error_msgmeans exit 1; the last section of the log(n/6)points to the failed stage; locate by stage (partitioning/unpacking/kernel/bootfs/rootfs/cleanup).
Pitfalls
- Do notuse
n1as the-bvalue — board id is column 14 of the board model librarys905d(conf L52)。 - Do notfabricate DTB filenames or generate DTB locally — FDTFILE must be verifiable in the ophub dtb package (runtime verification); this is the anti-hallucination red line.
- Do notrun remake directly on macOS/Windows — it depends on losetup/btrfs; route through fw-emulation or GitHub Actions.
- Do notmodify
make-openwrt/openwrt-files/for customization — fork zero-commit discipline: customize via Image BuilderFILES=to produce rootfs.tar.gz and then feed it to remake (this pattern has been verified in a real-world repository: tinynas-files README L3 declares it as "via Image BuilderFILES=Firmware injection, multi-architecture packaging shared single-source overlay"), otherwise upstream sync will inevitably conflict. - Do notself-develop an eMMC installation script — Amlogic Box is already injected during packaging, and reimplementing it will conflict with openwrt-install-amlogic.
- Do notuse less than boot 256 MiB / root 1024 MiB (L293-294 directly reports an error and exits).
- Do nottreat
6.x.yas the real version — it is actually four lines: 6.1/6.6/6.12/6.18 (conf header comment L26-27). - Do notstart when remaining disk space is <3 GiB — it will be silently skipped and mistaken for success (L1325-1332).
Official Sources
- https://github.com/ophub/amlogic-s9xxx-openwrt(remake script, action.yml, documents/)
- https://github.com/ophub/kernel(kernel releases: tags such as kernel_stable)
- https://github.com/ophub/luci-app-amlogic(Amlogic Box: eMMC installation/online update)
- https://github.com/ophub/amlogic-s9xxx-armbian(platform-files/different-files dependency source)
- https://openwrt.org/toh/(device master table, used only for cross-checking model aliases, not as a basis for board id)
Privacy
- Does not collect or send user data externally;
-nsignature and date written into the image are information actively provided by the user. - Troubleshooting may touch
/etcconfiguration within the user's rootfs (keys, passwords): analyze only locally, do not copy into skill output, do not upload. - Default LAN IP 192.168.1.1 (L115) written into the image is expected; the intranet address customized by the user via
-pis sensitive information, remind not to send it out with screenshots.