mirror of
https://github.com/openwrt/openwrt.git
synced 2026-06-17 12:40:16 +04:00
a3f4d1e0c6
Manually rebuild pending patches: - 203-kallsyms_uncompressed.patch - 417-mtd-spi-nand-macronix-disable-continuous-read-for-MX.patch - 487-mtd-spinand-Add-support-for-Etron-EM73D044VCx.patch - 530-jffs2_make_lzma_available.patch - 681-net-remove-NETIF_F_GSO_FRAGLIST-from-NETIF_F_GSO_SOF.patch - 701-netfilter-nf_tables-ignore-EOPNOTSUPP-on-flowtable-d.patch - 710-bridge-add-knob-for-filtering-rx-tx-BPDU-pack.patch - 732-03-net-ethernet-mtk_eth_soc-optimize-dma-ring-address-i.patch - 737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch - 739-03-net-pcs-pcs-mtk-lynxi-add-platform-driver-for-MT7988.patch - 739-05-net-pcs-add-driver-for-MediaTek-USXGMII-PCS.patch - 802-OPP-Provide-old-opp-to-config_clks-on-_set_opp.patch - 812-PCI-sysfs-enforce-single-creation-of-sysfs-entry-for.patch - 850-0023-PCI-aardvark-Make-main-irq_chip-structure-a-static-d.patch Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com> Link: https://github.com/openwrt/openwrt/pull/21078 Signed-off-by: Robert Marko <robimarko@gmail.com>
184 lines
5.1 KiB
Diff
184 lines
5.1 KiB
Diff
From: Felix Fietkau <nbd@nbd.name>
|
|
Subject: kernel: add a config option for keeping the kallsyms table uncompressed, saving ~9kb kernel size after lzma on ar71xx
|
|
|
|
[john@phrozen.org: added to my upstream queue 30.12.2016]
|
|
lede-commit: e0e3509b5ce2ccf93d4d67ea907613f5f7ec2eed
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
---
|
|
init/Kconfig | 11 +++++++++++
|
|
kernel/kallsyms.c | 8 ++++++++
|
|
kernel/vmcore_info.c | 2 ++
|
|
scripts/kallsyms.c | 12 ++++++++++++
|
|
scripts/link-vmlinux.sh | 4 ++++
|
|
5 files changed, 37 insertions(+)
|
|
|
|
--- a/init/Kconfig
|
|
+++ b/init/Kconfig
|
|
@@ -1625,6 +1625,17 @@ config SYSFS_SYSCALL
|
|
|
|
If unsure say N here.
|
|
|
|
+config KALLSYMS_UNCOMPRESSED
|
|
+ bool "Keep kallsyms uncompressed"
|
|
+ depends on KALLSYMS
|
|
+ help
|
|
+ Normally kallsyms contains compressed symbols (using a token table),
|
|
+ reducing the uncompressed kernel image size. Keeping the symbol table
|
|
+ uncompressed significantly improves the size of this part in compressed
|
|
+ kernel images.
|
|
+
|
|
+ Say N unless you need compressed kernel images to be small.
|
|
+
|
|
config HAVE_PCSPKR_PLATFORM
|
|
bool
|
|
|
|
--- a/kernel/kallsyms.c
|
|
+++ b/kernel/kallsyms.c
|
|
@@ -69,6 +69,11 @@ static unsigned int kallsyms_expand_symb
|
|
* For every byte on the compressed symbol data, copy the table
|
|
* entry for that byte.
|
|
*/
|
|
+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
|
|
+ memcpy(result, data + 1, len - 1);
|
|
+ result += len - 1;
|
|
+ len = 0;
|
|
+#endif
|
|
while (len) {
|
|
tptr = &kallsyms_token_table[kallsyms_token_index[*data]];
|
|
data++;
|
|
@@ -101,6 +106,9 @@ tail:
|
|
*/
|
|
static char kallsyms_get_symbol_type(unsigned int off)
|
|
{
|
|
+#ifdef CONFIG_KALLSYMS_UNCOMPRESSED
|
|
+ return kallsyms_names[off + 1];
|
|
+#endif
|
|
/*
|
|
* Get just the first code, look it up in the token table,
|
|
* and return the first char from this token. If MSB of length
|
|
--- a/kernel/vmcore_info.c
|
|
+++ b/kernel/vmcore_info.c
|
|
@@ -218,8 +218,10 @@ static int __init crash_save_vmcoreinfo_
|
|
#ifdef CONFIG_KALLSYMS
|
|
VMCOREINFO_SYMBOL(kallsyms_names);
|
|
VMCOREINFO_SYMBOL(kallsyms_num_syms);
|
|
+#ifndef CONFIG_KALLSYMS_UNCOMPRESSED
|
|
VMCOREINFO_SYMBOL(kallsyms_token_table);
|
|
VMCOREINFO_SYMBOL(kallsyms_token_index);
|
|
+#endif
|
|
VMCOREINFO_SYMBOL(kallsyms_offsets);
|
|
VMCOREINFO_SYMBOL(kallsyms_relative_base);
|
|
#endif /* CONFIG_KALLSYMS */
|
|
--- a/scripts/kallsyms.c
|
|
+++ b/scripts/kallsyms.c
|
|
@@ -57,6 +57,7 @@ static struct addr_range text_ranges[] =
|
|
static struct sym_entry **table;
|
|
static unsigned int table_size, table_cnt;
|
|
static int all_symbols;
|
|
+static int uncompressed;
|
|
|
|
static int token_profit[0x10000];
|
|
|
|
@@ -399,13 +400,17 @@ static void write_src(void)
|
|
for (k = 0; k < table[i]->len; k++)
|
|
printf(", 0x%02x", table[i]->sym[k]);
|
|
|
|
- /*
|
|
- * Now that we wrote out the compressed symbol name, restore the
|
|
- * original name and print it in the comment.
|
|
- */
|
|
- expand_symbol(table[i]->sym, table[i]->len, buf);
|
|
- strcpy((char *)table[i]->sym, buf);
|
|
- printf("\t/* %s */\n", table[i]->sym);
|
|
+ if (!uncompressed) {
|
|
+ /*
|
|
+ * Now that we wrote out the compressed symbol name, restore the
|
|
+ * original name and print it in the comment.
|
|
+ */
|
|
+ expand_symbol(table[i]->sym, table[i]->len, buf);
|
|
+ strcpy((char *)table[i]->sym, buf);
|
|
+ printf("\t/* %s */\n", table[i]->sym);
|
|
+ } else {
|
|
+ printf("\n");
|
|
+ }
|
|
}
|
|
printf("\n");
|
|
|
|
@@ -416,20 +421,22 @@ static void write_src(void)
|
|
|
|
free(markers);
|
|
|
|
- output_label("kallsyms_token_table");
|
|
- off = 0;
|
|
- for (i = 0; i < 256; i++) {
|
|
- best_idx[i] = off;
|
|
- expand_symbol(best_table[i], best_table_len[i], buf);
|
|
- printf("\t.asciz\t\"%s\"\n", buf);
|
|
- off += strlen(buf) + 1;
|
|
+ if (!uncompressed) {
|
|
+ output_label("kallsyms_token_table");
|
|
+ off = 0;
|
|
+ for (i = 0; i < 256; i++) {
|
|
+ best_idx[i] = off;
|
|
+ expand_symbol(best_table[i], best_table_len[i], buf);
|
|
+ printf("\t.asciz\t\"%s\"\n", buf);
|
|
+ off += strlen(buf) + 1;
|
|
+ }
|
|
+ printf("\n");
|
|
+
|
|
+ output_label("kallsyms_token_index");
|
|
+ for (i = 0; i < 256; i++)
|
|
+ printf("\t.short\t%d\n", best_idx[i]);
|
|
+ printf("\n");
|
|
}
|
|
- printf("\n");
|
|
-
|
|
- output_label("kallsyms_token_index");
|
|
- for (i = 0; i < 256; i++)
|
|
- printf("\t.short\t%d\n", best_idx[i]);
|
|
- printf("\n");
|
|
|
|
output_label("kallsyms_offsets");
|
|
|
|
@@ -508,6 +515,9 @@ static unsigned char *find_token(unsigne
|
|
{
|
|
int i;
|
|
|
|
+ if (uncompressed)
|
|
+ return NULL;
|
|
+
|
|
for (i = 0; i < len - 1; i++) {
|
|
if (str[i] == token[0] && str[i+1] == token[1])
|
|
return &str[i];
|
|
@@ -580,6 +590,9 @@ static void optimize_result(void)
|
|
{
|
|
int i, best;
|
|
|
|
+ if (uncompressed)
|
|
+ return;
|
|
+
|
|
/* using the '\0' symbol last allows compress_symbols to use standard
|
|
* fast string functions */
|
|
for (i = 255; i >= 0; i--) {
|
|
@@ -717,6 +730,7 @@ int main(int argc, char **argv)
|
|
while (1) {
|
|
static const struct option long_options[] = {
|
|
{"all-symbols", no_argument, &all_symbols, 1},
|
|
+ {"uncompressed", no_argument, &uncompressed, 1},
|
|
{},
|
|
};
|
|
|
|
--- a/scripts/link-vmlinux.sh
|
|
+++ b/scripts/link-vmlinux.sh
|
|
@@ -142,6 +142,10 @@ kallsyms()
|
|
kallsymopt="${kallsymopt} --all-symbols"
|
|
fi
|
|
|
|
+ if is_enabled CONFIG_KALLSYMS_UNCOMPRESSED; then
|
|
+ kallsymopt="${kallsymopt} --uncompressed"
|
|
+ fi
|
|
+
|
|
info KSYMS "${2}.S"
|
|
scripts/kallsyms ${kallsymopt} "${1}" > "${2}.S"
|
|
|