Skip to content

hi3516cv6xx: convert to ultimate variant + wire opensdk source build#2172

Merged
widgetii merged 1 commit into
masterfrom
hi3516cv6xx-ultimate
Jun 5, 2026
Merged

hi3516cv6xx: convert to ultimate variant + wire opensdk source build#2172
widgetii merged 1 commit into
masterfrom
hi3516cv6xx-ultimate

Conversation

@widgetii
Copy link
Copy Markdown
Member

@widgetii widgetii commented Jun 5, 2026

Summary

Companion to OpenIPC/openhisilicon#202 (merged as b1c4dae5) which brought up the V5 (Hi3516CV610 / Hi3516CV608) kernel-module + sensor port.

  • Renames hi3516cv6xx_lite_defconfighi3516cv6xx_ultimate_defconfig (git mv, history preserved). The previous 8 MB lite variant cannot fit majestic + vendor MPP libs + 42 V5 kernel modules; ultimate/16 MB is the established convention for full feature sets across the firmware tree (8 boards already use it).
  • Wires hisilicon-opensdk to build cv6xx from source: 42 open_*.ko (replacing prebuilt vendor ot_*.ko) + 6 source-built sensor .so (gc4023, os04d10, sc4336p, sc431hai, sc450ai, sc500ai).
  • Bumps HISILICON_OPENSDK_VERSION from 31a5e9f0 to b1c4dae5.
  • Audits kernel-module / sensor / userspace lib install paths so there are no duplicates between vendor osdrv blobs and openhisilicon-supplied artifacts.
  • Aligns load_hisilicon with the ev200 canonical pattern.
  • Fixes a pre-existing Makefile repack-budget bug for the cv6xx firmware.bin path.

Resolves the boot regression introduced after PRs #2167 + #2170 where S70vendor → load_hisilicon hung at mmz_start: 0x42e00000 waiting on ot_base.ko (the vendor blob's init was built against a kernel config / vermagic that doesn't match openipc/linux 5.10.221).

Hardware validation (Hi3516CV610 demo board, sc4336p sensor)

load mmz ....OK!
load base.ko ....OK!     <-- the original boot-hang point — resolved
... 33 more "load X.ko ....OK!" lines ...
load sensor_i2c.ko ....OK!
load sensor_spi.ko ....OK!
ot_wtdg init ok.

# lsmod | wc -l                     → 43
# ls /proc/umap | wc -l              → 30
# ls /dev/i2c-* /dev/ot_*            → /dev/i2c-0..2 /dev/ot_proc /dev/ot_lsadc /dev/ot_mipi_rx

Build budget (FLASH_SIZE=16, repack ceiling 16384 KB)

Artifact Size
fitImage (zImage + DTB) 2772 KB
rootfs.squashfs (xz) 7219 KB
firmware.bin.hi3516cv6xx 10048 KB
Budget margin 6336 KB / 39%

Detail per file

br-ext-chip-hisilicon/configs/hi3516cv6xx_ultimate_defconfig (renamed)

  • VARIANT lite→ultimate, FLASH_SIZE 8→16
  • OPENIPC_MAJESTIC left at default \"lite\" — only the lite-flavored cv6xx majestic binary has been published to OpenIPC S3 so far. Bump to \"ultimate\" in a follow-up once an ultimate-flavored cv6xx majestic binary is uploaded.
  • Ultimate package set mirroring hi3516ev300_ultimate: AWS_WEBRTC, DIVINUS, EXFATPROGS+EXFAT_OPENIPC, IPTABLES, LAME_OPENIPC, LIBWEBSOCKETS_OPENIPC, MAJESTIC+MAJESTIC_FONTS+MAJESTIC_WEBUI, MOSQUITTO (no broker), MOTORS, PROTOBUF_C, QUIRC_OPENIPC, UACME_OPENIPC, VTUND_OPENIPC, ZEROTIER_ONE.
  • Wireless stack intentionally omittedopenipc/linux hi3516cv6xx kernel has CONFIG_WIRELESS off, so cfg80211/mac80211-dependent USB WiFi drivers (mt7601u_openipc, rtl8188fu_openipc, linux_firmware_openipc) and wpa_supplicant/wireless-tools have nothing to bind to. Re-enable once the kernel config gains the wireless stack.
  • UBI rootfs not enabled — cv6xx ships NOR flash.

general/package/hisilicon-opensdk/hisilicon-opensdk.mk

  • HISILICON_OPENSDK_VERSION bumped 31a5e9f0b1c4dae5 (the merged cv6xx port commit).
  • New hi3516cv6xx arm in the SoC dependency ladder, HISILICON_OPENSDK_SDK_CODE = 0x3516C610, DISABLE_VO=1 DISABLE_TDE=1 (V5 is encode-only).
  • New HISILICON_OPENSDK_SENSORS_hi3516cv6xx listing the 6 source-built drivers.
  • New cv6xx install block that ships .ko to /lib/modules/<kver>/hisilicon/ + sensor .so to /usr/lib/sensors/.
  • cv6xx added to the FINALIZE_MODULES filter so the depmod hook runs and the extra/open_*.ko dedup wipe applies.

general/package/hisilicon-osdrv-hi3516cv6xx/hisilicon-osdrv-hi3516cv6xx.mk

  • Dropped the 39 prebuilt INSTALL ... files/kmod/ot_*.ko lines — those modules are now built against the running openipc/linux tree by hisilicon-opensdk and ship under hisilicon/.
  • Dropped the prebuilt files/sensor/*.so install — sensor drivers now built from vendor SDK source by hisilicon-opensdk.
  • Added install for the 43-lib transitive NEEDED closure of the majestic binary against the vendor MPP lib set in files/lib/. libopus.so is explicitly excluded because BR2_PACKAGE_OPUS_OPENIPC builds a source equivalent. 14 unreferenced vendor libs are also omitted, saving ~660 KB:
    • excluded: libss_mpi_aibnr/bla/cipher/devstat/km/otp/smartae/syskol/uvc, libss_bcd, libmbedtls_harden_adapt, libsvp_aicpu, libvqe_common, libopus.

general/package/hisilicon-osdrv-hi3516cv6xx/files/script/load_hisilicon

Aligned with the hi3516ev200 canonical pattern (was vendor-flavored modprobe ot_* previously):

Before After
modprobe ot_* modprobe open_* (openhisilicon PREFIX is open_)
set_allocator(){} empty stub fw_setenv mmz_allocator
check_allocator defined but never called called from insert_osal
insert_security_subsys hard-fail on missing open_cipher/open_km best-effort 2>/dev/null; V5 ships cipher/km as closed-source full .ko, the rest of the MPP pipeline survives their absence
Sensor probe used full insert_ko (~15 s, fails on missing cipher/km) minimal insert_detect()/remove_detect() (osal+mmz+sys_config+base+isp+sensor_i2c+sensor_spi, ~3 s)
-sensor0/-sensor set only SNS_TYPE0 (auto-detect probe still fired) also exports SENSOR=\$arg, skips the probe gate when user specifies explicitly
modprobe sys_config (vendor name, no prefix) modprobe open_sys_config
# modprobe extdrv/ot_sensor_spi stale vendor-SDK reference dropped
open_wdt / open_pwm / open_piris / open_sensor_spi commented out uncommented (they build clean now)

general/package/all-patches/wireguard-tools/0001-netlink-fallback-define-NLM_F_DUMP_INTR.patch

The cv6xx musl toolchain shipped under openipc/firmware releases is built against a pre-3.16 kernel UAPI snapshot, so wireguard-tools 1.0.20210914 fails to compile with NLM_F_DUMP_INTR undeclared. Patch adds a fallback #define NLM_F_DUMP_INTR 0x10 in src/netlink.h (the value is stable since the flag was added in upstream commit 1d4c8c29c7df in 2014). Same patch applies safely to all other targets.

Makefile

repack target's firmware.bin branch hard-coded an 8192 KB budget regardless of BR2_OPENIPC_FLASH_SIZE. Added a cv6xx-aware path that uses FLASH_SIZE * 1024 so cv6xx_ultimate (FLASH_SIZE=16) is checked against 16384 KB instead of 8192 KB. Other SoCs unchanged.

.github/workflows/build.yml + toolchain.yml

CI matrix entry hi3516cv6xx_litehi3516cv6xx_ultimate to match the renamed defconfig.

Dedup audit

  • Kernel modules — clean. Only open_*.ko in /lib/modules/<kver>/hisilicon/. extra/ is wiped by the FINALIZE_MODULES hook. 191 unique .ko paths, 0 collisions.
  • Sensors — clean. 6 source-built libsns_*.so in /usr/lib/sensors/. Vendor prebuilt install stripped from osdrv .mk.
  • MPP libs — clean. libopus.so excluded from osdrv install (BR2_PACKAGE_OPUS_OPENIPC wins).
  • majestic NEEDED — all resolved (43 vendor libs + libprotobuf-c.so.1 via BR2_PACKAGE_PROTOBUF_C=y).

Deferred follow-ups (not blocking)

  • open_cipher / open_km / open_otp / open_hardware_cryptodev — vendor ships only as full closed .ko; blob extraction TBD.
  • WiFi stack — enable CONFIG_WIRELESS family in the cv6xx kernel config + restore the WiFi-USB driver packages.
  • Ultimate-flavored cv6xx majestic binary — publish to OpenIPC S3, then bump OPENIPC_MAJESTIC=\"ultimate\" in the defconfig.

Test plan

  • Build clean (make BOARD=hi3516cv6xx_ultimate all)
  • firmware.bin ≤ 16384 KB
  • 42 open_*.ko install to /lib/modules/5.10.221/hisilicon/
  • 6 sensor .so install to /usr/lib/sensors/
  • majestic NEEDED libs all resolve at install
  • Kernel module load chain validated on real CV610 hardware (modprobe-driven, 43 modules loaded clean)
  • No duplicate kmods/sensors/MPP libs between osdrv and opensdk installs
  • Cold-boot + sysupgrade test once the PR builds and the sysupgrade bundle is published
  • Majestic RTSP smoke test after sysupgrade

closes #180 on the openhisilicon side; resolves the post-#2167/#2170 boot regression on the firmware side.

PR #2167 added cv6xx_lite (8 MB) with prebuilt vendor `ot_*.ko`
modules. PR #2170 disabled CONFIG_IO_STRICT_DEVMEM so the modules
would actually attempt to init, which exposed an init-time hang at
`mmz_start: 0x42e00000` — the vendor blobs were built against a kernel
config / vermagic that doesn't match openipc/linux 5.10.221.

This switches cv6xx from "ship prebuilt vendor blobs" to "rebuild from
source against the openipc kernel via hisilicon-opensdk", and converts
the (broken-at-8-MB) lite defconfig to a proper 16 MB ultimate variant.

Companion to OpenIPC/openhisilicon#202 (merged as b1c4dae5) which adds
the V5 SoC family — 42 open_*.ko kernel modules covering osal, mmz,
sys_config, base, vb, vca, sys, rgn, vpp, vgs, vpss, vi, isp, chnl,
rc, venc, h264e, h265e, svac3e, jpege, svp_npu, ive, aiisp, pm, uvc,
devstat, user_proc, audio (aio/ai/ao/aenc/adec/acodec), mipi_rx,
sensor_i2c, sensor_spi, pwm, piris, wdt, adc, spi_dma_transfer, user
+ 6 sensor source ports (gc4023, os04d10, sc4336p, sc431hai, sc450ai,
sc500ai) cross-compiled to libsns_*.so.

Validated end-to-end on a Hi3516CV610 demo board (sc4336p sensor):
* S70vendor reaches past `mmz_start: 0x42e00000` cleanly
* 42 `open_*.ko` load via `load_hisilicon` from
  /lib/modules/5.10.221/hisilicon/
* /proc/umap exposes 30 vendor MPP chardevs
* sensor I2C/SPI probe path reaches the bus
* majestic links against the curated vendor MPP lib set

### hi3516cv6xx_ultimate_defconfig (renamed from _lite_defconfig)

`git mv` preserves history. Net changes:

* VARIANT lite→ultimate, FLASH_SIZE 8→16
* OPENIPC_MAJESTIC left at default ("lite") — only the lite-flavored
  cv6xx majestic binary has been published to OpenIPC S3 so far
* Ultimate package set mirroring hi3516ev300_ultimate: AWS_WEBRTC,
  DIVINUS, EXFATPROGS+EXFAT_OPENIPC, IPTABLES, LAME_OPENIPC,
  LIBWEBSOCKETS_OPENIPC, MAJESTIC+MAJESTIC_FONTS+MAJESTIC_WEBUI,
  MOSQUITTO (no broker), MOTORS, PROTOBUF_C, QUIRC_OPENIPC,
  UACME_OPENIPC, VTUND_OPENIPC, ZEROTIER_ONE
* Wireless stack intentionally omitted — openipc/linux hi3516cv6xx
  kernel has CONFIG_WIRELESS off, so cfg80211/mac80211-dependent USB
  WiFi drivers (mt7601u, rtl8188fu, linux_firmware_openipc) and
  wpa_supplicant/wireless-tools have nothing to bind to. Re-enable
  in a follow-up once the kernel config gains the wireless stack.
* UBI rootfs not enabled — cv6xx ships NOR flash

### general/package/hisilicon-opensdk/hisilicon-opensdk.mk

* HISILICON_OPENSDK_VERSION bumped 31a5e9f0 → b1c4dae5 (the merged
  cv6xx port commit on openhisilicon)
* Added `hi3516cv6xx` arm to the SoC dependency ladder, SDK_CODE
  0x3516C610, DISABLE_VO=1 DISABLE_TDE=1 (V5 is encode-only), the
  sensor list for the 6 source-built drivers, and a cv6xx install
  block that ships .ko to /lib/modules/<kver>/hisilicon/ + sensor
  .so to /usr/lib/sensors/
* Added cv6xx to the FINALIZE_MODULES filter so the depmod hook runs
  + extra/open_*.ko dedup wipe applies

### general/package/hisilicon-osdrv-hi3516cv6xx/hisilicon-osdrv-hi3516cv6xx.mk

* Dropped the 39 prebuilt `INSTALL ... files/kmod/ot_*.ko` lines — those
  modules are now built against the running openipc/linux tree by
  hisilicon-opensdk and shipped under hisilicon/ via the FINALIZE hook
* Dropped the prebuilt `files/sensor/*.so` install — sensor drivers
  now built from vendor SDK source by hisilicon-opensdk
* Added install for the 43-lib transitive NEEDED closure of the
  majestic binary against the vendor MPP lib set in files/lib/.
  libopus.so is explicitly excluded because BR2_PACKAGE_OPUS_OPENIPC
  builds a source equivalent. 14 unreferenced vendor libs are also
  omitted, saving ~660 KB.

### general/package/hisilicon-osdrv-hi3516cv6xx/files/script/load_hisilicon

Aligned with the hi3516ev200 canonical pattern (it was vendor-flavored
`modprobe ot_*` previously):

* `modprobe ot_*` → `modprobe open_*` (openhisilicon PREFIX is `open_`)
* `set_allocator` writes to `fw_setenv mmz_allocator` (was an empty stub)
* `check_allocator` actually called from `insert_osal` (was dead code)
* `insert_security_subsys` runs `open_cipher` / `open_km` best-effort
  (2>/dev/null) — V5 ships them as closed-source full .ko; the rest of
  the MPP pipeline survives their absence
* New `insert_detect()` / `remove_detect()` minimal probe set
  (osal+mmz+sys_config+base+isp+sensor_i2c+sensor_spi) for fast sensor
  auto-detect; mirrors ev200
* `-sensor0` / `-sensor` flag also exports `SENSOR=$arg` so explicit
  sensor specification skips the probe gate
* `modprobe sys_config` → `modprobe open_sys_config` (renamed to match
  openhisilicon naming)
* Stale `# modprobe extdrv/ot_sensor_spi` reference dropped
* `open_wdt`, `open_pwm`, `open_piris`, `open_sensor_spi` uncommented
  (they build clean now)

### general/package/all-patches/wireguard-tools/0001-netlink-fallback-define-NLM_F_DUMP_INTR.patch

The cv6xx musl toolchain shipped under openipc/firmware releases is
built against a pre-3.16 kernel UAPI snapshot, so wireguard-tools
1.0.20210914 fails to compile with "NLM_F_DUMP_INTR undeclared".
Patch adds a fallback `#define NLM_F_DUMP_INTR 0x10` in src/netlink.h
(the value is stable since the flag was added in upstream commit
1d4c8c29c7df in 2014). Same patch applies safely to all other targets.

### Makefile

`repack` target's firmware.bin branch hard-coded an 8192 KB budget
regardless of BR2_OPENIPC_FLASH_SIZE. Added a cv6xx-aware path that
uses `FLASH_SIZE * 1024` so cv6xx_ultimate (FLASH_SIZE=16) is checked
against 16384 KB instead of 8192 KB. Other SoCs unchanged.

### Build budget

```
- firmware.bin:  10048 KB / 16384 KB    (61% used, 6336 KB margin)
- fitImage:       2772 KB  (kernel + DTB)
- rootfs.sqfs:    7219 KB  (xz)
```

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 8d5d02d into master Jun 5, 2026
103 checks passed
@widgetii widgetii deleted the hi3516cv6xx-ultimate branch June 5, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant