From e0c6bc0bfdedf03bb520a118bda46b0ea9fefba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdurrahman=20Kaan=20Dike=C3=A7?= Date: Fri, 16 Oct 2026 08:54:34 +0300 Subject: [PATCH] Mainline 6.18.57 and 7.2.11 with every module the boards can use (FINDINGS 130) - build.sh/build-modules.sh default to 6.18.57 (7.2.11 via KV); all 17 patches and the port edits apply unchanged. - all-modules.py: after the fragment, every tristate that is off becomes a module, to a fixpoint. Built-ins are checked to stay built in, bools change only where all-modules.config opens a family, PCI cards stay out (an expansion with PCI=n decides), and all-modules.exclude keeps out test/debug code, board-wiring drivers, the SoC GPU drivers, VFIO and the Spreadtrum drivers the fragment does not name. It stops the build when something it must not turn on (perf/kprobes, IOMMU DMA, CMA...) comes on. - check-dt-modules.py (build-modules.sh): no module may bind to a node of the vendor device tree by itself (dt-compatibles.txt: the F50's and the U30 Air's compatibles); it caught spi_sprd. - audit-bundle.py also checks the Image against all-modules.report. - 7.2.11: 3077 modules (132 MB unpacked, bundle 55.7 MB; was 442, 21.0 MB); 6.18.57: 3010 (bundle 53.7 MB). The boot ramdisk does not grow. Docker's check-config: nothing generally necessary missing (ten before). - Device-tested on F50-B (Ubuntu) and the U30 Air (openwrt-luci), both kernels; KVM in VHE mode with a guest; dockur/windows-arm now gets NAT networking (no xt_nat before) and stops at its RAM check (1.4 GB boards). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VVN2zDgf76kMDVSuWhHPUE --- docs/FINDINGS.md | 131 +++++++++++++ tests/test_all_modules.py | 109 +++++++++++ upstream/README.md | 18 +- upstream/all-modules.config | 42 +++++ upstream/all-modules.exclude | 156 ++++++++++++++++ upstream/all-modules.py | 192 +++++++++++++++++++ upstream/audit-bundle.py | 7 +- upstream/build-modules.sh | 7 +- upstream/build.sh | 10 +- upstream/check-dt-modules.py | 44 +++++ upstream/dt-compatibles.txt | 316 ++++++++++++++++++++++++++++++++ upstream/dt-modules-allowed.txt | 2 + 12 files changed, 1025 insertions(+), 9 deletions(-) create mode 100644 tests/test_all_modules.py create mode 100644 upstream/all-modules.config create mode 100644 upstream/all-modules.exclude create mode 100644 upstream/all-modules.py create mode 100644 upstream/check-dt-modules.py create mode 100644 upstream/dt-compatibles.txt create mode 100644 upstream/dt-modules-allowed.txt diff --git a/docs/FINDINGS.md b/docs/FINDINGS.md index 97dd0264..25c3686f 100644 --- a/docs/FINDINGS.md +++ b/docs/FINDINGS.md @@ -153,6 +153,7 @@ what replaced it. The table below gives each section's state. | 112 | Making room by a reset, and the installation that resumes afterwards: kano's transaction, Android's recovery formats the encrypted `userdata`, the checks of the resumed run (`f6b0668d`, `0e19fe32`) | experimental; unit tests and tests against fakes (a fake eMMC); not run on a device, here or by kano | | 120 | Data roaming: a switch of our own in the dial and its watchdog (no switch of the modem's is known), the network's word for roaming, and a test hook | current (unit tests; checklist items 1-5 run on a U30 Air, openwrt-luci, and an F50, Ubuntu, both v2026.10.27, 2026-10-15, through the test hook; no SIM that really roams) | | 125 | Release names: the day of the release and its number (`vYYYY.MM.DD.N`), newer than every three-field tag; one comparer per language against one table; what the updaters and installers up to v2026.10.27 do with them | current (unit tests in sh, Python, JavaScript and PowerShell; the old clients read from their code, not run) | +| 130 | Linux 6.18.57 and 7.2.11 with every module the boards can use (`all-modules.py`, with a device-tree check), KVM in VHE mode with a guest, Docker's check-config and dockur/windows-arm | current (built here; F50-B Ubuntu and the U30 Air openwrt-luci, both kernels each, 2026-10-16; dockur stops at its own RAM check: the boards have 1.4 GB) | ## Hardware and firmware facts @@ -8241,3 +8242,133 @@ three have the same logic in these places): time of publishing and was right. * The graphical installer and the installers' beta question are newer than v2026.10.27 (`tools/release_pick.py` is not in those tags); they go by the time of publishing too, now with the tag order on top. + +### 130. Linux 6.18.57 and 7.2.11 with every module the boards can use, KVM, and what Docker and dockur/windows-arm need + +**Versions.** 7.2.11 (stable) and 6.18.57 (longterm), both of 2026-10-15. kernel.org's `sha256sums.asc` for v6.x and +v7.x carry a good signature of the checksum autosigner (`B886 8C80 BA62 A1FF FAF5 FDA9 632D 3A06 589D A6B1`, fetched +by WKD), and both tarballs match it (`build.sh` checks the sums; the signature was checked by hand). `build.sh` and +`build-modules.sh` default to 6.18.57; the release workflow takes the newest of each series from kernel.org anyway. +All 17 patches (`patches/*` and `patches/6.18/0007`) and every `port/install.py` edit apply unchanged to both trees: +none is upstream yet, none was dropped or changed. + +**All modules (`upstream/all-modules.py`).** Not allmodconfig. After the fragment, every option declared `tristate` +in the tree that is off becomes `m`, `olddefconfig`, again until nothing changes (a fixpoint: a module whose +dependencies are only now met comes in on the next round). The rules: + +* Bools stay as the fragment leaves them, except the ones `all-modules.config` turns on because they only open a + family: the Wi-Fi vendors (USB sticks), joysticks, tablets, touch screens (the USB ones), TV/radio/SDR, ALSA's + `snd-aloop`/`snd-dummy`, iSCSI, AX.25, the legacy iptables/ebtables tables, `/dev/hidraw`; and it keeps + `DRM_FBDEV_EMULATION` off (no framebuffer console). A bool that only became visible with a new driver takes its + default, except that the ones that look like debugging or tests go off again (6-7 per kernel). +* PCI cards are left out: the expansion runs once with `PCI=n`, and only what survives there is taken (the only PCIe + link is the soldered Marlin3). +* `all-modules.exclude` keeps out test/debug/benchmark code, ASoC, display panels, the SoC GPU drivers (panfrost and + co. would bind next to the vendor Mali driver), VFIO (no mainline IOMMU driver for this SoC), legacy gadget drivers + and the dummy UDC (mu300-usb takes the first UDC), and by directory the drivers of chips that only a board's device + tree wires up (regulators, MFDs, power supplies, clocks, pins, PHYs, camera sensors, DSA switches, platform host + controllers, MACs, NAND...). A `keep` line takes a USB part of such a directory back in (`MMC_VUB300`, + `TOUCHSCREEN_USB_COMPOSITE`, LED triggers and the multicolor/flash LED classes HID drivers need). Tuners, + demodulators and webcam sensors are still built when a USB driver selects them. +* It stops the build when a built-in option changed, and when something it must not turn on came on. Both fired while + the rules were written: `MMC_BLOCK` would have become a module (`depends on RPMB || !RPMB` - the eMMC driver), and + `BT_HCIUART` the same through `SERIAL_DEV_BUS`/`POWER_SEQUENCING`; `EXT4_USE_FOR_EXT2` would have gone with + `EXT2_FS`, `I3C_OR_I2C` with `I3C`; `PERF_EVENTS` (kept off, 31p) came with CoreSight; `IOMMU_DMA`/`OF_IOMMU` + and `CMA`/`DMA_CMA` (the DMA path of every vendor-tree device with an `iommus` property, and the vendor's + `shared-dma-pool` regions as CMA) came with panfrost/etnaviv, `IOMMU_API` with VFIO. Each is excluded, with the + reason, in `all-modules.exclude`. +* `check-dt-modules.py` (in `build-modules.sh`) then fails the build when a module's `of:` alias matches a compatible + of the vendor device tree (`dt-compatibles.txt`: all 314 strings of the F50's and the U30 Air's + `/proc/device-tree`): udev would load it at boot and it would drive SoC hardware next to the vendor drivers. It + caught `spi_sprd` (`sprd,sc9860-spi`). On the device, F50-B then still loaded `sc27xx_vibra` (it bound nothing): + every Spreadtrum/Unisoc driver the fragment does not name is out now. Two rules were too broad and the device + test showed it (ebtables and the Logitech HID drivers were missing); both are fixed. +* `make-bundle.sh` checks the Image's embedded config against `all-modules.report` too (what the expansion added), + as against the fragment. `MU300_ALL_MODULES=0` builds the fragment alone. + +| | 6.18.56 (v2026.10.16.1) | 6.18.57 | 7.2.10 (v2026.10.16.1) | 7.2.11 | +|---|---|---|---|---| +| options newly `m` / bools newly `y` | | 2419 / 202 | | 2484 / 209 | +| modules in the bundle | 435 | 3010 | 442 | 3077 | +| modules unpacked | 28.5 MB | 124.9 MB | 30.1 MB | 132.1 MB | +| `mu300-kernel-*.tar.gz` | 20.3 MB | 53.7 MB | 21.0 MB | 55.7 MB | +| Image as LK loads it (bytes) | 23 996 424 | 24 655 880 | 24 750 088 | 25 606 152 | +| generic ramdisk segment (bytes) | 1 833 133 | 1 833 154 | 1 834 504 | 1 834 499 | +| build tree (`out-*`) | 2.8 GB | 6.7 GB | 2.9 GB | 6.9 GB | + +The boot image grows only by the Image (+0.66 and +0.86 MB): the generic ramdisk still loads only +`module-order.txt`. The Image grows by what the new drivers select into the core (netpoll for netconsole, devlink, +DPLL, quota, hidraw, I2C slave, CRC/crypto library code). Docker's `contrib/check-config.sh`: the fragment alone +missed ten "generally necessary" options (the legacy `iptable_*`/`ip6table_*` tables, `IP_NF_NAT`, +MASQUERADE...), both new configs miss none; the optional misses are `CGROUP_PERF` (needs `PERF_EVENTS`, kept off), +SELinux/AppArmor (not built) and ZFS. + +**One bundle, no separate extra.** The whole set stays in `mu300-kernel-.tar.gz`. Its size is far below +GitHub's 2 GB per asset (the largest Magisk zip, Ubuntu 26.04 with 7.2, goes from 134 MB to about 170 MB). A split +would put one module set into two packages whose dependencies cross (the HID drivers need the multicolor LED class, +the netfilter targets their cores) and which `depmod` and kmodloader must see together, and an installer would have +to decide which half a device gets. On the device the cost is disk: about 100 MB more per installed mainline kernel +and system (Ubuntu 135 MiB under `extra/`, OpenWrt 125 MiB flat), plus the previous set `mu300-update` keeps for +`rollback-boot`. The OpenWrt images carry the 6.18 set as before (`build-rootfs.sh`), so they grow by the same ~96 MiB +unpacked (~33 MB in the tarball). Plain OpenWrt in an 804 MiB region (F50-C, 613 MiB free in section 85) keeps +about 517 MiB free, and about 270 MiB after a kernel switch (the new set and the kept previous one). A copy that +does not fit fails safe: `kernel_modules_into_systems` returns an error, `mu300-update` puts the previous modules +back and leaves the boot image unchanged. + +**KVM.** The firmware starts every CPU at EL2 on both boards, and both new kernels run KVM in VHE mode (F50-B, +7.2.11; 6.18.57 the same with 568/664 trap handlers): +``` +CPU: All CPU(s) started at EL2 +kvm [1]: IPA Size Limit: 40 bits +kvm [1]: GICv3: no GICV resource entry +kvm [1]: disabling GICv2 emulation +kvm [1]: GIC system register CPU interface enabled +kvm [1]: VHE mode initialized successfully +``` +A guest ran: Alpine 3.22's aarch64 `vmlinuz-virt` + `initramfs-virt` (6.12.110) under `qemu-system-aarch64 +-machine virt,accel=kvm,gic-version=3 -cpu host -smp 2 -m 256`, pinned to the A76 cores 4-7 (`-cpu host` needs one +core type; the A55/A76 mix is why), QEMU 11.1 from the dockur image, on 7.2.10, 7.2.11 and 6.18.57 alike: the guest +logs `Booting Linux on physical CPU 0x0000000000 [0x414fd0b0]` (an A76), `smccc: KVM: hypervisor services detected` +and reaches Alpine's initramfs shell. The U30 Air logs the same EL2/VHE lines on both kernels (it has no QEMU). + +**Docker and dockur/windows-arm** (on F50-B with Docker 29.1.3 from Ubuntu's archive, installed from .debs and +removed again). What the container needs from the host: `/dev/kvm` (writable), `/dev/net/tun`, `NET_ADMIN`, a bridge +and a tap for its NAT mode, iptables (nft or legacy) with `nat` (DNAT, MASQUERADE) and `mangle`, `/dev/vhost-net` +and macvtap for its DHCP mode, passt as the fallback. `docker compose up` with its `compose.yml` (image +`dockurr/windows-arm`, loaded from `docker save`, restart off): + +| | 7.2.10 (released) | 7.2.11 (this config) | +|---|---|---| +| `docker compose up` | fails: `Unable to enable DNAT rule ... Extension DNAT revision 0 not supported, missing kernel module?` (no `xt_nat`) | starts, ports published | +| dockur's network stage | `Failed to configure IP tables` -> "falling back to user-mode networking" (passt) | `Mode: NAT` (bridge `docker`, tap `qemu`, DNAT/MASQUERADE rules in place) | +| its KVM check, `info kvm` in its QEMU | passes, `kvm support: enabled` | the same | +| its RAM check | `Windows 11 requires at least 2.0 GB of RAM, but only 668 MB can be allocated.` | the same (580 MB) | + +The kernel side is complete now, and the board is not: 1.4 GB of RAM cannot hold Windows 11 (2 GB minimum). With +`RAM_CHECK=N` the container goes on to download Windows, which F50-B (no internet) could not; nothing past that was +tried. Small Linux guests run. + +**Device tests** (2026-10-16, bundles installed with `MU300_KERNEL_BUNDLE=... MU300_RELEASE=v2026.10.16.1 +mu300-update kernel `; each board then went back to its released kernel, with the v2026.10.27 boot image as +its previous one again, as before): + +* F50-B, Ubuntu 24.04, 7.2.11 (twice: before and after the last exclusions) and 6.18.57: boots, kernel 5.3 s, + userspace 34 s, no oops or warning, no failed unit; the 5 GHz access point, Bluetooth, USB network, the mobile + bearer (an address and an IPv6 prefix; this carrier passes no traffic without a VPN, and the released 7.2.10 did + the same in the same minute), cpufreq and thermal. udev loads `drm` (systemd's `modprobe@drm`) and our + `extra-modules` loads `snd-aloop` (for mu300-voice), which exists now. `modprobe` of 109 names across the classes + (iptables tables, ebtables, SCTP, TIPC, batman-adv, Open vSwitch, USB serial/net/storage, btrfs/jfs/nilfs2/erofs/ + gfs2/ocfs2/ceph/xfs, dm-raid/dm-vdo/bcache/drbd, NVMe-TCP, iSCSI, btusb, rtw88/rtw89/mt7921u/carl9170/ath9k_htc/ + rt2800usb/brcmfmac, uvcvideo, em28xx, DVB, snd-usb-audio, HID, xpad, wacom, i2c-tiny-usb, gs_usb, NFC, vhost_net, + macvtap...): 94 load, 10 are built in, 5 are not modules by design (reiserfs is gone since 6.13, `iio_dummy` and + VFIO excluded, two names of the list were wrong: `hid-cp2112`, `can-j1939`); 252 modules loaded at once, no oops. +* U30 Air, openwrt-luci, 6.18.57 and 7.2.11: boots in under a minute with the owner's VPN profile (sing-box, kill + switch on) back up and its exit IP answering, the access point, the charger and fuel gauge (80 %), the LEDs, mobile + data under the VPN; KVM in VHE mode. kmodloader handles 3010 modules: one `modprobe` takes 0.1 s, the 109-name + sample 10.8 s, no oops, the VPN up throughout. At boot it loads 114 modules (100 before): the `/etc/modules.d` + lists of the OpenWrt kmod packages name the legacy `iptable_filter`/`iptable_mangle`, `ipt_REJECT` and some `xt_` + targets, which exist now; such a table is only set up when iptables-legacy uses it. The VPN configuration is + byte-for-byte what it was (checksums compared after the restore). + +Not done: no ZTE V50 to read its compatibles from (`dt-compatibles.txt` has the F50's and the U30 Air's); no +release was built or tagged; the boards ran the bundles built here, the CI workflows build the kernels. diff --git a/tests/test_all_modules.py b/tests/test_all_modules.py new file mode 100644 index 00000000..830a6578 --- /dev/null +++ b/tests/test_all_modules.py @@ -0,0 +1,109 @@ +"""upstream/all-modules.py (every tristate the boards can use, as a module) and check-dt-modules.py (none of them +may bind to the vendor device tree by itself).""" +import importlib.util +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest + +TOP = Path(__file__).resolve().parents[1] +UP = TOP / 'upstream' + + +def load(name, file): + spec = importlib.util.spec_from_file_location(name, UP / file) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod + + +allmod = load('all_modules', 'all-modules.py') + + +class AllModules(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.d = Path(self.tmp.name) + + def test_write_set_replaces_the_line_that_names_an_option(self): + cfg = self.d / '.config' + cfg.write_text('CONFIG_A=y\n# CONFIG_B is not set\nCONFIG_BB=m\nCONFIG_C="x"\n') + allmod.write_set(str(cfg), {'B': 'm', 'A': 'n'}) + self.assertEqual(allmod.read(str(cfg)), {'A': 'n', 'B': 'm', 'BB': 'm', 'C': '"x"'}) + self.assertEqual(cfg.read_text().count('CONFIG_B'), 2) # B once, BB untouched + + def test_tristates_are_found_with_their_directory(self): + k = self.d / 'drivers' / 'foo' + k.mkdir(parents=True) + (k / 'Kconfig').write_text('menuconfig FOO\n\ttristate "foo"\nconfig FOO_OPT\n\tbool "opt"\n' + 'config FOO_LIB\n\tdef_tristate m\n') + self.assertEqual(allmod.tristates(str(self.d)), {'FOO': 'drivers/foo', 'FOO_LIB': 'drivers/foo'}) + + def test_the_rules_keep_board_wiring_tests_and_the_soc_gpu_out(self): + dirs, keep, pats = allmod.rules() + w = lambda sym, where: allmod.wanted(sym, where, dirs, keep, pats) + for sym, where in (('USB_SERIAL_CH341', 'drivers/usb/serial'), ('BTRFS_FS', 'fs/btrfs'), + ('MMC_VUB300', 'drivers/mmc/host'), ('DRM_UDL', 'drivers/gpu/drm/udl'), + ('LEDS_TRIGGER_PATTERN', 'drivers/leds/trigger'), ('NFT_CT', 'net/netfilter'), + ('TOUCHSCREEN_USB_COMPOSITE', 'drivers/input/touchscreen'), + ('BRIDGE_NF_EBTABLES', 'net/bridge/netfilter'), ('LEDS_CLASS_MULTICOLOR', 'drivers/leds')): + self.assertTrue(w(sym, where), sym) + for sym, where in (('SND_SOC_WM8960', 'sound/soc/codecs'), ('DRM_PANFROST', 'drivers/gpu/drm/panfrost'), + ('REGULATOR_FIXED_VOLTAGE', 'drivers/regulator'), ('CRC_KUNIT_TEST', 'lib'), + ('RPMB', 'drivers/misc'), ('EXT2_FS', 'fs/ext2'), ('CORESIGHT', 'drivers/hwtracing/coresight'), + ('USB_DUMMY_HCD', 'drivers/usb/gadget/udc'), ('USB_ETH', 'drivers/usb/gadget/legacy'), + ('VFIO', 'drivers/vfio'), ('MMC_SDHCI_OF_ARASAN', 'drivers/mmc/host'), + ('SERIAL_DEV_BUS', 'drivers/tty/serdev'), ('POWER_SEQUENCING', 'drivers/power/sequencing'), + ('INPUT_SC27XX_VIBRA', 'drivers/input/misc'), ('SPI_SPRD', 'drivers/spi')): + self.assertFalse(w(sym, where), sym) + + def test_what_must_stay_off_is_checked(self): + for k in ('PERF_EVENTS', 'KPROBES', 'IOMMU_DMA', 'OF_IOMMU', 'DMA_CMA', 'COMPILE_TEST'): + self.assertIn(k, allmod.FORBIDDEN_Y) + self.assertTrue(allmod.NEW_BOOL_OFF.search('RTLWIFI_DEBUG')) + self.assertFalse(allmod.NEW_BOOL_OFF.search('IOMMU_DEFAULT_DMA_STRICT')) # "FAULT" in DEFAULT is not one + fam = (UP / 'all-modules.config').read_text() + self.assertIn('CONFIG_NETFILTER_XTABLES_LEGACY=y', fam) # Docker's check-config: iptable_nat & co. + self.assertIn('CONFIG_DRM_FBDEV_EMULATION=n', fam) + + def test_the_build_runs_both(self): + b = (UP / 'build.sh').read_text() + self.assertLess(b.index('olddefconfig'), b.index('python3 /work/all-modules.py . $O')) + self.assertLess(b.index('python3 /work/all-modules.py . $O'), b.index('config options not taken')) + self.assertIn('cp $O/all-modules.report $OUT/', b) + m = (UP / 'build-modules.sh').read_text() + self.assertIn('python3 /work/check-dt-modules.py', m) + self.assertIn("(out / 'all-modules.report')", (UP / 'audit-bundle.py').read_text()) + + +class DtModules(unittest.TestCase): + def run_check(self, aliases, *allowed): + with tempfile.TemporaryDirectory() as d: + a = Path(d) / 'modules.alias' + a.write_text(aliases) + c = Path(d) / 'compat' + c.write_text('# boards\nsprd,ums9620-dwc3\nregulator-fixed\nst,st21nfc\n') + return subprocess.run([sys.executable, str(UP / 'check-dt-modules.py'), str(a), str(c), *allowed], + capture_output=True, text=True) + + def test_a_module_that_matches_a_node_fails_the_build(self): + r = self.run_check('alias of:N*T*Cregulator-fixed reg_fixed_voltage\n' + 'alias of:N*T*Cregulator-fixedC* reg_fixed_voltage\nalias usb:v1234p* foo\n') + self.assertNotEqual(r.returncode, 0) + self.assertIn('reg_fixed_voltage binds to regulator-fixed', r.stderr) + + def test_unrelated_and_allowed_modules_pass(self): + self.assertEqual(self.run_check('alias of:N*T*Cvendor,otherC* other\nalias usb:v1234p* foo\n' + 'alias of:NGAISLER_APBPS2T(null)C* apbps2\n').returncode, 0) + self.assertEqual(self.run_check('alias of:N*T*Cst,st21nfc nfc-thing\n', 'nfc_thing').returncode, 0) + + def test_the_compatibles_of_both_boards_are_listed(self): + compat = (UP / 'dt-compatibles.txt').read_text().split() + for c in ('sprd,ums9620', 'zte-ldo-leds', 'arm,gic-v3', 'sprd,sc9860-spi'): + self.assertIn(c, compat) + + +if __name__ == '__main__': + unittest.main() diff --git a/upstream/README.md b/upstream/README.md index 9487bbaf..3a0abd66 100644 --- a/upstream/README.md +++ b/upstream/README.md @@ -1,6 +1,6 @@ # Mainline (LTS) kernel on the MU300 -Mainline **Linux 6.18.56** (the current longterm series) runs Ubuntu 24.04 and OpenWrt 25.12 on the ZTE F50 / +Mainline **Linux 6.18.57** (the current longterm series) runs Ubuntu 24.04 and OpenWrt 25.12 on the ZTE F50 / MU300 (Unisoc UMS9620): all 8 CPUs (4×A55, 4×A76), eMMC, USB NCM + ACM, the 5 GHz hotspot, Bluetooth, the modem with mobile data (downlink and uplink), SMS, the VPN, the Mali GPU, thermal/cpufreq, the PMIC watchdog and reboot. `docs/FINDINGS.md` 31-31f has what it took and what is still open. @@ -27,7 +27,7 @@ merged) describes the same GIC/UART/timer layout; this device is derived from th ## Build and test ```sh docker build -t mu300-mainline-build upstream/ -docker volume create mu300-mainline # build.sh fetches linux-$KV (default 6.18.56) into it, checked against kernel.org +docker volume create mu300-mainline # build.sh fetches linux-$KV (default 6.18.57) into it, checked against kernel.org docker run --rm -v mu300-mainline:/src -v "$PWD/upstream":/work mu300-mainline-build bash /work/build.sh docker run --rm -v mu300-mainline:/src -v "$PWD/upstream":/work mu300-mainline-build bash /work/build-modules.sh upstream/make-bundle.sh mu300-kernel-6.18.tar.gz # Image for LK, generic ramdisk segment, modules @@ -37,7 +37,13 @@ The build stops on anything that drifts silently: a patch that neither applies n Kconfig does not take (unless listed in `config-ignored.txt`), a port edit whose anchor moved, or a module whose vermagic does not match the kernel. `tools/make-release.sh` packages the same bundle as `mu300-kernel-6.18.tar.gz`. -The config is allnoconfig plus `mu300-mainline.config`: what the board and the boot need is built in, along with +The config is allnoconfig plus `mu300-mainline.config`, and then `all-modules.py` (FINDINGS 130): every other +tristate option the boards can use becomes a module - USB devices of every class, filesystems, netfilter, protocols, +crypto, block, media, iio, hwmon - while what the fragment built in stays built in (checked), bools change only where +`all-modules.config` opens a family, and `all-modules.exclude` keeps out test/debug code, PCI cards, and the drivers +of chips only a board's device tree wires up. `check-dt-modules.py` then fails the build if a module would bind to a +node of the vendor device tree (`dt-compatibles.txt`) by itself. `MU300_ALL_MODULES=0` builds the fragment alone. +In the fragment, what the board and the boot need is built in, along with KVM (`/dev/kvm`; the CPUs start at EL2); what only matters once used - netfilter extras, tunnels, IPsec, tc, filesystems, USB modems/adapters/Wi-Fi sticks, device mapper - is a module. `build-modules.sh` installs the kernel's own modules (stripped) flat into `out/modules` next to the vendor ones, and the bundle ships them all; @@ -60,8 +66,8 @@ boot/flash-trial.sh boot-mainline.img # slot b only, falls back to Android ## Newer kernels (7.x) -The whole port - kernel and all 31 out-of-tree modules - also builds against **7.2.10**, the newest stable release -(2026-10-11), from the same sources as 6.18, and runs on the device: four boots out of four (2026-09-27) with the +The whole port - kernel and all 31 out-of-tree modules - also builds against **7.2.11**, the newest stable release +(2026-10-15), from the same sources as 6.18, and runs on the device: four boots out of four (2026-09-27) with the Wi-Fi access point, mobile data (18.7 MB/s), Bluetooth, the Mali GPU, cpufreq and the modem's AT channel working, and no warning or oops in the log. (7.2 is a stable, not a longterm release: 6.18 stays the base, 7.x is how the next jump is kept small.) One source serves both: @@ -76,7 +82,7 @@ next jump is kept small.) One source serves both: release, so the next break shows up as a red run rather than at the next jump. Releases carry it as `mu300-kernel-7.2.tar.gz`: `sudo mu300-update kernel 7.2` on the device, or choice 3 in the -installer. It is built next to 6.18: `OUTDIR=out-7.2 KV=7.2.10` for `build.sh` and `build-modules.sh`, and +installer. It is built next to 6.18: `OUTDIR=out-7.2 KV=7.2.11` for `build.sh` and `build-modules.sh`, and `MU300_UPSTREAM_OUT=upstream/out-7.2` for `make-bundle.sh`; `tools/make-release.sh` packs both. ## Remaining mainline work (as of 2026-09-26) diff --git a/upstream/all-modules.config b/upstream/all-modules.config new file mode 100644 index 00000000..17566993 --- /dev/null +++ b/upstream/all-modules.config @@ -0,0 +1,42 @@ +# The bools all-modules.py turns on before it makes every tristate it can a module: each one only opens a family +# of drivers (a menu) and builds nothing into the Image by itself. Everything else stays as mu300-mainline.config +# leaves it. +# USB Wi-Fi sticks of every vendor (mac80211 and cfg80211 drivers; the PCI and SDIO ones stay out with PCI) +CONFIG_WLAN_VENDOR_ADMTEK=y +CONFIG_WLAN_VENDOR_ATH=y +CONFIG_WLAN_VENDOR_ATMEL=y +CONFIG_WLAN_VENDOR_BROADCOM=y +CONFIG_WLAN_VENDOR_INTERSIL=y +CONFIG_WLAN_VENDOR_MARVELL=y +CONFIG_WLAN_VENDOR_MICROCHIP=y +CONFIG_WLAN_VENDOR_PURELIFI=y +CONFIG_WLAN_VENDOR_RSI=y +CONFIG_WLAN_VENDOR_SILABS=y +CONFIG_WLAN_VENDOR_ST=y +CONFIG_WLAN_VENDOR_TI=y +CONFIG_WLAN_VENDOR_ZYDAS=y +CONFIG_WLAN_VENDOR_QUANTENNA=y +# game pads, graphics tablets and USB touch screens +CONFIG_INPUT_JOYSTICK=y +CONFIG_INPUT_TABLET=y +CONFIG_INPUT_TOUCHSCREEN=y +# TV and radio sticks, SDR dongles (rtl-sdr), next to the webcams that were in already +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y +CONFIG_MEDIA_RADIO_SUPPORT=y +CONFIG_MEDIA_SDR_SUPPORT=y +# snd-aloop, snd-dummy, snd-virmidi +CONFIG_SND_DRIVERS=y +# iSCSI (initiator over TCP) +CONFIG_SCSI_LOWLEVEL=y +# AX.25 and friends (packet radio over a USB TNC) +CONFIG_HAMRADIO=y +# the legacy iptables/ebtables tables, as modules: iptables-legacy, and Docker's check-config.sh lists +# iptable_filter/iptable_nat as generally necessary. Nothing loads them unless asked (both systems run their +# iptables over nftables) +CONFIG_NETFILTER_XTABLES_LEGACY=y +CONFIG_BRIDGE_NF_EBTABLES_LEGACY=y +# kept off: the DRM framebuffer emulation would bring the framebuffer console along (the console is the UART) +CONFIG_DRM_FBDEV_EMULATION=n +# /dev/hidraw: FIDO/U2F keys, game pads and the HID drivers that need it (the CP2112 USB-I2C bridge) +CONFIG_HIDRAW=y diff --git a/upstream/all-modules.exclude b/upstream/all-modules.exclude new file mode 100644 index 00000000..f0191424 --- /dev/null +++ b/upstream/all-modules.exclude @@ -0,0 +1,156 @@ +# all-modules.py: options (regular expressions on the name without CONFIG_) that are never made modules +# test, debug and benchmark code +(^|_)TESTS?($|_) +KUNIT +TORTURE +SELFTEST|SELF_TEST +SAMPLE +BENCH +DEBUG +LKDTM +INJECT +^(KASAN|KCSAN|KMSAN|UBSAN|KCOV|GCOV) +# ASoC: codecs and machine glue work only wired up by a board's device tree (the SoC's own audio is not ported) +^SND_SOC +# display panels and bridges: wired to a board; there is no display +^DRM_PANEL +# fake USB device controller: mu300-usb takes the first UDC it finds +^USB_DUMMY_HCD$ +# the legacy gadget drivers: mu300-usb builds the gadget through configfs, and these would grab the UDC +^USB_(ZERO|ETH|G_\w+|GADGETFS|FUNCTIONFS|MASS_STORAGE|GADGET_TARGET|MIDI_GADGET|CDC_COMPOSITE|AUDIO|RAW_GADGET|CONFIGFS_F_\w+_?TEST\w*)$ +# a module of these would demote a built-in (all-modules.py stops on that): MMC_BLOCK "depends on RPMB || !RPMB", +# BT_HCIUART on SERIAL_DEV_BUS and POWER_SEQUENCING the same way, ext4 serves ext2 only without EXT2_FS, I3C_OR_I2C follows I3C +^RPMB$ +^(SERIAL_DEV_BUS|POWER_SEQUENCING)$ +^EXT2_FS$ +^I3C$ +# CoreSight trace: selects PERF_EVENTS (kept off, FINDINGS 31p) and would bind to the SoC's trace blocks +^CORESIGHT +# board wiring: drivers for chips a board's device tree connects (power, clocks, pins, displays, camera sensors, +# Ethernet switches, the SoC's own infrastructure). Without a board that has them they never bind, and the ones +# USB devices need (tuners, demodulators, sensors of a webcam) are still built: their USB driver selects them +dir drivers/regulator +dir drivers/mfd +dir drivers/power +dir drivers/pinctrl +dir drivers/clk +dir drivers/extcon +dir drivers/leds +keep ^LEDS_(TRIGGER_\w+|CLASS_MULTICOLOR|CLASS_FLASH)$ +dir drivers/video/backlight +dir drivers/gpu/drm/bridge +dir drivers/gpu/drm/panel +dir drivers/media/i2c +dir drivers/media/spi +dir drivers/media/dvb-frontends +dir drivers/media/tuners +dir drivers/media/platform +dir drivers/media/test-drivers +dir drivers/rtc +dir drivers/input/touchscreen +keep ^TOUCHSCREEN_USB_COMPOSITE$ +dir net/dsa +dir drivers/net/dsa +dir drivers/phy +dir drivers/reset +dir drivers/soc +dir drivers/irqchip +dir drivers/clocksource +dir drivers/iommu +dir drivers/dma +dir drivers/mailbox +dir drivers/remoteproc +dir drivers/rpmsg +dir drivers/interconnect +dir drivers/memory +dir drivers/pmdomain +dir drivers/thermal +dir drivers/cpufreq +dir drivers/cpuidle +dir drivers/devfreq +dir drivers/nvmem +dir drivers/perf +dir drivers/firmware +dir drivers/bus +dir drivers/hwspinlock +dir drivers/pwm +dir drivers/mux +dir drivers/slimbus +dir drivers/soundwire +dir drivers/spmi +dir drivers/hte +dir drivers/edac +dir drivers/fpga +dir drivers/char/hw_random +keep ^HW_RANDOM_VIRTIO$ +dir drivers/usb/typec +dir drivers/usb/phy +dir drivers/usb/dwc2 +dir drivers/usb/musb +dir drivers/usb/chipidea +dir drivers/usb/cdns3 +dir drivers/usb/gadget/udc +dir drivers/watchdog +# DRM: only the displays a USB port takes. The SoC GPU drivers (panfrost, lima, etnaviv...) would bind next to +# the vendor Mali driver and select IOMMU DMA and CMA, which change how every device of the vendor tree maps memory +dir drivers/gpu/drm +keep ^(DRM|DRM_UDL|DRM_GUD|DRM_GM12U320|DRM_VGEM)$ +dir drivers/video/fbdev +dir drivers/auxdisplay +# platform host and device controllers: the board has its dwc3/xHCI built in (USB serial, storage, network, +# audio, video and the other class drivers are elsewhere and taken) +dir drivers/usb/host +dir drivers/usb/isp1760 +dir drivers/usb/fotg210 +dir drivers/usb/mtu3 +dir drivers/usb/renesas_usbhs +dir drivers/usb/c67x00 +dir drivers/usb/dwc3 +dir drivers/mmc/host +keep ^MMC_(VUB300|USHC)$ +# other buses and boards' parts: no PCMCIA, PATA/SATA, UFS, parallel NOR/NAND, platform Ethernet MACs and CAN +# controllers, server management (IPMI, FSI, PECI, OCC), trace hubs on this board +dir drivers/pcmcia +dir sound/pcmcia +dir drivers/ata +dir drivers/ufs +dir drivers/mtd/nand +dir drivers/mtd/maps +dir drivers/mtd/chips +dir drivers/mtd/lpddr +dir drivers/mtd/spi-nor +dir drivers/mtd/hyperbus +dir drivers/mtd/devices +keep ^MTD_(BLOCK2MTD|PHRAM|MTDRAM|SLRAM)$ +dir drivers/net/ethernet +dir drivers/net/can/sja1000 +dir drivers/net/can/cc770 +dir drivers/net/can/m_can +dir drivers/net/can/c_can +dir drivers/net/can/ctucanfd +dir drivers/net/can/softing +dir drivers/net/can/spi +dir drivers/net/can/ifi_canfd +dir drivers/char/ipmi +dir drivers/fsi +dir drivers/peci +dir drivers/hwmon/peci +dir drivers/hwmon/occ +dir drivers/hwtracing +dir drivers/most +dir drivers/mcb +dir drivers/greybus +dir drivers/nvdimm +dir drivers/dax +dir drivers/char/xillybus +dir drivers/i2c/muxes +dir drivers/dibs +# VFIO: selects the IOMMU API, and mainline has no driver for this SoC's IOMMUs, so there is nothing to pass through +^VFIO +# test drivers that do not say so in their names +dir drivers/iio/dummy +# the mainline driver of the SoC's SPI controllers: it binds to the vendor tree's sprd,sc9860-spi nodes (check-dt-modules.py) +^SPI_SPRD$ +# the PMIC's vibrator (the boards have none): udev loaded it on F50-B at boot, though it bound nothing; no other +# Spreadtrum/Unisoc driver came in with the expansion (SPI_SPRD above), and none may (the rule is general) +(^|_)(SPRD|SC27XX|UMS9|UNISOC) diff --git a/upstream/all-modules.py b/upstream/all-modules.py new file mode 100644 index 00000000..f29f1b69 --- /dev/null +++ b/upstream/all-modules.py @@ -0,0 +1,192 @@ +#!/usr/bin/env python3 +"""Turn every tristate option that can be a module on this board into =m (build.sh, after the fragment). + + python3 all-modules.py KERNEL_SRC O_DIR + +Not allmodconfig: what the fragment built in stays built in (checked), bools are not touched except the few in +all-modules.config that open a family of drivers, and newly visible debug/test bools are switched off again. The +expansion is a fixpoint: a tristate whose dependencies are now met becomes =m, until nothing changes. + +Left out (all-modules.exclude, regular expressions on the option name): test, debug and benchmark code, parts that +only work wired up on a board (ASoC codecs, display panels and bridges), and the drivers that would bind to the +vendor device tree these boards boot with (check-dt-modules.py finds them after the build). PCI drivers are left +out too: the only PCIe link is the soldered Marlin3 Wi-Fi/BT chip, so the expansion runs with PCI off and only the +options that made it there are taken over. + +The report ($O/all-modules.report) lists the new modules and every bool that came on with them. +""" +import os +import re +import shutil +import subprocess +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +# debug and test switches that must stay off whatever came on with a driver (the ones the boot depends on staying +# off: kprobes and the tracing they pull in broke 2 of 36 boots of 7.2, FINDINGS 31p) +NEW_BOOL_OFF = re.compile(r'DEBUG|(^|_)TESTS?($|_)|KUNIT|TORTURE|SELFTEST|VERBOSE|TRACE|TRACING|DUMP|INJECT|' + r'WERROR|COMPILE_TEST|SAMPLE|BENCH') +FORBIDDEN_Y = ['KPROBES', 'FTRACE', 'FUNCTION_TRACER', 'KPROBE_EVENTS', 'BPF_EVENTS', 'PERF_EVENTS', 'KASAN', + 'UBSAN', 'KCSAN', 'KFENCE', 'LOCKDEP', 'PROVE_LOCKING', 'DEBUG_KMEMLEAK', 'COMPILE_TEST', 'STAGING', + 'RANDOMIZE_BASE', 'MODULE_SIG_FORCE', 'DEBUG_INFO_REDUCED', + # the DMA path of every device with an "iommus" property in the vendor tree, and the vendor's + # shared-dma-pool regions turned into CMA: SoC GPU/display drivers select these + 'IOMMU_SUPPORT', 'IOMMU_API', 'IOMMU_DMA', 'OF_IOMMU', 'CMA', 'DMA_CMA'] + + +def read(path): + vals = {} + with open(path) as f: + lines = f.readlines() + for line in lines: + m = re.match(r'CONFIG_(\w+)=(.*)', line) + if m: + vals[m.group(1)] = m.group(2) + else: + m = re.match(r'# CONFIG_(\w+) is not set', line) + if m: + vals[m.group(1)] = 'n' + return vals + + +def write_set(path, values): + """Set CONFIG_= for each item (replacing the line that names it), as scripts/config would.""" + keys = set(values) + out = [] + with open(path) as f: + lines = f.readlines() + for l in lines: + m = re.match(r'(?:# )?CONFIG_(\w+)[= ]', l) + if m and m.group(1) in keys: + continue + out.append(l) + out += ['CONFIG_%s=%s\n' % (k, v) if v != 'n' else '# CONFIG_%s is not set\n' % k for k, v in sorted(values.items())] + with open(path, 'w') as f: + f.writelines(out) + + +def olddefconfig(src, o, cfg): + subprocess.run(['make', '-s', '-C', src, 'O=' + o, 'ARCH=arm64', 'KCONFIG_CONFIG=' + cfg, 'olddefconfig'], + check=True, stdout=subprocess.DEVNULL) + + +def tristates(src): + """Every option declared tristate in some Kconfig file of the tree, with the directory of that file.""" + found = {} + head = re.compile(r'^\s*(?:menu)?config\s+(\w+)') + typ = re.compile(r'^\s*(tristate|def_tristate|bool|def_bool|int|hex|string)\b') + for root, dirs, files in os.walk(src): + dirs[:] = [d for d in dirs if not d.startswith('.') and d not in ('Documentation', 'tools', 'samples')] + for f in files: + if not f.startswith('Kconfig'): + continue + cur = None + with open(os.path.join(root, f), errors='replace') as kf: + klines = kf.readlines() + for line in klines: + m = head.match(line) + if m: + cur = m.group(1) + continue + m = typ.match(line) + if m and cur: + if m.group(1) in ('tristate', 'def_tristate'): + found.setdefault(cur, os.path.relpath(root, src)) + cur = None + return found + + +def rules(): + """all-modules.exclude: 'dir PATH' (options declared under PATH), 'keep REGEX' (taken even so), REGEX.""" + dirs, keep, pats = [], [], [] + with open(os.path.join(HERE, 'all-modules.exclude')) as f: + rule_lines = f.readlines() + for line in rule_lines: + line = line.split('#', 1)[0].strip() + if line.startswith('dir '): + dirs.append(line[4:].strip().rstrip('/') + '/') + elif line.startswith('keep '): + keep.append(re.compile(line[5:].strip())) + elif line: + pats.append(re.compile(line)) + return dirs, keep, pats + + +def wanted(sym, where, dirs, keep, pats): + if any(p.search(sym) for p in keep): + return True + return not (any((where + '/').startswith(d) for d in dirs) or any(p.search(sym) for p in pats)) + + +def fixpoint(src, o, cfg, cands, fam): + """Set every candidate that is off to m, olddefconfig, again until the set of modules stops growing. The + switches of all-modules.config go in every round: one that only becomes visible with a new driver (a bool + under it) would otherwise be dropped before it counts.""" + for _ in range(40): + cur = read(cfg) + todo = {k: 'm' for k in cands if cur.get(k, 'n') == 'n'} + before = {k for k, v in cur.items() if v == 'm'} + write_set(cfg, dict(todo, **fam)) + olddefconfig(src, o, cfg) + after = {k for k, v in read(cfg).items() if v == 'm'} + if after <= before: + return + sys.exit('all-modules: no fixpoint after 40 rounds') + + +def main(): + src, o = sys.argv[1], sys.argv[2] + cfg = os.path.join(o, '.config') + base = read(cfg) + base_y = {k for k, v in base.items() if v == 'y'} + # the bools that open a family of drivers + fam = {} + with open(os.path.join(HERE, 'all-modules.config')) as f: + fam_lines = f.readlines() + for line in fam_lines: + m = re.match(r'CONFIG_(\w+)=(.*)', line) + if m: + fam[m.group(1)] = m.group(2) + write_set(cfg, fam) + olddefconfig(src, o, cfg) + dirs, keep, pats = rules() + tri = tristates(src) + cands = sorted(k for k, where in tri.items() if wanted(k, where, dirs, keep, pats)) + # the expansion with PCI off: what survives there does not need a PCI card + tmp = os.path.join(o, 'all-modules.nopci') + shutil.copy(cfg, tmp) + write_set(tmp, {'PCI': 'n'}) + olddefconfig(src, o, tmp) + fixpoint(src, o, tmp, cands, dict(fam, PCI='n')) + nopci = {k for k, v in read(tmp).items() if v == 'm' and k in cands} + os.remove(tmp) + fixpoint(src, o, cfg, sorted(nopci), fam) + # bools that came on with the new drivers and look like debugging or tests go off again + now = read(cfg) + off = {k: 'n' for k, v in now.items() if v == 'y' and k not in base_y and k not in fam and NEW_BOOL_OFF.search(k)} + if off: + write_set(cfg, off) + olddefconfig(src, o, cfg) + final = read(cfg) + lost = sorted(k for k in base_y if final.get(k) != 'y') + if lost: + sys.exit('all-modules: built-in options changed: ' + ' '.join('%s=%s' % (k, final.get(k, 'n')) for k in lost)) + bad = [k for k in FORBIDDEN_Y if final.get(k) == 'y' and base.get(k) != 'y'] + bad += [k for k, v in fam.items() if final.get(k, 'n') != v and v == 'n'] + if bad: + sys.exit('all-modules: turned on what must stay off: ' + ' '.join(bad)) + new_m = sorted(k for k, v in final.items() if v == 'm' and base.get(k) != 'm') + new_y = sorted(k for k, v in final.items() if v == 'y' and k not in base_y) + with open(os.path.join(o, 'all-modules.report'), 'w') as f: + f.write('# new =m (%d)\n' % len(new_m)) + f.writelines('CONFIG_%s=m\n' % k for k in new_m) + f.write('# new =y (%d): family switches and what came on with the new drivers\n' % len(new_y)) + f.writelines('CONFIG_%s=y\n' % k for k in new_y) + f.write('# switched off again (%d)\n' % len(off)) + f.writelines('# CONFIG_%s is not set\n' % k for k in sorted(off)) + print('all-modules: %d options newly =m, %d bools newly =y, %d debug/test bools kept off; built-ins unchanged' + % (len(new_m), len(new_y), len(off))) + + +if __name__ == '__main__': + main() diff --git a/upstream/audit-bundle.py b/upstream/audit-bundle.py index 39361ca7..c1de8c0a 100644 --- a/upstream/audit-bundle.py +++ b/upstream/audit-bundle.py @@ -6,6 +6,8 @@ import sys def audit(out, fragment): + """fragment: mu300-mainline.config; all-modules.report next to the Image (what all-modules.py added) is checked + the same way when the build left one.""" image = (out / 'Image').read_bytes() start = image.find(b'IKCFG_ST') end = image.find(b'IKCFG_ED', start + 8) @@ -13,7 +15,10 @@ def audit(out, fragment): raise ValueError('Image has no embedded kernel config') config = gzip.decompress(image[start + 8:end]).decode() actual = dict(line.split('=', 1) for line in config.splitlines() if line.startswith('CONFIG_')) - for line in fragment.read_text().splitlines(): + wanted = fragment.read_text().splitlines() + if (out / 'all-modules.report').is_file(): + wanted += (out / 'all-modules.report').read_text().splitlines() + for line in wanted: if not line.startswith('CONFIG_'): continue key, value = line.split('=', 1) diff --git a/upstream/build-modules.sh b/upstream/build-modules.sh index 950b495e..cec8c79e 100644 --- a/upstream/build-modules.sh +++ b/upstream/build-modules.sh @@ -3,7 +3,7 @@ # the kernel's own modules next to them (upstream/out/modules, flat). # Run inside the mu300-mainline-build container: bash /work/build-modules.sh [module-dir...] set -eo pipefail -KV=${KV:-6.18.56} +KV=${KV:-6.18.57} K=/src/linux-$KV O=/src/out-$KV OUT=/work/${OUTDIR:-out} # as in build.sh @@ -27,6 +27,11 @@ find "$O/mod-install/lib/modules" -name '*.ko' -exec basename {} \; | sort > $O/ # each other tr - _ < $O/modules.in-tree | sort > $O/modules.in-tree.names [ -z "$(uniq -d $O/modules.in-tree.names)" ] || { echo "in-tree modules share a name: $(uniq -d $O/modules.in-tree.names)" >&2; exit 1; } +# none of them may load by itself on the boards: udev loads what matches a node of the vendor device tree +krel=$(cat $O/include/config/kernel.release) +depmod -b "$O/mod-install" "$krel" +python3 /work/check-dt-modules.py "$O/mod-install/lib/modules/$krel/modules.alias" /work/dt-compatibles.txt \ + $(sed 's/#.*//' /work/dt-modules-allowed.txt) find "$O/mod-install/lib/modules" -name '*.ko' -exec cp {} $OUT/modules/ \; extra= for m in $mods; do diff --git a/upstream/build.sh b/upstream/build.sh index e909c6d1..46b2654a 100644 --- a/upstream/build.sh +++ b/upstream/build.sh @@ -1,7 +1,7 @@ #!/bin/bash # Build mainline for the MU300 inside mu300-mainline-build: Image + DTB. /work = this directory, /src = kernel tree volume set -eo pipefail -KV=${KV:-6.18.56} +KV=${KV:-6.18.57} # where Image, DTB and modules.builtin go: /work/out for 6.18, OUTDIR=out-7.2 keeps another kernel next to it OUT=/work/${OUTDIR:-out} # the kernel source, fetched once into the volume and checked against kernel.org's checksum list @@ -38,6 +38,11 @@ if grep -q '^config NFS_V4_1$' fs/nfs/Kconfig; then ./scripts/config --file "$O/.config" --enable NFS_V4_1 fi make O=$O ARCH=arm64 olddefconfig >/dev/null +# every other tristate option this board can use becomes a module (all-modules.py: not allmodconfig - what is built +# in stays built in, bools only where all-modules.config opens a family, no PCI cards, no debug/test code, nothing +# that would bind to the vendor device tree); MU300_ALL_MODULES=0 builds the fragment alone +rm -f $O/all-modules.report +[ "${MU300_ALL_MODULES:-1}" = 0 ] || python3 /work/all-modules.py . $O # options Kconfig did not take; ones known not to exist in this kernel are listed in config-ignored.txt, any # other one stops the build (a silently dropped option has cost a working feature before) bad= @@ -60,4 +65,7 @@ mkdir -p $OUT cp $O/arch/arm64/boot/Image $O/ums9620-mu300.dtb $OUT/ # for depmod on the device: modprobe of a built-in driver fails without them cp $O/modules.builtin $O/modules.builtin.modinfo $OUT/ +# what all-modules.py added: make-bundle.sh checks the Image against it as against the fragment +rm -f $OUT/all-modules.report +[ ! -f $O/all-modules.report ] || cp $O/all-modules.report $OUT/ ls -la $OUT diff --git a/upstream/check-dt-modules.py b/upstream/check-dt-modules.py new file mode 100644 index 00000000..f1b2c8bc --- /dev/null +++ b/upstream/check-dt-modules.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +"""No module of the set may bind by itself to a node of the vendor device tree (build-modules.sh, after the build). + + python3 check-dt-modules.py MODULES_ALIAS dt-compatibles.txt [allowed module...] + +Ubuntu's udev loads every module whose "of:" alias matches a node of the device tree at boot. The vendor tree these +boards boot with names hundreds of nodes (dt-compatibles.txt: every compatible string of the F50's and the U30 +Air's /proc/device-tree, 2026-10-16), and a mainline driver that matched one of them would start driving a part of +the SoC next to (or instead of) the vendor driver - the expansion of all-modules.py must not bring one in. The +modules that are meant to bind (the vendor ones, the U30 Air's charger...) are named on the command line. +""" +import fnmatch +import re +import sys + + +def main(): + alias_file, compat_file = sys.argv[1], sys.argv[2] + allowed = set(a.replace('-', '_') for a in sys.argv[3:]) + compats = [l.strip() for l in open(compat_file) if l.strip() and not l.startswith('#')] + bad = {} + for line in open(alias_file): + m = re.match(r'alias (of:\S+) (\S+)', line) + if not m: + continue + pat, mod = m.group(1), m.group(2).replace('-', '_') + # only the aliases of a compatible string: "of:N*T*C" (an alias of a node name, such as the + # GRLIB drivers' "of:NGAISLER_APBPS2T(null)...", needs a node of that name, and this tree has none) + if not pat.startswith('of:N*T*C'): + continue + # "...C*" at the end also matches a later compatible of the node + cpat = re.sub(r'C\*$', '', pat[len('of:N*T*C'):]) + for comp in compats: + if fnmatch.fnmatchcase(comp, cpat) and mod not in allowed: + bad.setdefault(mod, set()).add(comp) + if bad: + for mod, comps in sorted(bad.items()): + print('%s binds to %s' % (mod, ' '.join(sorted(comps))), file=sys.stderr) + sys.exit('check-dt-modules: %d module(s) would load by themselves on the boards' % len(bad)) + print('check-dt-modules: no module binds to the vendor device tree by itself (%d compatibles)' % len(compats)) + + +if __name__ == '__main__': + main() diff --git a/upstream/dt-compatibles.txt b/upstream/dt-compatibles.txt new file mode 100644 index 00000000..6f6871b7 --- /dev/null +++ b/upstream/dt-compatibles.txt @@ -0,0 +1,316 @@ +# every compatible string of the vendor device tree as Linux sees it (/proc/device-tree), F50 and U30 Air, 2026-10-16: +# check-dt-modules.py fails the build when a module would bind to one of them by itself +android,firmware +android,vbmeta +arm,armv8 +arm,armv8-pmuv3 +arm,armv8-timer +arm,coresight-etm4x +arm,coresight-funnel +arm,coresight-tmc +arm,coresight-tmc_group +arm,cortex-a55 +arm,cortex-a76 +arm,gic-v3 +arm,idle-state +arm,primecell +arm,psci-0.2 +arm,tmc_group +awinic,aw883xx_smartpa +awinic,aw9610x_sar +charger-manager +fixed-clock +generic-adc-thermal +gpio-keys +gpio-leds +img,ax3xxx-nna +linux,extcon-usb-gpio +pmem-region +ramoops +shared-dma-pool +simple-battery +simple-bus +snps,dw-pcie +snps,sprd-dwc3 +sprd,agcp-i2s-dai +sprd,apb-busmonitor +sprd,apb-prot +sprd,apetb +sprd,autotest +sprd,cluster-cooling +sprd,cp_dump +sprd,cpp +sprd,cpufreq-v2 +sprd,csi-controller +sprd,dbg-log-qogirn6pro +sprd,dcam_lite +sprd,ddr-dvfs +sprd,debuglog +sprd,debugstat +sprd,display-subsystem +sprd,djtag +sprd,dptx +sprd,flash-aw36518_gpio +sprd,generic-mipi-panel +sprd,gnss +sprd,gsp-core +sprd,gsp-lite-r4p0-qogirn6pro +sprd,gsp-r9p0-qogirn6pro +sprd,hwdvfs-cpp +sprd,hwdvfs-dcam-if +sprd,hwdvfs-dcam-mtx +sprd,hwdvfs-dcam0_1-axi +sprd,hwdvfs-dcam2_3 +sprd,hwdvfs-dcam2_3-axi +sprd,hwdvfs-depth +sprd,hwdvfs-dpu-qogirn6pro +sprd,hwdvfs-dpuvsp-qogirn6pro +sprd,hwdvfs-fd +sprd,hwdvfs-gsp-qogirn6pro +sprd,hwdvfs-isp +sprd,hwdvfs-jpg +sprd,hwdvfs-mmsys +sprd,hwdvfs-mtx_data +sprd,hwdvfs-vdma +sprd,hwdvfs-vdsp +sprd,hwdvfs-vdsp_mtx +sprd,hwdvfs-vpuenc-qogirn6pro +sprd,hwdvfs-vsp-qogirn6pro +sprd,hwspinlock-r3p0 +sprd,i2s +sprd,iommuvau-epp-n6pro +sprd,iommuvau-idma-n6pro +sprd,iommuvau-vdma-n6pro +sprd,ion +sprd,isp +sprd,mali-natt +sprd,mali-power-model +sprd,marlin3-fm +sprd,mipi-csi-phy +sprd,mtty +sprd,npu-power-model +sprd,orca-sipa-delegate +sprd,pcie +sprd,phycp-dvfs +sprd,pscp-dvfs +sprd,ptn38003a redriver +sprd,pub-dmc +sprd,qogirl6-dmc-mpu +sprd,qogirn6pro-adi +sprd,qogirn6pro-apdu +sprd,qogirn6pro-busmonitor +sprd,qogirn6pro-cam +sprd,qogirn6pro-camsys-domain +sprd,qogirn6pro-dma +sprd,qogirn6pro-dmc-mpu +sprd,qogirn6pro-dpu +sprd,qogirn6pro-dpu1 +sprd,qogirn6pro-dsi-host +sprd,qogirn6pro-dsi-phy +sprd,qogirn6pro-dwc3 +sprd,qogirn6pro-efuse +sprd,qogirn6pro-eic-async +sprd,qogirn6pro-eic-debounce +sprd,qogirn6pro-eic-latch +sprd,qogirn6pro-eic-sync +sprd,qogirn6pro-gpio +sprd,qogirn6pro-i2c +sprd,qogirn6pro-ipa-sys-power-domain +sprd,qogirn6pro-jpg +sprd,qogirn6pro-musb +sprd,qogirn6pro-pamu3 +sprd,qogirn6pro-phy +sprd,qogirn6pro-pinctrl +sprd,qogirn6pro-ptm +sprd,qogirn6pro-pwm +sprd,qogirn6pro-sipa +sprd,qogirn6pro-ssphy +sprd,qogirn6pro-suspend-timer +sprd,qogirn6pro-timer +sprd,qogirn6pro-vdsp +sprd,sc2355-pcie-wifi +sprd,sc2731-eic +sprd,sc27xx-7sreset +sprd,sc27xx-adc +sprd,sc27xx-audio-codec +sprd,sc27xx-bltc +sprd,sc27xx-efuse +sprd,sc27xx-eic +sprd,sc27xx-fast-chg +sprd,sc27xx-fgu +sprd,sc27xx-keypad-led +sprd,sc27xx-pd +sprd,sc27xx-poweroff +sprd,sc27xx-regulator +sprd,sc27xx-rtc +sprd,sc27xx-smpl +sprd,sc27xx-typec +sprd,sc27xx-vibrator +sprd,sc27xx-wdt +sprd,sc9836-uart +sprd,sc9860-dma +sprd,sc9860-eic-async +sprd,sc9860-eic-debounce +sprd,sc9860-eic-latch +sprd,sc9860-eic-sync +sprd,sc9860-gpio +sprd,sc9860-i2c +sprd,sc9860-spi +sprd,sc9860-suspend-timer +sprd,sc9860-timer +sprd,sdhci-r11 +sprd,sensor-main +sprd,sensor-main2 +sprd,sensor-sub +sprd,sfp +sprd,sharkl5pro-busmonitor +sprd,sipa_dummy +sprd,sipa_eth +sprd,sipa_usb +sprd,sipc +sprd,slog_bridge +sprd,soc-id +sprd,spipe +sprd,spool +sprd,sprd-trng +sprd,sysfrt-timer +sprd,syst-timer +sprd,thermal_r5p0 +sprd,time-sync +sprd,time-sync-ch +sprd,trusty-irq-v1 +sprd,trusty-log-v1 +sprd,trusty-smc-v1 +sprd,trusty-tui-v1 +sprd,trusty-virtio-v1 +sprd,tshm +sprd,ufshc +sprd,ump9620 +sprd,ump9620-7sreset +sprd,ump9620-adc +sprd,ump9620-bc1p2 +sprd,ump9620-bltc +sprd,ump9620-efuse +sprd,ump9620-fast-chg +sprd,ump9620-fgu +sprd,ump9620-keypad-led +sprd,ump9620-pd +sprd,ump9620-poweroff +sprd,ump9620-smpl +sprd,ump9620-vibrator +sprd,ump9620-wdt +sprd,ump9621 +sprd,ump9621-efuse +sprd,ump9621-regulator +sprd,ump9621-syscon +sprd,ump9622 +sprd,ump9622-syscon +sprd,ump9622-tsensor +sprd,ump962x-regulator +sprd,ump962x-syscon +sprd,ump96xx-bc1p2 +sprd,ump96xx-eic +sprd,ump96xx-rtc +sprd,ump96xx-typec +sprd,ums9520-glbregs +sprd,ums9620 +sprd,ums9620-ai-clk +sprd,ums9620-ai-dvfs-clk +sprd,ums9620-aiapb-gate +sprd,ums9620-aon-gate +sprd,ums9620-aonapb-clk +sprd,ums9620-ap-clk +sprd,ums9620-apahb-gate +sprd,ums9620-apapb-gate +sprd,ums9620-audcpapb-gate +sprd,ums9620-audcpglb-gate +sprd,ums9620-dpu-vsp-clk +sprd,ums9620-dpu-vsp-gate +sprd,ums9620-g1-pll +sprd,ums9620-g10-pll +sprd,ums9620-g1l-pll +sprd,ums9620-g5l-pll +sprd,ums9620-g5r-pll +sprd,ums9620-g8-pll +sprd,ums9620-g9-pll +sprd,ums9620-glbregs +sprd,ums9620-ipa-clk +sprd,ums9620-ipaapb-gate +sprd,ums9620-ipadispc-gate +sprd,ums9620-ipaglb-gate +sprd,ums9620-mm-clk +sprd,ums9620-mm-gate +sprd,ums9620-pcie-clk +sprd,ums9620-pcieapb-gate +sprd,ums9620-pmu-gate +sprd,ums9620-spi +sprd,ums9620-topdvfs-clk +sprd,ums9620-uart +sprd,vdsp-mailbox +sprd,voice_trigger_irq +sprd,vpu-dec-core0 +sprd,vpu-enc-core0 +sprd,vpu-enc-core1 +sprd,vpu-pd +sprd,wdt-r2p0-fiq +sprd-uid +st,st21nfc +stk,stk501xx +syscon +ti,bq2560x_chg +unisoc,agdsp-access +unisoc,apipe +unisoc,audcp-boot +unisoc,audio-codec-dig-agcp +unisoc,audio-mem-sharkl5 +unisoc,audio-mem-sharkl5pro +unisoc,audio_dsp_call_info +unisoc,audio_dsp_log +unisoc,audio_dsp_mem +unisoc,audio_dsp_pcm +unisoc,audio_pipe_bthal +unisoc,audio_pipe_effect +unisoc,audio_pipe_recordproc +unisoc,audio_pipe_trigger_rx +unisoc,audio_pipe_trigger_tx +unisoc,audio_pipe_voice +unisoc,audio_sipc +unisoc,fe-dai +unisoc,headset +unisoc,i2s-null-codec +unisoc,iommuvaul6p-cpp +unisoc,iommuvaul6p-dcam +unisoc,iommuvaul6p-dcam1 +unisoc,iommuvaul6p-dispc +unisoc,iommuvaul6p-dispc1 +unisoc,iommuvaul6p-fd +unisoc,iommuvaul6p-gsp +unisoc,iommuvaul6p-gsp1 +unisoc,iommuvaul6p-isp +unisoc,iommuvaul6p-jpg +unisoc,iommuvaul6p-vsp +unisoc,iommuvaul6p-vsp1 +unisoc,iommuvaul6p-vsp2 +unisoc,mailbox +unisoc,map-user +unisoc,marlin3_pcie +unisoc,mcdt-r2p0 +unisoc,modem +unisoc,pcm-routing +unisoc,pdm-ums9620 +unisoc,qogirn6pro-audcp-dvfs +unisoc,qogirn6pro-compress-platform +unisoc,qogirn6pro-pcm-platform +unisoc,qogirn6pro-vbc +unisoc,sharkl5-pcm-platform +unisoc,sipc-virt-bus +unisoc,tdm +unisoc,ump9620-audio-codec +unisoc,vbc-v4-codec-sc2730 +usb-c-connector +virtual-thermal +zte,battery-capacity-learning +zte,charge-arbitrate-service +zte,charger-policy-service +zte-ldo-leds +zte-misc diff --git a/upstream/dt-modules-allowed.txt b/upstream/dt-modules-allowed.txt new file mode 100644 index 00000000..838d14a5 --- /dev/null +++ b/upstream/dt-modules-allowed.txt @@ -0,0 +1,2 @@ +# modules that may bind to a node of the vendor device tree (check-dt-modules.py): none so far - the drivers the +# boards need are built in or the vendor modules, which are not checked