summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-01-14 16:08:18 +0000
committerFelix Fietkau <nbd@openwrt.org>2013-01-14 16:08:18 +0000
commite0e3509b5ce2ccf93d4d67ea907613f5f7ec2eed (patch)
tree516c804d054dbf48dd932e087a3b365456372c77
parentb8ee5a7a1ceb1dde18c869c9ccff72032457ff6c (diff)
downloadmaster-31e0f0ae-e0e3509b5ce2ccf93d4d67ea907613f5f7ec2eed.tar.gz
master-31e0f0ae-e0e3509b5ce2ccf93d4d67ea907613f5f7ec2eed.tar.bz2
master-31e0f0ae-e0e3509b5ce2ccf93d4d67ea907613f5f7ec2eed.zip
kernel: add a config option for keeping the kallsyms table uncompressed, saving ~9kb kernel size after lzma on ar71xx
SVN-Revision: 35154
-rw-r--r--target/linux/generic/config-3.71
-rw-r--r--target/linux/generic/patches-3.7/203-kallsyms_uncompressed.patch108
2 files changed, 109 insertions, 0 deletions
diff --git a/target/linux/generic/config-3.7 b/target/linux/generic/config-3.7
index b761d6c8ad..f2147e1294 100644
--- a/target/linux/generic/config-3.7
+++ b/target/linux/generic/config-3.7
@@ -1343,6 +1343,7 @@ CONFIG_JOLIET=y
# CONFIG_JUMP_LABEL is not set
# CONFIG_KALLSYMS is not set
# CONFIG_KALLSYMS_ALL is not set
+CONFIG_KALLSYMS_UNCOMPRESSED=y
# CONFIG_KARMA_PARTITION is not set
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_GZIP is not set
diff --git a/target/linux/generic/patches-3.7/203-kallsyms_uncompressed.patch b/target/linux/generic/patches-3.7/203-kallsyms_uncompressed.patch
new file mode 100644
index 0000000000..57655aae23
--- /dev/null
+++ b/target/linux/generic/patches-3.7/203-kallsyms_uncompressed.patch
@@ -0,0 +1,108 @@
+--- a/scripts/kallsyms.c
++++ b/scripts/kallsyms.c
+@@ -83,6 +83,7 @@ static struct text_range text_ranges[] =
+ static struct sym_entry *table;
+ static unsigned int table_size, table_cnt;
+ static int all_symbols = 0;
++static int uncompressed = 0;
+ static char symbol_prefix_char = '\0';
+
+ int token_profit[0x10000];
+@@ -389,6 +390,9 @@ static void write_src(void)
+
+ free(markers);
+
++ if (uncompressed)
++ return;
++
+ output_label("kallsyms_token_table");
+ off = 0;
+ for (i = 0; i < 256; i++) {
+@@ -447,6 +451,9 @@ static void *find_token(unsigned char *s
+ {
+ 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];
+@@ -519,6 +526,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--) {
+@@ -675,7 +685,9 @@ int main(int argc, char **argv)
+ if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\''))
+ p++;
+ symbol_prefix_char = *p;
+- } else
++ } else if (strcmp(argv[i], "--uncompressed") == 0)
++ uncompressed = 1;
++ else
+ usage();
+ }
+ } else if (argc != 1)
+--- a/init/Kconfig
++++ b/init/Kconfig
+@@ -1198,6 +1198,17 @@ config KALLSYMS_ALL
+
+ Say N unless you really need all symbols.
+
++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 HOTPLUG
+ def_bool y
+
+--- a/scripts/link-vmlinux.sh
++++ b/scripts/link-vmlinux.sh
+@@ -83,6 +83,10 @@ kallsyms()
+ kallsymopt="${kallsymopt} --all-symbols"
+ fi
+
++ if [ -n "${CONFIG_KALLSYMS_UNCOMPRESSED}" ]; then
++ kallsymopt="${kallsymopt} --uncompressed"
++ fi
++
+ local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
+ ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
+
+--- a/kernel/kallsyms.c
++++ b/kernel/kallsyms.c
+@@ -106,6 +106,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++;
+@@ -133,6 +138,9 @@ static unsigned int kallsyms_expand_symb
+ */
+ 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.