Files
openwrt/target/linux/generic/hack-6.18/204-module_strip.patch
T
Edoardo Pinci 411a8112dd kernel: bump 6.18 to 6.18.53
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.18.53

Removed upstreamed:
  target/linux/airoha/patches-6.18/160-v7.2-net-airoha-Reserve-RX-headroom-to-avoid-skb-realloca.patch [1]
  target/linux/airoha/patches-6.18/220-08-usb-host-add-ARCH_AIROHA-in-XHCI-MTK-dependency.patch [2]
  target/linux/ath79/patches-6.18/341-wifi-ath9k-obtain-system-gpios.patch [3]
  target/linux/bcm27xx/patches-6.18/0850-dmaengine-dw-axi-dmac-Wait-for-runtime-resume.patch [4]
  target/linux/econet/patches-6.18/040-v7.2-PCI-mediatek-Protect-root-bus-removal-with-rescan-lo.patch [5]
  target/linux/econet/patches-6.18/781-v7.3-net-dsa-mt7530-add-en7528-support.patch [6]
  target/linux/generic/backport-6.18/706-v7.2-bus-mhi-host-pci_generic-round-up-nr_irqs-to-a-power-of-two.patch [7]
  target/linux/generic/backport-6.18/751-v7.2-net-dsa-qca8k-add-support-for-force-mode-for-fixed-l.patch [8]
  target/linux/generic/backport-6.18/852-v7.1-rtc-cmos-use-platform_get_irq_optional.patch [9]
  target/linux/generic/backport-6.18/941-v7.2-net-dsa-realtek-rtl8365mb-add-support-for-rtl8367sb.patch [10]
  target/linux/generic/backport-6.18/946-v7.3-net-dsa-mt7530-populate-lpi_interfaces-to-fix-EEE-support.patch [11]
  target/linux/generic/backport-6.18/947-v7.3-net-ethernet-mtk_eth_soc-populate-lpi_interfaces-to-fix-EEE-support.patch [12]
  target/linux/ramips/patches-6.18/102-01-pwm-mediatek-set-mt7628-pwm45_fixup-flag-to-false.patch [13]
  target/linux/generic/hack-6.18/890-serial-8250-add-UPIO_AU-case-to-set_io_from_upio.patch [14]
  target/linux/generic/backport-6.18/895-v7.2-Bluetooth-btusb-Add-Mercusys-MA530-for-Realtek-RTL87.patch [15]

Manually rebased:
  target/linux/generic/pending-6.18/737-10-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch
  target/linux/ath79/patches-6.18/900-unaligned_access_hacks.patch
  target/linux/bcm27xx/patches-6.18/0372-i2c-designware-Add-support-for-bus-clear-feature.patch
  target/linux/econet/patches-6.18/310-usb-enable-econet-usb.patch

Added:
  target/linux/ath79/patches-6.18/341-wifi-ath9k-always-register-system-gpios.patch

All other patches automatically rebased via update_kernel.sh

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=20f46d0077f7a6d2f8078d0ed6a4c5a8062bea01
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=a5ff304195ca4c91425425136435fd2c3bde53ff
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=70d472076ce472b4ea605f06f14893eb17894720
4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=626e080d297db7996d6995620bb4eeebd928067e
5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=a568939487dcbc1a3e341208585e224be897e25e
6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=fe997254b17dcaa19b7f559bc66730bc8cf1ad6f
7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=05b9953e40d53acac86144a92724d4fab9ac5ac9
8. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=a726cc53424a6fdbd4e45e53b8e1d60a6ae75411
9. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=9811e2c321f779902a79bb0d9035a8848d8f0d39
10. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=f3e0f9c64a8557370437b961bb7e0425d87875db
11. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=3c367198e2e2825aae445497b3f7195329009aa1
12. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=9edd644864787a8c8ed24f6cdc20a652b4408726
13. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=b3674e8c01b36825879abff2f82697827b007a70
14. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=9f67997353caa29c6a080789a1fb6e01fb50c118
15. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.53&id=0f7f58ea629699c0fcd68fd01e41c2f6ac6c63d1

Build system: x86/64
Build-tested: mediatek/filogic
Run-tested: mediatek/filogic

Signed-off-by: Edoardo Pinci <epinci@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/25331
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-10-01 00:49:54 +02:00

196 lines
6.3 KiB
Diff

From a779a482fb9b9f8fcdf8b2519c789b4b9bb5dd05 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Fri, 7 Jul 2017 16:56:48 +0200
Subject: build: add a hack for removing non-essential module info
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
include/linux/module.h | 13 ++++++++-----
include/linux/moduleparam.h | 15 ++++++++++++---
init/Kconfig | 7 +++++++
kernel/module.c | 5 ++++-
scripts/mod/modpost.c | 12 ++++++++++++
5 files changed, 43 insertions(+), 9 deletions(-)
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -239,10 +239,10 @@ struct module_kobject *lookup_or_create_
* Author(s), use "Name <email>" or just "Name", for multiple
* authors use multiple MODULE_AUTHOR() statements/lines.
*/
-#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
+#define MODULE_AUTHOR(_author) MODULE_INFO_STRIP(author, _author)
/* What your module does. */
-#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
+#define MODULE_DESCRIPTION(_description) MODULE_INFO_STRIP(description, _description)
/*
* Format: __mod_device_table__kmod_<modname>__<type>__<name>
@@ -279,7 +279,9 @@ static typeof(name) __mod_device_table(t
*/
#if defined(MODULE) || !defined(CONFIG_SYSFS)
-#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
+#define MODULE_VERSION(_version) MODULE_INFO_STRIP(version, _version)
+#elif defined(CONFIG_MODULE_STRIPPED)
+#define MODULE_VERSION(_version) __MODULE_INFO_DISABLED(version)
#else
#define MODULE_VERSION(_version) \
MODULE_INFO(version, _version); \
@@ -302,7 +304,7 @@ static typeof(name) __mod_device_table(t
/* Optional firmware file (or files) needed by the module
* format is simply firmware file name. Multiple firmware
* files require multiple MODULE_FIRMWARE() specifiers */
-#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
+#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware)
#define MODULE_IMPORT_NS(ns) MODULE_INFO(import_ns, ns)
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -24,6 +24,16 @@
#define __MODULE_INFO_PREFIX KBUILD_MODNAME "."
#endif
+/* This struct is here for syntactic coherency, it is not used */
+#define __MODULE_INFO_DISABLED(name) \
+ struct __UNIQUE_ID(name) {}
+
+#ifdef CONFIG_MODULE_STRIPPED
+#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_DISABLED(tag)
+#else
+#define MODULE_INFO_STRIP(tag, info) MODULE_INFO(tag, info)
+#endif
+
/* Generic info of form tag = "info" */
#define MODULE_INFO(tag, info) \
static const char __UNIQUE_ID(modinfo)[] \
@@ -36,7 +46,7 @@
/* One for each parameter, describing how to use it. Some files do
multiple of these per line, so can't just use MODULE_INFO. */
#define MODULE_PARM_DESC(_parm, desc) \
- MODULE_INFO(parm, #_parm ":" desc)
+ MODULE_INFO_STRIP(parm, #_parm ":" desc)
struct kernel_param;
--- a/kernel/module/Kconfig
+++ b/kernel/module/Kconfig
@@ -462,4 +462,11 @@ config MODULES_TREE_LOOKUP
def_bool y
depends on PERF_EVENTS || TRACING || CFI
+config MODULE_STRIPPED
+ bool "Reduce module size"
+ depends on MODULES
+ help
+ Remove module parameter descriptions, author info, version, aliases,
+ device tables, etc.
+
endif # MODULES
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -1075,6 +1075,7 @@ const size_t modinfo_attrs_count = ARRAY
static const char vermagic[] = VERMAGIC_STRING;
+#if defined(CONFIG_MODVERSIONS) || !defined(CONFIG_MODULE_STRIPPED)
int try_to_force_load(struct module *mod, const char *reason)
{
#ifdef CONFIG_MODULE_FORCE_LOAD
@@ -1086,6 +1087,7 @@ int try_to_force_load(struct module *mod
return -ENOEXEC;
#endif
}
+#endif
/* Parse tag=value strings from .modinfo section */
char *module_next_tag_pair(char *string, unsigned long *secsize)
@@ -2591,9 +2593,11 @@ static void module_augment_kernel_taints
static int check_modinfo(struct module *mod, struct load_info *info, int flags)
{
- const char *modmagic = get_modinfo(info, "vermagic");
int err;
+#ifndef CONFIG_MODULE_STRIPPED
+ const char *modmagic = get_modinfo(info, "vermagic");
+
if (flags & MODULE_INIT_IGNORE_VERMAGIC)
modmagic = NULL;
@@ -2607,6 +2611,7 @@ static int check_modinfo(struct module *
info->name, modmagic, vermagic);
return -ENOEXEC;
}
+#endif
err = check_modinfo_livepatch(mod, info);
if (err)
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1619,7 +1619,9 @@ static void read_symbols(const char *mod
symname = remove_dot(info.strtab + sym->st_name);
handle_symbol(mod, &info, sym, symname);
+#ifndef CONFIG_MODULE_STRIPPED
handle_moddevtable(mod, &info, sym, symname);
+#endif
}
check_sec_ref(mod, &info);
@@ -1841,7 +1843,9 @@ static void add_header(struct buffer *b,
buf_printf(b, "#include <linux/export-internal.h>\n");
buf_printf(b, "#include <linux/compiler.h>\n");
buf_printf(b, "\n");
+#ifndef CONFIG_MODULE_STRIPPED
buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n");
+#endif
buf_printf(b, "\n");
buf_printf(b, "__visible struct module __this_module\n");
buf_printf(b, "__section(\".gnu.linkonce.this_module\") = {\n");
@@ -1855,11 +1859,13 @@ static void add_header(struct buffer *b,
buf_printf(b, "\t.arch = MODULE_ARCH_INIT,\n");
buf_printf(b, "};\n");
+#ifndef CONFIG_MODULE_STRIPPED
if (!external_module)
buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n");
if (strstarts(mod->name, "drivers/staging"))
buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
+#endif
if (strstarts(mod->name, "tools/testing"))
buf_printf(b, "\nMODULE_INFO(test, \"Y\");\n");
@@ -2013,11 +2019,13 @@ static void add_depends(struct buffer *b
static void add_srcversion(struct buffer *b, struct module *mod)
{
+#ifndef CONFIG_MODULE_STRIPPED
if (mod->srcversion[0]) {
buf_printf(b, "\n");
buf_printf(b, "MODULE_INFO(srcversion, \"%s\");\n",
mod->srcversion);
}
+#endif
}
static void write_buf(struct buffer *b, const char *fname)
@@ -2118,12 +2126,14 @@ static void write_mod_c_file(struct modu
add_extended_versions(&buf, mod);
add_depends(&buf, mod);
+#ifndef CONFIG_MODULE_STRIPPED
buf_printf(&buf, "\n");
list_for_each_entry_safe(alias, next, &mod->aliases, node) {
buf_printf(&buf, "MODULE_ALIAS(\"%s\");\n", alias->str);
list_del(&alias->node);
free(alias);
}
+#endif
add_srcversion(&buf, mod);