mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-28 09:39:00 +00:00
fec22f8375
Removed upstreamed: generic/backport-6.1/803-v6.5-01-leds-trigger-netdev-Recheck-NETDEV_LED_MODE_LINKUP-o.patch[1] generic/pending-6.1/143-jffs2-reduce-stack-usage-in-jffs2_build_xattr_subsys.patch[2] bcm27xx/patches-6.1/950-0034-drm-bridge-Introduce-pre_enable_upstream_first-to-al.patch[3] bcm27xx/patches-6.1/950-0439-nvmem-Use-NVMEM_DEVID_AUTO.patch[4] bcm4908/patches-6.1/040-mtd-parsers-refer-to-ARCH_BCMBCA-instead-of-ARCH_BCM.patch[5] bcm53xx/patches-6.1/031-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch[6] bcm53xx/patches-6.1/031-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch[7] mediatek/patches-6.1/351-cpufreq-mediatek-correct-voltages-for-MT7622-and-MT7.patch[8] qualcommax/patches-6.1/0008-v6.2-clk-qcom-reset-support-resetting-multiple-bits.patch[9] Manually rebased: bcm27xx/patches-6.1/950-0035-drm-panel-Add-prepare_upstream_first-flag-to-drm_pan.patch bcm27xx/patches-6.1/950-0404-drm-panel-panel-ilitek9881c-Add-prepare_upstream_fir.patch bcm27xx/patches-6.1/950-0699-Bluetooth-hci_sync-Add-fallback-bd-address-prop.patch mediatek/patches-6.1/350-21-cpufreq-mediatek-Add-support-for-MT7988.patch All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.39&id=ab0bd172d6289310a05a0cd15e1432e828d386ae 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.39&id=6df680709d901346831ef8f221cc90a42062c526 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.39&id=5044e5f2511c9afdf9880d2bb6b9d37dfc345dac 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.39&id=e27948f329f7e02591ed1feb9a7710c2ccf89a83 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.39&id=ad2928e7f3f6120a0bd18aa1056b3b24068027c5 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.39&id=2b55a985727833f37c39911f34096b3fdf2a367d 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.39&id=90d4c487cd658b51212eb65ae804ab11af193672 8. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.39&id=7e3ee25e8c7c7be1eacdfc6d9f5f0e550a2af241 9. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.39&id=b20854ef6c4955be3310975a72f02d92cb01d6d4 Build system: x86/64 Build-tested: x86/64 Run-tested: x86/64 Co-authored-by: Hauke Mehrtens <hauke@hauke-m.de> Co-authored-by: Christian Marangi <ansuelsmth@gmail.com> Signed-off-by: John Audia <therealgraysky@proton.me> [ rebase bcm27xx and mediatek patches, refresh commit description ] Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> [ minor fixup to bcm27xx patches, refresh commit description ] Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
211 lines
7.2 KiB
Diff
211 lines
7.2 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
|
|
@@ -163,6 +163,7 @@ extern void cleanup_module(void);
|
|
|
|
/* Generic info of form tag = "info" */
|
|
#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
|
|
+#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info)
|
|
|
|
/* For userspace: you can also call me... */
|
|
#define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
|
|
@@ -232,12 +233,12 @@ extern void cleanup_module(void);
|
|
* 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)
|
|
|
|
-#ifdef MODULE
|
|
+#if defined(MODULE) && !defined(CONFIG_MODULE_STRIPPED)
|
|
/* Creates an alias so file2alias.c can find device table. */
|
|
#define MODULE_DEVICE_TABLE(type, name) \
|
|
extern typeof(name) __mod_##type##__##name##_device_table \
|
|
@@ -264,7 +265,9 @@ extern typeof(name) __mod_##type##__##na
|
|
*/
|
|
|
|
#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); \
|
|
@@ -287,7 +290,7 @@ extern typeof(name) __mod_##type##__##na
|
|
/* 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, __stringify(ns))
|
|
|
|
--- a/include/linux/moduleparam.h
|
|
+++ b/include/linux/moduleparam.h
|
|
@@ -20,6 +20,16 @@
|
|
/* Chosen so that structs with an unsigned long line up. */
|
|
#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
|
|
|
|
+/* 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, name, info) __MODULE_INFO_DISABLED(name)
|
|
+#else
|
|
+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO(tag, name, info)
|
|
+#endif
|
|
+
|
|
#define __MODULE_INFO(tag, name, info) \
|
|
static const char __UNIQUE_ID(name)[] \
|
|
__used __section(".modinfo") __aligned(1) \
|
|
@@ -31,7 +41,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, #_parm ":" desc)
|
|
+ __MODULE_INFO_STRIP(parm, _parm, #_parm ":" desc)
|
|
|
|
struct kernel_param;
|
|
|
|
--- a/kernel/module/Kconfig
|
|
+++ b/kernel/module/Kconfig
|
|
@@ -290,4 +290,11 @@ config MODULES_TREE_LOOKUP
|
|
def_bool y
|
|
depends on PERF_EVENTS || TRACING || CFI_CLANG
|
|
|
|
+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
|
|
@@ -988,6 +988,7 @@ size_t modinfo_attrs_count = ARRAY_SIZE(
|
|
|
|
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
|
|
@@ -999,6 +1000,7 @@ int try_to_force_load(struct module *mod
|
|
return -ENOEXEC;
|
|
#endif
|
|
}
|
|
+#endif
|
|
|
|
static char *get_modinfo(const struct load_info *info, const char *tag);
|
|
static char *get_next_modinfo(const struct load_info *info, const char *tag,
|
|
@@ -1950,9 +1952,11 @@ static int setup_load_info(struct load_i
|
|
|
|
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;
|
|
|
|
@@ -1973,6 +1977,7 @@ static int check_modinfo(struct module *
|
|
mod->name);
|
|
add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
|
|
}
|
|
+#endif
|
|
|
|
check_modinfo_retpoline(mod, info);
|
|
|
|
--- a/scripts/mod/modpost.c
|
|
+++ b/scripts/mod/modpost.c
|
|
@@ -1781,7 +1781,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
|
|
}
|
|
|
|
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
|
|
@@ -1944,8 +1946,10 @@ static void add_header(struct buffer *b,
|
|
buf_printf(b, "BUILD_SALT;\n");
|
|
buf_printf(b, "BUILD_LTO_INFO;\n");
|
|
buf_printf(b, "\n");
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
|
|
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");
|
|
@@ -1959,8 +1963,10 @@ 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");
|
|
+#endif
|
|
|
|
buf_printf(b,
|
|
"\n"
|
|
@@ -1968,8 +1974,10 @@ static void add_header(struct buffer *b,
|
|
"MODULE_INFO(retpoline, \"Y\");\n"
|
|
"#endif\n");
|
|
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
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");
|
|
@@ -2065,11 +2073,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)
|
|
@@ -2155,7 +2165,9 @@ static void write_mod_c_file(struct modu
|
|
add_exported_symbols(&buf, mod);
|
|
add_versions(&buf, mod);
|
|
add_depends(&buf, mod);
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
add_moddevtable(&buf, mod);
|
|
+#endif
|
|
add_srcversion(&buf, mod);
|
|
|
|
ret = snprintf(fname, sizeof(fname), "%s.mod.c", mod->name);
|