From 07fa15e1372cf299b697cfa879645acaf7a9c647 Mon Sep 17 00:00:00 2001 From: AI Dev Date: Wed, 28 Oct 2026 16:01:57 +0000 Subject: [PATCH 1/2] xiongmai-opensdk-xm510: open_vi in place of the vendor xm510_vi.ko xiongmai-opensdk-xm510 also builds drivers/xm510_vi (open_vi.ko) from OpenIPC/openxiongmai (9498822), and load_xiongmai loads it by modprobe, falling back to the vendor xm510_vi.ko. It keeps the vendor /dev/vi ABI and releases the frames of a consumer that exits. The fallback is insmod: the vendor xm510_vi.ko depends on mmz, so modprobe would load the vendor mmz.ko under a running open_mmz, which refuses it ("exports duplicate symbol mmz_alloc"), and the load fails. open_vi looks the MMZ symbols up and has no module dependency. --- .../package/xiongmai-opensdk-xm510/Config.in | 4 +-- .../xiongmai-opensdk-xm510.mk | 14 +++++----- .../files/script/load_xiongmai | 26 ++++++++++++++----- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/general/package/xiongmai-opensdk-xm510/Config.in b/general/package/xiongmai-opensdk-xm510/Config.in index 9c4c61ab5..b29c79bcb 100644 --- a/general/package/xiongmai-opensdk-xm510/Config.in +++ b/general/package/xiongmai-opensdk-xm510/Config.in @@ -3,7 +3,7 @@ config BR2_PACKAGE_XIONGMAI_OPENSDK_XM510 depends on BR2_LINUX_KERNEL help Library for running uclibc applications in musl environment, - and the open MMZ (open_mmz) and H.264 encoder (open_h264) - kernel modules from OpenIPC/openxiongmai. + and the open MMZ (open_mmz), H.264 encoder (open_h264) and + video input (open_vi) kernel modules from OpenIPC/openxiongmai. https://github.com/OpenIPC/openxiongmai diff --git a/general/package/xiongmai-opensdk-xm510/xiongmai-opensdk-xm510.mk b/general/package/xiongmai-opensdk-xm510/xiongmai-opensdk-xm510.mk index d3d47030c..7f7ff73bf 100644 --- a/general/package/xiongmai-opensdk-xm510/xiongmai-opensdk-xm510.mk +++ b/general/package/xiongmai-opensdk-xm510/xiongmai-opensdk-xm510.mk @@ -5,9 +5,9 @@ ################################################################################ XIONGMAI_OPENSDK_XM510_SITE = $(call github,openipc,openxiongmai,$(XIONGMAI_OPENSDK_XM510_VERSION)) -XIONGMAI_OPENSDK_XM510_VERSION = 0e82ee26e74c813a7ec98496a4138d05f8c5e36f +XIONGMAI_OPENSDK_XM510_VERSION = 9498822e40875fbfc981df96cbce488c8a48b297 -XIONGMAI_OPENSDK_XM510_LICENSE = MIT (libwrapper), GPL-2.0 (open_mmz, open_h264 kernel modules) +XIONGMAI_OPENSDK_XM510_LICENSE = MIT (libwrapper), GPL-2.0 (open_mmz, open_h264, open_vi kernel modules) XIONGMAI_OPENSDK_XM510_LICENSE_FILES = LICENSE # Install after osdrv, as xiongmai-opensdk does with xiongmai-osdrv-xm530. @@ -17,10 +17,12 @@ endif # The open drivers, which load_xiongmai prefers over the vendor modules: # drivers/xm_mmz (open_mmz.ko), the XM510 mmz.ko's allocator and /proc -# layout, and drivers/hx280enc (open_h264.ko), the encoder driver in place of -# xm510_h264.ko. The kernel-module infrastructure installs them under -# /lib/modules//extra/. Neither needs a vendor module's symbols. -XIONGMAI_OPENSDK_XM510_MODULE_SUBDIRS = drivers/xm_mmz drivers/hx280enc +# layout; drivers/hx280enc (open_h264.ko), the encoder driver in place of +# xm510_h264.ko; and drivers/xm510_vi (open_vi.ko), the VI driver in place of +# xm510_vi.ko, which releases the frames of a consumer that exits. The +# kernel-module infrastructure installs them under /lib/modules// +# extra/. None has a module dependency: open_vi looks the MMZ symbols up. +XIONGMAI_OPENSDK_XM510_MODULE_SUBDIRS = drivers/xm_mmz drivers/hx280enc drivers/xm510_vi # libwrapper (uclibc symbols for the vendor binaries on musl) is this # package's own source, not openxiongmai's. diff --git a/general/package/xiongmai-osdrv-xm510/files/script/load_xiongmai b/general/package/xiongmai-osdrv-xm510/files/script/load_xiongmai index ee65686c1..b0d5a836d 100755 --- a/general/package/xiongmai-osdrv-xm510/files/script/load_xiongmai +++ b/general/package/xiongmai-osdrv-xm510/files/script/load_xiongmai @@ -72,10 +72,10 @@ remove_sns() rmmod -w ssp_sony &> /dev/null } -# MMZ and the encoder: the open drivers when xiongmai-opensdk-xm510 installed -# them (OpenIPC/openxiongmai drivers/xm_mmz and drivers/hx280enc), the vendor -# modules otherwise, which depmod indexes here under xiongmai/. Neither open -# module needs a vendor module's symbols. +# MMZ, VI and the encoder: the open drivers when xiongmai-opensdk-xm510 +# installed them (OpenIPC/openxiongmai drivers/xm_mmz, drivers/xm510_vi and +# drivers/hx280enc), the vendor modules otherwise, which depmod indexes here +# under xiongmai/. None of the open modules needs a vendor module's symbols. insert_mmz() { modprobe open_mmz mmz_start=$MEM_START mmz_size=$MEM_LEN 2>/dev/null || @@ -88,6 +88,20 @@ remove_mmz() rmmod -w open_mmz 2>/dev/null || rmmod -w mmz } +# The vendor xm510_vi.ko depends on mmz: modprobe would load the vendor +# mmz.ko under a running open_mmz, which refuses it (duplicate mmz_alloc) and +# fails the load. insmod takes the symbols from whichever MMZ is loaded. +insert_vi() +{ + modprobe open_vi buffer=$VI_BUFF 2>/dev/null || + insmod xm510_vi.ko buffer=$VI_BUFF +} + +remove_vi() +{ + rmmod -w open_vi 2>/dev/null || rmmod -w xm510_vi +} + insert_h264() { modprobe open_h264 2>/dev/null || modprobe xm510_h264 @@ -110,7 +124,7 @@ insert_ko() cd /lib/modules/3.0.101/xiongmai/ insert_sns > /dev/null insert_mmz - insmod xm510_vi.ko buffer=$VI_BUFF + insert_vi insmod xm510_isp.ko insmod xm510_rgn.ko insert_h264 @@ -129,7 +143,7 @@ remove_ko() remove_h264 rmmod -w xm510_rgn rmmod -w xm510_isp - rmmod -w xm510_vi + remove_vi remove_mmz remove_sns From 8c6e11491bd381034101bc41a27abecb7b53f26a Mon Sep 17 00:00:00 2001 From: AI Dev Date: Wed, 28 Oct 2026 16:20:21 +0000 Subject: [PATCH 2/2] xiongmai-osdrv-xm510: vendor VI fallback by modprobe on the vendor MMZ With the vendor mmz.ko loaded, modprobe resolves xm510_vi.ko's dependency, so the fallback uses it there; insmod is left only for open_mmz, where modprobe would load the vendor mmz.ko beside it and fail. Tested on the XM510: the fallback loads xm510_vi on open_mmz (insmod) and on the vendor mmz (modprobe), with video both times. --- .../xiongmai-osdrv-xm510/files/script/load_xiongmai | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/general/package/xiongmai-osdrv-xm510/files/script/load_xiongmai b/general/package/xiongmai-osdrv-xm510/files/script/load_xiongmai index b0d5a836d..f5d3814c0 100755 --- a/general/package/xiongmai-osdrv-xm510/files/script/load_xiongmai +++ b/general/package/xiongmai-osdrv-xm510/files/script/load_xiongmai @@ -88,13 +88,18 @@ remove_mmz() rmmod -w open_mmz 2>/dev/null || rmmod -w mmz } -# The vendor xm510_vi.ko depends on mmz: modprobe would load the vendor -# mmz.ko under a running open_mmz, which refuses it (duplicate mmz_alloc) and -# fails the load. insmod takes the symbols from whichever MMZ is loaded. +# The vendor xm510_vi.ko depends on mmz. With the vendor mmz.ko loaded, +# modprobe resolves that; on open_mmz it would load the vendor mmz.ko beside +# it, which open_mmz refuses ("exports duplicate symbol mmz_alloc"), failing +# the load, so there it is insmod, which takes the symbols open_mmz exports. insert_vi() { - modprobe open_vi buffer=$VI_BUFF 2>/dev/null || + modprobe open_vi buffer=$VI_BUFF 2>/dev/null && return + if grep -q "^mmz " /proc/modules; then + modprobe xm510_vi buffer=$VI_BUFF + else insmod xm510_vi.ko buffer=$VI_BUFF + fi } remove_vi()