Skip to content

Commit 8d5d02d

Browse files
widgetiiclaude
andauthored
hi3516cv6xx: convert to ultimate variant + wire opensdk source build (#2172)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d7e89a8 commit 8d5d02d

8 files changed

Lines changed: 271 additions & 144 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
- hi3516dv300_lite
122122

123123
# Hisilicon [HI3516CV6XX]
124-
- hi3516cv6xx_lite
124+
- hi3516cv6xx_ultimate
125125

126126
# Hisilicon [HI3516EV200]
127127
- hi3516dv200_lite

.github/workflows/toolchain.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- hi3516cv200_lite
2727
- hi3516cv300_lite
2828
- hi3516cv500_lite
29-
- hi3516cv6xx_lite
29+
- hi3516cv6xx_ultimate
3030
- hi3516ev200_lite
3131
- hi3519v101_lite
3232
- hi3520dv200_lite

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ endif
9999
@$(call BUNDLE_SDK)
100100

101101
repack:
102-
ifneq ($(wildcard $(TARGET)/images/firmware.bin),)
102+
ifeq ($(BR2_OPENIPC_SOC_FAMILY),"hi3516cv6xx")
103+
@$(call PREPARE_REPACK,firmware.bin,$(shell expr $(subst ",,$(BR2_OPENIPC_FLASH_SIZE)) \* 1024),,,nor)
104+
else ifneq ($(wildcard $(TARGET)/images/firmware.bin),)
103105
@$(call PREPARE_REPACK,firmware.bin,8192,,,nor)
104106
else
105107
ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS),y)

br-ext-chip-hisilicon/configs/hi3516cv6xx_lite_defconfig renamed to br-ext-chip-hisilicon/configs/hi3516cv6xx_ultimate_defconfig

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
BR2_OPENIPC_SOC_VENDOR="hisilicon"
33
BR2_OPENIPC_SOC_MODEL="hi3516cv6xx"
44
BR2_OPENIPC_SOC_FAMILY="hi3516cv6xx"
5-
BR2_OPENIPC_VARIANT="lite"
6-
BR2_OPENIPC_FLASH_SIZE="8"
5+
BR2_OPENIPC_VARIANT="ultimate"
6+
BR2_OPENIPC_FLASH_SIZE="16"
7+
# OPENIPC_MAJESTIC defaults to "lite" — only the "lite" flavor of the
8+
# cv6xx majestic binary has been published to OpenIPC S3 so far. Bump
9+
# to "ultimate" once an ultimate-flavored cv6xx binary is uploaded.
710

811
# Architecture
912
BR2_arm=y
@@ -38,34 +41,52 @@ BR2_LINUX_KERNEL_INTREE_DTS_NAME="hi3516cv610-demb"
3841

3942
# Filesystem
4043
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config"
44+
BR2_PACKAGE_EXFATPROGS=y
4145
BR2_PACKAGE_UBOOT_TOOLS=y
42-
BR2_PACKAGE_ZLIB=y
4346
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
47+
BR2_PACKAGE_IPTABLES=y
48+
BR2_PACKAGE_MOSQUITTO=y
49+
# BR2_PACKAGE_MOSQUITTO_BROKER is not set
4450
BR2_PACKAGE_WIREGUARD_LINUX_COMPAT=y
4551
BR2_PACKAGE_WIREGUARD_TOOLS=y
52+
# Wireless stack omitted — openipc/linux hi3516cv6xx kernel has
53+
# CONFIG_WIRELESS off, so cfg80211/mac80211-dependent USB WiFi drivers
54+
# (mt7601u, rtl8188fu) and wpa_supplicant/wireless-tools have nothing
55+
# to bind to. Re-enable once the kernel config gains the wireless stack.
4656
BR2_TARGET_ROOTFS_CPIO=y
4757
BR2_TARGET_ROOTFS_SQUASHFS=y
4858
BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y
4959

5060
# Packages
61+
BR2_PACKAGE_AWS_WEBRTC=y
62+
BR2_PACKAGE_DIVINUS=y
5163
BR2_PACKAGE_DROPBEAR_OPENIPC=y
52-
# BR2_PACKAGE_HISILICON_OPENSDK is not set
64+
BR2_PACKAGE_EXFAT_OPENIPC=y
65+
BR2_PACKAGE_HISILICON_OPENSDK=y
5366
BR2_PACKAGE_HISILICON_OSDRV_HI3516CV6XX=y
5467
BR2_PACKAGE_IPCTOOL=y
5568
BR2_PACKAGE_JSONFILTER=y
56-
BR2_PACKAGE_LIBCURL_OPENIPC=y
69+
BR2_PACKAGE_LAME_OPENIPC=y
5770
BR2_PACKAGE_LIBCURL_OPENIPC_CURL=y
5871
# BR2_PACKAGE_LIBCURL_OPENIPC_PROXY_SUPPORT is not set
5972
# BR2_PACKAGE_LIBCURL_OPENIPC_COOKIES_SUPPORT is not set
6073
# BR2_PACKAGE_LIBCURL_OPENIPC_EXTRA_PROTOCOLS_FEATURES is not set
6174
BR2_PACKAGE_LIBEVENT_OPENIPC=y
6275
BR2_PACKAGE_LIBOGG_OPENIPC=y
63-
# BR2_PACKAGE_MAJESTIC_FONTS=y
64-
# BR2_PACKAGE_MAJESTIC_WEBUI=y
65-
# BR2_PACKAGE_MAJESTIC=y
66-
BR2_PACKAGE_MBEDTLS_OPENIPC=y
67-
# BR2_PACKAGE_MOTORS=y
76+
BR2_PACKAGE_LIBWEBSOCKETS_OPENIPC=y
77+
BR2_PACKAGE_MAJESTIC=y
78+
BR2_PACKAGE_MAJESTIC_FONTS=y
79+
BR2_PACKAGE_MAJESTIC_WEBUI=y
80+
BR2_PACKAGE_MOTORS=y
6881
BR2_PACKAGE_OPUS_OPENIPC=y
6982
BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y
70-
# BR2_PACKAGE_VTUND_OPENIPC is not set
83+
# protobuf-c is dynamically loaded by the cv6xx-flavored majestic binary
84+
# (libprotobuf-c.so.1 appears in DT_NEEDED but no other ultimate config
85+
# selects it — the vendor majestic build was linked against a private
86+
# protobuf-c version).
87+
BR2_PACKAGE_PROTOBUF_C=y
88+
BR2_PACKAGE_QUIRC_OPENIPC=y
89+
BR2_PACKAGE_UACME_OPENIPC=y
90+
BR2_PACKAGE_VTUND_OPENIPC=y
7191
BR2_PACKAGE_YAML_CLI=y
92+
BR2_PACKAGE_ZEROTIER_ONE=y
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Provide a fallback NLM_F_DUMP_INTR define for toolchains whose
2+
linux/netlink.h kernel UAPI headers predate kernel 3.16 (which is when
3+
the flag was added in commit 1d4c8c29c7df). The cv6xx (V5) musl
4+
toolchain shipped under openipc/firmware releases is built against a
5+
pre-3.16 UAPI snapshot, so wireguard-tools 1.0.20210914 fails to compile
6+
against it with "NLM_F_DUMP_INTR undeclared". The kernel-side value is
7+
0x10 and has been stable since its introduction; defining it locally
8+
when the system header omits it is safe across all targets.
9+
10+
Signed-off-by: OpenIPC <noreply@openipc.org>
11+
12+
diff -urN a/src/netlink.h b/src/netlink.h
13+
--- a/src/netlink.h
14+
+++ b/src/netlink.h
15+
@@ -21,6 +21,10 @@
16+
#include <linux/netlink.h>
17+
#include <linux/genetlink.h>
18+
19+
+#ifndef NLM_F_DUMP_INTR
20+
+#define NLM_F_DUMP_INTR 0x10
21+
+#endif
22+
+
23+
#define MNL_SOCKET_AUTOPID 0
24+
#define MNL_ALIGNTO 4
25+
#define MNL_ALIGN(len) (((len)+MNL_ALIGNTO-1) & ~(MNL_ALIGNTO-1))

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

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
################################################################################
66

77
HISILICON_OPENSDK_SITE = $(call github,openipc,openhisilicon,$(HISILICON_OPENSDK_VERSION))
8-
HISILICON_OPENSDK_VERSION = 31a5e9f0
8+
HISILICON_OPENSDK_VERSION = b1c4dae5
99

1010
HISILICON_OPENSDK_LICENSE = GPL-3.0
1111
HISILICON_OPENSDK_LICENSE_FILES = LICENSE
@@ -32,6 +32,9 @@ endif
3232
ifeq ($(BR2_PACKAGE_HISILICON_OSDRV_HI3520DV200),y)
3333
HISILICON_OPENSDK_DEPENDENCIES += hisilicon-osdrv-hi3520dv200
3434
endif
35+
ifeq ($(BR2_PACKAGE_HISILICON_OSDRV_HI3516CV6XX),y)
36+
HISILICON_OPENSDK_DEPENDENCIES += hisilicon-osdrv-hi3516cv6xx
37+
endif
3538

3639
HISILICON_OPENSDK_MODULE_SUBDIRS = kernel
3740
HISILICON_OPENSDK_MODULE_MAKE_OPTS = \
@@ -51,12 +54,25 @@ endif
5154
HISILICON_OPENSDK_MODULE_MAKE_OPTS += DISABLE_VO=1
5255
endif
5356

57+
# V5 (hi3516cv6xx) is encode-only — no VO, no HDMI, no TDE, no NNIE, no
58+
# VDEC, no VEDU, no JPEGD, no GDC, no DIS, no MIPI_TX, no HIFB. These
59+
# blobs simply don't exist in the CV610 SDK. The per-SoC .kbuild already
60+
# omits the obj-m lines, but the shared Kbuild fallback path
61+
# (kernel/Kbuild's `else` branch) gates on DISABLE_* macros — match those
62+
# guards so any shared per-block Kbuild fragments that get pulled in via
63+
# include() stay disabled.
64+
ifeq ($(OPENIPC_SOC_FAMILY),hi3516cv6xx)
65+
HISILICON_OPENSDK_MODULE_MAKE_OPTS += DISABLE_VO=1 DISABLE_TDE=1
66+
endif
67+
5468
ifeq ($(OPENIPC_SOC_FAMILY),hi3516ev200)
5569
HISILICON_OPENSDK_SDK_CODE = 0x3516E200
5670
else ifeq ($(OPENIPC_SOC_FAMILY),gk7205v200)
5771
HISILICON_OPENSDK_SDK_CODE = 0x7205200
5872
else ifeq ($(OPENIPC_SOC_FAMILY),hi3516cv500)
5973
HISILICON_OPENSDK_SDK_CODE = 0x3516C500
74+
else ifeq ($(OPENIPC_SOC_FAMILY),hi3516cv6xx)
75+
HISILICON_OPENSDK_SDK_CODE = 0x3516C610
6076
endif
6177

6278
# for userspace libraries
@@ -74,6 +90,13 @@ define HISILICON_OPENSDK_BUILD_CMDS
7490
endef
7591
endif
7692

93+
# hi3516cv6xx (V5) builds the 6 sensor drivers from source. The MPP
94+
# userspace libraries (libss_mpi_*.so, libvqe_*.so, libsvp_*.so etc.)
95+
# don't have a source mirror yet and continue to ship prebuilt from
96+
# hisilicon-osdrv-hi3516cv6xx. The default BUILD_CMDS runs
97+
# `make -C libraries all` which the libraries/Makefile filters down
98+
# to ./sensor/hi3516cv6xx/% for this CHIPARCH.
99+
77100
# Sensor install list per SoC family
78101
HISILICON_OPENSDK_SENSORS_hi3516ev200 = \
79102
aptina_ar0237/libsns_ar0237 \
@@ -199,6 +222,13 @@ HISILICON_OPENSDK_SENSORS_hi3516cv200 = \
199222
soi_jxf23/libsns_jxf23 \
200223
soi_jxh42/libsns_jxh42 \
201224
sony_imx222/libsns_imx222
225+
HISILICON_OPENSDK_SENSORS_hi3516cv6xx = \
226+
galaxycore_gc4023/libsns_gc4023 \
227+
omnivision_os04d10/libsns_os04d10 \
228+
smart_sc431hai/libsns_sc431hai \
229+
smart_sc4336p/libsns_sc4336p \
230+
smart_sc450ai/libsns_sc450ai \
231+
smart_sc500ai/libsns_sc500ai
202232

203233
HISILICON_OPENSDK_SENSORS = $(HISILICON_OPENSDK_SENSORS_$(OPENIPC_SOC_FAMILY))
204234

@@ -470,6 +500,24 @@ define HISILICON_OPENSDK_INSTALL_TARGET_CMDS
470500
done
471501
endef
472502

503+
# For hi3516cv6xx: V5 — install opensdk .ko directly to hisilicon/ keeping
504+
# the open_* names. load_hisilicon (rewritten) drives `modprobe open_*`.
505+
# Sensor .so files built from source under libraries/sensor/hi3516cv6xx/
506+
# get installed to /usr/lib/sensors/, overwriting any prebuilt vendor
507+
# copies that hisilicon-osdrv-hi3516cv6xx may also have installed.
508+
else ifeq ($(OPENIPC_SOC_FAMILY),hi3516cv6xx)
509+
HISILICON_OPENSDK_KMOD_DST = $(HISILICON_OPENSDK_KMOD_BASE)
510+
define HISILICON_OPENSDK_INSTALL_TARGET_CMDS
511+
$(INSTALL) -m 755 -d $(HISILICON_OPENSDK_KMOD_DST)
512+
for ko in $(@D)/kernel/open_*.ko; do \
513+
[ -f $${ko} ] && $(INSTALL) -m 644 -t $(HISILICON_OPENSDK_KMOD_DST) $${ko} || true; \
514+
done
515+
$(INSTALL) -m 755 -d $(TARGET_DIR)/usr/lib/sensors
516+
$(foreach s,$(HISILICON_OPENSDK_SENSORS), \
517+
$(INSTALL) -D -m 0644 $(@D)/libraries/sensor/$(OPENIPC_SOC_FAMILY)/$(s).so $(TARGET_DIR)/usr/lib/sensors ; \
518+
)
519+
endef
520+
473521
else ifeq ($(OPENIPC_SOC_FAMILY),hi3520dv200)
474522
# hi3520dv200: V2-era 4-channel analog DVR SoC. Kernel 3.0.8. No
475523
# sensor blobs (NVP6114 analog video decoder kernel module is built
@@ -519,7 +567,7 @@ $(eval $(kernel-module))
519567
# TARGET_FINALIZE_HOOKS (linux package is processed before this one), so
520568
# it has already executed by the time we get here — we need a second pass
521569
# so modules.dep reflects the post-cleanup state.
522-
ifneq ($(filter hi3516cv500 hi3516cv200 hi3516cv100 hi3516av100 hi3519v101 hi3516cv300 hi3520dv200,$(OPENIPC_SOC_FAMILY)),)
570+
ifneq ($(filter hi3516cv500 hi3516cv200 hi3516cv100 hi3516av100 hi3519v101 hi3516cv300 hi3520dv200 hi3516cv6xx,$(OPENIPC_SOC_FAMILY)),)
523571
define HISILICON_OPENSDK_FINALIZE_MODULES
524572
$(if $(BR2_PER_PACKAGE_DIRECTORIES),rsync -a $(PER_PACKAGE_DIR)/hisilicon-opensdk/target/lib/modules/ $(TARGET_DIR)/lib/modules/)
525573
rm -rf $(TARGET_DIR)/lib/modules/*/extra/open_*.ko

0 commit comments

Comments
 (0)