From cad7131f9f3cd38d685f40a7a4d95a1a75745c66 Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin <6576495+widgetii@users.noreply.github.com> Date: Thu, 3 Sep 2026 08:27:30 +0300 Subject: [PATCH 1/4] package/majestic-af: build the out-of-core autofocus plugin from source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit majestic's autofocus engine now lives out of core in the OpenIPC/majestic-af plugin — a single shared object majestic dlopen()s. Compile it from source the way motors is: fetch the repo, build plugin.c/engine.c/af2.c into majestic-af.so, install to /usr/lib. The HAL seams it calls (sdk_get_focus_value, ...) resolve against the majestic executable at dlopen (majestic built WITH_PLUGINS_SUPPORT), so it links nothing from majestic — only its own vendored headers. depends on BR2_PACKAGE_MAJESTIC; a board's defconfig selects it (the hi3516ev300 85H50AI profile does), and the engine only loads where autofocus is enabled, so shipping the .so where it isn't used is harmless. --- general/package/Config.in | 1 + general/package/majestic-af/Config.in | 11 ++++++++ general/package/majestic-af/majestic-af.mk | 31 ++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 general/package/majestic-af/Config.in create mode 100644 general/package/majestic-af/majestic-af.mk diff --git a/general/package/Config.in b/general/package/Config.in index e300df277..857b4da2a 100644 --- a/general/package/Config.in +++ b/general/package/Config.in @@ -67,6 +67,7 @@ source "$BR2_EXTERNAL_GENERAL_PATH/package/linux-patcher/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/majestic-fonts/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/majestic-webui/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/majestic/Config.in" +source "$BR2_EXTERNAL_GENERAL_PATH/package/majestic-af/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/matter/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/mavfwd/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/mbedtls-openipc/Config.in" diff --git a/general/package/majestic-af/Config.in b/general/package/majestic-af/Config.in new file mode 100644 index 000000000..36d8295ee --- /dev/null +++ b/general/package/majestic-af/Config.in @@ -0,0 +1,11 @@ +config BR2_PACKAGE_MAJESTIC_AF + bool "majestic-af" + depends on BR2_PACKAGE_MAJESTIC + help + Out-of-core autofocus / PTZ engine plugin for majestic, compiled + from source. majestic loads /usr/lib/majestic-af.so at runtime when + autofocus is enabled and the majestic binary exports the plugin HAL + seams; the contrast search, the motorized-lens UART actuator (XiongMai + near-Pelco and standard Pelco-D), and the worker threads live here. + + https://github.com/OpenIPC/majestic-af diff --git a/general/package/majestic-af/majestic-af.mk b/general/package/majestic-af/majestic-af.mk new file mode 100644 index 000000000..3ef5b1f68 --- /dev/null +++ b/general/package/majestic-af/majestic-af.mk @@ -0,0 +1,31 @@ +################################################################################ +# +# majestic-af +# +################################################################################ + +MAJESTIC_AF_SITE = $(call github,openipc,majestic-af,$(MAJESTIC_AF_VERSION)) +MAJESTIC_AF_VERSION = HEAD + +MAJESTIC_AF_LICENSE = MIT +MAJESTIC_AF_LICENSE_FILES = LICENSE + +# Out-of-core autofocus / PTZ engine for majestic: one shared object majestic +# dlopen()s at runtime. The HAL seams it calls (sdk_get_focus_value, ...) are +# left UNDEFINED here and resolve against the majestic executable at dlopen, so +# this links nothing from majestic — only its own vendored headers. majestic must +# be built with plugin-symbol export (WITH_PLUGINS_SUPPORT) for those to resolve; +# the plugin otherwise fails to load and majestic keeps working without it. +define MAJESTIC_AF_BUILD_CMDS + $(TARGET_CC) $(TARGET_CFLAGS) -std=gnu99 -fPIC -shared \ + -DFILE_BASENAME=\"majestic-af\" \ + -I$(@D)/include \ + $(@D)/src/plugin.c $(@D)/src/engine.c $(@D)/src/af2.c \ + -o $(@D)/majestic-af.so +endef + +define MAJESTIC_AF_INSTALL_TARGET_CMDS + $(INSTALL) -m 0644 -D $(@D)/majestic-af.so $(TARGET_DIR)/usr/lib/majestic-af.so +endef + +$(eval $(generic-package)) From 34628d6221c38c6fe9f0c3846024ff847bc8a5f5 Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin <6576495+widgetii@users.noreply.github.com> Date: Thu, 3 Sep 2026 08:31:27 +0300 Subject: [PATCH 2/4] ci-matrix: majestic-af is selected by the builder device, not a firmware board MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The selector requires every general/package to be built by some board in ALL_BOARDS or listed in NOT_BUILT. majestic-af's BR2_PACKAGE selection lives in the OpenIPC/builder device defconfig (hi3516ev300_lite_xm-85h50ai), so no firmware defconfig builds it — add it to NOT_BUILT, like matter and the other device/overlay-selected packages. --- .github/scripts/ci-matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/ci-matrix.py b/.github/scripts/ci-matrix.py index 4ad7c420c..68d5964ba 100644 --- a/.github/scripts/ci-matrix.py +++ b/.github/scripts/ci-matrix.py @@ -255,7 +255,7 @@ "faceter-detector", "fdk-aac-openipc", "ffmpeg-openipc", "gdbserver-lite", "go2rtc", "herald", "hisi-gpio", "hisilicon-osdrv-hi3536dv100", "i2c-telemetry", "jsonfilter", "libhv-openipc", "libre-openipc", "libsrt-openipc", - "linux-patcher", "matter", + "linux-patcher", "majestic-af", "matter", "mavfwd", "mdnsd-openipc", "mini", "mqtt-bot", "msposd", "n3n-openipc", "nabto", "netblink", "node-exporter", "ntfy", "onvif-simple-server", "openipc-nfs-root", "osd-openipc", "rtl8188eus-openipc", "rtl8192eu-openipc", "rtl8811cu-openipc", From ed5acd24eb0b0f820cce17bd55e92852e91cf756 Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin <6576495+widgetii@users.noreply.github.com> Date: Thu, 3 Sep 2026 08:48:15 +0300 Subject: [PATCH 3/4] hi3516ev300_lite: select majestic-af so CI builds it Per PR-compliance rule 2 (new sources wired into the build) a defconfig must select the package, and rule ('one board, one file') prefers a generic SoC defconfig over device-only selection. hi3516ev300_lite is the hi3516ev200-family build whose majestic is compiled WITH_PLUGINS_SUPPORT, so the plugin's HAL seams resolve at dlopen there. Selecting it here builds and installs it under firmware CI; drop the ci-matrix NOT_BUILT exception accordingly. The .so only loads where isp.autofocus is enabled, so shipping it on other ev300-lite images is harmless. --- .github/scripts/ci-matrix.py | 2 +- br-ext-chip-hisilicon/configs/hi3516ev300_lite_defconfig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/scripts/ci-matrix.py b/.github/scripts/ci-matrix.py index 68d5964ba..4ad7c420c 100644 --- a/.github/scripts/ci-matrix.py +++ b/.github/scripts/ci-matrix.py @@ -255,7 +255,7 @@ "faceter-detector", "fdk-aac-openipc", "ffmpeg-openipc", "gdbserver-lite", "go2rtc", "herald", "hisi-gpio", "hisilicon-osdrv-hi3536dv100", "i2c-telemetry", "jsonfilter", "libhv-openipc", "libre-openipc", "libsrt-openipc", - "linux-patcher", "majestic-af", "matter", + "linux-patcher", "matter", "mavfwd", "mdnsd-openipc", "mini", "mqtt-bot", "msposd", "n3n-openipc", "nabto", "netblink", "node-exporter", "ntfy", "onvif-simple-server", "openipc-nfs-root", "osd-openipc", "rtl8188eus-openipc", "rtl8192eu-openipc", "rtl8811cu-openipc", diff --git a/br-ext-chip-hisilicon/configs/hi3516ev300_lite_defconfig b/br-ext-chip-hisilicon/configs/hi3516ev300_lite_defconfig index 84e197cd2..1743eb612 100644 --- a/br-ext-chip-hisilicon/configs/hi3516ev300_lite_defconfig +++ b/br-ext-chip-hisilicon/configs/hi3516ev300_lite_defconfig @@ -56,6 +56,7 @@ BR2_PACKAGE_LIBOGG_OPENIPC=y BR2_PACKAGE_MAJESTIC_FONTS=y BR2_PACKAGE_MAJESTIC_WEBUI=y BR2_PACKAGE_MAJESTIC=y +BR2_PACKAGE_MAJESTIC_AF=y BR2_PACKAGE_MBEDTLS_OPENIPC=y BR2_PACKAGE_MOTORS=y BR2_PACKAGE_OPUS_OPENIPC=y From 0c616eea8b2a40323feae7cd135eff173959d366 Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin <6576495+widgetii@users.noreply.github.com> Date: Thu, 3 Sep 2026 08:49:00 +0300 Subject: [PATCH 4/4] majestic-af: pin a full SHA instead of HEAD PR-compliance: a new package should pin a full 40-character SHA for reproducible builds. Bump this when the plugin cuts fixes/releases. --- general/package/majestic-af/majestic-af.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/general/package/majestic-af/majestic-af.mk b/general/package/majestic-af/majestic-af.mk index 3ef5b1f68..88c6b8eae 100644 --- a/general/package/majestic-af/majestic-af.mk +++ b/general/package/majestic-af/majestic-af.mk @@ -5,7 +5,7 @@ ################################################################################ MAJESTIC_AF_SITE = $(call github,openipc,majestic-af,$(MAJESTIC_AF_VERSION)) -MAJESTIC_AF_VERSION = HEAD +MAJESTIC_AF_VERSION = 7caebdc6289347a04cadbf48894600858f45ae69 MAJESTIC_AF_LICENSE = MIT MAJESTIC_AF_LICENSE_FILES = LICENSE