diff options
| author | Ingo Molnar <mingo@elte.hu> | 2009-03-31 07:53:43 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-03-31 07:53:43 -0400 |
| commit | 7bee946358c3cb957d4aa648fc5ab3cad0b232d0 (patch) | |
| tree | 693061ebde2abc35ecc846e5084630d7225aaaff /scripts | |
| parent | d820ac4c2fa881079e6b689d2098adce337558ae (diff) | |
| parent | 15f7176eb1cccec0a332541285ee752b935c1c85 (diff) | |
Merge branch 'linus' into locking-for-linus
Conflicts:
lib/Kconfig.debug
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile.lib | 16 | ||||
| -rw-r--r-- | scripts/bin_size | 10 | ||||
| -rw-r--r-- | scripts/gcc-x86_32-has-stack-protector.sh | 8 | ||||
| -rw-r--r-- | scripts/gcc-x86_64-has-stack-protector.sh | 6 | ||||
| -rw-r--r-- | scripts/gen_initramfs_list.sh | 18 | ||||
| -rw-r--r-- | scripts/headers_check.pl | 2 | ||||
| -rw-r--r-- | scripts/kconfig/conf.c | 16 | ||||
| -rw-r--r-- | scripts/kconfig/confdata.c | 51 | ||||
| -rw-r--r-- | scripts/mod/file2alias.c | 12 | ||||
| -rw-r--r-- | scripts/mod/modpost.c | 5 |
10 files changed, 117 insertions, 27 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index e06365775bdf..979619574f70 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -97,7 +97,7 @@ modname_flags = $(if $(filter 1,$(words $(modname))),\ | |||
| 97 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") | 97 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") |
| 98 | 98 | ||
| 99 | #hash values | 99 | #hash values |
| 100 | ifdef CONFIG_DYNAMIC_PRINTK_DEBUG | 100 | ifdef CONFIG_DYNAMIC_DEBUG |
| 101 | debug_flags = -D"DEBUG_HASH=$(shell ./scripts/basic/hash djb2 $(@D)$(modname))"\ | 101 | debug_flags = -D"DEBUG_HASH=$(shell ./scripts/basic/hash djb2 $(@D)$(modname))"\ |
| 102 | -D"DEBUG_HASH2=$(shell ./scripts/basic/hash r5 $(@D)$(modname))" | 102 | -D"DEBUG_HASH2=$(shell ./scripts/basic/hash r5 $(@D)$(modname))" |
| 103 | else | 103 | else |
| @@ -186,3 +186,17 @@ quiet_cmd_gzip = GZIP $@ | |||
| 186 | cmd_gzip = gzip -f -9 < $< > $@ | 186 | cmd_gzip = gzip -f -9 < $< > $@ |
| 187 | 187 | ||
| 188 | 188 | ||
| 189 | # Bzip2 | ||
| 190 | # --------------------------------------------------------------------------- | ||
| 191 | |||
| 192 | # Bzip2 does not include size in file... so we have to fake that | ||
| 193 | size_append=$(CONFIG_SHELL) $(srctree)/scripts/bin_size | ||
| 194 | |||
| 195 | quiet_cmd_bzip2 = BZIP2 $@ | ||
| 196 | cmd_bzip2 = (bzip2 -9 < $< && $(size_append) $<) > $@ || (rm -f $@ ; false) | ||
| 197 | |||
| 198 | # Lzma | ||
| 199 | # --------------------------------------------------------------------------- | ||
| 200 | |||
| 201 | quiet_cmd_lzma = LZMA $@ | ||
| 202 | cmd_lzma = (lzma -9 -c $< && $(size_append) $<) >$@ || (rm -f $@ ; false) | ||
diff --git a/scripts/bin_size b/scripts/bin_size new file mode 100644 index 000000000000..43e1b360cee6 --- /dev/null +++ b/scripts/bin_size | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | if [ $# = 0 ] ; then | ||
| 4 | echo Usage: $0 file | ||
| 5 | fi | ||
| 6 | |||
| 7 | size_dec=`stat -c "%s" $1` | ||
| 8 | size_hex_echo_string=`printf "%08x" $size_dec | | ||
| 9 | sed 's/\(..\)\(..\)\(..\)\(..\)/\\\\x\4\\\\x\3\\\\x\2\\\\x\1/g'` | ||
| 10 | /bin/echo -ne $size_hex_echo_string | ||
diff --git a/scripts/gcc-x86_32-has-stack-protector.sh b/scripts/gcc-x86_32-has-stack-protector.sh new file mode 100644 index 000000000000..29493dc4528d --- /dev/null +++ b/scripts/gcc-x86_32-has-stack-protector.sh | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | echo "int foo(void) { char X[200]; return 3; }" | $* -S -xc -c -O0 -fstack-protector - -o - 2> /dev/null | grep -q "%gs" | ||
| 4 | if [ "$?" -eq "0" ] ; then | ||
| 5 | echo y | ||
| 6 | else | ||
| 7 | echo n | ||
| 8 | fi | ||
diff --git a/scripts/gcc-x86_64-has-stack-protector.sh b/scripts/gcc-x86_64-has-stack-protector.sh index 325c0a1b03b6..afaec618b395 100644 --- a/scripts/gcc-x86_64-has-stack-protector.sh +++ b/scripts/gcc-x86_64-has-stack-protector.sh | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | echo "int foo(void) { char X[200]; return 3; }" | $1 -S -xc -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs" | 3 | echo "int foo(void) { char X[200]; return 3; }" | $* -S -xc -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs" |
| 4 | if [ "$?" -eq "0" ] ; then | 4 | if [ "$?" -eq "0" ] ; then |
| 5 | echo $2 | 5 | echo y |
| 6 | else | ||
| 7 | echo n | ||
| 6 | fi | 8 | fi |
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 5f3415f28736..3eea8f15131b 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | # Released under the terms of the GNU GPL | 5 | # Released under the terms of the GNU GPL |
| 6 | # | 6 | # |
| 7 | # Generate a cpio packed initramfs. It uses gen_init_cpio to generate | 7 | # Generate a cpio packed initramfs. It uses gen_init_cpio to generate |
| 8 | # the cpio archive, and gzip to pack it. | 8 | # the cpio archive, and then compresses it. |
| 9 | # The script may also be used to generate the inputfile used for gen_init_cpio | 9 | # The script may also be used to generate the inputfile used for gen_init_cpio |
| 10 | # This script assumes that gen_init_cpio is located in usr/ directory | 10 | # This script assumes that gen_init_cpio is located in usr/ directory |
| 11 | 11 | ||
| @@ -16,8 +16,8 @@ usage() { | |||
| 16 | cat << EOF | 16 | cat << EOF |
| 17 | Usage: | 17 | Usage: |
| 18 | $0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ... | 18 | $0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ... |
| 19 | -o <file> Create gzipped initramfs file named <file> using | 19 | -o <file> Create compressed initramfs file named <file> using |
| 20 | gen_init_cpio and gzip | 20 | gen_init_cpio and compressor depending on the extension |
| 21 | -u <uid> User ID to map to user ID 0 (root). | 21 | -u <uid> User ID to map to user ID 0 (root). |
| 22 | <uid> is only meaningful if <cpio_source> is a | 22 | <uid> is only meaningful if <cpio_source> is a |
| 23 | directory. "squash" forces all files to uid 0. | 23 | directory. "squash" forces all files to uid 0. |
| @@ -225,6 +225,7 @@ cpio_list= | |||
| 225 | output="/dev/stdout" | 225 | output="/dev/stdout" |
| 226 | output_file="" | 226 | output_file="" |
| 227 | is_cpio_compressed= | 227 | is_cpio_compressed= |
| 228 | compr="gzip -9 -f" | ||
| 228 | 229 | ||
| 229 | arg="$1" | 230 | arg="$1" |
| 230 | case "$arg" in | 231 | case "$arg" in |
| @@ -233,11 +234,15 @@ case "$arg" in | |||
| 233 | echo "deps_initramfs := \\" | 234 | echo "deps_initramfs := \\" |
| 234 | shift | 235 | shift |
| 235 | ;; | 236 | ;; |
| 236 | "-o") # generate gzipped cpio image named $1 | 237 | "-o") # generate compressed cpio image named $1 |
| 237 | shift | 238 | shift |
| 238 | output_file="$1" | 239 | output_file="$1" |
| 239 | cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" | 240 | cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" |
| 240 | output=${cpio_list} | 241 | output=${cpio_list} |
| 242 | echo "$output_file" | grep -q "\.gz$" && compr="gzip -9 -f" | ||
| 243 | echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f" | ||
| 244 | echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f" | ||
| 245 | echo "$output_file" | grep -q "\.cpio$" && compr="cat" | ||
| 241 | shift | 246 | shift |
| 242 | ;; | 247 | ;; |
| 243 | esac | 248 | esac |
| @@ -274,7 +279,7 @@ while [ $# -gt 0 ]; do | |||
| 274 | esac | 279 | esac |
| 275 | done | 280 | done |
| 276 | 281 | ||
| 277 | # If output_file is set we will generate cpio archive and gzip it | 282 | # If output_file is set we will generate cpio archive and compress it |
| 278 | # we are carefull to delete tmp files | 283 | # we are carefull to delete tmp files |
| 279 | if [ ! -z ${output_file} ]; then | 284 | if [ ! -z ${output_file} ]; then |
| 280 | if [ -z ${cpio_file} ]; then | 285 | if [ -z ${cpio_file} ]; then |
| @@ -287,7 +292,8 @@ if [ ! -z ${output_file} ]; then | |||
| 287 | if [ "${is_cpio_compressed}" = "compressed" ]; then | 292 | if [ "${is_cpio_compressed}" = "compressed" ]; then |
| 288 | cat ${cpio_tfile} > ${output_file} | 293 | cat ${cpio_tfile} > ${output_file} |
| 289 | else | 294 | else |
| 290 | cat ${cpio_tfile} | gzip -f -9 - > ${output_file} | 295 | (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ |
| 296 | || (rm -f ${output_file} ; false) | ||
| 291 | fi | 297 | fi |
| 292 | [ -z ${cpio_file} ] && rm ${cpio_tfile} | 298 | [ -z ${cpio_file} ] && rm ${cpio_tfile} |
| 293 | fi | 299 | fi |
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index db30fac3083e..56f90a480899 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl | |||
| @@ -38,7 +38,7 @@ foreach my $file (@files) { | |||
| 38 | &check_asm_types(); | 38 | &check_asm_types(); |
| 39 | &check_sizetypes(); | 39 | &check_sizetypes(); |
| 40 | &check_prototypes(); | 40 | &check_prototypes(); |
| 41 | &check_config(); | 41 | # Dropped for now. Too much noise &check_config(); |
| 42 | } | 42 | } |
| 43 | close FH; | 43 | close FH; |
| 44 | } | 44 | } |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 3e1057f885c6..d190092c3b6e 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <time.h> | 11 | #include <time.h> |
| 12 | #include <unistd.h> | 12 | #include <unistd.h> |
| 13 | #include <sys/stat.h> | 13 | #include <sys/stat.h> |
| 14 | #include <sys/time.h> | ||
| 14 | 15 | ||
| 15 | #define LKC_DIRECT_LINK | 16 | #define LKC_DIRECT_LINK |
| 16 | #include "lkc.h" | 17 | #include "lkc.h" |
| @@ -464,9 +465,22 @@ int main(int ac, char **av) | |||
| 464 | input_mode = set_yes; | 465 | input_mode = set_yes; |
| 465 | break; | 466 | break; |
| 466 | case 'r': | 467 | case 'r': |
| 468 | { | ||
| 469 | struct timeval now; | ||
| 470 | unsigned int seed; | ||
| 471 | |||
| 472 | /* | ||
| 473 | * Use microseconds derived seed, | ||
| 474 | * compensate for systems where it may be zero | ||
| 475 | */ | ||
| 476 | gettimeofday(&now, NULL); | ||
| 477 | |||
| 478 | seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); | ||
| 479 | srand(seed); | ||
| 480 | |||
| 467 | input_mode = set_random; | 481 | input_mode = set_random; |
| 468 | srand(time(NULL)); | ||
| 469 | break; | 482 | break; |
| 483 | } | ||
| 470 | case 'h': | 484 | case 'h': |
| 471 | printf(_("See README for usage info\n")); | 485 | printf(_("See README for usage info\n")); |
| 472 | exit(0); | 486 | exit(0); |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 830d9eae11f9..273d73888f9d 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
| @@ -843,7 +843,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) | |||
| 843 | default: | 843 | default: |
| 844 | continue; | 844 | continue; |
| 845 | } | 845 | } |
| 846 | if (!sym_is_choice(sym) || mode != def_random) | 846 | if (!(sym_is_choice(sym) && mode == def_random)) |
| 847 | sym->flags |= SYMBOL_DEF_USER; | 847 | sym->flags |= SYMBOL_DEF_USER; |
| 848 | break; | 848 | break; |
| 849 | default: | 849 | default: |
| @@ -856,28 +856,49 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) | |||
| 856 | 856 | ||
| 857 | if (mode != def_random) | 857 | if (mode != def_random) |
| 858 | return; | 858 | return; |
| 859 | 859 | /* | |
| 860 | * We have different type of choice blocks. | ||
| 861 | * If curr.tri equal to mod then we can select several | ||
| 862 | * choice symbols in one block. | ||
| 863 | * In this case we do nothing. | ||
| 864 | * If curr.tri equal yes then only one symbol can be | ||
| 865 | * selected in a choice block and we set it to yes, | ||
| 866 | * and the rest to no. | ||
| 867 | */ | ||
| 860 | for_all_symbols(i, csym) { | 868 | for_all_symbols(i, csym) { |
| 861 | if (sym_has_value(csym) || !sym_is_choice(csym)) | 869 | if (sym_has_value(csym) || !sym_is_choice(csym)) |
| 862 | continue; | 870 | continue; |
| 863 | 871 | ||
| 864 | sym_calc_value(csym); | 872 | sym_calc_value(csym); |
| 873 | |||
| 874 | if (csym->curr.tri != yes) | ||
| 875 | continue; | ||
| 876 | |||
| 865 | prop = sym_get_choice_prop(csym); | 877 | prop = sym_get_choice_prop(csym); |
| 866 | def = -1; | 878 | |
| 867 | while (1) { | 879 | /* count entries in choice block */ |
| 868 | cnt = 0; | 880 | cnt = 0; |
| 869 | expr_list_for_each_sym(prop->expr, e, sym) { | 881 | expr_list_for_each_sym(prop->expr, e, sym) |
| 870 | if (sym->visible == no) | 882 | cnt++; |
| 871 | continue; | 883 | |
| 872 | if (def == cnt++) { | 884 | /* |
| 873 | csym->def[S_DEF_USER].val = sym; | 885 | * find a random value and set it to yes, |
| 874 | break; | 886 | * set the rest to no so we have only one set |
| 875 | } | 887 | */ |
| 888 | def = (rand() % cnt); | ||
| 889 | |||
| 890 | cnt = 0; | ||
| 891 | expr_list_for_each_sym(prop->expr, e, sym) { | ||
| 892 | if (def == cnt++) { | ||
| 893 | sym->def[S_DEF_USER].tri = yes; | ||
| 894 | csym->def[S_DEF_USER].val = sym; | ||
| 895 | } | ||
| 896 | else { | ||
| 897 | sym->def[S_DEF_USER].tri = no; | ||
| 876 | } | 898 | } |
| 877 | if (def >= 0 || cnt < 2) | ||
| 878 | break; | ||
| 879 | def = (rand() % cnt) + 1; | ||
| 880 | } | 899 | } |
| 881 | csym->flags |= SYMBOL_DEF_USER; | 900 | csym->flags |= SYMBOL_DEF_USER; |
| 901 | /* clear VALID to get value calculated */ | ||
| 902 | csym->flags &= ~(SYMBOL_VALID); | ||
| 882 | } | 903 | } |
| 883 | } | 904 | } |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 4eea60b1693e..a3344285ccf4 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -710,6 +710,14 @@ static int do_dmi_entry(const char *filename, struct dmi_system_id *id, | |||
| 710 | strcat(alias, ":"); | 710 | strcat(alias, ":"); |
| 711 | return 1; | 711 | return 1; |
| 712 | } | 712 | } |
| 713 | |||
| 714 | static int do_platform_entry(const char *filename, | ||
| 715 | struct platform_device_id *id, char *alias) | ||
| 716 | { | ||
| 717 | sprintf(alias, PLATFORM_MODULE_PREFIX "%s", id->name); | ||
| 718 | return 1; | ||
| 719 | } | ||
| 720 | |||
| 713 | /* Ignore any prefix, eg. some architectures prepend _ */ | 721 | /* Ignore any prefix, eg. some architectures prepend _ */ |
| 714 | static inline int sym_is(const char *symbol, const char *name) | 722 | static inline int sym_is(const char *symbol, const char *name) |
| 715 | { | 723 | { |
| @@ -849,6 +857,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 849 | do_table(symval, sym->st_size, | 857 | do_table(symval, sym->st_size, |
| 850 | sizeof(struct dmi_system_id), "dmi", | 858 | sizeof(struct dmi_system_id), "dmi", |
| 851 | do_dmi_entry, mod); | 859 | do_dmi_entry, mod); |
| 860 | else if (sym_is(symname, "__mod_platform_device_table")) | ||
| 861 | do_table(symval, sym->st_size, | ||
| 862 | sizeof(struct platform_device_id), "platform", | ||
| 863 | do_platform_entry, mod); | ||
| 852 | free(zeros); | 864 | free(zeros); |
| 853 | } | 865 | } |
| 854 | 866 | ||
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 88921611b22e..7e62303133dc 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
| @@ -415,8 +415,9 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
| 415 | const char *secstrings | 415 | const char *secstrings |
| 416 | = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; | 416 | = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; |
| 417 | const char *secname; | 417 | const char *secname; |
| 418 | int nobits = sechdrs[i].sh_type == SHT_NOBITS; | ||
| 418 | 419 | ||
| 419 | if (sechdrs[i].sh_offset > info->size) { | 420 | if (!nobits && sechdrs[i].sh_offset > info->size) { |
| 420 | fatal("%s is truncated. sechdrs[i].sh_offset=%lu > " | 421 | fatal("%s is truncated. sechdrs[i].sh_offset=%lu > " |
| 421 | "sizeof(*hrd)=%zu\n", filename, | 422 | "sizeof(*hrd)=%zu\n", filename, |
| 422 | (unsigned long)sechdrs[i].sh_offset, | 423 | (unsigned long)sechdrs[i].sh_offset, |
| @@ -425,6 +426,8 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
| 425 | } | 426 | } |
| 426 | secname = secstrings + sechdrs[i].sh_name; | 427 | secname = secstrings + sechdrs[i].sh_name; |
| 427 | if (strcmp(secname, ".modinfo") == 0) { | 428 | if (strcmp(secname, ".modinfo") == 0) { |
| 429 | if (nobits) | ||
| 430 | fatal("%s has NOBITS .modinfo\n", filename); | ||
| 428 | info->modinfo = (void *)hdr + sechdrs[i].sh_offset; | 431 | info->modinfo = (void *)hdr + sechdrs[i].sh_offset; |
| 429 | info->modinfo_len = sechdrs[i].sh_size; | 432 | info->modinfo_len = sechdrs[i].sh_size; |
| 430 | } else if (strcmp(secname, "__ksymtab") == 0) | 433 | } else if (strcmp(secname, "__ksymtab") == 0) |
