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
7 changes: 6 additions & 1 deletion .github/workflows/release-phicomm-n1-device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ jobs:
run: |
. UFI003/package/release-common.sh
phicomm_n1_fetch_debs PhicommN1/install/debs.txt "$RUNNER_TEMP/debs"
- name: Fetch and verify pinned firmware
run: |
. UFI003/package/release-common.sh
phicomm_n1_fetch_firmware PhicommN1/install/firmware.txt "$RUNNER_TEMP/firmware"
- name: Build bundle
env:
DEBVERSION: ${{ steps.version.outputs.debversion }}
run: |
sh PhicommN1/package/build-bundle.sh --version "$DEBVERSION" "$RUNNER_TEMP/debs" "$RUNNER_TEMP/dist"
sh PhicommN1/package/build-bundle.sh --version "$DEBVERSION" --firmware "$RUNNER_TEMP/firmware" "$RUNNER_TEMP/debs" "$RUNNER_TEMP/dist"
- name: Check bundle and checksum release files
env:
DEBVERSION: ${{ steps.version.outputs.debversion }}
Expand Down Expand Up @@ -108,6 +112,7 @@ jobs:
printf '\nBuilt from OpenXPlay-Hardware@%s\n\n' "$(git rev-parse HEAD)"
printf -- '- `%s`\n' "$asset" SHA256SUMS
printf '\nThe bundle carries unmodified Debian 13 packages whose sources are named in SOURCES.txt. OpenXPlay-Hardware is under the OpenXPlay-Hardware License 1.0 (no commercial use).\n'
printf '\nThe device package carries unmodified Cypress Wi-Fi firmware from linux-firmware under LICENCE.cypress.\n'
} > "$notes"
cd "$RUNNER_TEMP/release"
sha256sum -c SHA256SUMS || { echo '::error::Release artifact checksum mismatch'; exit 1; }
Expand Down
10 changes: 5 additions & 5 deletions PhicommN1/README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Created by riko chen on 2026-10-21

斐讯 N1 电视盒子(晶晨 S905D)的支持文件,适用于从 eMMC 运行 ophub Armbian(Debian 13,内核 6.12)的设备。

`package/` 构建设备包,以及 OpenXPlay Flasher 通过网络 SSH 安装的离线设备整合包。设备包安装主机配置,并修复两个板级问题:把以太网 PHY 的 ID 写入启动设备树(内核更新后会重新写入),使每次开机都能识别 PHY;给 wlan0 和蓝牙控制器换成由出厂以太网 MAC 推导的地址,取代所有 N1 共用的地址:
`package/` 构建设备包,以及 OpenXPlay Flasher 通过网络 SSH 安装的离线设备整合包。设备包安装主机配置,把以太网 PHY 的 ID 写入启动设备树(内核更新后会重新写入),并给 wlan0 和蓝牙控制器换成由出厂以太网 MAC 推导的地址。它还为板载 BCM43455 安装较新的 Cypress Wi-Fi 固件,使 wlan0 在 CN 监管域下可以使用 5 GHz 信道 36-48。

```sh
sh package/build-deb.sh out
sh package/build-bundle.sh --version 0.1.0 /path/to/debs out
sh package/build-deb.sh --firmware /path/to/firmware out
sh package/build-bundle.sh --version 0.1.0 --firmware /path/to/firmware /path/to/debs out
```

构建需要 Linux 上的 `dpkg-deb`,或已缓存的 `debian:trixie` Docker 镜像。将 `install/debs.txt` 固定版本的 Debian 包放到 `/path/to/debs`,支持 `arm64` 和 `all`。清单列出全新 ophub Debian 13 服务器镜像缺少、而设备包和中继包需要的软件包,因此整合包可以离线安装。构建和安装脚本均不下载软件包。`--sources DIR` 可带入本地 Debian 源码归档,`SOURCES.txt` 记录对应源码位置。
构建需要 Linux 上的 `dpkg-deb`,或已缓存的 `debian:trixie` Docker 镜像。将 `install/debs.txt` 固定版本的 Debian 包放到 `/path/to/debs`,支持 `arm64` 和 `all`。将 `install/firmware.txt` 固定的未修改固件和许可证文件按上游文件名放到 `/path/to/firmware`。Debian 清单列出全新 ophub Debian 13 服务器镜像缺少、而设备包和中继包需要的软件包,因此整合包可以离线安装。构建会校验所有固件哈希;构建和安装脚本均不下载文件。`--sources DIR` 可带入本地 Debian 源码归档,`SOURCES.txt` 记录源码位置和固件来源。

## 许可证

本目录全部内容与本仓库其余部分一样采用 [OpenXPlay-Hardware License](../LICENSE)。
本目录文件采用 [OpenXPlay-Hardware License](../LICENSE)。打包的 Cypress 固件采用 LICENCE.cypress,许可证全文包含在设备包中。
10 changes: 5 additions & 5 deletions PhicommN1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Created by riko chen on 2026-10-21

Support files for the Phicomm N1 TV box (Amlogic S905D) running ophub Armbian (Debian 13, kernel 6.12) from eMMC.

`package/` builds the device package and the offline device bundle that the OpenXPlay Flasher installs over SSH on the network. The package installs the host profile and fixes two board problems: it writes the Ethernet PHY's ID into the boot device tree (again after kernel updates), so the PHY is found on every boot, and it gives wlan0 and the Bluetooth controller addresses derived from the factory Ethernet MAC instead of the ones every N1 shares:
`package/` builds the device package and the offline device bundle that the OpenXPlay Flasher installs over SSH on the network. The package installs the host profile, writes the Ethernet PHY's ID into the boot device tree (again after kernel updates), and gives wlan0 and the Bluetooth controller addresses derived from the factory Ethernet MAC. It also installs newer Cypress Wi-Fi firmware for the onboard BCM43455 so wlan0 can use 5 GHz channels 36-48 under the CN regulatory domain.

```sh
sh package/build-deb.sh out
sh package/build-bundle.sh --version 0.1.0 /path/to/debs out
sh package/build-deb.sh --firmware /path/to/firmware out
sh package/build-bundle.sh --version 0.1.0 --firmware /path/to/firmware /path/to/debs out
```

Builds need `dpkg-deb` on Linux, or a cached `debian:trixie` Docker image. Put the pinned Debian binaries from `install/debs.txt` in `/path/to/debs`; both `arm64` and `all` packages are accepted. The list holds what the device and relay packages need that a fresh ophub Debian 13 server image lacks, so the bundle installs offline. No build or installer downloads packages. `--sources DIR` includes local Debian source archives; `SOURCES.txt` records corresponding source locations.
Builds need `dpkg-deb` on Linux, or a cached `debian:trixie` Docker image. Put the pinned Debian binaries from `install/debs.txt` in `/path/to/debs`; both `arm64` and `all` packages are accepted. Put the unmodified firmware and licence files pinned in `install/firmware.txt` in `/path/to/firmware`, using their upstream basenames. The Debian list holds what the device and relay packages need that a fresh ophub Debian 13 server image lacks, so the bundle installs offline. Builds verify all firmware hashes; no build or installer downloads files. `--sources DIR` includes local Debian source archives; `SOURCES.txt` records source locations and firmware provenance.

## License

Everything here is under the [OpenXPlay-Hardware License](../LICENSE) like the rest of this repository.
Files here use the [OpenXPlay-Hardware License](../LICENSE). The packaged Cypress firmware uses LICENCE.cypress, included in the device package.
9 changes: 9 additions & 0 deletions PhicommN1/install/firmware.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2026 OpenXPlay.org
# SPDX-License-Identifier: LicenseRef-OpenXPlay-Hardware-1.0
# Created by riko chen on 2026-10-26
# linux-firmware commit upstream-path sha256; files are unmodified upstream objects.
# Cypress 7.45.286 firmware and CLM enable BCM43455 5 GHz channels 36-48 under CN.
# LICENCE.cypress permits object-code redistribution for use with Cypress chips.
a137a09be163c5e3fc6e96ba3bfb9eb328394c34 cypress/cyfmac43455-sdio.bin eaff8d2b6d2501bb5c477ba343900c7487af915898eac13bc91b33b1285dadce
a137a09be163c5e3fc6e96ba3bfb9eb328394c34 cypress/cyfmac43455-sdio.clm_blob 8fbe9fc2952e2fbab062a142c1ea3e261cd74604761e12f304781b911df4a328
a137a09be163c5e3fc6e96ba3bfb9eb328394c34 LICENSES/LICENCE.cypress ae0db6cc4db33941148df0f67de53e76a77b1b5a46b3165edb7040aa2750015f
17 changes: 14 additions & 3 deletions PhicommN1/package/build-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-FileCopyrightText: 2026 OpenXPlay.org
# SPDX-License-Identifier: LicenseRef-OpenXPlay-Hardware-1.0
# Created by riko chen on 2026-10-21
# Usage: build-bundle.sh [--version VERSION] [--sources DIR] DEBS_DIR OUTPUT_DIR
# Usage: build-bundle.sh [--version VERSION] [--sources DIR] --firmware DIR DEBS_DIR OUTPUT_DIR
# All inputs are local. debs/debs.txt preserves dependency order for the offline installer.
set -eu
here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
Expand All @@ -11,14 +11,17 @@ repo=$(dirname "$n1")
fail() { echo "Error: $*" >&2; exit 1; }
version=0.1.0
sources=
firmware=
while [ "$#" -gt 2 ]; do
case "$1" in
--version) version=$2; shift 2 ;;
--sources) sources=$(CDPATH= cd -- "$2" && pwd); shift 2 ;;
--firmware) firmware=$(CDPATH= cd -- "$2" && pwd); shift 2 ;;
*) fail "Unknown option: $1" ;;
esac
done
[ "$#" -eq 2 ] || fail "Usage: $0 [--version VERSION] [--sources DIR] DEBS_DIR OUTPUT_DIR"
[ "$#" -eq 2 ] && [ -n "$firmware" ] ||
fail "Usage: $0 [--version VERSION] [--sources DIR] --firmware DIR DEBS_DIR OUTPUT_DIR"
case "$version" in ''|*[!0-9A-Za-z.+~-]*|[!0-9]*) fail "Invalid Debian version: $version" ;; esac
debs=$(CDPATH= cd -- "$1" && pwd)
mkdir -p "$2"
Expand Down Expand Up @@ -69,7 +72,7 @@ while read -r pkg ver digest extra || [ -n "$pkg" ]; do
[ -n "$found" ] || fail "Missing pinned .deb: $pkg $ver (arm64 or all)"
cp -f "$found" "$root/debs/"
done < "$n1/install/debs.txt"
sh "$here/build-deb.sh" --version "$version" "$root/debs" >&2
sh "$here/build-deb.sh" --version "$version" --firmware "$firmware" "$root/debs" >&2
device=$root/debs/openxplay-phicomm-n1_${version}_all.deb
# Keep the generated device package last, after all pinned dependencies (including an empty list).
printf '\nopenxplay-phicomm-n1 %s %s\n' "$version" "$(sum "$device")" >> "$root/debs/debs.txt"
Expand All @@ -94,6 +97,14 @@ fi
done
echo
echo 'openxplay-phicomm-n1: https://github.com/OpenXPlay/OpenXPlay-Hardware (PhicommN1/).'
echo
echo 'Unmodified Cypress Wi-Fi firmware and LICENCE.cypress from linux-firmware:'
# Match the builder's test-only fixture pins; production always records the committed list.
while read -r commit path digest extra || [ -n "$commit" ]; do
case "$commit" in ''|'#'*) continue ;; esac
printf 'https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/%s?id=%s sha256 %s\n' \
"$path" "$commit" "$digest"
done < "${OPENXPLAY_N1_TEST_FIRMWARE_PINS:-$n1/install/firmware.txt}"
} > "$root/SOURCES.txt"
json() { printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g'; }
{
Expand Down
57 changes: 52 additions & 5 deletions PhicommN1/package/build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,50 @@
# SPDX-License-Identifier: LicenseRef-OpenXPlay-Hardware-1.0
# Created by riko chen on 2026-10-21
# Builds openxplay-phicomm-n1_<version>_all.deb. No relay or kernel binaries.
# Usage: build-deb.sh [--version VERSION] OUTPUT_DIR
# Usage: build-deb.sh [--version VERSION] --firmware DIR OUTPUT_DIR
set -eu
here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
n1=$(dirname "$here")
repo=$(dirname "$n1")
fail() { echo "Error: $*" >&2; exit 1; }
version=0.1.0
firmware=
inside=false
while [ "$#" -gt 1 ]; do
case "$1" in
--version) version=$2; shift 2 ;;
--firmware) firmware=$2; shift 2 ;;
--inside) inside=true; shift ;;
*) break ;;
esac
done
[ "$#" -eq 1 ] || fail "Usage: $0 [--version VERSION] OUTPUT_DIR"
[ "$#" -eq 1 ] && [ -n "$firmware" ] || fail "Usage: $0 [--version VERSION] --firmware DIR OUTPUT_DIR"
case "$version" in ''|*[!0-9A-Za-z.+~-]*|[!0-9]*) fail "Invalid Debian version: $version" ;; esac
out=$1
firmware=$(CDPATH= cd -- "$firmware" && pwd) || fail 'Missing firmware directory'
sum() { if command -v sha256sum >/dev/null 2>&1; then sha256sum "$1"; else shasum -a 256 "$1"; fi | cut -d' ' -f1; }
# Test-only fixture pins replace the inputs, never the checks. Production uses the committed list.
firmware_pins=${OPENXPLAY_N1_TEST_FIRMWARE_PINS:-$n1/install/firmware.txt}
seen=' '
while read -r commit path digest extra || [ -n "$commit" ]; do
case "$commit" in ''|'#'*) continue ;; esac
[ -z "$extra" ] && printf '%s\n' "$commit" | LC_ALL=C grep -Eq '^[0-9a-fA-F]{40}$' &&
printf '%s\n' "$path" | LC_ALL=C grep -Eq '^[A-Za-z0-9._-]+(/[A-Za-z0-9._-]+)*$' &&
printf '%s\n' "$digest" | LC_ALL=C grep -Eq '^[0-9a-fA-F]{64}$' || fail "Invalid firmware.txt row: $commit"
case "/$path/" in *..*|*/./*) fail "Invalid firmware path: $path" ;; esac
base=${path##*/}
case "$base" in cyfmac43455-sdio.bin|cyfmac43455-sdio.clm_blob|LICENCE.cypress) ;;
*) fail "Unexpected pinned firmware file: $base" ;;
esac
case "$seen" in *" $base "*) fail "Duplicate firmware basename: $base" ;; esac
seen="$seen$base "
[ ! -L "$firmware/$base" ] || fail "Symlink firmware input: $base"
[ -f "$firmware/$base" ] || fail "Missing regular firmware file: $base"
[ "$(sum "$firmware/$base")" = "$(printf '%s' "$digest" | tr 'A-F' 'a-f')" ] || fail "SHA-256 mismatch: $base"
done < "$firmware_pins"
for base in cyfmac43455-sdio.bin cyfmac43455-sdio.clm_blob LICENCE.cypress; do
case "$seen" in *" $base "*) ;; *) fail "Missing firmware pin: $base" ;; esac
done
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-$(git -C "$repo" log -1 --format=%ct 2>/dev/null || echo 1792540800)}
case "$SOURCE_DATE_EPOCH" in ''|*[!0-9]*) fail 'SOURCE_DATE_EPOCH must be an integer' ;; esac
export SOURCE_DATE_EPOCH
Expand All @@ -32,11 +58,21 @@ if ! command -v dpkg-deb >/dev/null 2>&1; then
stream=$(mktemp -d)
trap 'rm -rf "$stream"' 0
trap 'exit 1' HUP INT TERM
mkdir "$stream/firmware"
for base in cyfmac43455-sdio.bin cyfmac43455-sdio.clm_blob LICENCE.cypress; do
cp -f "$firmware/$base" "$stream/firmware/$base"
done
if [ -n "${OPENXPLAY_N1_TEST_FIRMWARE_PINS:-}" ]; then
cp -f "$firmware_pins" "$stream/firmware/test-pins.txt"
export OPENXPLAY_N1_TEST_FIRMWARE_PINS=/work/firmware/test-pins.txt
fi
COPYFILE_DISABLE=1 tar --no-xattrs -cf "$stream/input.tar" -C "$repo" LICENSE PhicommN1
COPYFILE_DISABLE=1 tar --no-xattrs -rf "$stream/input.tar" -C "$stream" firmware
if ! docker run -i --rm --pull=never --network=none --platform linux/arm64 -e SOURCE_DATE_EPOCH \
-e OPENXPLAY_N1_TEST_FIRMWARE_PINS \
debian:trixie sh -c \
"mkdir -p /work /out && tar -xf - -C /work &&
sh /work/PhicommN1/package/build-deb.sh --inside --version '$version' /out >&2 &&
sh /work/PhicommN1/package/build-deb.sh --inside --version '$version' --firmware /work/firmware /out >&2 &&
tar -cf - -C /out ." < "$stream/input.tar" > "$stream/output.tar"; then
fail 'Container build failed'
fi
Expand All @@ -62,6 +98,9 @@ put 0644 "$n1/wifi/70-openxplay-n1-wifi-mac.rules" /lib/udev/rules.d/70-openxpla
doc=$root/usr/share/doc/openxplay-phicomm-n1
install -d "$doc" "$root/DEBIAN"
install -m 0644 "$repo/LICENSE" "$doc/LICENSE"
put 0644 "$firmware/cyfmac43455-sdio.bin" /usr/lib/firmware/updates/brcm/brcmfmac43455-sdio.phicomm,n1.bin
put 0644 "$firmware/cyfmac43455-sdio.clm_blob" /usr/lib/firmware/updates/brcm/brcmfmac43455-sdio.phicomm,n1.clm_blob
install -m 0644 "$firmware/LICENCE.cypress" "$doc/LICENCE.cypress"
cat > "$doc/copyright" <<EOF
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: openxplay-phicomm-n1
Expand All @@ -71,6 +110,13 @@ Files: *
Copyright: 2026 OpenXPlay.org
License: LicenseRef-OpenXPlay-Hardware-1.0
See LICENSE: no commercial use; distributors must publish the complete source.

Files: usr/lib/firmware/updates/brcm/*
Copyright: Cypress Semiconductor Corporation, an Infineon Technologies company
License: LicenseRef-LICENCE.cypress
Comment: Unmodified linux-firmware cypress/cyfmac43455-sdio.bin and
cypress/cyfmac43455-sdio.clm_blob, version 7.45.286, from commit
a137a09be163c5e3fc6e96ba3bfb9eb328394c34. See LICENCE.cypress for the full text.
EOF
ctl=$root/DEBIAN
for s in preinst postinst prerm postrm; do install -m 0755 "$here/debian/$s" "$ctl/$s"; done
Expand All @@ -87,8 +133,9 @@ Section: misc
Priority: optional
Homepage: https://openxplay.org
Description: OpenXPlay device support for the Phicomm N1 TV box
Phicomm N1 host profile, Ethernet PHY and Wi-Fi address fixes, and offline
dependencies for ophub Armbian, Debian 13 arm64. No relay or accessory identity.
Phicomm N1 host profile, Ethernet PHY and Wi-Fi address fixes, newer Cypress
Wi-Fi firmware, and offline dependencies for ophub Armbian, Debian 13 arm64.
No relay or accessory identity.
EOF
(cd "$root" && find . -type f ! -path './DEBIAN/*' | LC_ALL=C sort | sed 's#^\./##' |
while IFS= read -r f; do md5sum "$f"; done) > "$ctl/md5sums"
Expand Down
2 changes: 1 addition & 1 deletion PhicommN1/package/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ configure|abort-upgrade|abort-deconfigure|abort-remove)
deb-systemd-invoke start bluetooth.service >/dev/null || :
fi
if [ "$1" = configure ]; then
echo 'openxplay-phicomm-n1: the Ethernet PHY fix and the per-device Wi-Fi and Bluetooth addresses take effect at the next boot.'
echo 'openxplay-phicomm-n1: the Ethernet PHY fix, Wi-Fi firmware and per-device Wi-Fi and Bluetooth addresses take effect at the next boot.'
fi
;;
esac
Expand Down
Loading
Loading