I would like to take this opportunity to mention that the best way to save space here is to not build modules -- make them built-ins. I did a quick experiment of this and instead of saving 4k, my *image* is a full 256k smaller. I haven't analysed the specifics, but also this means less RAM consumed because squashfs uses the page cache for uncompressed files. Further, modules inherently have greater overhead, even after __init sections have been discarded.
sed -i 's/=m/=y/g;' build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/linux-4.14.63/.config make The only downside is that built-ins cannot be unloaded and will always occupy a portion of RAM. But having them built into the kernel is far more efficient. Daniel On 10/29/2018 05:54 PM, Daniel Santos wrote: > Never EVER do this! Decades of computer science has taught us "best > practices" -- ways of doing things that provide an optimal outcome for > all parties involved. While this type of hack is fine if you're working > alone, it is not a "best practice" and is completely unacceptable for a > large FOSS project. This is especially insidious because it goes behind > the back of the programmer / user / hacker and makes a change without > their consent or direction -- this is the type of behaviour we've come > to expect from Google, m$, Apple and the like, not from FOSS. > > Doing --strip-all is not appropriate default behaviour as this includes > relocation data and breaks things like kmemleak. The presence of debug > information in modules is already controlled by CONFIG_DEBUG_INFO, > CONFIG_DEBUG_INFO_REDUCED, etc. Force-stripping just makes life crappy > for anybody who needs to debug the a kernel built in OpenWRT. (Some of > us do run gdb on the kernel.) > > If --strip-all really is desired, it should probably be added to the > CONFIG_MODULE_STRIPPED patch, and should be done at install time > (probably via objcopy), not at link time. This leaves the in-tree > modules useful for debugging, decompiling, diagnostics, profiling, etc. > > Signed-off-by: Daniel Santos <daniel.san...@pobox.com> > --- > .../generic/hack-4.14/202-reduce_module_size.patch | 24 > ---------------------- > .../generic/hack-4.9/202-reduce_module_size.patch | 24 > ---------------------- > 2 files changed, 48 deletions(-) > delete mode 100644 > target/linux/generic/hack-4.14/202-reduce_module_size.patch > delete mode 100644 target/linux/generic/hack-4.9/202-reduce_module_size.patch > > diff --git a/target/linux/generic/hack-4.14/202-reduce_module_size.patch > b/target/linux/generic/hack-4.14/202-reduce_module_size.patch > deleted file mode 100644 > index 2cbb6add9a..0000000000 > --- a/target/linux/generic/hack-4.14/202-reduce_module_size.patch > +++ /dev/null > @@ -1,24 +0,0 @@ > -From fd66884da2f96d2a7ea73f58b1b86251b959a913 Mon Sep 17 00:00:00 2001 > -From: Felix Fietkau <n...@nbd.name> > -Date: Fri, 7 Jul 2017 16:56:19 +0200 > -Subject: kernel: strip unnecessary symbol table information from kernel > modules > - > -reduces default squashfs size on ar71xx by about 4k > - > -lede-commit: 058d331a39077f159ca8922f1f422a1346d6aa67 > -Signed-off-by: Felix Fietkau <n...@nbd.name> > ---- > - Makefile | 2 +- > - 1 file changed, 1 insertion(+), 1 deletion(-) > - > ---- a/Makefile > -+++ b/Makefile > -@@ -425,7 +425,7 @@ KBUILD_AFLAGS_KERNEL := > - KBUILD_CFLAGS_KERNEL := > - KBUILD_AFLAGS_MODULE := -DMODULE > - KBUILD_CFLAGS_MODULE := -DMODULE > --KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds > -+KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if > $(CONFIG_PROFILING),,-s) > - GCC_PLUGINS_CFLAGS := > - > - export ARCH SRCARCH SUBARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS > LD > diff --git a/target/linux/generic/hack-4.9/202-reduce_module_size.patch > b/target/linux/generic/hack-4.9/202-reduce_module_size.patch > deleted file mode 100644 > index f744b945fe..0000000000 > --- a/target/linux/generic/hack-4.9/202-reduce_module_size.patch > +++ /dev/null > @@ -1,24 +0,0 @@ > -From fd66884da2f96d2a7ea73f58b1b86251b959a913 Mon Sep 17 00:00:00 2001 > -From: Felix Fietkau <n...@nbd.name> > -Date: Fri, 7 Jul 2017 16:56:19 +0200 > -Subject: kernel: strip unnecessary symbol table information from kernel > modules > - > -reduces default squashfs size on ar71xx by about 4k > - > -lede-commit: 058d331a39077f159ca8922f1f422a1346d6aa67 > -Signed-off-by: Felix Fietkau <n...@nbd.name> > ---- > - Makefile | 2 +- > - 1 file changed, 1 insertion(+), 1 deletion(-) > - > ---- a/Makefile > -+++ b/Makefile > -@@ -403,7 +403,7 @@ KBUILD_AFLAGS_KERNEL := > - KBUILD_CFLAGS_KERNEL := > - KBUILD_AFLAGS_MODULE := -DMODULE > - KBUILD_CFLAGS_MODULE := -DMODULE > --KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds > -+KBUILD_LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds $(if > $(CONFIG_PROFILING),,-s) > - GCC_PLUGINS_CFLAGS := > - > - # Read KERNELRELEASE from include/config/kernel.release (if it exists) _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel