mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
5158e28769
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.64 Manually rebased: generic/hack-6.6/780-usb-net-MeigLink_modem_support.patch bcm27xx/patches-6.6/950-0585-drm-vc4-Introduce-generation-number-enum.patch bcm27xx/patches-6.6/950-0610-drm-vc4-hvs-Support-BCM2712-HVS.patch bcm27xx/patches-6.6/950-0829-vc4-hvs-Add-support-for-D0-register-changes.patch Removed upstreamed: bcm27xx/patches-6.6/950-0597-drm-vc4-hdmi-Avoid-hang-with-debug-registers-when-su.patch[1] bcm27xx/patches-6.6/950-0599-drm-vc4-Fix-dlist-debug-not-resetting-the-next-entry.patch[2] bcm27xx/patches-6.6/950-0600-drm-vc4-Remove-incorrect-limit-from-hvs_dlist-debugf.patch[3] bcm27xx/patches-6.6/950-0708-drm-vc4-Correct-logic-on-stopping-an-HVS-channel.patch[4] ramips/patches-6.6/002-01-v6.13-clk-ralink-mtmips-fix-clock-plan-for-Ralink-SoC-RT38.patch[5] ramips/patches-6.6/002-02-v6.13-clk-ralink-mtmips-fix-clocks-probe-order-in-oldest-r.patch[6] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=223ee2567a55e4f80315c768d2969e6a3b9fb23d 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=8182b5ca19c6f173b6498d1c6d3e4b034b76bbde 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=52c1716f65a558174e381360bd88f18dae4be85c 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=9728b508b01a5eeeac79ceb676364c674dd951ac 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=f85a1d06afbcc57ac44176db8f9d7a934979952c 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.64&id=fbb13732c6ffa9d58cedafabcd5ce8fd7ef8ae5a Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Co-authored-by: Mieczyslaw Nalewaj <namiltd@yahoo.com> Signed-off-by: John Audia <therealgraysky@proton.me> Link: https://github.com/openwrt/openwrt/pull/17217 Signed-off-by: Robert Marko <robimarko@gmail.com>
211 lines
7.1 KiB
Diff
211 lines
7.1 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
|
|
@@ -164,6 +164,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)
|
|
@@ -233,12 +234,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 \
|
|
@@ -265,7 +266,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); \
|
|
@@ -288,7 +291,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
|
|
@@ -389,4 +389,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
|
|
@@ -997,6 +997,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
|
|
@@ -1008,6 +1009,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)
|
|
@@ -2075,9 +2077,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;
|
|
|
|
@@ -2091,6 +2095,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
|
|
@@ -1666,7 +1666,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);
|
|
@@ -1839,8 +1841,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");
|
|
@@ -1854,8 +1858,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"
|
|
@@ -1863,8 +1869,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");
|
|
@@ -1974,11 +1982,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)
|
|
@@ -2061,7 +2071,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);
|