From dcb3901b4fb4d34a5160882b9490a913f1308ad7 Mon Sep 17 00:00:00 2001 From: AI Dev Date: Wed, 30 Sep 2026 04:25:13 +0000 Subject: [PATCH] build: strip kernel modules with --strip-unneeded, not --strip-debug Buildroot installs modules with INSTALL_MOD_STRIP=1, which the kernel turns into `strip --strip-debug`, so every module still ships its full .symtab and .strtab. Any other value is passed to strip as its options; --strip-unneeded keeps the symbols relocation and __ksymtab need and drops the rest. pkg-kernel-module.mk uses the same LINUX_MAKE_FLAGS, so out-of-tree modules are covered too. hi3516ev300_lite: rootfs.squashfs 5096 -> 5052 KB on a clean build. --- general/external.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/general/external.mk b/general/external.mk index d7a2842a88..6dce6ca836 100644 --- a/general/external.mk +++ b/general/external.mk @@ -28,5 +28,17 @@ OPENIPC_TOOLCHAIN := toolchain/toolchain.$(OPENIPC_KERNEL) # by ~45KB in the size report rather than anything failing. WPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_TDLS CONFIG_IEEE80211R +# linux.mk passes INSTALL_MOD_STRIP=1, which the kernel turns into +# `strip --strip-debug`: every module still ships its full .symtab/.strtab. +# Any other value is handed to strip as its options, and --strip-unneeded keeps +# exactly the symbols relocation and __ksymtab need. The last assignment on the +# make command line wins, and pkg-kernel-module.mk installs with the same +# LINUX_MAKE_FLAGS, so out-of-tree modules (wireguard, the Wi-Fi drivers) are +# covered too. Same include-order dependency as the line above. The cost is +# that an oops inside a module prints offsets instead of its static function +# names. On hi3516ev300 this took the 26 in-tree and wireguard modules from +# 1827288 to 1624584 B, and all 26 loaded and worked on the camera. +LINUX_MAKE_FLAGS += INSTALL_MOD_STRIP=--strip-unneeded + include $(sort $(wildcard $(BR2_EXTERNAL)/package/*/*.mk)) include $(sort $(wildcard $(BR2_EXTERNAL)/package/legacy/*/*.mk))