Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 9 additions & 32 deletions .github/workflows/build-xm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,9 @@ jobs:
fail-fast: false
matrix:
include:
- { soc: xm510, kinds: "nor", files: "output/u-boot-xm510-*.bin" }
# SPI NAND images follow a guess at how the XM530 boots from NAND
# (see openipc-xm's CLAUDE.md); smoke-tested on qemu-hisilicon's
# NAND model, which implements the same guess.
- { soc: xm530, kinds: "nor nand", files: "output/u-boot-xm530-*.bin" }
- { soc: xm550, kinds: "nor nand", files: "output/u-boot-xm550-*.bin" }
- { soc: xm510, kinds: "nor", files: "output/u-boot-xm510-nor.bin" }
- { soc: xm530, kinds: "nor", files: "output/u-boot-xm530-nor.bin" }
- { soc: xm550, kinds: "nor", files: "output/u-boot-xm550-nor.bin" }

steps:
- name: Checkout
Expand Down Expand Up @@ -100,8 +97,8 @@ jobs:

- name: Check partition fit
run: |
# Boot partition sizes from this tree's mtdparts: NOR boot = 256 KiB
# (env at 0x40000), NAND/UBI boot = 768 KiB (0xc0000). An image
# Boot partition size from this tree's mtdparts: NOR boot = 256 KiB
# (env at 0x40000). An image
# larger than its boot partition overflows into env and bricks the
# device on upgrade.
soc='${{ matrix.soc }}'
Expand All @@ -128,9 +125,6 @@ jobs:
[ "$found" = 1 ] || { echo "missing ${kind} image for ${soc} (${pattern})" >&2; rc=1; }
}
check_kind nor 256 "output/*${soc}*-nor.bin"
case "$kinds" in
*nand*) check_kind nand 768 "output/*${soc}*-nand.bin" ;;
esac
exit $rc

- name: Upload artifact
Expand Down Expand Up @@ -188,8 +182,6 @@ jobs:
- { soc: xm510, kind: nor }
- { soc: xm530, kind: nor }
- { soc: xm550, kind: nor }
- { soc: xm530, kind: nand }
- { soc: xm550, kind: nand }
steps:
- name: Download qemu-arm
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -222,25 +214,10 @@ jobs:
UBOOT="u-boot-${soc}-${kind}.bin"
test -f "$UBOOT"
echo "booting $UBOOT"
if [ "$kind" = nor ]; then
# 8 MiB NOR, U-Boot at 0, the rest erased
dd if=/dev/zero bs=1M count=8 2>/dev/null | tr '\0' '\377' > /tmp/flash.bin
dd if="$UBOOT" of=/tmp/flash.bin bs=1 conv=notrunc 2>/dev/null
FLASH="-M ${soc},flash-file=/tmp/flash.bin -global xm-sfc.wps=on"
else
# 128 MiB SPI NAND, raw 2048+64-byte pages, U-Boot from page 0
python3 - "$UBOOT" /tmp/nand.bin <<'PY'
import sys
D, S, PAGES = 2048, 64, 1024 * 64
raw = bytearray(b'\xff' * (PAGES * (D + S)))
img = open(sys.argv[1], 'rb').read()
for i in range(0, len(img), D):
o = (i // D) * (D + S)
raw[o:o + len(img[i:i + D])] = img[i:i + D]
open(sys.argv[2], 'wb').write(raw)
PY
FLASH="-M ${soc} -global xm-sfc.nand-file=/tmp/nand.bin"
fi
# 8 MiB NOR, U-Boot at 0, the rest erased
dd if=/dev/zero bs=1M count=8 2>/dev/null | tr '\0' '\377' > /tmp/flash.bin
dd if="$UBOOT" of=/tmp/flash.bin bs=1 conv=notrunc 2>/dev/null
FLASH="-M ${soc},flash-file=/tmp/flash.bin -global xm-sfc.wps=on"
chmod +x ./qemu-arm
# Two boots: the first finds an erased environment and saves the
# default one; the second must load it back.
Expand Down
8 changes: 2 additions & 6 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,8 @@ The build logic lives here. Other branches call it:
- `pull_request` runs only when the workflow file itself changes.
- **No `hold`:** every SoC has a qemu-hisilicon machine, so every image is
smoke-tested and released.
- **NAND legs:** xm530/xm550 build `kinds: "nor nand"`, and `qemu_smoke`
has a NAND leg for each.
- A NAND leg boots a raw 128 MiB image (2048+64-byte pages) through
`-global xm-sfc.nand-file=`, which needs qemu-hisilicon's NAND model.
- The NAND images rest on an unverified guess at the XM530 NAND boot
path; `openipc-xm`'s `CLAUDE.md` explains it.
- **NOR only:** every leg builds, uploads and smoke-tests
`u-boot-<soc>-nor.bin` alone. openipc-xm has no SPI NAND images.
- **Smoke test:** two boots of an 8 MiB flash image under
`-global xm-sfc.wps=on`.
- It passes on `Hit Ctrl-C`.
Expand Down
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ U-Boot for Xiongmai's own camera SoCs, on the same mainline release

**NOR:** `xm510`, `xm530`, `xm550`

**SPI NAND:** `xm530`, `xm550`. These images are **unverified on
silicon**: nothing documents how the XM530 boots from SPI NAND, and they
follow the vendor SDK's unused NAND configuration (U-Boot behind a 4 KiB
header in the controller window). They have only run on qemu-hisilicon's
NAND model, which implements the same assumption. The OpenIPC XM530
kernel has no SPI NAND driver yet.

The boot ROM runs U-Boot in place from SPI NOR, and U-Boot brings up DDR
itself, so the image is `u-boot.bin` as linked: `u-boot-<soc>-nor.bin`,
written at flash offset 0. The flash driver clears the per-block write
Expand All @@ -93,8 +86,7 @@ bash build.sh # xm510 xm530 xm550
bash build.sh xm530 # a single SoC
```

Images land in `output/` as `u-boot-<soc>-nor.bin` and, for xm530/xm550,
`u-boot-<soc>-nand.bin`.
Images land in `output/` as `u-boot-<soc>-nor.bin`.

The toolchain is `arm-linux-gnueabi-`, as for hisilicon.

Expand Down Expand Up @@ -222,8 +214,6 @@ smoke-tested:
- booted a second time, which must load the environment the first boot
saved.

The NAND images get the same two boots on qemu-hisilicon's SPI NAND model.

Its `release` input fills this repository's
[`Xiongmai` release](../../releases/tag/xiongmai); `publish` uploads to
`OpenIPC/firmware` `latest`, where no other repository publishes
Expand Down
Loading