[linux-riscv][J][PATCH] UBUNTU: SAUCE: scripts/Makefile.modinst discard-locals from modules

Dimitri John Ledkov dimitri.ledkov at canonical.com
Wed Mar 9 16:16:22 UTC 2022

On riscv, it appears that all kernel modules are generated with an
excesive amount of local symbols and assembly automatic generated
symbols increasing the size of stripped .ko modules multiple times
over similar ones on other architectures. When stripping .ko on riscv,
discard these local symbols too, which should make our module sizes
somewhat more reasonable.

BugLink: https://bugs.launchpad.net/bugs/1964335

Signed-off-by: Andy Whitcroft <apw at canonical.com>
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>

 This makes kernel install 863MB smaller, and everything appears to
 work fine. I.e. loaded btrfs module, mounted btrfs filesystem,
 unmounted it, etc.

 scripts/Makefile.modinst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index ff9b09e4cf..373d6953ad 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -46,7 +46,11 @@ quiet_cmd_install = INSTALL $@
 ifeq ($(INSTALL_MOD_STRIP),1)
+ifeq ($(ARCH),riscv)
+strip-option := --strip-debug --discard-locals
 strip-option := --strip-debug
 strip-option := $(INSTALL_MOD_STRIP)

More information about the kernel-team mailing list