mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-30 10:39:04 +00:00
9261e7447e
This makes the patches which were just copied in the previous commit apply on top of kernel 4.19. The patches in the backports-4.19 folder were checked if they are really in kernel 4.19 based on the title and only removed if they were found in the upstream kernel. The following additional patches form the pending folder went into upstream Linux 4.19: pending-4.19/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch pending-4.19/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch pending-4.19/478-mtd-spi-nor-Add-support-for-XM25QH64A-and-XM25QH128A.patch pending-4.19/479-mtd-spi-nor-add-eon-en25qh32.patch pending-4.19/950-tty-serial-exar-generalize-rs485-setup.patch pending-4.19/340-MIPS-mm-remove-mips_dma_mapping_error.patch Bigger changes were introduced to the m25p80 spi nor driver, as far as I saw it in the new code, it now has the functionality provided in this patch: pending-4.19/450-mtd-m25p80-allow-fallback-from-spi_flash_read-to-reg.patch Part of this patch went upstream independent of OpenWrt: hack-4.19/220-gc_sections.patch This patch was reworked to match the changes done upstream. The MIPS DMA API changed a lot, this patch was rewritten to match the new DMA handling: pending-4.19/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch I did bigger manual changes to the following patches and I am not 100% sure if they are all correct: pending-4.19/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch pending-4.19/411-mtd-partial_eraseblock_write.patch pending-4.19/600-netfilter_conntrack_flush.patch pending-4.19/611-netfilter_match_bypass_default_table.patch pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch hack-4.19/211-host_tools_portability.patch hack-4.19/221-module_exports.patch hack-4.19/321-powerpc_crtsavres_prereq.patch hack-4.19/902-debloat_proc.patch This is based on patchset from Marko Ratkaj <marko.ratkaj@sartura.hr> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
207 lines
7.0 KiB
Diff
207 lines
7.0 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
|
|
@@ -160,6 +160,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)
|
|
@@ -203,12 +204,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 \
|
|
@@ -235,7 +236,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) \
|
|
static struct module_version_attribute ___modver_attr = { \
|
|
@@ -257,7 +260,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)
|
|
|
|
struct notifier_block;
|
|
|
|
--- a/include/linux/moduleparam.h
|
|
+++ b/include/linux/moduleparam.h
|
|
@@ -17,6 +17,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
|
|
+
|
|
#ifdef MODULE
|
|
#define __MODULE_INFO(tag, name, info) \
|
|
static const char __UNIQUE_ID(name)[] \
|
|
@@ -24,8 +34,7 @@ static const char __UNIQUE_ID(name)[]
|
|
= __stringify(tag) "=" info
|
|
#else /* !MODULE */
|
|
/* This struct is here for syntactic coherency, it is not used */
|
|
-#define __MODULE_INFO(tag, name, info) \
|
|
- struct __UNIQUE_ID(name) {}
|
|
+#define __MODULE_INFO(tag, name, info) __MODULE_INFO_DISABLED(name)
|
|
#endif
|
|
#define __MODULE_PARM_TYPE(name, _type) \
|
|
__MODULE_INFO(parmtype, name##type, #name ":" _type)
|
|
@@ -33,7 +42,7 @@ static const char __UNIQUE_ID(name)[]
|
|
/* 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/init/Kconfig
|
|
+++ b/init/Kconfig
|
|
@@ -1988,6 +1988,13 @@ config TRIM_UNUSED_KSYMS
|
|
|
|
If unsure, or if you need to build out-of-tree modules, say N.
|
|
|
|
+config MODULE_STRIPPED
|
|
+ bool "Reduce module size"
|
|
+ depends on MODULES
|
|
+ help
|
|
+ Remove module parameter descriptions, author info, version, aliases,
|
|
+ device tables, etc.
|
|
+
|
|
endif # MODULES
|
|
|
|
config MODULES_TREE_LOOKUP
|
|
--- a/kernel/module.c
|
|
+++ b/kernel/module.c
|
|
@@ -3002,9 +3002,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;
|
|
|
|
@@ -3025,6 +3027,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
|
|
@@ -1969,7 +1969,9 @@ static void read_symbols(const char *mod
|
|
symname = remove_dot(info.strtab + sym->st_name);
|
|
|
|
handle_modversions(mod, &info, sym, symname);
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
handle_moddevtable(mod, &info, sym, symname);
|
|
+#endif
|
|
}
|
|
if (!is_vmlinux(modname) || vmlinux_section_warnings)
|
|
check_sec_ref(mod, modname, &info);
|
|
@@ -2132,8 +2134,10 @@ static void add_header(struct buffer *b,
|
|
buf_printf(b, "\n");
|
|
buf_printf(b, "BUILD_SALT;\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, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
|
|
@@ -2150,8 +2154,10 @@ static void add_header(struct buffer *b,
|
|
|
|
static void add_intree_flag(struct buffer *b, int is_intree)
|
|
{
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
if (is_intree)
|
|
buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n");
|
|
+#endif
|
|
}
|
|
|
|
/* Cannot check for assembler */
|
|
@@ -2164,8 +2170,10 @@ static void add_retpoline(struct buffer
|
|
|
|
static void add_staging_flag(struct buffer *b, const char *name)
|
|
{
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
if (strstarts(name, "drivers/staging"))
|
|
buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
|
|
+#endif
|
|
}
|
|
|
|
/**
|
|
@@ -2264,11 +2272,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_if_changed(struct buffer *b, const char *fname)
|
|
@@ -2505,7 +2515,9 @@ int main(int argc, char **argv)
|
|
add_staging_flag(&buf, mod->name);
|
|
err |= add_versions(&buf, mod);
|
|
add_depends(&buf, mod, modules);
|
|
+#ifndef CONFIG_MODULE_STRIPPED
|
|
add_moddevtable(&buf, mod);
|
|
+#endif
|
|
add_srcversion(&buf, mod);
|
|
|
|
sprintf(fname, "%s.mod.c", mod->name);
|