Skip to content

build: run the final depmod on kernels that see this checkout's git - #2854

Merged
openipc-ai merged 1 commit into
masterfrom
build-depmod-scmversion
Nov 14, 2026
Merged

openipc-ai merged 1 commit into
masterfrom
build-depmod-scmversion

Conversation

@openipc-ai

Copy link
Copy Markdown
Collaborator

Problem

On the Xiongmai V200 boards (xm530v200, xm533, xm535d1, xm535d2, xm535w1), USB Wi-Fi never comes up on the shipped image. modules.dep lists none of the xiongmai/ vendor modules and none of the ATBM driver, so every xm_v200_wifi arm in /etc/wireless/usb, and load_xiongmai's own modprobe dwc2 / modprobe xm_usb0, fail with not found in modules.dep. The same gap is why the first-gen XM530 ATBM6032 bring-up in #2316 cannot load its driver (#2853).

Cause: linux.mk's target-finalize LINUX_RUN_DEPMOD runs only if lib/modules/$(LINUX_VERSION_PROBED) exists. That probe runs make kernelrelease without the GIT_DIR=. that every package step gets. The XM 3.10.103 kernels' scripts/setlocalversion has no git rev-parse --show-cdup guard, so it finds this firmware checkout above the build directory and appends +:

$ make -s ARCH=arm kernelrelease           # in output/build/linux-custom, inside the checkout
3.10.103++
$ cat include/config/kernel.release        # what the kernel and its modules were built as
3.10.103+

test -d lib/modules/3.10.103++ fails silently and depmod never runs. With per-package directories, the final modules.dep is then whichever package's copy rsync laid down last. That copy is complete on xm530 (xiongmai-opensdk's, which depends on everything) and nearly empty on the V200 family. A package-level $(LINUX_RUN_DEPMOD) hook is skipped by the same test.

The fix is an empty .scmversion in the kernel tree, which setlocalversion reads instead of asking git, so the probe matches the build. The kernel's own release string does not change: its build already ran with GIT_DIR=. and found no git. Kernels that have the guard (4.x and later here), or that ignore the file (6.3 and later), are unaffected.

Hardware tested on

Not run on a camera. Tested on the qemu-bench XM530V200 and XM550 machines with the atbm-wifi USB dongle model (007a:8888). CI will build the full matrix, since general/external.mk reaches every board. A V200 board with ATBM Wi-Fi is still needed to confirm on hardware.

Evidence

Scan of every latest release asset for .ko files missing from modules.dep (186 assets, 2026-11-13 nightly). The V200 family:

openipc.xm530v200-nor-lite.tgz 3.10.103+ ko=31 missing=20 xiongmai/xm_usb0.ko xiongmai/vpss.ko xiongmai/vo.ko xiongmai/venc.ko ...
openipc.xm533-nor-lite.tgz     3.10.103+ ko=31 missing=19 xiongmai/vi.ko xiongmai/venc_mem.ko xiongmai/venc.ko ...
openipc.xm535d1-nor-lite.tgz   3.10.103+ ko=30 missing=19 xiongmai/xm_usb0.ko xiongmai/vpss.ko ...
openipc.xm535d2-nor-lite.tgz   3.10.103+ ko=29 missing=20 xiongmai/xm_usb0.ko xiongmai/vpss.ko ...
openipc.xm535w1-nor-lite.tgz   3.10.103+ ko=30 missing=19 xiongmai/xm_usb0.ko xiongmai/vi.ko ...

All 52 HiSilicon/Goke/SigmaStar split images index every module. hi3516av200 neo (3.18.20) is also missing all 32 hisilicon/ modules. That may be the same mechanism, but this PR has not been built or checked on that board.

Before, the xm530v200 nightly (master+a0f341e) on the twin, with wlandev=atbm603x-xm530v200-x2-wq2:

$ /etc/wireless/usb atbm603x-xm530v200-x2-wq2; echo rc=$?; ls /sys/class/net
modprobe: module dwc2 not found in modules.dep
modprobe: module xm_usb0 not found in modules.dep
modprobe: module atbm603x_comb_wifi_usb not found in modules.dep
rc=1
eth0  lo

After, xm530v200_lite built with this change, same twin and env, Wi-Fi brought up by S40network at boot:

$ grep -E 'dwc2|xm_usb0|atbm' /lib/modules/3.10.103+/modules.dep
extra/hal_apollo/atbm603x_comb_wifi_usb.ko: kernel/net/wireless/cfg80211.ko
xiongmai/xm_usb0.ko:
xiongmai/dwc2.ko:
$ lsmod
cfg80211              122200  1 atbm603x_comb_wifi_usb
xm_usb0                  724  0
dwc2                   80996  0
$ ls /sys/class/net
eth0   lo     p2p0   wlan0
$ wpa_cli -i wlan0 status | grep -E '^(wpa_state|ssid)='
ssid=OpenIPC
wpa_state=COMPLETED
$ udhcpc -i wlan0 -n -q
udhcpc: lease of 10.0.2.15 obtained from 10.0.2.2, lease time 86400
$ ping -c 3 10.0.2.2
3 packets transmitted, 3 packets received, 0% packet loss

The same fix on xm530_lite with #2316's ATBM6032 arm (twin xm550, wlandev=atbm603x-xm530 wifipdn=96) gives wlan0, wpa_state=COMPLETED, a DHCP lease and 3/3 pings. Without this fix, that build has no wlan0. kernel.release stays 3.10.103+, and the uImage differs only in the header timestamp.

Scope

  • No kernel patches under general/package/all-patches/linux/ (those go to OpenIPC/linux)
  • No files specific to a single retail camera model (those go to OpenIPC/builder)
  • No probing or bring-up tooling (that goes to OpenIPC/ipctool)
  • Nothing under general/overlay/ or in a shared load_<vendor> script hardcodes a value specific to my board
  • Package sources come from an OpenIPC repository, and any version bump keeps at least the specificity of the pin it replaces (no package change)
  • No LD_PRELOAD, and no binaries that cannot be rebuilt from source
  • New code is selected by a defconfig, so CI actually builds it (the hook is in general/external.mk and runs for every board)

linux.mk's target-finalize depmod runs only if
lib/modules/$(LINUX_VERSION_PROBED) exists, and the probe runs `make
kernelrelease` without the GIT_DIR=. every build step gets. The XM
3.10.103 kernels' setlocalversion has no `git rev-parse --show-cdup`
guard, so inside the firmware checkout it appends "+" (3.10.103++ against
modules built as 3.10.103+), the test fails silently, and modules.dep is
whichever per-package copy rsync laid down last.

On the xm530v200, xm533 and xm535* nightlies that copy lists none of the
xiongmai/ modules nor the ATBM driver, so every V200 Wi-Fi profile and
load_xiongmai's own `modprobe dwc2` / `modprobe xm_usb0` fail with
"not found in modules.dep" (#2853). An empty .scmversion is what
setlocalversion reads instead of asking git, so the probe agrees with the
build. The kernel's own release string is unchanged: its build already
ran with GIT_DIR=. and found no git.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Restore final depmod for kernels affected by checkout Git metadata

🐞 Bug fix 🕐 10-20 Minutes

Grey Divider

AI Description

• Prevent kernel-release probes from picking up Git metadata in legacy kernel trees.
• Restore final module indexing so Xiongmai USB Wi-Fi and vendor modules can load.
Diagram

graph TD
  A["Linux extract"] --> B["SCM version hook"] --> C["Kernel tree"] --> D["Release probe"] --> E{"Module directory exists?"} --> F["Final depmod"] --> G["Module index"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Patch Buildroot's release probe
  • ➕ Fixes the environment mismatch at the probe itself.
  • ➕ Avoids adding a file to every extracted kernel tree.
  • ➖ Requires carrying a Buildroot patch or changing upstream behavior.
  • ➖ Adds maintenance for a mismatch triggered by specific legacy kernels.

Recommendation: Keep the post-extract hook: it uses the legacy kernel's supported .scmversion mechanism, leaves the built release unchanged, and avoids a Buildroot patch. Confirm the hook runs before release probing across the CI board matrix.

Files changed (1) +17 / -0

Bug fix (1) +17 / -0
external.mkStabilize kernel release detection after extraction +17/-0

Stabilize kernel release detection after extraction

• Adds a Linux post-extract hook that creates an empty .scmversion in the kernel tree. Legacy kernels then avoid incorporating the parent checkout's Git metadata into Buildroot's release probe, allowing the final depmod pass to find and index installed modules.

general/external.mk

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can ask Qodo to dismiss a finding you disagree with, with your reason on record

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@openipc-ai
openipc-ai merged commit 9114682 into master Nov 14, 2026
153 of 154 checks passed
@openipc-ai
openipc-ai deleted the build-depmod-scmversion branch November 14, 2026 11:42
openipc-ai added a commit to OpenIPC/qemu-bench that referenced this pull request Nov 14, 2026
* xiongmai: USB Wi-Fi on the releases, through S40network, in CI

test-xm-usb-wifi.sh boots the xm530v200 and xm530 release bundles with the
atbm-wifi dongle and an environment that names the Wi-Fi profile and a
WPA2-PSK network, and lets S40network bring it up: on xm530v200 wlan0 must
join, lease and ping; on xm530 (-M xm550, no driver in that release) dwc_otg
and wifi_pdn must enumerate the dongle. The job wifi-xiongmai runs both.

It is the regression test for OpenIPC/firmware#2854. On the 2026-11-13
xm530v200 nightly it fails as the camera did -- modprobe: module dwc2 /
xm_usb0 / atbm603x_comb_wifi_usb not found in modules.dep -- and on a build
with that fix it joins, leases 10.0.2.15 and pings 3/3.

* test-xm-usb-wifi: survive a clean log, check wifi_pdn, keep QEMU off stdin

The modules.dep diagnostic is a grep with no match on a good image, and
under errexit / pipefail that ended the script before its checks; the runs
so far passed only because every release also prints exfat's line. The
xm530 row now requires wifi_pdn to load as well as dwc_otg: QEMU plugs the
dongle in whatever the pad does. And the backgrounded QEMU reads /dev/null.
openipc-ai added a commit to yatotoshka/firmware that referenced this pull request Nov 14, 2026
…led ATBM6032 bring-up

Review of OpenIPC#2316: the depmod hook is gone, as OpenIPC#2854 restored depmod on the
XM 3.10.103 kernels for every board. Renaming the vendor backport to
cfg80211_xm711.ko left it module "cfg80211", so depmod split the shared
symbols between the two copies; it now sits in /usr/lib/xiongmai like mmz.ko
and `wifi xm711` loads it by path. The atbm603x-xm530 profile now fails when
wifipdn is unset, a modprobe fails, or wlan0 never appears, so S40network
falls back to the wired port.
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