diff options
Diffstat (limited to 'scripts')
38 files changed, 1165 insertions, 566 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore index 09e2406f3b78..b939fbd01195 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | # | 1 | # |
| 2 | # Generated files | 2 | # Generated files |
| 3 | # | 3 | # |
| 4 | ihex2fw | ||
| 5 | conmakehash | 4 | conmakehash |
| 6 | kallsyms | 5 | kallsyms |
| 7 | pnmtologo | 6 | pnmtologo |
diff --git a/scripts/Makefile b/scripts/Makefile index 035182e16afb..aafdf064feef 100644 --- a/scripts/Makefile +++ b/scripts/Makefile | |||
| @@ -2,12 +2,11 @@ | |||
| 2 | # scripts contains sources for various helper programs used throughout | 2 | # scripts contains sources for various helper programs used throughout |
| 3 | # the kernel for the build process. | 3 | # the kernel for the build process. |
| 4 | # --------------------------------------------------------------------------- | 4 | # --------------------------------------------------------------------------- |
| 5 | # ihex2fw: Parser/loader for IHEX formatted data | ||
| 6 | # kallsyms: Find all symbols in vmlinux | 5 | # kallsyms: Find all symbols in vmlinux |
| 7 | # pnmttologo: Convert pnm files to logo files | 6 | # pnmttologo: Convert pnm files to logo files |
| 7 | # conmakehash: Create chartable | ||
| 8 | # conmakehash: Create arrays for initializing the kernel console tables | 8 | # conmakehash: Create arrays for initializing the kernel console tables |
| 9 | 9 | ||
| 10 | hostprogs-y := ihex2fw | ||
| 11 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms | 10 | hostprogs-$(CONFIG_KALLSYMS) += kallsyms |
| 12 | hostprogs-$(CONFIG_LOGO) += pnmtologo | 11 | hostprogs-$(CONFIG_LOGO) += pnmtologo |
| 13 | hostprogs-$(CONFIG_VT) += conmakehash | 12 | hostprogs-$(CONFIG_VT) += conmakehash |
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 5d900307de3e..5c4b7a400c18 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -27,6 +27,9 @@ ccflags-y := | |||
| 27 | cppflags-y := | 27 | cppflags-y := |
| 28 | ldflags-y := | 28 | ldflags-y := |
| 29 | 29 | ||
| 30 | subdir-asflags-y := | ||
| 31 | subdir-ccflags-y := | ||
| 32 | |||
| 30 | # Read auto.conf if it exists, otherwise ignore | 33 | # Read auto.conf if it exists, otherwise ignore |
| 31 | -include include/config/auto.conf | 34 | -include include/config/auto.conf |
| 32 | 35 | ||
| @@ -112,13 +115,13 @@ endif | |||
| 112 | # --------------------------------------------------------------------------- | 115 | # --------------------------------------------------------------------------- |
| 113 | 116 | ||
| 114 | # Default is built-in, unless we know otherwise | 117 | # Default is built-in, unless we know otherwise |
| 115 | modkern_cflags := $(CFLAGS_KERNEL) | 118 | modkern_cflags = $(if $(part-of-module), $(CFLAGS_MODULE), $(CFLAGS_KERNEL)) |
| 116 | quiet_modtag := $(empty) $(empty) | 119 | quiet_modtag := $(empty) $(empty) |
| 117 | 120 | ||
| 118 | $(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE) | 121 | $(real-objs-m) : part-of-module := y |
| 119 | $(real-objs-m:.o=.i) : modkern_cflags := $(CFLAGS_MODULE) | 122 | $(real-objs-m:.o=.i) : part-of-module := y |
| 120 | $(real-objs-m:.o=.s) : modkern_cflags := $(CFLAGS_MODULE) | 123 | $(real-objs-m:.o=.s) : part-of-module := y |
| 121 | $(real-objs-m:.o=.lst): modkern_cflags := $(CFLAGS_MODULE) | 124 | $(real-objs-m:.o=.lst): part-of-module := y |
| 122 | 125 | ||
| 123 | $(real-objs-m) : quiet_modtag := [M] | 126 | $(real-objs-m) : quiet_modtag := [M] |
| 124 | $(real-objs-m:.o=.i) : quiet_modtag := [M] | 127 | $(real-objs-m:.o=.i) : quiet_modtag := [M] |
| @@ -151,16 +154,16 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< | |||
| 151 | $(obj)/%.i: $(src)/%.c FORCE | 154 | $(obj)/%.i: $(src)/%.c FORCE |
| 152 | $(call if_changed_dep,cc_i_c) | 155 | $(call if_changed_dep,cc_i_c) |
| 153 | 156 | ||
| 154 | cmd_genksyms = \ | 157 | cmd_gensymtypes = \ |
| 155 | $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ | 158 | $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ |
| 156 | $(GENKSYMS) -T $@ -A -a $(ARCH) \ | 159 | $(GENKSYMS) -T $@ -a $(ARCH) \ |
| 157 | $(if $(KBUILD_PRESERVE),-p) \ | 160 | $(if $(KBUILD_PRESERVE),-p) \ |
| 158 | $(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null))) | 161 | $(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null))) |
| 159 | 162 | ||
| 160 | quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ | 163 | quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ |
| 161 | cmd_cc_symtypes_c = \ | 164 | cmd_cc_symtypes_c = \ |
| 162 | set -e; \ | 165 | set -e; \ |
| 163 | $(call cmd_genksyms, true) >/dev/null; \ | 166 | $(call cmd_gensymtypes, true) >/dev/null; \ |
| 164 | test -s $@ || rm -f $@ | 167 | test -s $@ || rm -f $@ |
| 165 | 168 | ||
| 166 | $(obj)/%.symtypes : $(src)/%.c FORCE | 169 | $(obj)/%.symtypes : $(src)/%.c FORCE |
| @@ -177,45 +180,36 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< | |||
| 177 | 180 | ||
| 178 | else | 181 | else |
| 179 | # When module versioning is enabled the following steps are executed: | 182 | # When module versioning is enabled the following steps are executed: |
| 180 | # o compile a .tmp_<file>.s from <file>.c | 183 | # o compile a .tmp_<file>.o from <file>.c |
| 181 | # o if .tmp_<file>.s doesn't contain a __ksymtab version, i.e. does | 184 | # o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does |
| 182 | # not export symbols, we just assemble .tmp_<file>.s to <file>.o and | 185 | # not export symbols, we just rename .tmp_<file>.o to <file>.o and |
| 183 | # are done. | 186 | # are done. |
| 184 | # o otherwise, we calculate symbol versions using the good old | 187 | # o otherwise, we calculate symbol versions using the good old |
| 185 | # genksyms on the preprocessed source and postprocess them in a way | 188 | # genksyms on the preprocessed source and postprocess them in a way |
| 186 | # that they are usable as assembly source | 189 | # that they are usable as a linker script |
| 187 | # o assemble <file>.o from .tmp_<file>.s forcing inclusion of directives | 190 | # o generate <file>.o from .tmp_<file>.o using the linker to |
| 188 | # defining the actual values of __crc_*, followed by objcopy-ing them | 191 | # replace the unresolved symbols __crc_exported_symbol with |
| 189 | # to force these symbols to be local to permit stripping them later. | 192 | # the actual value of the checksum generated by genksyms |
| 190 | s_file = $(@D)/.tmp_$(@F:.o=.s) | ||
| 191 | v_file = $(@D)/.tmp_$(@F:.o=.v) | ||
| 192 | tmp_o_file = $(@D)/.tmp_$(@F) | ||
| 193 | no_g_c_flags = $(filter-out -g%,$(c_flags)) | ||
| 194 | |||
| 195 | cmd_cc_o_c = $(CC) $(c_flags) -S -o $(s_file) $< | ||
| 196 | 193 | ||
| 194 | cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< | ||
| 197 | cmd_modversions = \ | 195 | cmd_modversions = \ |
| 198 | if grep -q __ksymtab $(s_file); then \ | 196 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ |
| 199 | if $(call cmd_genksyms, $(KBUILD_SYMTYPES)) > $(v_file) \ | 197 | $(call cmd_gensymtypes, $(KBUILD_SYMTYPES)) \ |
| 200 | && $(CC) $(no_g_c_flags) -c -Wa,$(v_file) \ | 198 | > $(@D)/.tmp_$(@F:.o=.ver); \ |
| 201 | -o $(tmp_o_file) $(s_file) \ | 199 | \ |
| 202 | && $(OBJCOPY) -L '__crc_*' -L '___crc_*' -w \ | 200 | $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ |
| 203 | $(tmp_o_file) $@; \ | 201 | -T $(@D)/.tmp_$(@F:.o=.ver); \ |
| 204 | then \ | 202 | rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ |
| 205 | : ; \ | ||
| 206 | else \ | ||
| 207 | rm -f $@; exit 1; \ | ||
| 208 | fi; \ | ||
| 209 | else \ | 203 | else \ |
| 210 | rm -f $(v_file); \ | 204 | mv -f $(@D)/.tmp_$(@F) $@; \ |
| 211 | $(CC) $(no_g_c_flags) -c -o $@ $(s_file); \ | ||
| 212 | fi; | 205 | fi; |
| 213 | endif | 206 | endif |
| 214 | 207 | ||
| 215 | ifdef CONFIG_FTRACE_MCOUNT_RECORD | 208 | ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| 216 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ | 209 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ |
| 217 | "$(if $(CONFIG_64BIT),64,32)" \ | 210 | "$(if $(CONFIG_64BIT),64,32)" \ |
| 218 | "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" "$(@)"; | 211 | "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ |
| 212 | "$(if $(part-of-module),1,0)" "$(@)"; | ||
| 219 | endif | 213 | endif |
| 220 | 214 | ||
| 221 | define rule_cc_o_c | 215 | define rule_cc_o_c |
| @@ -225,12 +219,7 @@ define rule_cc_o_c | |||
| 225 | $(cmd_record_mcount) \ | 219 | $(cmd_record_mcount) \ |
| 226 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ | 220 | scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ |
| 227 | $(dot-target).tmp; \ | 221 | $(dot-target).tmp; \ |
| 228 | if [ -r $(@D)/.tmp_$(@F:.o=.v) ]; then \ | 222 | rm -f $(depfile); \ |
| 229 | echo >> $(dot-target).tmp; \ | ||
| 230 | echo '$@: $(GENKSYMS)' >> $(dot-target).tmp; \ | ||
| 231 | echo '$(GENKSYMS):: ;' >> $(dot-target).tmp; \ | ||
| 232 | fi; \ | ||
| 233 | rm -f $(depfile) $(@D)/.tmp_$(@F:.o=.?); \ | ||
| 234 | mv -f $(dot-target).tmp $(dot-target).cmd | 223 | mv -f $(dot-target).tmp $(dot-target).cmd |
| 235 | endef | 224 | endef |
| 236 | 225 | ||
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst index 612dc13ddd85..095cfc8b9dbf 100644 --- a/scripts/Makefile.headersinst +++ b/scripts/Makefile.headersinst | |||
| @@ -14,6 +14,8 @@ _dst := $(if $(dst),$(dst),$(obj)) | |||
| 14 | kbuild-file := $(srctree)/$(obj)/Kbuild | 14 | kbuild-file := $(srctree)/$(obj)/Kbuild |
| 15 | include $(kbuild-file) | 15 | include $(kbuild-file) |
| 16 | 16 | ||
| 17 | _dst := $(if $(destination-y),$(destination-y),$(_dst)) | ||
| 18 | |||
| 17 | include scripts/Kbuild.include | 19 | include scripts/Kbuild.include |
| 18 | 20 | ||
| 19 | install := $(INSTALL_HDR_PATH)/$(_dst) | 21 | install := $(INSTALL_HDR_PATH)/$(_dst) |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index e06365775bdf..cba61ca403ca 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -4,6 +4,11 @@ ccflags-y += $(EXTRA_CFLAGS) | |||
| 4 | cppflags-y += $(EXTRA_CPPFLAGS) | 4 | cppflags-y += $(EXTRA_CPPFLAGS) |
| 5 | ldflags-y += $(EXTRA_LDFLAGS) | 5 | ldflags-y += $(EXTRA_LDFLAGS) |
| 6 | 6 | ||
| 7 | # | ||
| 8 | # flags that take effect in sub directories | ||
| 9 | export KBUILD_SUBDIR_ASFLAGS := $(KBUILD_SUBDIR_ASFLAGS) $(subdir-asflags-y) | ||
| 10 | export KBUILD_SUBDIR_CCFLAGS := $(KBUILD_SUBDIR_CCFLAGS) $(subdir-ccflags-y) | ||
| 11 | |||
| 7 | # Figure out what we need to build from the various variables | 12 | # Figure out what we need to build from the various variables |
| 8 | # =========================================================================== | 13 | # =========================================================================== |
| 9 | 14 | ||
| @@ -97,17 +102,17 @@ modname_flags = $(if $(filter 1,$(words $(modname))),\ | |||
| 97 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") | 102 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") |
| 98 | 103 | ||
| 99 | #hash values | 104 | #hash values |
| 100 | ifdef CONFIG_DYNAMIC_PRINTK_DEBUG | 105 | ifdef CONFIG_DYNAMIC_DEBUG |
| 101 | debug_flags = -D"DEBUG_HASH=$(shell ./scripts/basic/hash djb2 $(@D)$(modname))"\ | 106 | debug_flags = -D"DEBUG_HASH=$(shell ./scripts/basic/hash djb2 $(@D)$(modname))"\ |
| 102 | -D"DEBUG_HASH2=$(shell ./scripts/basic/hash r5 $(@D)$(modname))" | 107 | -D"DEBUG_HASH2=$(shell ./scripts/basic/hash r5 $(@D)$(modname))" |
| 103 | else | 108 | else |
| 104 | debug_flags = | 109 | debug_flags = |
| 105 | endif | 110 | endif |
| 106 | 111 | ||
| 107 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ | 112 | orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \ |
| 108 | $(ccflags-y) $(CFLAGS_$(basetarget).o) | 113 | $(ccflags-y) $(CFLAGS_$(basetarget).o) |
| 109 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) | 114 | _c_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags)) |
| 110 | _a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) \ | 115 | _a_flags = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \ |
| 111 | $(asflags-y) $(AFLAGS_$(basetarget).o) | 116 | $(asflags-y) $(AFLAGS_$(basetarget).o) |
| 112 | _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) | 117 | _cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F)) |
| 113 | 118 | ||
| @@ -186,3 +191,17 @@ quiet_cmd_gzip = GZIP $@ | |||
| 186 | cmd_gzip = gzip -f -9 < $< > $@ | 191 | cmd_gzip = gzip -f -9 < $< > $@ |
| 187 | 192 | ||
| 188 | 193 | ||
| 194 | # Bzip2 | ||
| 195 | # --------------------------------------------------------------------------- | ||
| 196 | |||
| 197 | # Bzip2 does not include size in file... so we have to fake that | ||
| 198 | size_append=$(CONFIG_SHELL) $(srctree)/scripts/bin_size | ||
| 199 | |||
| 200 | quiet_cmd_bzip2 = BZIP2 $@ | ||
| 201 | cmd_bzip2 = (bzip2 -9 < $< && $(size_append) $<) > $@ || (rm -f $@ ; false) | ||
| 202 | |||
| 203 | # Lzma | ||
| 204 | # --------------------------------------------------------------------------- | ||
| 205 | |||
| 206 | quiet_cmd_lzma = LZMA $@ | ||
| 207 | cmd_lzma = (lzma -9 -c $< && $(size_append) $<) >$@ || (rm -f $@ ; false) | ||
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index a5122dce1264..efa5d940e632 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst | |||
| @@ -17,8 +17,7 @@ __modinst: $(modules) | |||
| 17 | @: | 17 | @: |
| 18 | 18 | ||
| 19 | quiet_cmd_modules_install = INSTALL $@ | 19 | quiet_cmd_modules_install = INSTALL $@ |
| 20 | cmd_modules_install = mkdir -p $(2); \ | 20 | cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) |
| 21 | $(mod_strip_cmd) $@ $(2)/$(notdir $@) || cp $@ $(2) | ||
| 22 | 21 | ||
| 23 | # Modules built outside the kernel source tree go into extra by default | 22 | # Modules built outside the kernel source tree go into extra by default |
| 24 | INSTALL_MOD_DIR ?= extra | 23 | INSTALL_MOD_DIR ?= extra |
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/bootgraph.pl b/scripts/bootgraph.pl index b0246307aac4..12caa822a232 100644 --- a/scripts/bootgraph.pl +++ b/scripts/bootgraph.pl | |||
| @@ -51,7 +51,7 @@ my %pidctr; | |||
| 51 | 51 | ||
| 52 | while (<>) { | 52 | while (<>) { |
| 53 | my $line = $_; | 53 | my $line = $_; |
| 54 | if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_]+)\+/) { | 54 | if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) { |
| 55 | my $func = $2; | 55 | my $func = $2; |
| 56 | if ($done == 0) { | 56 | if ($done == 0) { |
| 57 | $start{$func} = $1; | 57 | $start{$func} = $1; |
| @@ -87,7 +87,7 @@ while (<>) { | |||
| 87 | $count = $count + 1; | 87 | $count = $count + 1; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_]+)\+.*returned/) { | 90 | if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_\.]+)\+.*returned/) { |
| 91 | if ($done == 0) { | 91 | if ($done == 0) { |
| 92 | $end{$2} = $1; | 92 | $end{$2} = $1; |
| 93 | $maxtime = $1; | 93 | $maxtime = $1; |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7bed4ed2c519..2d5ece798c4c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -10,7 +10,7 @@ use strict; | |||
| 10 | my $P = $0; | 10 | my $P = $0; |
| 11 | $P =~ s@.*/@@g; | 11 | $P =~ s@.*/@@g; |
| 12 | 12 | ||
| 13 | my $V = '0.26'; | 13 | my $V = '0.28'; |
| 14 | 14 | ||
| 15 | use Getopt::Long qw(:config no_auto_abbrev); | 15 | use Getopt::Long qw(:config no_auto_abbrev); |
| 16 | 16 | ||
| @@ -110,7 +110,8 @@ our $Sparse = qr{ | |||
| 110 | __iomem| | 110 | __iomem| |
| 111 | __must_check| | 111 | __must_check| |
| 112 | __init_refok| | 112 | __init_refok| |
| 113 | __kprobes | 113 | __kprobes| |
| 114 | __ref | ||
| 114 | }x; | 115 | }x; |
| 115 | our $Attribute = qr{ | 116 | our $Attribute = qr{ |
| 116 | const| | 117 | const| |
| @@ -411,13 +412,15 @@ sub ctx_statement_block { | |||
| 411 | 412 | ||
| 412 | my $type = ''; | 413 | my $type = ''; |
| 413 | my $level = 0; | 414 | my $level = 0; |
| 414 | my @stack = ([$type, $level]); | 415 | my @stack = (); |
| 415 | my $p; | 416 | my $p; |
| 416 | my $c; | 417 | my $c; |
| 417 | my $len = 0; | 418 | my $len = 0; |
| 418 | 419 | ||
| 419 | my $remainder; | 420 | my $remainder; |
| 420 | while (1) { | 421 | while (1) { |
| 422 | @stack = (['', 0]) if ($#stack == -1); | ||
| 423 | |||
| 421 | #warn "CSB: blk<$blk> remain<$remain>\n"; | 424 | #warn "CSB: blk<$blk> remain<$remain>\n"; |
| 422 | # If we are about to drop off the end, pull in more | 425 | # If we are about to drop off the end, pull in more |
| 423 | # context. | 426 | # context. |
| @@ -1238,7 +1241,8 @@ sub process { | |||
| 1238 | $realfile =~ s@^([^/]*)/@@; | 1241 | $realfile =~ s@^([^/]*)/@@; |
| 1239 | 1242 | ||
| 1240 | $p1_prefix = $1; | 1243 | $p1_prefix = $1; |
| 1241 | if ($tree && $p1_prefix ne '' && -e "$root/$p1_prefix") { | 1244 | if (!$file && $tree && $p1_prefix ne '' && |
| 1245 | -e "$root/$p1_prefix") { | ||
| 1242 | WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n"); | 1246 | WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n"); |
| 1243 | } | 1247 | } |
| 1244 | 1248 | ||
| @@ -1581,9 +1585,9 @@ sub process { | |||
| 1581 | } | 1585 | } |
| 1582 | # TEST: allow direct testing of the attribute matcher. | 1586 | # TEST: allow direct testing of the attribute matcher. |
| 1583 | if ($dbg_attr) { | 1587 | if ($dbg_attr) { |
| 1584 | if ($line =~ /^.\s*$Attribute\s*$/) { | 1588 | if ($line =~ /^.\s*$Modifier\s*$/) { |
| 1585 | ERROR("TEST: is attr\n" . $herecurr); | 1589 | ERROR("TEST: is attr\n" . $herecurr); |
| 1586 | } elsif ($dbg_attr > 1 && $line =~ /^.+($Attribute)/) { | 1590 | } elsif ($dbg_attr > 1 && $line =~ /^.+($Modifier)/) { |
| 1587 | ERROR("TEST: is not attr ($1 is)\n". $herecurr); | 1591 | ERROR("TEST: is not attr ($1 is)\n". $herecurr); |
| 1588 | } | 1592 | } |
| 1589 | next; | 1593 | next; |
| @@ -1655,7 +1659,7 @@ sub process { | |||
| 1655 | 1659 | ||
| 1656 | # * goes on variable not on type | 1660 | # * goes on variable not on type |
| 1657 | # (char*[ const]) | 1661 | # (char*[ const]) |
| 1658 | if ($line =~ m{\($NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)*)\)}) { | 1662 | if ($line =~ m{\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\)}) { |
| 1659 | my ($from, $to) = ($1, $1); | 1663 | my ($from, $to) = ($1, $1); |
| 1660 | 1664 | ||
| 1661 | # Should start with a space. | 1665 | # Should start with a space. |
| @@ -1663,14 +1667,14 @@ sub process { | |||
| 1663 | # Should not end with a space. | 1667 | # Should not end with a space. |
| 1664 | $to =~ s/\s+$//; | 1668 | $to =~ s/\s+$//; |
| 1665 | # '*'s should not have spaces between. | 1669 | # '*'s should not have spaces between. |
| 1666 | while ($to =~ s/(.)\s\*/$1\*/) { | 1670 | while ($to =~ s/\*\s+\*/\*\*/) { |
| 1667 | } | 1671 | } |
| 1668 | 1672 | ||
| 1669 | #print "from<$from> to<$to>\n"; | 1673 | #print "from<$from> to<$to>\n"; |
| 1670 | if ($from ne $to) { | 1674 | if ($from ne $to) { |
| 1671 | ERROR("\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr); | 1675 | ERROR("\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr); |
| 1672 | } | 1676 | } |
| 1673 | } elsif ($line =~ m{\b$NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)?)($Ident)}) { | 1677 | } elsif ($line =~ m{\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident)}) { |
| 1674 | my ($from, $to, $ident) = ($1, $1, $2); | 1678 | my ($from, $to, $ident) = ($1, $1, $2); |
| 1675 | 1679 | ||
| 1676 | # Should start with a space. | 1680 | # Should start with a space. |
| @@ -1678,13 +1682,13 @@ sub process { | |||
| 1678 | # Should not end with a space. | 1682 | # Should not end with a space. |
| 1679 | $to =~ s/\s+$//; | 1683 | $to =~ s/\s+$//; |
| 1680 | # '*'s should not have spaces between. | 1684 | # '*'s should not have spaces between. |
| 1681 | while ($to =~ s/(.)\s\*/$1\*/) { | 1685 | while ($to =~ s/\*\s+\*/\*\*/) { |
| 1682 | } | 1686 | } |
| 1683 | # Modifiers should have spaces. | 1687 | # Modifiers should have spaces. |
| 1684 | $to =~ s/(\b$Modifier$)/$1 /; | 1688 | $to =~ s/(\b$Modifier$)/$1 /; |
| 1685 | 1689 | ||
| 1686 | #print "from<$from> to<$to>\n"; | 1690 | #print "from<$from> to<$to> ident<$ident>\n"; |
| 1687 | if ($from ne $to) { | 1691 | if ($from ne $to && $ident !~ /^$Modifier$/) { |
| 1688 | ERROR("\"foo${from}bar\" should be \"foo${to}bar\"\n" . $herecurr); | 1692 | ERROR("\"foo${from}bar\" should be \"foo${to}bar\"\n" . $herecurr); |
| 1689 | } | 1693 | } |
| 1690 | } | 1694 | } |
| @@ -1883,11 +1887,11 @@ sub process { | |||
| 1883 | if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { | 1887 | if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { |
| 1884 | ERROR("space required before that '$op' $at\n" . $hereptr); | 1888 | ERROR("space required before that '$op' $at\n" . $hereptr); |
| 1885 | } | 1889 | } |
| 1886 | if ($op eq '*' && $cc =~/\s*const\b/) { | 1890 | if ($op eq '*' && $cc =~/\s*$Modifier\b/) { |
| 1887 | # A unary '*' may be const | 1891 | # A unary '*' may be const |
| 1888 | 1892 | ||
| 1889 | } elsif ($ctx =~ /.xW/) { | 1893 | } elsif ($ctx =~ /.xW/) { |
| 1890 | ERROR("space prohibited after that '$op' $at\n" . $hereptr); | 1894 | ERROR("Aspace prohibited after that '$op' $at\n" . $hereptr); |
| 1891 | } | 1895 | } |
| 1892 | 1896 | ||
| 1893 | # unary ++ and unary -- are allowed no space on one side. | 1897 | # unary ++ and unary -- are allowed no space on one side. |
| @@ -2014,7 +2018,11 @@ sub process { | |||
| 2014 | 2018 | ||
| 2015 | # Flatten any parentheses | 2019 | # Flatten any parentheses |
| 2016 | $value =~ s/\)\(/\) \(/g; | 2020 | $value =~ s/\)\(/\) \(/g; |
| 2017 | while ($value !~ /(?:$Ident|-?$Constant)\s*$Compare\s*(?:$Ident|-?$Constant)/ && $value =~ s/\([^\(\)]*\)/1/) { | 2021 | while ($value =~ s/\[[^\{\}]*\]/1/ || |
| 2022 | $value !~ /(?:$Ident|-?$Constant)\s* | ||
| 2023 | $Compare\s* | ||
| 2024 | (?:$Ident|-?$Constant)/x && | ||
| 2025 | $value =~ s/\([^\(\)]*\)/1/) { | ||
| 2018 | } | 2026 | } |
| 2019 | 2027 | ||
| 2020 | if ($value =~ /^(?:$Ident|-?$Constant)$/) { | 2028 | if ($value =~ /^(?:$Ident|-?$Constant)$/) { |
| @@ -2102,6 +2110,11 @@ sub process { | |||
| 2102 | ERROR("trailing statements should be on next line\n" . $herecurr); | 2110 | ERROR("trailing statements should be on next line\n" . $herecurr); |
| 2103 | } | 2111 | } |
| 2104 | } | 2112 | } |
| 2113 | # if should not continue a brace | ||
| 2114 | if ($line =~ /}\s*if\b/) { | ||
| 2115 | ERROR("trailing statements should be on next line\n" . | ||
| 2116 | $herecurr); | ||
| 2117 | } | ||
| 2105 | # case and default should not have general statements after them | 2118 | # case and default should not have general statements after them |
| 2106 | if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && | 2119 | if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g && |
| 2107 | $line !~ /\G(?: | 2120 | $line !~ /\G(?: |
| @@ -2516,9 +2529,10 @@ sub process { | |||
| 2516 | WARN("please use device_initcall() instead of __initcall()\n" . $herecurr); | 2529 | WARN("please use device_initcall() instead of __initcall()\n" . $herecurr); |
| 2517 | } | 2530 | } |
| 2518 | # check for struct file_operations, ensure they are const. | 2531 | # check for struct file_operations, ensure they are const. |
| 2519 | if ($line =~ /\bstruct\s+file_operations\b/ && | 2532 | if ($line !~ /\bconst\b/ && |
| 2520 | $line !~ /\bconst\b/) { | 2533 | $line =~ /\bstruct\s+(file_operations|seq_operations)\b/) { |
| 2521 | WARN("struct file_operations should normally be const\n" . $herecurr); | 2534 | WARN("struct $1 should normally be const\n" . |
| 2535 | $herecurr); | ||
| 2522 | } | 2536 | } |
| 2523 | 2537 | ||
| 2524 | # use of NR_CPUS is usually wrong | 2538 | # use of NR_CPUS is usually wrong |
| @@ -2548,7 +2562,7 @@ sub process { | |||
| 2548 | if ($line =~ /\bin_atomic\s*\(/) { | 2562 | if ($line =~ /\bin_atomic\s*\(/) { |
| 2549 | if ($realfile =~ m@^drivers/@) { | 2563 | if ($realfile =~ m@^drivers/@) { |
| 2550 | ERROR("do not use in_atomic in drivers\n" . $herecurr); | 2564 | ERROR("do not use in_atomic in drivers\n" . $herecurr); |
| 2551 | } else { | 2565 | } elsif ($realfile !~ m@^kernel/@) { |
| 2552 | WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); | 2566 | WARN("use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); |
| 2553 | } | 2567 | } |
| 2554 | } | 2568 | } |
diff --git a/scripts/config b/scripts/config index 68b9761cdc38..db6084b78a10 100755 --- a/scripts/config +++ b/scripts/config | |||
| @@ -60,6 +60,10 @@ else | |||
| 60 | FN=.config | 60 | FN=.config |
| 61 | fi | 61 | fi |
| 62 | 62 | ||
| 63 | if [ "$1" = "" ] ; then | ||
| 64 | usage | ||
| 65 | fi | ||
| 66 | |||
| 63 | while [ "$1" != "" ] ; do | 67 | while [ "$1" != "" ] ; do |
| 64 | CMD="$1" | 68 | CMD="$1" |
| 65 | shift | 69 | shift |
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..76af5f9623e3 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. |
| @@ -97,7 +97,7 @@ print_mtime() { | |||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | list_parse() { | 99 | list_parse() { |
| 100 | echo "$1 \\" | 100 | [ ! -L "$1" ] && echo "$1 \\" || : |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | # for each file print a line in following format | 103 | # for each file print a line in following format |
| @@ -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/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index f8bb4cabd62d..3a8297b5184c 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
| @@ -43,7 +43,7 @@ int cur_line = 1; | |||
| 43 | char *cur_filename; | 43 | char *cur_filename; |
| 44 | 44 | ||
| 45 | static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, | 45 | static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, |
| 46 | flag_preserve, flag_warnings, flag_asm; | 46 | flag_preserve, flag_warnings; |
| 47 | static const char *arch = ""; | 47 | static const char *arch = ""; |
| 48 | static const char *mod_prefix = ""; | 48 | static const char *mod_prefix = ""; |
| 49 | 49 | ||
| @@ -610,11 +610,8 @@ void export_symbol(const char *name) | |||
| 610 | if (flag_dump_defs) | 610 | if (flag_dump_defs) |
| 611 | fputs(">\n", debugfile); | 611 | fputs(">\n", debugfile); |
| 612 | 612 | ||
| 613 | /* Used as assembly source or a linker script. */ | 613 | /* Used as a linker script. */ |
| 614 | printf(flag_asm | 614 | printf("%s__crc_%s = 0x%08lx ;\n", mod_prefix, name, crc); |
| 615 | ? ".equiv %s__crc_%s, %#08lx\n" | ||
| 616 | : "%s__crc_%s = %#08lx ;\n", | ||
| 617 | mod_prefix, name, crc); | ||
| 618 | } | 615 | } |
| 619 | } | 616 | } |
| 620 | 617 | ||
| @@ -651,10 +648,9 @@ void error_with_pos(const char *fmt, ...) | |||
| 651 | 648 | ||
| 652 | static void genksyms_usage(void) | 649 | static void genksyms_usage(void) |
| 653 | { | 650 | { |
| 654 | fputs("Usage:\n" "genksyms [-aAdDTwqhV] > /path/to/.tmp_obj.ver\n" "\n" | 651 | fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n" |
| 655 | #ifdef __GNU_LIBRARY__ | 652 | #ifdef __GNU_LIBRARY__ |
| 656 | " -a, --arch Select architecture\n" | 653 | " -a, --arch Select architecture\n" |
| 657 | " -A, --asm Generate assembly rather than linker script\n" | ||
| 658 | " -d, --debug Increment the debug level (repeatable)\n" | 654 | " -d, --debug Increment the debug level (repeatable)\n" |
| 659 | " -D, --dump Dump expanded symbol defs (for debugging only)\n" | 655 | " -D, --dump Dump expanded symbol defs (for debugging only)\n" |
| 660 | " -r, --reference file Read reference symbols from a file\n" | 656 | " -r, --reference file Read reference symbols from a file\n" |
| @@ -666,7 +662,6 @@ static void genksyms_usage(void) | |||
| 666 | " -V, --version Print the release version\n" | 662 | " -V, --version Print the release version\n" |
| 667 | #else /* __GNU_LIBRARY__ */ | 663 | #else /* __GNU_LIBRARY__ */ |
| 668 | " -a Select architecture\n" | 664 | " -a Select architecture\n" |
| 669 | " -A Generate assembly rather than linker script\n" | ||
| 670 | " -d Increment the debug level (repeatable)\n" | 665 | " -d Increment the debug level (repeatable)\n" |
| 671 | " -D Dump expanded symbol defs (for debugging only)\n" | 666 | " -D Dump expanded symbol defs (for debugging only)\n" |
| 672 | " -r file Read reference symbols from a file\n" | 667 | " -r file Read reference symbols from a file\n" |
| @@ -688,7 +683,6 @@ int main(int argc, char **argv) | |||
| 688 | #ifdef __GNU_LIBRARY__ | 683 | #ifdef __GNU_LIBRARY__ |
| 689 | struct option long_opts[] = { | 684 | struct option long_opts[] = { |
| 690 | {"arch", 1, 0, 'a'}, | 685 | {"arch", 1, 0, 'a'}, |
| 691 | {"asm", 0, 0, 'A'}, | ||
| 692 | {"debug", 0, 0, 'd'}, | 686 | {"debug", 0, 0, 'd'}, |
| 693 | {"warnings", 0, 0, 'w'}, | 687 | {"warnings", 0, 0, 'w'}, |
| 694 | {"quiet", 0, 0, 'q'}, | 688 | {"quiet", 0, 0, 'q'}, |
| @@ -701,10 +695,10 @@ int main(int argc, char **argv) | |||
| 701 | {0, 0, 0, 0} | 695 | {0, 0, 0, 0} |
| 702 | }; | 696 | }; |
| 703 | 697 | ||
| 704 | while ((o = getopt_long(argc, argv, "a:dwqVADr:T:ph", | 698 | while ((o = getopt_long(argc, argv, "a:dwqVDr:T:ph", |
| 705 | &long_opts[0], NULL)) != EOF) | 699 | &long_opts[0], NULL)) != EOF) |
| 706 | #else /* __GNU_LIBRARY__ */ | 700 | #else /* __GNU_LIBRARY__ */ |
| 707 | while ((o = getopt(argc, argv, "a:dwqVADr:T:ph")) != EOF) | 701 | while ((o = getopt(argc, argv, "a:dwqVDr:T:ph")) != EOF) |
| 708 | #endif /* __GNU_LIBRARY__ */ | 702 | #endif /* __GNU_LIBRARY__ */ |
| 709 | switch (o) { | 703 | switch (o) { |
| 710 | case 'a': | 704 | case 'a': |
| @@ -722,9 +716,6 @@ int main(int argc, char **argv) | |||
| 722 | case 'V': | 716 | case 'V': |
| 723 | fputs("genksyms version 2.5.60\n", stderr); | 717 | fputs("genksyms version 2.5.60\n", stderr); |
| 724 | break; | 718 | break; |
| 725 | case 'A': | ||
| 726 | flag_asm = 1; | ||
| 727 | break; | ||
| 728 | case 'D': | 719 | case 'D': |
| 729 | flag_dump_defs = 1; | 720 | flag_dump_defs = 1; |
| 730 | break; | 721 | break; |
diff --git a/scripts/genksyms/keywords.c_shipped b/scripts/genksyms/keywords.c_shipped index 83484fe93ede..971e0113ae7a 100644 --- a/scripts/genksyms/keywords.c_shipped +++ b/scripts/genksyms/keywords.c_shipped | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* ANSI-C code produced by gperf version 3.0.1 */ | 1 | /* ANSI-C code produced by gperf version 3.0.2 */ |
| 2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ | 2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ |
| 3 | 3 | ||
| 4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | 4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
| @@ -32,7 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | #line 3 "scripts/genksyms/keywords.gperf" | 33 | #line 3 "scripts/genksyms/keywords.gperf" |
| 34 | struct resword { const char *name; int token; }; | 34 | struct resword { const char *name; int token; }; |
| 35 | /* maximum key range = 64, duplicates = 0 */ | 35 | /* maximum key range = 62, duplicates = 0 */ |
| 36 | 36 | ||
| 37 | #ifdef __GNUC__ | 37 | #ifdef __GNUC__ |
| 38 | __inline | 38 | __inline |
| @@ -46,32 +46,32 @@ is_reserved_hash (register const char *str, register unsigned int len) | |||
| 46 | { | 46 | { |
| 47 | static const unsigned char asso_values[] = | 47 | static const unsigned char asso_values[] = |
| 48 | { | 48 | { |
| 49 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 49 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 50 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 50 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 51 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 51 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 52 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 52 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 53 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 53 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 54 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 54 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 55 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, | 55 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 5, |
| 56 | 67, 67, 67, 67, 67, 67, 15, 67, 67, 67, | 56 | 65, 65, 65, 65, 65, 65, 35, 65, 65, 65, |
| 57 | 0, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 57 | 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 58 | 67, 67, 67, 67, 67, 0, 67, 0, 67, 5, | 58 | 65, 65, 65, 65, 65, 0, 65, 0, 65, 5, |
| 59 | 25, 20, 15, 30, 67, 15, 67, 67, 10, 0, | 59 | 20, 15, 10, 30, 65, 15, 65, 65, 20, 0, |
| 60 | 10, 40, 20, 67, 10, 5, 0, 10, 15, 67, | 60 | 10, 35, 20, 65, 10, 5, 0, 10, 5, 65, |
| 61 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 61 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 62 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 62 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 63 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 63 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 64 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 64 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 65 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 65 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 66 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 66 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 67 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 67 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 68 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 68 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 69 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 69 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 70 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 70 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 71 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 71 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 72 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 72 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 73 | 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | 73 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, |
| 74 | 67, 67, 67, 67, 67, 67 | 74 | 65, 65, 65, 65, 65, 65 |
| 75 | }; | 75 | }; |
| 76 | return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; | 76 | return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; |
| 77 | } | 77 | } |
| @@ -84,119 +84,116 @@ is_reserved_word (register const char *str, register unsigned int len) | |||
| 84 | { | 84 | { |
| 85 | enum | 85 | enum |
| 86 | { | 86 | { |
| 87 | TOTAL_KEYWORDS = 45, | 87 | TOTAL_KEYWORDS = 43, |
| 88 | MIN_WORD_LENGTH = 3, | 88 | MIN_WORD_LENGTH = 3, |
| 89 | MAX_WORD_LENGTH = 24, | 89 | MAX_WORD_LENGTH = 24, |
| 90 | MIN_HASH_VALUE = 3, | 90 | MIN_HASH_VALUE = 3, |
| 91 | MAX_HASH_VALUE = 66 | 91 | MAX_HASH_VALUE = 64 |
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| 94 | static const struct resword wordlist[] = | 94 | static const struct resword wordlist[] = |
| 95 | { | 95 | { |
| 96 | {""}, {""}, {""}, | 96 | {""}, {""}, {""}, |
| 97 | #line 28 "scripts/genksyms/keywords.gperf" | 97 | #line 26 "scripts/genksyms/keywords.gperf" |
| 98 | {"asm", ASM_KEYW}, | 98 | {"asm", ASM_KEYW}, |
| 99 | {""}, | 99 | {""}, |
| 100 | #line 10 "scripts/genksyms/keywords.gperf" | 100 | #line 8 "scripts/genksyms/keywords.gperf" |
| 101 | {"__asm", ASM_KEYW}, | 101 | {"__asm", ASM_KEYW}, |
| 102 | {""}, | 102 | {""}, |
| 103 | #line 11 "scripts/genksyms/keywords.gperf" | 103 | #line 9 "scripts/genksyms/keywords.gperf" |
| 104 | {"__asm__", ASM_KEYW}, | 104 | {"__asm__", ASM_KEYW}, |
| 105 | {""}, {""}, | 105 | {""}, {""}, |
| 106 | #line 54 "scripts/genksyms/keywords.gperf" | 106 | #line 52 "scripts/genksyms/keywords.gperf" |
| 107 | {"__typeof__", TYPEOF_KEYW}, | 107 | {"__typeof__", TYPEOF_KEYW}, |
| 108 | {""}, | 108 | {""}, |
| 109 | #line 14 "scripts/genksyms/keywords.gperf" | 109 | #line 12 "scripts/genksyms/keywords.gperf" |
| 110 | {"__const", CONST_KEYW}, | 110 | {"__const", CONST_KEYW}, |
| 111 | #line 13 "scripts/genksyms/keywords.gperf" | 111 | #line 11 "scripts/genksyms/keywords.gperf" |
| 112 | {"__attribute__", ATTRIBUTE_KEYW}, | 112 | {"__attribute__", ATTRIBUTE_KEYW}, |
| 113 | #line 15 "scripts/genksyms/keywords.gperf" | 113 | #line 13 "scripts/genksyms/keywords.gperf" |
| 114 | {"__const__", CONST_KEYW}, | 114 | {"__const__", CONST_KEYW}, |
| 115 | #line 20 "scripts/genksyms/keywords.gperf" | 115 | #line 18 "scripts/genksyms/keywords.gperf" |
| 116 | {"__signed__", SIGNED_KEYW}, | 116 | {"__signed__", SIGNED_KEYW}, |
| 117 | #line 46 "scripts/genksyms/keywords.gperf" | 117 | #line 44 "scripts/genksyms/keywords.gperf" |
| 118 | {"static", STATIC_KEYW}, | 118 | {"static", STATIC_KEYW}, |
| 119 | {""}, | 119 | #line 20 "scripts/genksyms/keywords.gperf" |
| 120 | #line 41 "scripts/genksyms/keywords.gperf" | 120 | {"__volatile__", VOLATILE_KEYW}, |
| 121 | #line 39 "scripts/genksyms/keywords.gperf" | ||
| 121 | {"int", INT_KEYW}, | 122 | {"int", INT_KEYW}, |
| 122 | #line 34 "scripts/genksyms/keywords.gperf" | 123 | #line 32 "scripts/genksyms/keywords.gperf" |
| 123 | {"char", CHAR_KEYW}, | 124 | {"char", CHAR_KEYW}, |
| 124 | #line 35 "scripts/genksyms/keywords.gperf" | 125 | #line 33 "scripts/genksyms/keywords.gperf" |
| 125 | {"const", CONST_KEYW}, | 126 | {"const", CONST_KEYW}, |
| 126 | #line 47 "scripts/genksyms/keywords.gperf" | 127 | #line 45 "scripts/genksyms/keywords.gperf" |
| 127 | {"struct", STRUCT_KEYW}, | 128 | {"struct", STRUCT_KEYW}, |
| 128 | #line 26 "scripts/genksyms/keywords.gperf" | 129 | #line 24 "scripts/genksyms/keywords.gperf" |
| 129 | {"__restrict__", RESTRICT_KEYW}, | 130 | {"__restrict__", RESTRICT_KEYW}, |
| 130 | #line 27 "scripts/genksyms/keywords.gperf" | ||
| 131 | {"restrict", RESTRICT_KEYW}, | ||
| 132 | #line 7 "scripts/genksyms/keywords.gperf" | ||
| 133 | {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, | ||
| 134 | #line 18 "scripts/genksyms/keywords.gperf" | ||
| 135 | {"__inline__", INLINE_KEYW}, | ||
| 136 | {""}, | ||
| 137 | #line 22 "scripts/genksyms/keywords.gperf" | ||
| 138 | {"__volatile__", VOLATILE_KEYW}, | ||
| 139 | #line 5 "scripts/genksyms/keywords.gperf" | ||
| 140 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, | ||
| 141 | #line 25 "scripts/genksyms/keywords.gperf" | 131 | #line 25 "scripts/genksyms/keywords.gperf" |
| 132 | {"restrict", RESTRICT_KEYW}, | ||
| 133 | #line 23 "scripts/genksyms/keywords.gperf" | ||
| 142 | {"_restrict", RESTRICT_KEYW}, | 134 | {"_restrict", RESTRICT_KEYW}, |
| 143 | {""}, | ||
| 144 | #line 12 "scripts/genksyms/keywords.gperf" | ||
| 145 | {"__attribute", ATTRIBUTE_KEYW}, | ||
| 146 | #line 6 "scripts/genksyms/keywords.gperf" | ||
| 147 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, | ||
| 148 | #line 16 "scripts/genksyms/keywords.gperf" | 135 | #line 16 "scripts/genksyms/keywords.gperf" |
| 136 | {"__inline__", INLINE_KEYW}, | ||
| 137 | #line 10 "scripts/genksyms/keywords.gperf" | ||
| 138 | {"__attribute", ATTRIBUTE_KEYW}, | ||
| 139 | {""}, | ||
| 140 | #line 14 "scripts/genksyms/keywords.gperf" | ||
| 149 | {"__extension__", EXTENSION_KEYW}, | 141 | {"__extension__", EXTENSION_KEYW}, |
| 150 | #line 37 "scripts/genksyms/keywords.gperf" | 142 | #line 35 "scripts/genksyms/keywords.gperf" |
| 151 | {"enum", ENUM_KEYW}, | 143 | {"enum", ENUM_KEYW}, |
| 152 | #line 8 "scripts/genksyms/keywords.gperf" | 144 | #line 19 "scripts/genksyms/keywords.gperf" |
| 153 | {"EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW}, | 145 | {"__volatile", VOLATILE_KEYW}, |
| 154 | #line 38 "scripts/genksyms/keywords.gperf" | 146 | #line 36 "scripts/genksyms/keywords.gperf" |
| 155 | {"extern", EXTERN_KEYW}, | 147 | {"extern", EXTERN_KEYW}, |
| 156 | {""}, | 148 | {""}, |
| 157 | #line 19 "scripts/genksyms/keywords.gperf" | 149 | #line 17 "scripts/genksyms/keywords.gperf" |
| 158 | {"__signed", SIGNED_KEYW}, | 150 | {"__signed", SIGNED_KEYW}, |
| 159 | #line 9 "scripts/genksyms/keywords.gperf" | 151 | #line 7 "scripts/genksyms/keywords.gperf" |
| 160 | {"EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, | 152 | {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, |
| 161 | #line 49 "scripts/genksyms/keywords.gperf" | 153 | {""}, |
| 162 | {"union", UNION_KEYW}, | 154 | #line 51 "scripts/genksyms/keywords.gperf" |
| 163 | #line 53 "scripts/genksyms/keywords.gperf" | ||
| 164 | {"typeof", TYPEOF_KEYW}, | 155 | {"typeof", TYPEOF_KEYW}, |
| 165 | #line 48 "scripts/genksyms/keywords.gperf" | 156 | #line 46 "scripts/genksyms/keywords.gperf" |
| 166 | {"typedef", TYPEDEF_KEYW}, | 157 | {"typedef", TYPEDEF_KEYW}, |
| 167 | #line 17 "scripts/genksyms/keywords.gperf" | 158 | #line 15 "scripts/genksyms/keywords.gperf" |
| 168 | {"__inline", INLINE_KEYW}, | 159 | {"__inline", INLINE_KEYW}, |
| 169 | #line 33 "scripts/genksyms/keywords.gperf" | 160 | #line 31 "scripts/genksyms/keywords.gperf" |
| 170 | {"auto", AUTO_KEYW}, | 161 | {"auto", AUTO_KEYW}, |
| 171 | #line 21 "scripts/genksyms/keywords.gperf" | 162 | #line 47 "scripts/genksyms/keywords.gperf" |
| 172 | {"__volatile", VOLATILE_KEYW}, | 163 | {"union", UNION_KEYW}, |
| 173 | {""}, {""}, | 164 | {""}, {""}, |
| 174 | #line 50 "scripts/genksyms/keywords.gperf" | 165 | #line 48 "scripts/genksyms/keywords.gperf" |
| 175 | {"unsigned", UNSIGNED_KEYW}, | 166 | {"unsigned", UNSIGNED_KEYW}, |
| 176 | {""}, | 167 | #line 49 "scripts/genksyms/keywords.gperf" |
| 177 | #line 44 "scripts/genksyms/keywords.gperf" | 168 | {"void", VOID_KEYW}, |
| 169 | #line 42 "scripts/genksyms/keywords.gperf" | ||
| 178 | {"short", SHORT_KEYW}, | 170 | {"short", SHORT_KEYW}, |
| 179 | #line 40 "scripts/genksyms/keywords.gperf" | 171 | {""}, {""}, |
| 172 | #line 50 "scripts/genksyms/keywords.gperf" | ||
| 173 | {"volatile", VOLATILE_KEYW}, | ||
| 174 | {""}, | ||
| 175 | #line 37 "scripts/genksyms/keywords.gperf" | ||
| 176 | {"float", FLOAT_KEYW}, | ||
| 177 | #line 34 "scripts/genksyms/keywords.gperf" | ||
| 178 | {"double", DOUBLE_KEYW}, | ||
| 179 | {""}, | ||
| 180 | #line 5 "scripts/genksyms/keywords.gperf" | ||
| 181 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, | ||
| 182 | {""}, {""}, | ||
| 183 | #line 38 "scripts/genksyms/keywords.gperf" | ||
| 180 | {"inline", INLINE_KEYW}, | 184 | {"inline", INLINE_KEYW}, |
| 185 | #line 6 "scripts/genksyms/keywords.gperf" | ||
| 186 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, | ||
| 187 | #line 41 "scripts/genksyms/keywords.gperf" | ||
| 188 | {"register", REGISTER_KEYW}, | ||
| 181 | {""}, | 189 | {""}, |
| 182 | #line 52 "scripts/genksyms/keywords.gperf" | 190 | #line 22 "scripts/genksyms/keywords.gperf" |
| 183 | {"volatile", VOLATILE_KEYW}, | ||
| 184 | #line 42 "scripts/genksyms/keywords.gperf" | ||
| 185 | {"long", LONG_KEYW}, | ||
| 186 | #line 24 "scripts/genksyms/keywords.gperf" | ||
| 187 | {"_Bool", BOOL_KEYW}, | 191 | {"_Bool", BOOL_KEYW}, |
| 188 | {""}, {""}, | ||
| 189 | #line 43 "scripts/genksyms/keywords.gperf" | 192 | #line 43 "scripts/genksyms/keywords.gperf" |
| 190 | {"register", REGISTER_KEYW}, | 193 | {"signed", SIGNED_KEYW}, |
| 191 | #line 51 "scripts/genksyms/keywords.gperf" | 194 | {""}, {""}, |
| 192 | {"void", VOID_KEYW}, | 195 | #line 40 "scripts/genksyms/keywords.gperf" |
| 193 | #line 39 "scripts/genksyms/keywords.gperf" | 196 | {"long", LONG_KEYW} |
| 194 | {"float", FLOAT_KEYW}, | ||
| 195 | #line 36 "scripts/genksyms/keywords.gperf" | ||
| 196 | {"double", DOUBLE_KEYW}, | ||
| 197 | {""}, {""}, {""}, {""}, | ||
| 198 | #line 45 "scripts/genksyms/keywords.gperf" | ||
| 199 | {"signed", SIGNED_KEYW} | ||
| 200 | }; | 197 | }; |
| 201 | 198 | ||
| 202 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | 199 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
diff --git a/scripts/genksyms/keywords.gperf b/scripts/genksyms/keywords.gperf index 8abe7ab8d88f..5ef3733225fb 100644 --- a/scripts/genksyms/keywords.gperf +++ b/scripts/genksyms/keywords.gperf | |||
| @@ -5,8 +5,6 @@ struct resword { const char *name; int token; } | |||
| 5 | EXPORT_SYMBOL, EXPORT_SYMBOL_KEYW | 5 | EXPORT_SYMBOL, EXPORT_SYMBOL_KEYW |
| 6 | EXPORT_SYMBOL_GPL, EXPORT_SYMBOL_KEYW | 6 | EXPORT_SYMBOL_GPL, EXPORT_SYMBOL_KEYW |
| 7 | EXPORT_SYMBOL_GPL_FUTURE, EXPORT_SYMBOL_KEYW | 7 | EXPORT_SYMBOL_GPL_FUTURE, EXPORT_SYMBOL_KEYW |
| 8 | EXPORT_UNUSED_SYMBOL, EXPORT_SYMBOL_KEYW | ||
| 9 | EXPORT_UNUSED_SYMBOL_GPL, EXPORT_SYMBOL_KEYW | ||
| 10 | __asm, ASM_KEYW | 8 | __asm, ASM_KEYW |
| 11 | __asm__, ASM_KEYW | 9 | __asm__, ASM_KEYW |
| 12 | __attribute, ATTRIBUTE_KEYW | 10 | __attribute, ATTRIBUTE_KEYW |
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl new file mode 100755 index 000000000000..60dc0c48c929 --- /dev/null +++ b/scripts/get_maintainer.pl | |||
| @@ -0,0 +1,515 @@ | |||
| 1 | #!/usr/bin/perl -w | ||
| 2 | # (c) 2007, Joe Perches <joe@perches.com> | ||
| 3 | # created from checkpatch.pl | ||
| 4 | # | ||
| 5 | # Print selected MAINTAINERS information for | ||
| 6 | # the files modified in a patch or for a file | ||
| 7 | # | ||
| 8 | # usage: perl scripts/get_maintainers.pl [OPTIONS] <patch> | ||
| 9 | # perl scripts/get_maintainers.pl [OPTIONS] -f <file> | ||
| 10 | # | ||
| 11 | # Licensed under the terms of the GNU GPL License version 2 | ||
| 12 | |||
| 13 | use strict; | ||
| 14 | |||
| 15 | my $P = $0; | ||
| 16 | my $V = '0.15'; | ||
| 17 | |||
| 18 | use Getopt::Long qw(:config no_auto_abbrev); | ||
| 19 | |||
| 20 | my $lk_path = "./"; | ||
| 21 | my $email = 1; | ||
| 22 | my $email_usename = 1; | ||
| 23 | my $email_maintainer = 1; | ||
| 24 | my $email_list = 1; | ||
| 25 | my $email_subscriber_list = 0; | ||
| 26 | my $email_git = 1; | ||
| 27 | my $email_git_penguin_chiefs = 0; | ||
| 28 | my $email_git_min_signatures = 1; | ||
| 29 | my $email_git_max_maintainers = 5; | ||
| 30 | my $email_git_since = "1-year-ago"; | ||
| 31 | my $output_multiline = 1; | ||
| 32 | my $output_separator = ", "; | ||
| 33 | my $scm = 0; | ||
| 34 | my $web = 0; | ||
| 35 | my $subsystem = 0; | ||
| 36 | my $status = 0; | ||
| 37 | my $from_filename = 0; | ||
| 38 | my $version = 0; | ||
| 39 | my $help = 0; | ||
| 40 | |||
| 41 | my $exit = 0; | ||
| 42 | |||
| 43 | my @penguin_chief = (); | ||
| 44 | push(@penguin_chief,"Linus Torvalds:torvalds\@linux-foundation.org"); | ||
| 45 | #Andrew wants in on most everything - 2009/01/14 | ||
| 46 | #push(@penguin_chief,"Andrew Morton:akpm\@linux-foundation.org"); | ||
| 47 | |||
| 48 | my @penguin_chief_names = (); | ||
| 49 | foreach my $chief (@penguin_chief) { | ||
| 50 | if ($chief =~ m/^(.*):(.*)/) { | ||
| 51 | my $chief_name = $1; | ||
| 52 | my $chief_addr = $2; | ||
| 53 | push(@penguin_chief_names, $chief_name); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | my $penguin_chiefs = "\(" . join("|",@penguin_chief_names) . "\)"; | ||
| 57 | |||
| 58 | if (!GetOptions( | ||
| 59 | 'email!' => \$email, | ||
| 60 | 'git!' => \$email_git, | ||
| 61 | 'git-chief-penguins!' => \$email_git_penguin_chiefs, | ||
| 62 | 'git-min-signatures=i' => \$email_git_min_signatures, | ||
| 63 | 'git-max-maintainers=i' => \$email_git_max_maintainers, | ||
| 64 | 'git-since=s' => \$email_git_since, | ||
| 65 | 'm!' => \$email_maintainer, | ||
| 66 | 'n!' => \$email_usename, | ||
| 67 | 'l!' => \$email_list, | ||
| 68 | 's!' => \$email_subscriber_list, | ||
| 69 | 'multiline!' => \$output_multiline, | ||
| 70 | 'separator=s' => \$output_separator, | ||
| 71 | 'subsystem!' => \$subsystem, | ||
| 72 | 'status!' => \$status, | ||
| 73 | 'scm!' => \$scm, | ||
| 74 | 'web!' => \$web, | ||
| 75 | 'f|file' => \$from_filename, | ||
| 76 | 'v|version' => \$version, | ||
| 77 | 'h|help' => \$help, | ||
| 78 | )) { | ||
| 79 | usage(); | ||
| 80 | die "$P: invalid argument\n"; | ||
| 81 | } | ||
| 82 | |||
| 83 | if ($help != 0) { | ||
| 84 | usage(); | ||
| 85 | exit 0; | ||
| 86 | } | ||
| 87 | |||
| 88 | if ($version != 0) { | ||
| 89 | print("${P} ${V}\n"); | ||
| 90 | exit 0; | ||
| 91 | } | ||
| 92 | |||
| 93 | if ($#ARGV < 0) { | ||
| 94 | usage(); | ||
| 95 | die "$P: argument missing: patchfile or -f file please\n"; | ||
| 96 | } | ||
| 97 | |||
| 98 | my $selections = $email + $scm + $status + $subsystem + $web; | ||
| 99 | if ($selections == 0) { | ||
| 100 | usage(); | ||
| 101 | die "$P: Missing required option: email, scm, status, subsystem or web\n"; | ||
| 102 | } | ||
| 103 | |||
| 104 | if ($email && ($email_maintainer + $email_list + $email_subscriber_list | ||
| 105 | + $email_git + $email_git_penguin_chiefs) == 0) { | ||
| 106 | usage(); | ||
| 107 | die "$P: Please select at least 1 email option\n"; | ||
| 108 | } | ||
| 109 | |||
| 110 | if (!top_of_kernel_tree($lk_path)) { | ||
| 111 | die "$P: The current directory does not appear to be " | ||
| 112 | . "a linux kernel source tree.\n"; | ||
| 113 | } | ||
| 114 | |||
| 115 | ## Read MAINTAINERS for type/value pairs | ||
| 116 | |||
| 117 | my @typevalue = (); | ||
| 118 | open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n"; | ||
| 119 | while (<MAINT>) { | ||
| 120 | my $line = $_; | ||
| 121 | |||
| 122 | if ($line =~ m/^(\C):\s*(.*)/) { | ||
| 123 | my $type = $1; | ||
| 124 | my $value = $2; | ||
| 125 | |||
| 126 | ##Filename pattern matching | ||
| 127 | if ($type eq "F" || $type eq "X") { | ||
| 128 | $value =~ s@\.@\\\.@g; ##Convert . to \. | ||
| 129 | $value =~ s/\*/\.\*/g; ##Convert * to .* | ||
| 130 | $value =~ s/\?/\./g; ##Convert ? to . | ||
| 131 | } | ||
| 132 | push(@typevalue, "$type:$value"); | ||
| 133 | } elsif (!/^(\s)*$/) { | ||
| 134 | $line =~ s/\n$//g; | ||
| 135 | push(@typevalue, $line); | ||
| 136 | } | ||
| 137 | } | ||
| 138 | close(MAINT); | ||
| 139 | |||
| 140 | ## use the filenames on the command line or find the filenames in the patchfiles | ||
| 141 | |||
| 142 | my @files = (); | ||
| 143 | |||
| 144 | foreach my $file (@ARGV) { | ||
| 145 | next if ((-d $file)); | ||
| 146 | if (!(-f $file)) { | ||
| 147 | die "$P: file '${file}' not found\n"; | ||
| 148 | } | ||
| 149 | if ($from_filename) { | ||
| 150 | push(@files, $file); | ||
| 151 | } else { | ||
| 152 | my $file_cnt = @files; | ||
| 153 | open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; | ||
| 154 | while (<PATCH>) { | ||
| 155 | if (m/^\+\+\+\s+(\S+)/) { | ||
| 156 | my $filename = $1; | ||
| 157 | $filename =~ s@^[^/]*/@@; | ||
| 158 | $filename =~ s@\n@@; | ||
| 159 | push(@files, $filename); | ||
| 160 | } | ||
| 161 | } | ||
| 162 | close(PATCH); | ||
| 163 | if ($file_cnt == @files) { | ||
| 164 | die "$P: file '${file}' doesn't appear to be a patch. " | ||
| 165 | . "Add -f to options?\n"; | ||
| 166 | } | ||
| 167 | @files = sort_and_uniq(@files); | ||
| 168 | } | ||
| 169 | } | ||
| 170 | |||
| 171 | my @email_to = (); | ||
| 172 | my @scm = (); | ||
| 173 | my @web = (); | ||
| 174 | my @subsystem = (); | ||
| 175 | my @status = (); | ||
| 176 | |||
| 177 | # Find responsible parties | ||
| 178 | |||
| 179 | foreach my $file (@files) { | ||
| 180 | |||
| 181 | #Do not match excluded file patterns | ||
| 182 | |||
| 183 | my $exclude = 0; | ||
| 184 | foreach my $line (@typevalue) { | ||
| 185 | if ($line =~ m/^(\C):(.*)/) { | ||
| 186 | my $type = $1; | ||
| 187 | my $value = $2; | ||
| 188 | if ($type eq 'X') { | ||
| 189 | if (file_match_pattern($file, $value)) { | ||
| 190 | $exclude = 1; | ||
| 191 | } | ||
| 192 | } | ||
| 193 | } | ||
| 194 | } | ||
| 195 | |||
| 196 | if (!$exclude) { | ||
| 197 | my $tvi = 0; | ||
| 198 | foreach my $line (@typevalue) { | ||
| 199 | if ($line =~ m/^(\C):(.*)/) { | ||
| 200 | my $type = $1; | ||
| 201 | my $value = $2; | ||
| 202 | if ($type eq 'F') { | ||
| 203 | if (file_match_pattern($file, $value)) { | ||
| 204 | add_categories($tvi); | ||
| 205 | } | ||
| 206 | } | ||
| 207 | } | ||
| 208 | $tvi++; | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 212 | if ($email && $email_git) { | ||
| 213 | recent_git_signoffs($file); | ||
| 214 | } | ||
| 215 | |||
| 216 | } | ||
| 217 | |||
| 218 | if ($email_git_penguin_chiefs) { | ||
| 219 | foreach my $chief (@penguin_chief) { | ||
| 220 | if ($chief =~ m/^(.*):(.*)/) { | ||
| 221 | my $chief_name = $1; | ||
| 222 | my $chief_addr = $2; | ||
| 223 | if ($email_usename) { | ||
| 224 | push(@email_to, format_email($chief_name, $chief_addr)); | ||
| 225 | } else { | ||
| 226 | push(@email_to, $chief_addr); | ||
| 227 | } | ||
| 228 | } | ||
| 229 | } | ||
| 230 | } | ||
| 231 | |||
| 232 | if ($email) { | ||
| 233 | my $address_cnt = @email_to; | ||
| 234 | if ($address_cnt == 0 && $email_list) { | ||
| 235 | push(@email_to, "linux-kernel\@vger.kernel.org"); | ||
| 236 | } | ||
| 237 | |||
| 238 | #Don't sort email address list, but do remove duplicates | ||
| 239 | @email_to = uniq(@email_to); | ||
| 240 | output(@email_to); | ||
| 241 | } | ||
| 242 | |||
| 243 | if ($scm) { | ||
| 244 | @scm = sort_and_uniq(@scm); | ||
| 245 | output(@scm); | ||
| 246 | } | ||
| 247 | |||
| 248 | if ($status) { | ||
| 249 | @status = sort_and_uniq(@status); | ||
| 250 | output(@status); | ||
| 251 | } | ||
| 252 | |||
| 253 | if ($subsystem) { | ||
| 254 | @subsystem = sort_and_uniq(@subsystem); | ||
| 255 | output(@subsystem); | ||
| 256 | } | ||
| 257 | |||
| 258 | if ($web) { | ||
| 259 | @web = sort_and_uniq(@web); | ||
| 260 | output(@web); | ||
| 261 | } | ||
| 262 | |||
| 263 | exit($exit); | ||
| 264 | |||
| 265 | sub file_match_pattern { | ||
| 266 | my ($file, $pattern) = @_; | ||
| 267 | if (substr($pattern, -1) eq "/") { | ||
| 268 | if ($file =~ m@^$pattern@) { | ||
| 269 | return 1; | ||
| 270 | } | ||
| 271 | } else { | ||
| 272 | if ($file =~ m@^$pattern@) { | ||
| 273 | my $s1 = ($file =~ tr@/@@); | ||
| 274 | my $s2 = ($pattern =~ tr@/@@); | ||
| 275 | if ($s1 == $s2) { | ||
| 276 | return 1; | ||
| 277 | } | ||
| 278 | } | ||
| 279 | } | ||
| 280 | return 0; | ||
| 281 | } | ||
| 282 | |||
| 283 | sub usage { | ||
| 284 | print <<EOT; | ||
| 285 | usage: $P [options] patchfile | ||
| 286 | $P [options] -f file | ||
| 287 | version: $V | ||
| 288 | |||
| 289 | MAINTAINER field selection options: | ||
| 290 | --email => print email address(es) if any | ||
| 291 | --git => include recent git \*-by: signers | ||
| 292 | --git-chief-penguins => include ${penguin_chiefs} | ||
| 293 | --git-min-signatures => number of signatures required (default: 1) | ||
| 294 | --git-max-maintainers => maximum maintainers to add (default: 5) | ||
| 295 | --git-since => git history to use (default: 1-year-ago) | ||
| 296 | --m => include maintainer(s) if any | ||
| 297 | --n => include name 'Full Name <addr\@domain.tld>' | ||
| 298 | --l => include list(s) if any | ||
| 299 | --s => include subscriber only list(s) if any | ||
| 300 | --scm => print SCM tree(s) if any | ||
| 301 | --status => print status if any | ||
| 302 | --subsystem => print subsystem name if any | ||
| 303 | --web => print website(s) if any | ||
| 304 | |||
| 305 | Output type options: | ||
| 306 | --separator [, ] => separator for multiple entries on 1 line | ||
| 307 | --multiline => print 1 entry per line | ||
| 308 | |||
| 309 | Default options: | ||
| 310 | [--email --git --m --l --multiline] | ||
| 311 | |||
| 312 | Other options: | ||
| 313 | --version -> show version | ||
| 314 | --help => show this help information | ||
| 315 | |||
| 316 | EOT | ||
| 317 | } | ||
| 318 | |||
| 319 | sub top_of_kernel_tree { | ||
| 320 | my ($lk_path) = @_; | ||
| 321 | |||
| 322 | if ($lk_path ne "" && substr($lk_path,length($lk_path)-1,1) ne "/") { | ||
| 323 | $lk_path .= "/"; | ||
| 324 | } | ||
| 325 | if ( (-f "${lk_path}COPYING") | ||
| 326 | && (-f "${lk_path}CREDITS") | ||
| 327 | && (-f "${lk_path}Kbuild") | ||
| 328 | && (-f "${lk_path}MAINTAINERS") | ||
| 329 | && (-f "${lk_path}Makefile") | ||
| 330 | && (-f "${lk_path}README") | ||
| 331 | && (-d "${lk_path}Documentation") | ||
| 332 | && (-d "${lk_path}arch") | ||
| 333 | && (-d "${lk_path}include") | ||
| 334 | && (-d "${lk_path}drivers") | ||
| 335 | && (-d "${lk_path}fs") | ||
| 336 | && (-d "${lk_path}init") | ||
| 337 | && (-d "${lk_path}ipc") | ||
| 338 | && (-d "${lk_path}kernel") | ||
| 339 | && (-d "${lk_path}lib") | ||
| 340 | && (-d "${lk_path}scripts")) { | ||
| 341 | return 1; | ||
| 342 | } | ||
| 343 | return 0; | ||
| 344 | } | ||
| 345 | |||
| 346 | sub format_email { | ||
| 347 | my ($name, $email) = @_; | ||
| 348 | |||
| 349 | $name =~ s/^\s+|\s+$//g; | ||
| 350 | $email =~ s/^\s+|\s+$//g; | ||
| 351 | |||
| 352 | my $formatted_email = ""; | ||
| 353 | |||
| 354 | if ($name =~ /[^a-z0-9 \.\-]/i) { ##has "must quote" chars | ||
| 355 | $name =~ s/(?<!\\)"/\\"/g; ##escape quotes | ||
| 356 | $formatted_email = "\"${name}\"\ \<${email}\>"; | ||
| 357 | } else { | ||
| 358 | $formatted_email = "${name} \<${email}\>"; | ||
| 359 | } | ||
| 360 | return $formatted_email; | ||
| 361 | } | ||
| 362 | |||
| 363 | sub add_categories { | ||
| 364 | my ($index) = @_; | ||
| 365 | |||
| 366 | $index = $index - 1; | ||
| 367 | while ($index >= 0) { | ||
| 368 | my $tv = $typevalue[$index]; | ||
| 369 | if ($tv =~ m/^(\C):(.*)/) { | ||
| 370 | my $ptype = $1; | ||
| 371 | my $pvalue = $2; | ||
| 372 | if ($ptype eq "L") { | ||
| 373 | my $subscr = $pvalue; | ||
| 374 | if ($subscr =~ m/\s*\(subscribers-only\)/) { | ||
| 375 | if ($email_subscriber_list) { | ||
| 376 | $subscr =~ s/\s*\(subscribers-only\)//g; | ||
| 377 | push(@email_to, $subscr); | ||
| 378 | } | ||
| 379 | } else { | ||
| 380 | if ($email_list) { | ||
| 381 | push(@email_to, $pvalue); | ||
| 382 | } | ||
| 383 | } | ||
| 384 | } elsif ($ptype eq "M") { | ||
| 385 | if ($email_maintainer) { | ||
| 386 | if ($index >= 0) { | ||
| 387 | my $tv = $typevalue[$index - 1]; | ||
| 388 | if ($tv =~ m/^(\C):(.*)/) { | ||
| 389 | if ($1 eq "P" && $email_usename) { | ||
| 390 | push(@email_to, format_email($2, $pvalue)); | ||
| 391 | } else { | ||
| 392 | push(@email_to, $pvalue); | ||
| 393 | } | ||
| 394 | } | ||
| 395 | } else { | ||
| 396 | push(@email_to, $pvalue); | ||
| 397 | } | ||
| 398 | } | ||
| 399 | } elsif ($ptype eq "T") { | ||
| 400 | push(@scm, $pvalue); | ||
| 401 | } elsif ($ptype eq "W") { | ||
| 402 | push(@web, $pvalue); | ||
| 403 | } elsif ($ptype eq "S") { | ||
| 404 | push(@status, $pvalue); | ||
| 405 | } | ||
| 406 | |||
| 407 | $index--; | ||
| 408 | } else { | ||
| 409 | push(@subsystem,$tv); | ||
| 410 | $index = -1; | ||
| 411 | } | ||
| 412 | } | ||
| 413 | } | ||
| 414 | |||
| 415 | sub which { | ||
| 416 | my ($bin) = @_; | ||
| 417 | |||
| 418 | foreach my $path (split /:/, $ENV{PATH}) { | ||
| 419 | if (-e "$path/$bin") { | ||
| 420 | return "$path/$bin"; | ||
| 421 | } | ||
| 422 | } | ||
| 423 | |||
| 424 | return ""; | ||
| 425 | } | ||
| 426 | |||
| 427 | sub recent_git_signoffs { | ||
| 428 | my ($file) = @_; | ||
| 429 | |||
| 430 | my $sign_offs = ""; | ||
| 431 | my $cmd = ""; | ||
| 432 | my $output = ""; | ||
| 433 | my $count = 0; | ||
| 434 | my @lines = (); | ||
| 435 | |||
| 436 | if (which("git") eq "") { | ||
| 437 | die("$P: git not found. Add --nogit to options?\n"); | ||
| 438 | } | ||
| 439 | |||
| 440 | $cmd = "git log --since=${email_git_since} -- ${file}"; | ||
| 441 | $cmd .= " | grep -Pi \"^[-_ a-z]+by:.*\\\@\""; | ||
| 442 | if (!$email_git_penguin_chiefs) { | ||
| 443 | $cmd .= " | grep -Pv \"${penguin_chiefs}\""; | ||
| 444 | } | ||
| 445 | $cmd .= " | cut -f2- -d\":\""; | ||
| 446 | $cmd .= " | sed -e \"s/^\\s+//g\""; | ||
| 447 | $cmd .= " | sort | uniq -c | sort -rn"; | ||
| 448 | |||
| 449 | $output = `${cmd}`; | ||
| 450 | $output =~ s/^\s*//gm; | ||
| 451 | |||
| 452 | @lines = split("\n", $output); | ||
| 453 | foreach my $line (@lines) { | ||
| 454 | if ($line =~ m/([0-9]+)\s+(.*)/) { | ||
| 455 | my $sign_offs = $1; | ||
| 456 | $line = $2; | ||
| 457 | $count++; | ||
| 458 | if ($sign_offs < $email_git_min_signatures || | ||
| 459 | $count > $email_git_max_maintainers) { | ||
| 460 | last; | ||
| 461 | } | ||
| 462 | } else { | ||
| 463 | die("$P: Unexpected git output: ${line}\n"); | ||
| 464 | } | ||
| 465 | if ($line =~ m/(.+)<(.+)>/) { | ||
| 466 | my $git_name = $1; | ||
| 467 | my $git_addr = $2; | ||
| 468 | $git_name =~ tr/^\"//; | ||
| 469 | $git_name =~ tr/^\\s*//; | ||
| 470 | $git_name =~ tr/\"$//; | ||
| 471 | $git_name =~ tr/\\s*$//; | ||
| 472 | if ($email_usename) { | ||
| 473 | push(@email_to, format_email($git_name, $git_addr)); | ||
| 474 | } else { | ||
| 475 | push(@email_to, $git_addr); | ||
| 476 | } | ||
| 477 | } elsif ($line =~ m/<(.+)>/) { | ||
| 478 | my $git_addr = $1; | ||
| 479 | push(@email_to, $git_addr); | ||
| 480 | } else { | ||
| 481 | push(@email_to, $line); | ||
| 482 | } | ||
| 483 | } | ||
| 484 | return $output; | ||
| 485 | } | ||
| 486 | |||
| 487 | sub uniq { | ||
| 488 | my @parms = @_; | ||
| 489 | |||
| 490 | my %saw; | ||
| 491 | @parms = grep(!$saw{$_}++, @parms); | ||
| 492 | return @parms; | ||
| 493 | } | ||
| 494 | |||
| 495 | sub sort_and_uniq { | ||
| 496 | my @parms = @_; | ||
| 497 | |||
| 498 | my %saw; | ||
| 499 | @parms = sort @parms; | ||
| 500 | @parms = grep(!$saw{$_}++, @parms); | ||
| 501 | return @parms; | ||
| 502 | } | ||
| 503 | |||
| 504 | sub output { | ||
| 505 | my @parms = @_; | ||
| 506 | |||
| 507 | if ($output_multiline) { | ||
| 508 | foreach my $line (@parms) { | ||
| 509 | print("${line}\n"); | ||
| 510 | } | ||
| 511 | } else { | ||
| 512 | print(join($output_separator, @parms)); | ||
| 513 | print("\n"); | ||
| 514 | } | ||
| 515 | } | ||
diff --git a/scripts/headerdep.pl b/scripts/headerdep.pl index 97399da89ef2..b7f6c560e24d 100755 --- a/scripts/headerdep.pl +++ b/scripts/headerdep.pl | |||
| @@ -19,7 +19,7 @@ my $opt_graph; | |||
| 19 | version => \&version, | 19 | version => \&version, |
| 20 | 20 | ||
| 21 | all => \$opt_all, | 21 | all => \$opt_all, |
| 22 | I => \@opt_include, | 22 | "I=s" => \@opt_include, |
| 23 | graph => \$opt_graph, | 23 | graph => \$opt_graph, |
| 24 | ); | 24 | ); |
| 25 | 25 | ||
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/ihex2fw.c b/scripts/ihex2fw.c deleted file mode 100644 index 8f7fdaa9e010..000000000000 --- a/scripts/ihex2fw.c +++ /dev/null | |||
| @@ -1,268 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Parser/loader for IHEX formatted data. | ||
| 3 | * | ||
| 4 | * Copyright © 2008 David Woodhouse <dwmw2@infradead.org> | ||
| 5 | * Copyright © 2005 Jan Harkes <jaharkes@cs.cmu.edu> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <stdint.h> | ||
| 13 | #include <arpa/inet.h> | ||
| 14 | #include <stdio.h> | ||
| 15 | #include <errno.h> | ||
| 16 | #include <sys/types.h> | ||
| 17 | #include <sys/stat.h> | ||
| 18 | #include <sys/mman.h> | ||
| 19 | #include <fcntl.h> | ||
| 20 | #include <string.h> | ||
| 21 | #include <unistd.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | #define _GNU_SOURCE | ||
| 24 | #include <getopt.h> | ||
| 25 | |||
| 26 | |||
| 27 | struct ihex_binrec { | ||
| 28 | struct ihex_binrec *next; /* not part of the real data structure */ | ||
| 29 | uint32_t addr; | ||
| 30 | uint16_t len; | ||
| 31 | uint8_t data[]; | ||
| 32 | }; | ||
| 33 | |||
| 34 | /** | ||
| 35 | * nybble/hex are little helpers to parse hexadecimal numbers to a byte value | ||
| 36 | **/ | ||
| 37 | static uint8_t nybble(const uint8_t n) | ||
| 38 | { | ||
| 39 | if (n >= '0' && n <= '9') return n - '0'; | ||
| 40 | else if (n >= 'A' && n <= 'F') return n - ('A' - 10); | ||
| 41 | else if (n >= 'a' && n <= 'f') return n - ('a' - 10); | ||
| 42 | return 0; | ||
| 43 | } | ||
| 44 | |||
| 45 | static uint8_t hex(const uint8_t *data, uint8_t *crc) | ||
| 46 | { | ||
| 47 | uint8_t val = (nybble(data[0]) << 4) | nybble(data[1]); | ||
| 48 | *crc += val; | ||
| 49 | return val; | ||
| 50 | } | ||
| 51 | |||
| 52 | static int process_ihex(uint8_t *data, ssize_t size); | ||
| 53 | static void file_record(struct ihex_binrec *record); | ||
| 54 | static int output_records(int outfd); | ||
| 55 | |||
| 56 | static int sort_records = 0; | ||
| 57 | static int wide_records = 0; | ||
| 58 | |||
| 59 | int usage(void) | ||
| 60 | { | ||
| 61 | fprintf(stderr, "ihex2fw: Convert ihex files into binary " | ||
| 62 | "representation for use by Linux kernel\n"); | ||
| 63 | fprintf(stderr, "usage: ihex2fw [<options>] <src.HEX> <dst.fw>\n"); | ||
| 64 | fprintf(stderr, " -w: wide records (16-bit length)\n"); | ||
| 65 | fprintf(stderr, " -s: sort records by address\n"); | ||
| 66 | return 1; | ||
| 67 | } | ||
| 68 | |||
| 69 | int main(int argc, char **argv) | ||
| 70 | { | ||
| 71 | int infd, outfd; | ||
| 72 | struct stat st; | ||
| 73 | uint8_t *data; | ||
| 74 | int opt; | ||
| 75 | |||
| 76 | while ((opt = getopt(argc, argv, "ws")) != -1) { | ||
| 77 | switch (opt) { | ||
| 78 | case 'w': | ||
| 79 | wide_records = 1; | ||
| 80 | break; | ||
| 81 | case 's': | ||
| 82 | sort_records = 1; | ||
| 83 | break; | ||
| 84 | default: | ||
| 85 | return usage(); | ||
| 86 | } | ||
| 87 | } | ||
| 88 | |||
| 89 | if (optind + 2 != argc) | ||
| 90 | return usage(); | ||
| 91 | |||
| 92 | if (!strcmp(argv[optind], "-")) | ||
| 93 | infd = 0; | ||
| 94 | else | ||
| 95 | infd = open(argv[optind], O_RDONLY); | ||
| 96 | if (infd == -1) { | ||
| 97 | fprintf(stderr, "Failed to open source file: %s", | ||
| 98 | strerror(errno)); | ||
| 99 | return usage(); | ||
| 100 | } | ||
| 101 | if (fstat(infd, &st)) { | ||
| 102 | perror("stat"); | ||
| 103 | return 1; | ||
| 104 | } | ||
| 105 | data = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, infd, 0); | ||
| 106 | if (data == MAP_FAILED) { | ||
| 107 | perror("mmap"); | ||
| 108 | return 1; | ||
| 109 | } | ||
| 110 | |||
| 111 | if (!strcmp(argv[optind+1], "-")) | ||
| 112 | outfd = 1; | ||
| 113 | else | ||
| 114 | outfd = open(argv[optind+1], O_TRUNC|O_CREAT|O_WRONLY, 0644); | ||
| 115 | if (outfd == -1) { | ||
| 116 | fprintf(stderr, "Failed to open destination file: %s", | ||
| 117 | strerror(errno)); | ||
| 118 | return usage(); | ||
| 119 | } | ||
| 120 | if (process_ihex(data, st.st_size)) | ||
| 121 | return 1; | ||
| 122 | |||
| 123 | output_records(outfd); | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 127 | static int process_ihex(uint8_t *data, ssize_t size) | ||
| 128 | { | ||
| 129 | struct ihex_binrec *record; | ||
| 130 | uint32_t offset = 0; | ||
| 131 | uint8_t type, crc = 0, crcbyte = 0; | ||
| 132 | int i, j; | ||
| 133 | int line = 1; | ||
| 134 | int len; | ||
| 135 | |||
| 136 | i = 0; | ||
| 137 | next_record: | ||
| 138 | /* search for the start of record character */ | ||
| 139 | while (i < size) { | ||
| 140 | if (data[i] == '\n') line++; | ||
| 141 | if (data[i++] == ':') break; | ||
| 142 | } | ||
| 143 | |||
| 144 | /* Minimum record length would be about 10 characters */ | ||
| 145 | if (i + 10 > size) { | ||
| 146 | fprintf(stderr, "Can't find valid record at line %d\n", line); | ||
| 147 | return -EINVAL; | ||
| 148 | } | ||
| 149 | |||
| 150 | len = hex(data + i, &crc); i += 2; | ||
| 151 | if (wide_records) { | ||
| 152 | len <<= 8; | ||
| 153 | len += hex(data + i, &crc); i += 2; | ||
| 154 | } | ||
| 155 | record = malloc((sizeof (*record) + len + 3) & ~3); | ||
| 156 | if (!record) { | ||
| 157 | fprintf(stderr, "out of memory for records\n"); | ||
| 158 | return -ENOMEM; | ||
| 159 | } | ||
| 160 | memset(record, 0, (sizeof(*record) + len + 3) & ~3); | ||
| 161 | record->len = len; | ||
| 162 | |||
| 163 | /* now check if we have enough data to read everything */ | ||
| 164 | if (i + 8 + (record->len * 2) > size) { | ||
| 165 | fprintf(stderr, "Not enough data to read complete record at line %d\n", | ||
| 166 | line); | ||
| 167 | return -EINVAL; | ||
| 168 | } | ||
| 169 | |||
| 170 | record->addr = hex(data + i, &crc) << 8; i += 2; | ||
| 171 | record->addr |= hex(data + i, &crc); i += 2; | ||
| 172 | type = hex(data + i, &crc); i += 2; | ||
| 173 | |||
| 174 | for (j = 0; j < record->len; j++, i += 2) | ||
| 175 | record->data[j] = hex(data + i, &crc); | ||
| 176 | |||
| 177 | /* check CRC */ | ||
| 178 | crcbyte = hex(data + i, &crc); i += 2; | ||
| 179 | if (crc != 0) { | ||
| 180 | fprintf(stderr, "CRC failure at line %d: got 0x%X, expected 0x%X\n", | ||
| 181 | line, crcbyte, (unsigned char)(crcbyte-crc)); | ||
| 182 | return -EINVAL; | ||
| 183 | } | ||
| 184 | |||
| 185 | /* Done reading the record */ | ||
| 186 | switch (type) { | ||
| 187 | case 0: | ||
| 188 | /* old style EOF record? */ | ||
| 189 | if (!record->len) | ||
| 190 | break; | ||
| 191 | |||
| 192 | record->addr += offset; | ||
| 193 | file_record(record); | ||
| 194 | goto next_record; | ||
| 195 | |||
| 196 | case 1: /* End-Of-File Record */ | ||
| 197 | if (record->addr || record->len) { | ||
| 198 | fprintf(stderr, "Bad EOF record (type 01) format at line %d", | ||
| 199 | line); | ||
| 200 | return -EINVAL; | ||
| 201 | } | ||
| 202 | break; | ||
| 203 | |||
| 204 | case 2: /* Extended Segment Address Record (HEX86) */ | ||
| 205 | case 4: /* Extended Linear Address Record (HEX386) */ | ||
| 206 | if (record->addr || record->len != 2) { | ||
| 207 | fprintf(stderr, "Bad HEX86/HEX386 record (type %02X) at line %d\n", | ||
| 208 | type, line); | ||
| 209 | return -EINVAL; | ||
| 210 | } | ||
| 211 | |||
| 212 | /* We shouldn't really be using the offset for HEX86 because | ||
| 213 | * the wraparound case is specified quite differently. */ | ||
| 214 | offset = record->data[0] << 8 | record->data[1]; | ||
| 215 | offset <<= (type == 2 ? 4 : 16); | ||
| 216 | goto next_record; | ||
| 217 | |||
| 218 | case 3: /* Start Segment Address Record */ | ||
| 219 | case 5: /* Start Linear Address Record */ | ||
| 220 | if (record->addr || record->len != 4) { | ||
| 221 | fprintf(stderr, "Bad Start Address record (type %02X) at line %d\n", | ||
| 222 | type, line); | ||
| 223 | return -EINVAL; | ||
| 224 | } | ||
| 225 | |||
| 226 | /* These records contain the CS/IP or EIP where execution | ||
| 227 | * starts. Don't really know what to do with them. */ | ||
| 228 | goto next_record; | ||
| 229 | |||
| 230 | default: | ||
| 231 | fprintf(stderr, "Unknown record (type %02X)\n", type); | ||
| 232 | return -EINVAL; | ||
| 233 | } | ||
| 234 | |||
| 235 | return 0; | ||
| 236 | } | ||
| 237 | |||
| 238 | static struct ihex_binrec *records; | ||
| 239 | |||
| 240 | static void file_record(struct ihex_binrec *record) | ||
| 241 | { | ||
| 242 | struct ihex_binrec **p = &records; | ||
| 243 | |||
| 244 | while ((*p) && (!sort_records || (*p)->addr < record->addr)) | ||
| 245 | p = &((*p)->next); | ||
| 246 | |||
| 247 | record->next = *p; | ||
| 248 | *p = record; | ||
| 249 | } | ||
| 250 | |||
| 251 | static int output_records(int outfd) | ||
| 252 | { | ||
| 253 | unsigned char zeroes[6] = {0, 0, 0, 0, 0, 0}; | ||
| 254 | struct ihex_binrec *p = records; | ||
| 255 | |||
| 256 | while (p) { | ||
| 257 | uint16_t writelen = (p->len + 9) & ~3; | ||
| 258 | |||
| 259 | p->addr = htonl(p->addr); | ||
| 260 | p->len = htons(p->len); | ||
| 261 | write(outfd, &p->addr, writelen); | ||
| 262 | p = p->next; | ||
| 263 | } | ||
| 264 | /* EOF record is zero length, since we don't bother to represent | ||
| 265 | the type field in the binary version */ | ||
| 266 | write(outfd, zeroes, 6); | ||
| 267 | return 0; | ||
| 268 | } | ||
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 92758120a767..6654cbed965b 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
| @@ -130,9 +130,18 @@ static int read_symbol(FILE *in, struct sym_entry *s) | |||
| 130 | static int symbol_valid(struct sym_entry *s) | 130 | static int symbol_valid(struct sym_entry *s) |
| 131 | { | 131 | { |
| 132 | /* Symbols which vary between passes. Passes 1 and 2 must have | 132 | /* Symbols which vary between passes. Passes 1 and 2 must have |
| 133 | * identical symbol lists. | 133 | * identical symbol lists. The kallsyms_* symbols below are only added |
| 134 | * after pass 1, they would be included in pass 2 when --all-symbols is | ||
| 135 | * specified so exclude them to get a stable symbol list. | ||
| 134 | */ | 136 | */ |
| 135 | static char *special_symbols[] = { | 137 | static char *special_symbols[] = { |
| 138 | "kallsyms_addresses", | ||
| 139 | "kallsyms_num_syms", | ||
| 140 | "kallsyms_names", | ||
| 141 | "kallsyms_markers", | ||
| 142 | "kallsyms_token_table", | ||
| 143 | "kallsyms_token_index", | ||
| 144 | |||
| 136 | /* Exclude linker generated symbols which vary between passes */ | 145 | /* Exclude linker generated symbols which vary between passes */ |
| 137 | "_SDA_BASE_", /* ppc */ | 146 | "_SDA_BASE_", /* ppc */ |
| 138 | "_SDA2_BASE_", /* ppc */ | 147 | "_SDA2_BASE_", /* ppc */ |
| @@ -164,9 +173,7 @@ static int symbol_valid(struct sym_entry *s) | |||
| 164 | } | 173 | } |
| 165 | 174 | ||
| 166 | /* Exclude symbols which vary between passes. */ | 175 | /* Exclude symbols which vary between passes. */ |
| 167 | if (strstr((char *)s->sym + offset, "_compiled.") || | 176 | if (strstr((char *)s->sym + offset, "_compiled.")) |
| 168 | strncmp((char*)s->sym + offset, "__compound_literal.", 19) == 0 || | ||
| 169 | strncmp((char*)s->sym + offset, "__compound_literal$", 19) == 0) | ||
| 170 | return 0; | 177 | return 0; |
| 171 | 178 | ||
| 172 | for (i = 0; special_symbols[i]; i++) | 179 | for (i = 0; special_symbols[i]; i++) |
| @@ -493,6 +500,51 @@ static void optimize_token_table(void) | |||
| 493 | optimize_result(); | 500 | optimize_result(); |
| 494 | } | 501 | } |
| 495 | 502 | ||
| 503 | /* guess for "linker script provide" symbol */ | ||
| 504 | static int may_be_linker_script_provide_symbol(const struct sym_entry *se) | ||
| 505 | { | ||
| 506 | const char *symbol = (char *)se->sym + 1; | ||
| 507 | int len = se->len - 1; | ||
| 508 | |||
| 509 | if (len < 8) | ||
| 510 | return 0; | ||
| 511 | |||
| 512 | if (symbol[0] != '_' || symbol[1] != '_') | ||
| 513 | return 0; | ||
| 514 | |||
| 515 | /* __start_XXXXX */ | ||
| 516 | if (!memcmp(symbol + 2, "start_", 6)) | ||
| 517 | return 1; | ||
| 518 | |||
| 519 | /* __stop_XXXXX */ | ||
| 520 | if (!memcmp(symbol + 2, "stop_", 5)) | ||
| 521 | return 1; | ||
| 522 | |||
| 523 | /* __end_XXXXX */ | ||
| 524 | if (!memcmp(symbol + 2, "end_", 4)) | ||
| 525 | return 1; | ||
| 526 | |||
| 527 | /* __XXXXX_start */ | ||
| 528 | if (!memcmp(symbol + len - 6, "_start", 6)) | ||
| 529 | return 1; | ||
| 530 | |||
| 531 | /* __XXXXX_end */ | ||
| 532 | if (!memcmp(symbol + len - 4, "_end", 4)) | ||
| 533 | return 1; | ||
| 534 | |||
| 535 | return 0; | ||
| 536 | } | ||
| 537 | |||
| 538 | static int prefix_underscores_count(const char *str) | ||
| 539 | { | ||
| 540 | const char *tail = str; | ||
| 541 | |||
| 542 | while (*tail != '_') | ||
| 543 | tail++; | ||
| 544 | |||
| 545 | return tail - str; | ||
| 546 | } | ||
| 547 | |||
| 496 | static int compare_symbols(const void *a, const void *b) | 548 | static int compare_symbols(const void *a, const void *b) |
| 497 | { | 549 | { |
| 498 | const struct sym_entry *sa; | 550 | const struct sym_entry *sa; |
| @@ -514,6 +566,18 @@ static int compare_symbols(const void *a, const void *b) | |||
| 514 | if (wa != wb) | 566 | if (wa != wb) |
| 515 | return wa - wb; | 567 | return wa - wb; |
| 516 | 568 | ||
| 569 | /* sort by "linker script provide" type */ | ||
| 570 | wa = may_be_linker_script_provide_symbol(sa); | ||
| 571 | wb = may_be_linker_script_provide_symbol(sb); | ||
| 572 | if (wa != wb) | ||
| 573 | return wa - wb; | ||
| 574 | |||
| 575 | /* sort by the number of prefix underscores */ | ||
| 576 | wa = prefix_underscores_count((const char *)sa->sym + 1); | ||
| 577 | wb = prefix_underscores_count((const char *)sb->sym + 1); | ||
| 578 | if (wa != wb) | ||
| 579 | return wa - wb; | ||
| 580 | |||
| 517 | /* sort by initial order, so that other symbols are left undisturbed */ | 581 | /* sort by initial order, so that other symbols are left undisturbed */ |
| 518 | return sa->start_pos - sb->start_pos; | 582 | return sa->start_pos - sb->start_pos; |
| 519 | } | 583 | } |
| @@ -543,10 +607,8 @@ int main(int argc, char **argv) | |||
| 543 | usage(); | 607 | usage(); |
| 544 | 608 | ||
| 545 | read_map(stdin); | 609 | read_map(stdin); |
| 546 | if (table_cnt) { | 610 | sort_symbols(); |
| 547 | sort_symbols(); | 611 | optimize_token_table(); |
| 548 | optimize_token_table(); | ||
| 549 | } | ||
| 550 | write_src(); | 612 | write_src(); |
| 551 | 613 | ||
| 552 | return 0; | 614 | return 0; |
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/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c index 6eb72a7f2562..8d9ce22b0fc5 100644 --- a/scripts/kconfig/kxgettext.c +++ b/scripts/kconfig/kxgettext.c | |||
| @@ -43,6 +43,10 @@ static char *escape(const char* text, char *bf, int len) | |||
| 43 | ++text; | 43 | ++text; |
| 44 | goto next; | 44 | goto next; |
| 45 | } | 45 | } |
| 46 | else if (*text == '\\') { | ||
| 47 | *bfp++ = '\\'; | ||
| 48 | len--; | ||
| 49 | } | ||
| 46 | *bfp++ = *text++; | 50 | *bfp++ = *text++; |
| 47 | next: | 51 | next: |
| 48 | --len; | 52 | --len; |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 8bb83a100edb..0f11870116dc 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -1827,6 +1827,40 @@ sub reset_state { | |||
| 1827 | $state = 0; | 1827 | $state = 0; |
| 1828 | } | 1828 | } |
| 1829 | 1829 | ||
| 1830 | sub syscall_munge() { | ||
| 1831 | my $void = 0; | ||
| 1832 | |||
| 1833 | $prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs | ||
| 1834 | ## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { | ||
| 1835 | if ($prototype =~ m/SYSCALL_DEFINE0/) { | ||
| 1836 | $void = 1; | ||
| 1837 | ## $prototype = "long sys_$1(void)"; | ||
| 1838 | } | ||
| 1839 | |||
| 1840 | $prototype =~ s/SYSCALL_DEFINE.*\(/long sys_/; # fix return type & func name | ||
| 1841 | if ($prototype =~ m/long (sys_.*?),/) { | ||
| 1842 | $prototype =~ s/,/\(/; | ||
| 1843 | } elsif ($void) { | ||
| 1844 | $prototype =~ s/\)/\(void\)/; | ||
| 1845 | } | ||
| 1846 | |||
| 1847 | # now delete all of the odd-number commas in $prototype | ||
| 1848 | # so that arg types & arg names don't have a comma between them | ||
| 1849 | my $count = 0; | ||
| 1850 | my $len = length($prototype); | ||
| 1851 | if ($void) { | ||
| 1852 | $len = 0; # skip the for-loop | ||
| 1853 | } | ||
| 1854 | for (my $ix = 0; $ix < $len; $ix++) { | ||
| 1855 | if (substr($prototype, $ix, 1) eq ',') { | ||
| 1856 | $count++; | ||
| 1857 | if ($count % 2 == 1) { | ||
| 1858 | substr($prototype, $ix, 1) = ' '; | ||
| 1859 | } | ||
| 1860 | } | ||
| 1861 | } | ||
| 1862 | } | ||
| 1863 | |||
| 1830 | sub process_state3_function($$) { | 1864 | sub process_state3_function($$) { |
| 1831 | my $x = shift; | 1865 | my $x = shift; |
| 1832 | my $file = shift; | 1866 | my $file = shift; |
| @@ -1839,11 +1873,15 @@ sub process_state3_function($$) { | |||
| 1839 | elsif ($x =~ /([^\{]*)/) { | 1873 | elsif ($x =~ /([^\{]*)/) { |
| 1840 | $prototype .= $1; | 1874 | $prototype .= $1; |
| 1841 | } | 1875 | } |
| 1876 | |||
| 1842 | if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) { | 1877 | if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) { |
| 1843 | $prototype =~ s@/\*.*?\*/@@gos; # strip comments. | 1878 | $prototype =~ s@/\*.*?\*/@@gos; # strip comments. |
| 1844 | $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. | 1879 | $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. |
| 1845 | $prototype =~ s@^\s+@@gos; # strip leading spaces | 1880 | $prototype =~ s@^\s+@@gos; # strip leading spaces |
| 1846 | dump_function($prototype,$file); | 1881 | if ($prototype =~ /SYSCALL_DEFINE/) { |
| 1882 | syscall_munge(); | ||
| 1883 | } | ||
| 1884 | dump_function($prototype, $file); | ||
| 1847 | reset_state(); | 1885 | reset_state(); |
| 1848 | } | 1886 | } |
| 1849 | } | 1887 | } |
diff --git a/scripts/markup_oops.pl b/scripts/markup_oops.pl index d40449cafa84..528492bcba5b 100644 --- a/scripts/markup_oops.pl +++ b/scripts/markup_oops.pl | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #!/usr/bin/perl -w | 1 | #!/usr/bin/perl |
| 2 | 2 | ||
| 3 | use File::Basename; | 3 | use File::Basename; |
| 4 | 4 | ||
| @@ -29,27 +29,151 @@ my $filename = $vmlinux_name; | |||
| 29 | my $target = "0"; | 29 | my $target = "0"; |
| 30 | my $function; | 30 | my $function; |
| 31 | my $module = ""; | 31 | my $module = ""; |
| 32 | my $func_offset; | 32 | my $func_offset = 0; |
| 33 | my $vmaoffset = 0; | 33 | my $vmaoffset = 0; |
| 34 | 34 | ||
| 35 | my %regs; | ||
| 36 | |||
| 37 | |||
| 38 | sub parse_x86_regs | ||
| 39 | { | ||
| 40 | my ($line) = @_; | ||
| 41 | if ($line =~ /EAX: ([0-9a-f]+) EBX: ([0-9a-f]+) ECX: ([0-9a-f]+) EDX: ([0-9a-f]+)/) { | ||
| 42 | $regs{"%eax"} = $1; | ||
| 43 | $regs{"%ebx"} = $2; | ||
| 44 | $regs{"%ecx"} = $3; | ||
| 45 | $regs{"%edx"} = $4; | ||
| 46 | } | ||
| 47 | if ($line =~ /ESI: ([0-9a-f]+) EDI: ([0-9a-f]+) EBP: ([0-9a-f]+) ESP: ([0-9a-f]+)/) { | ||
| 48 | $regs{"%esi"} = $1; | ||
| 49 | $regs{"%edi"} = $2; | ||
| 50 | $regs{"%esp"} = $4; | ||
| 51 | } | ||
| 52 | if ($line =~ /RAX: ([0-9a-f]+) RBX: ([0-9a-f]+) RCX: ([0-9a-f]+)/) { | ||
| 53 | $regs{"%eax"} = $1; | ||
| 54 | $regs{"%ebx"} = $2; | ||
| 55 | $regs{"%ecx"} = $3; | ||
| 56 | } | ||
| 57 | if ($line =~ /RDX: ([0-9a-f]+) RSI: ([0-9a-f]+) RDI: ([0-9a-f]+)/) { | ||
| 58 | $regs{"%edx"} = $1; | ||
| 59 | $regs{"%esi"} = $2; | ||
| 60 | $regs{"%edi"} = $3; | ||
| 61 | } | ||
| 62 | if ($line =~ /RBP: ([0-9a-f]+) R08: ([0-9a-f]+) R09: ([0-9a-f]+)/) { | ||
| 63 | $regs{"%r08"} = $2; | ||
| 64 | $regs{"%r09"} = $3; | ||
| 65 | } | ||
| 66 | if ($line =~ /R10: ([0-9a-f]+) R11: ([0-9a-f]+) R12: ([0-9a-f]+)/) { | ||
| 67 | $regs{"%r10"} = $1; | ||
| 68 | $regs{"%r11"} = $2; | ||
| 69 | $regs{"%r12"} = $3; | ||
| 70 | } | ||
| 71 | if ($line =~ /R13: ([0-9a-f]+) R14: ([0-9a-f]+) R15: ([0-9a-f]+)/) { | ||
| 72 | $regs{"%r13"} = $1; | ||
| 73 | $regs{"%r14"} = $2; | ||
| 74 | $regs{"%r15"} = $3; | ||
| 75 | } | ||
| 76 | } | ||
| 77 | |||
| 78 | sub reg_name | ||
| 79 | { | ||
| 80 | my ($reg) = @_; | ||
| 81 | $reg =~ s/r(.)x/e\1x/; | ||
| 82 | $reg =~ s/r(.)i/e\1i/; | ||
| 83 | $reg =~ s/r(.)p/e\1p/; | ||
| 84 | return $reg; | ||
| 85 | } | ||
| 86 | |||
| 87 | sub process_x86_regs | ||
| 88 | { | ||
| 89 | my ($line, $cntr) = @_; | ||
| 90 | my $str = ""; | ||
| 91 | if (length($line) < 40) { | ||
| 92 | return ""; # not an asm istruction | ||
| 93 | } | ||
| 94 | |||
| 95 | # find the arguments to the instruction | ||
| 96 | if ($line =~ /([0-9a-zA-Z\,\%\(\)\-\+]+)$/) { | ||
| 97 | $lastword = $1; | ||
| 98 | } else { | ||
| 99 | return ""; | ||
| 100 | } | ||
| 101 | |||
| 102 | # we need to find the registers that get clobbered, | ||
| 103 | # since their value is no longer relevant for previous | ||
| 104 | # instructions in the stream. | ||
| 105 | |||
| 106 | $clobber = $lastword; | ||
| 107 | # first, remove all memory operands, they're read only | ||
| 108 | $clobber =~ s/\([a-z0-9\%\,]+\)//g; | ||
| 109 | # then, remove everything before the comma, thats the read part | ||
| 110 | $clobber =~ s/.*\,//g; | ||
| 111 | |||
| 112 | # if this is the instruction that faulted, we haven't actually done | ||
| 113 | # the write yet... nothing is clobbered. | ||
| 114 | if ($cntr == 0) { | ||
| 115 | $clobber = ""; | ||
| 116 | } | ||
| 117 | |||
| 118 | foreach $reg (keys(%regs)) { | ||
| 119 | my $clobberprime = reg_name($clobber); | ||
| 120 | my $lastwordprime = reg_name($lastword); | ||
| 121 | my $val = $regs{$reg}; | ||
| 122 | if ($val =~ /^[0]+$/) { | ||
| 123 | $val = "0"; | ||
| 124 | } else { | ||
| 125 | $val =~ s/^0*//; | ||
| 126 | } | ||
| 127 | |||
| 128 | # first check if we're clobbering this register; if we do | ||
| 129 | # we print it with a =>, and then delete its value | ||
| 130 | if ($clobber =~ /$reg/ || $clobberprime =~ /$reg/) { | ||
| 131 | if (length($val) > 0) { | ||
| 132 | $str = $str . " $reg => $val "; | ||
| 133 | } | ||
| 134 | $regs{$reg} = ""; | ||
| 135 | $val = ""; | ||
| 136 | } | ||
| 137 | # now check if we're reading this register | ||
| 138 | if ($lastword =~ /$reg/ || $lastwordprime =~ /$reg/) { | ||
| 139 | if (length($val) > 0) { | ||
| 140 | $str = $str . " $reg = $val "; | ||
| 141 | } | ||
| 142 | } | ||
| 143 | } | ||
| 144 | return $str; | ||
| 145 | } | ||
| 146 | |||
| 147 | # parse the oops | ||
| 35 | while (<STDIN>) { | 148 | while (<STDIN>) { |
| 36 | my $line = $_; | 149 | my $line = $_; |
| 37 | if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { | 150 | if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) { |
| 38 | $target = $1; | 151 | $target = $1; |
| 39 | } | 152 | } |
| 153 | if ($line =~ /RIP: 0010:\[\<([a-z0-9]+)\>\]/) { | ||
| 154 | $target = $1; | ||
| 155 | } | ||
| 40 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { | 156 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { |
| 41 | $function = $1; | 157 | $function = $1; |
| 42 | $func_offset = $2; | 158 | $func_offset = $2; |
| 43 | } | 159 | } |
| 160 | if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) { | ||
| 161 | $function = $1; | ||
| 162 | $func_offset = $2; | ||
| 163 | } | ||
| 44 | 164 | ||
| 45 | # check if it's a module | 165 | # check if it's a module |
| 46 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { | 166 | if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { |
| 47 | $module = $3; | 167 | $module = $3; |
| 48 | } | 168 | } |
| 169 | if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\] \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) { | ||
| 170 | $module = $3; | ||
| 171 | } | ||
| 172 | parse_x86_regs($line); | ||
| 49 | } | 173 | } |
| 50 | 174 | ||
| 51 | my $decodestart = hex($target) - hex($func_offset); | 175 | my $decodestart = hex($target) - hex($func_offset); |
| 52 | my $decodestop = $decodestart + 8192; | 176 | my $decodestop = hex($target) + 8192; |
| 53 | if ($target eq "0") { | 177 | if ($target eq "0") { |
| 54 | print "No oops found!\n"; | 178 | print "No oops found!\n"; |
| 55 | print "Usage: \n"; | 179 | print "Usage: \n"; |
| @@ -84,6 +208,7 @@ my $counter = 0; | |||
| 84 | my $state = 0; | 208 | my $state = 0; |
| 85 | my $center = 0; | 209 | my $center = 0; |
| 86 | my @lines; | 210 | my @lines; |
| 211 | my @reglines; | ||
| 87 | 212 | ||
| 88 | sub InRange { | 213 | sub InRange { |
| 89 | my ($address, $target) = @_; | 214 | my ($address, $target) = @_; |
| @@ -188,16 +313,36 @@ while ($finish < $counter) { | |||
| 188 | 313 | ||
| 189 | my $i; | 314 | my $i; |
| 190 | 315 | ||
| 191 | my $fulltext = ""; | 316 | |
| 317 | # start annotating the registers in the asm. | ||
| 318 | # this goes from the oopsing point back, so that the annotator | ||
| 319 | # can track (opportunistically) which registers got written and | ||
| 320 | # whos value no longer is relevant. | ||
| 321 | |||
| 322 | $i = $center; | ||
| 323 | while ($i >= $start) { | ||
| 324 | $reglines[$i] = process_x86_regs($lines[$i], $center - $i); | ||
| 325 | $i = $i - 1; | ||
| 326 | } | ||
| 327 | |||
| 192 | $i = $start; | 328 | $i = $start; |
| 193 | while ($i < $finish) { | 329 | while ($i < $finish) { |
| 330 | my $line; | ||
| 194 | if ($i == $center) { | 331 | if ($i == $center) { |
| 195 | $fulltext = $fulltext . "*$lines[$i] <----- faulting instruction\n"; | 332 | $line = "*$lines[$i] "; |
| 196 | } else { | 333 | } else { |
| 197 | $fulltext = $fulltext . " $lines[$i]\n"; | 334 | $line = " $lines[$i] "; |
| 335 | } | ||
| 336 | print $line; | ||
| 337 | if (defined($reglines[$i]) && length($reglines[$i]) > 0) { | ||
| 338 | my $c = 60 - length($line); | ||
| 339 | while ($c > 0) { print " "; $c = $c - 1; }; | ||
| 340 | print "| $reglines[$i]"; | ||
| 198 | } | 341 | } |
| 342 | if ($i == $center) { | ||
| 343 | print "<--- faulting instruction"; | ||
| 344 | } | ||
| 345 | print "\n"; | ||
| 199 | $i = $i +1; | 346 | $i = $i +1; |
| 200 | } | 347 | } |
| 201 | 348 | ||
| 202 | print $fulltext; | ||
| 203 | |||
diff --git a/scripts/mksysmap b/scripts/mksysmap index 1db316a3712b..6e133a0bae7a 100644 --- a/scripts/mksysmap +++ b/scripts/mksysmap | |||
| @@ -37,6 +37,9 @@ | |||
| 37 | 37 | ||
| 38 | # readprofile starts reading symbols when _stext is found, and | 38 | # readprofile starts reading symbols when _stext is found, and |
| 39 | # continue until it finds a symbol which is not either of 'T', 't', | 39 | # continue until it finds a symbol which is not either of 'T', 't', |
| 40 | # 'W' or 'w'. | 40 | # 'W' or 'w'. __crc_ are 'A' and placed in the middle |
| 41 | # so we just ignore them to let readprofile continue to work. | ||
| 42 | # (At least sparc64 has __crc_ in the middle). | ||
| 43 | |||
| 44 | $NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2 | ||
| 41 | 45 | ||
| 42 | $NM -n $1 | grep -v '\( [aNUw] \)\|\( \$[adt]\)' > $2 | ||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index d4dc222a74f3..a3344285ccf4 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -210,6 +210,7 @@ static void do_usb_table(void *symval, unsigned long size, | |||
| 210 | static int do_hid_entry(const char *filename, | 210 | static int do_hid_entry(const char *filename, |
| 211 | struct hid_device_id *id, char *alias) | 211 | struct hid_device_id *id, char *alias) |
| 212 | { | 212 | { |
| 213 | id->bus = TO_NATIVE(id->bus); | ||
| 213 | id->vendor = TO_NATIVE(id->vendor); | 214 | id->vendor = TO_NATIVE(id->vendor); |
| 214 | id->product = TO_NATIVE(id->product); | 215 | id->product = TO_NATIVE(id->product); |
| 215 | 216 | ||
| @@ -366,11 +367,17 @@ static void do_pnp_device_entry(void *symval, unsigned long size, | |||
| 366 | 367 | ||
| 367 | for (i = 0; i < count; i++) { | 368 | for (i = 0; i < count; i++) { |
| 368 | const char *id = (char *)devs[i].id; | 369 | const char *id = (char *)devs[i].id; |
| 370 | char acpi_id[sizeof(devs[0].id)]; | ||
| 371 | int j; | ||
| 369 | 372 | ||
| 370 | buf_printf(&mod->dev_table_buf, | 373 | buf_printf(&mod->dev_table_buf, |
| 371 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); | 374 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); |
| 375 | |||
| 376 | /* fix broken pnp bus lowercasing */ | ||
| 377 | for (j = 0; j < sizeof(acpi_id); j++) | ||
| 378 | acpi_id[j] = toupper(id[j]); | ||
| 372 | buf_printf(&mod->dev_table_buf, | 379 | buf_printf(&mod->dev_table_buf, |
| 373 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", id); | 380 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", acpi_id); |
| 374 | } | 381 | } |
| 375 | } | 382 | } |
| 376 | 383 | ||
| @@ -416,10 +423,17 @@ static void do_pnp_card_entries(void *symval, unsigned long size, | |||
| 416 | 423 | ||
| 417 | /* add an individual alias for every device entry */ | 424 | /* add an individual alias for every device entry */ |
| 418 | if (!dup) { | 425 | if (!dup) { |
| 426 | char acpi_id[sizeof(card->devs[0].id)]; | ||
| 427 | int k; | ||
| 428 | |||
| 419 | buf_printf(&mod->dev_table_buf, | 429 | buf_printf(&mod->dev_table_buf, |
| 420 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); | 430 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); |
| 431 | |||
| 432 | /* fix broken pnp bus lowercasing */ | ||
| 433 | for (k = 0; k < sizeof(acpi_id); k++) | ||
| 434 | acpi_id[k] = toupper(id[k]); | ||
| 421 | buf_printf(&mod->dev_table_buf, | 435 | buf_printf(&mod->dev_table_buf, |
| 422 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", id); | 436 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", acpi_id); |
| 423 | } | 437 | } |
| 424 | } | 438 | } |
| 425 | } | 439 | } |
| @@ -696,6 +710,14 @@ static int do_dmi_entry(const char *filename, struct dmi_system_id *id, | |||
| 696 | strcat(alias, ":"); | 710 | strcat(alias, ":"); |
| 697 | return 1; | 711 | return 1; |
| 698 | } | 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 | |||
| 699 | /* Ignore any prefix, eg. some architectures prepend _ */ | 721 | /* Ignore any prefix, eg. some architectures prepend _ */ |
| 700 | static inline int sym_is(const char *symbol, const char *name) | 722 | static inline int sym_is(const char *symbol, const char *name) |
| 701 | { | 723 | { |
| @@ -835,6 +857,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 835 | do_table(symval, sym->st_size, | 857 | do_table(symval, sym->st_size, |
| 836 | sizeof(struct dmi_system_id), "dmi", | 858 | sizeof(struct dmi_system_id), "dmi", |
| 837 | 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); | ||
| 838 | free(zeros); | 864 | free(zeros); |
| 839 | } | 865 | } |
| 840 | 866 | ||
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 88921611b22e..8d46ea7d6715 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) |
| @@ -791,15 +794,6 @@ static const char *init_exit_sections[] = | |||
| 791 | /* data section */ | 794 | /* data section */ |
| 792 | static const char *data_sections[] = { DATA_SECTIONS, NULL }; | 795 | static const char *data_sections[] = { DATA_SECTIONS, NULL }; |
| 793 | 796 | ||
| 794 | /* sections that may refer to an init/exit section with no warning */ | ||
| 795 | static const char *initref_sections[] = | ||
| 796 | { | ||
| 797 | ".text.init.refok*", | ||
| 798 | ".exit.text.refok*", | ||
| 799 | ".data.init.refok*", | ||
| 800 | NULL | ||
| 801 | }; | ||
| 802 | |||
| 803 | 797 | ||
| 804 | /* symbols in .data that may refer to init/exit sections */ | 798 | /* symbols in .data that may refer to init/exit sections */ |
| 805 | static const char *symbol_white_list[] = | 799 | static const char *symbol_white_list[] = |
| @@ -912,11 +906,6 @@ static int section_mismatch(const char *fromsec, const char *tosec) | |||
| 912 | /** | 906 | /** |
| 913 | * Whitelist to allow certain references to pass with no warning. | 907 | * Whitelist to allow certain references to pass with no warning. |
| 914 | * | 908 | * |
| 915 | * Pattern 0: | ||
| 916 | * Do not warn if funtion/data are marked with __init_refok/__initdata_refok. | ||
| 917 | * The pattern is identified by: | ||
| 918 | * fromsec = .text.init.refok* | .data.init.refok* | ||
| 919 | * | ||
| 920 | * Pattern 1: | 909 | * Pattern 1: |
| 921 | * If a module parameter is declared __initdata and permissions=0 | 910 | * If a module parameter is declared __initdata and permissions=0 |
| 922 | * then this is legal despite the warning generated. | 911 | * then this is legal despite the warning generated. |
| @@ -955,10 +944,6 @@ static int section_mismatch(const char *fromsec, const char *tosec) | |||
| 955 | static int secref_whitelist(const char *fromsec, const char *fromsym, | 944 | static int secref_whitelist(const char *fromsec, const char *fromsym, |
| 956 | const char *tosec, const char *tosym) | 945 | const char *tosec, const char *tosym) |
| 957 | { | 946 | { |
| 958 | /* Check for pattern 0 */ | ||
| 959 | if (match(fromsec, initref_sections)) | ||
| 960 | return 0; | ||
| 961 | |||
| 962 | /* Check for pattern 1 */ | 947 | /* Check for pattern 1 */ |
| 963 | if (match(tosec, init_data_sections) && | 948 | if (match(tosec, init_data_sections) && |
| 964 | match(fromsec, data_sections) && | 949 | match(fromsec, data_sections) && |
| @@ -1604,12 +1589,12 @@ static void read_symbols(char *modname) | |||
| 1604 | 1589 | ||
| 1605 | parse_elf_finish(&info); | 1590 | parse_elf_finish(&info); |
| 1606 | 1591 | ||
| 1607 | /* Our trick to get versioning for struct_module - it's | 1592 | /* Our trick to get versioning for module struct etc. - it's |
| 1608 | * never passed as an argument to an exported function, so | 1593 | * never passed as an argument to an exported function, so |
| 1609 | * the automatic versioning doesn't pick it up, but it's really | 1594 | * the automatic versioning doesn't pick it up, but it's really |
| 1610 | * important anyhow */ | 1595 | * important anyhow */ |
| 1611 | if (modversions) | 1596 | if (modversions) |
| 1612 | mod->unres = alloc_symbol("struct_module", 0, mod->unres); | 1597 | mod->unres = alloc_symbol("module_layout", 0, mod->unres); |
| 1613 | } | 1598 | } |
| 1614 | 1599 | ||
| 1615 | #define SZ 500 | 1600 | #define SZ 500 |
| @@ -1910,7 +1895,7 @@ static void read_dump(const char *fname, unsigned int kernel) | |||
| 1910 | if (!mod) { | 1895 | if (!mod) { |
| 1911 | if (is_vmlinux(modname)) | 1896 | if (is_vmlinux(modname)) |
| 1912 | have_vmlinux = 1; | 1897 | have_vmlinux = 1; |
| 1913 | mod = new_module(NOFAIL(strdup(modname))); | 1898 | mod = new_module(modname); |
| 1914 | mod->skip = 1; | 1899 | mod->skip = 1; |
| 1915 | } | 1900 | } |
| 1916 | s = sym_add_exported(symname, mod, export_no(export)); | 1901 | s = sym_add_exported(symname, mod, export_no(export)); |
| @@ -1994,7 +1979,7 @@ static void read_markers(const char *fname) | |||
| 1994 | 1979 | ||
| 1995 | mod = find_module(modname); | 1980 | mod = find_module(modname); |
| 1996 | if (!mod) { | 1981 | if (!mod) { |
| 1997 | mod = new_module(NOFAIL(strdup(modname))); | 1982 | mod = new_module(modname); |
| 1998 | mod->skip = 1; | 1983 | mod->skip = 1; |
| 1999 | } | 1984 | } |
| 2000 | if (is_vmlinux(modname)) { | 1985 | if (is_vmlinux(modname)) { |
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 8c6b7b09606a..fa4a0a17b7e0 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
| @@ -35,9 +35,10 @@ $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile | |||
| 35 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE | 35 | rpm-pkg rpm: $(objtree)/kernel.spec FORCE |
| 36 | $(MAKE) clean | 36 | $(MAKE) clean |
| 37 | $(PREV) ln -sf $(srctree) $(KERNELPATH) | 37 | $(PREV) ln -sf $(srctree) $(KERNELPATH) |
| 38 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion > $(objtree)/.scmversion | ||
| 38 | $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. | 39 | $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. |
| 39 | $(PREV) rm $(KERNELPATH) | 40 | $(PREV) rm $(KERNELPATH) |
| 40 | 41 | rm -f $(objtree)/.scmversion | |
| 41 | set -e; \ | 42 | set -e; \ |
| 42 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version | 43 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version |
| 43 | set -e; \ | 44 | set -e; \ |
diff --git a/scripts/package/buildtar b/scripts/package/buildtar index 28574ae55170..b1fd48db1640 100644 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar | |||
| @@ -75,6 +75,10 @@ case "${ARCH}" in | |||
| 75 | alpha) | 75 | alpha) |
| 76 | [ -f "${objtree}/arch/alpha/boot/vmlinux.gz" ] && cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" | 76 | [ -f "${objtree}/arch/alpha/boot/vmlinux.gz" ] && cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" |
| 77 | ;; | 77 | ;; |
| 78 | parisc*) | ||
| 79 | [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" | ||
| 80 | [ -f "${objtree}/lifimage" ] && cp -v -- "${objtree}/lifimage" "${tmpdir}/boot/lifimage-${KERNELRELEASE}" | ||
| 81 | ;; | ||
| 78 | vax) | 82 | vax) |
| 79 | [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS" | 83 | [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS" |
| 80 | [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk" | 84 | [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk" |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 2500886fb90a..3d93f8c81252 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
| @@ -86,9 +86,17 @@ echo "%endif" | |||
| 86 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" | 86 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" |
| 87 | 87 | ||
| 88 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" | 88 | echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE" |
| 89 | |||
| 90 | echo "%ifnarch ppc64" | ||
| 91 | echo 'cp vmlinux vmlinux.orig' | ||
| 92 | echo 'bzip2 -9 vmlinux' | ||
| 93 | echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2" | ||
| 94 | echo 'mv vmlinux.orig vmlinux' | ||
| 95 | echo "%endif" | ||
| 96 | |||
| 89 | echo "" | 97 | echo "" |
| 90 | echo "%clean" | 98 | echo "%clean" |
| 91 | echo '#echo -rf $RPM_BUILD_ROOT' | 99 | echo 'rm -rf $RPM_BUILD_ROOT' |
| 92 | echo "" | 100 | echo "" |
| 93 | echo "%files" | 101 | echo "%files" |
| 94 | echo '%defattr (-, root, root)' | 102 | echo '%defattr (-, root, root)' |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index fe831412bea9..409596eca124 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
| @@ -100,14 +100,19 @@ $P =~ s@.*/@@g; | |||
| 100 | 100 | ||
| 101 | my $V = '0.1'; | 101 | my $V = '0.1'; |
| 102 | 102 | ||
| 103 | if ($#ARGV < 6) { | 103 | if ($#ARGV < 7) { |
| 104 | print "usage: $P arch objdump objcopy cc ld nm rm mv inputfile\n"; | 104 | print "usage: $P arch bits objdump objcopy cc ld nm rm mv is_module inputfile\n"; |
| 105 | print "version: $V\n"; | 105 | print "version: $V\n"; |
| 106 | exit(1); | 106 | exit(1); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | my ($arch, $bits, $objdump, $objcopy, $cc, | 109 | my ($arch, $bits, $objdump, $objcopy, $cc, |
| 110 | $ld, $nm, $rm, $mv, $inputfile) = @ARGV; | 110 | $ld, $nm, $rm, $mv, $is_module, $inputfile) = @ARGV; |
| 111 | |||
| 112 | # This file refers to mcount and shouldn't be ftraced, so lets' ignore it | ||
| 113 | if ($inputfile eq "kernel/trace/ftrace.o") { | ||
| 114 | exit(0); | ||
| 115 | } | ||
| 111 | 116 | ||
| 112 | # Acceptable sections to record. | 117 | # Acceptable sections to record. |
| 113 | my %text_sections = ( | 118 | my %text_sections = ( |
| @@ -201,6 +206,13 @@ if ($arch eq "x86_64") { | |||
| 201 | $alignment = 2; | 206 | $alignment = 2; |
| 202 | $section_type = '%progbits'; | 207 | $section_type = '%progbits'; |
| 203 | 208 | ||
| 209 | } elsif ($arch eq "ia64") { | ||
| 210 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; | ||
| 211 | $type = "data8"; | ||
| 212 | |||
| 213 | if ($is_module eq "0") { | ||
| 214 | $cc .= " -mconstant-gp"; | ||
| 215 | } | ||
| 204 | } else { | 216 | } else { |
| 205 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; | 217 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; |
| 206 | } | 218 | } |
| @@ -263,7 +275,6 @@ if (!$found_version) { | |||
| 263 | "\tDisabling local function references.\n"; | 275 | "\tDisabling local function references.\n"; |
| 264 | } | 276 | } |
| 265 | 277 | ||
| 266 | |||
| 267 | # | 278 | # |
| 268 | # Step 1: find all the local (static functions) and weak symbols. | 279 | # Step 1: find all the local (static functions) and weak symbols. |
| 269 | # 't' is local, 'w/W' is weak (we never use a weak function) | 280 | # 't' is local, 'w/W' is weak (we never use a weak function) |
| @@ -331,13 +342,16 @@ sub update_funcs | |||
| 331 | # | 342 | # |
| 332 | # Step 2: find the sections and mcount call sites | 343 | # Step 2: find the sections and mcount call sites |
| 333 | # | 344 | # |
| 334 | open(IN, "$objdump -dr $inputfile|") || die "error running $objdump"; | 345 | open(IN, "$objdump -hdr $inputfile|") || die "error running $objdump"; |
| 335 | 346 | ||
| 336 | my $text; | 347 | my $text; |
| 337 | 348 | ||
| 349 | my $read_headers = 1; | ||
| 350 | |||
| 338 | while (<IN>) { | 351 | while (<IN>) { |
| 339 | # is it a section? | 352 | # is it a section? |
| 340 | if (/$section_regex/) { | 353 | if (/$section_regex/) { |
| 354 | $read_headers = 0; | ||
| 341 | 355 | ||
| 342 | # Only record text sections that we know are safe | 356 | # Only record text sections that we know are safe |
| 343 | if (defined($text_sections{$1})) { | 357 | if (defined($text_sections{$1})) { |
| @@ -371,6 +385,19 @@ while (<IN>) { | |||
| 371 | $ref_func = $text; | 385 | $ref_func = $text; |
| 372 | } | 386 | } |
| 373 | } | 387 | } |
| 388 | } elsif ($read_headers && /$mcount_section/) { | ||
| 389 | # | ||
| 390 | # Somehow the make process can execute this script on an | ||
| 391 | # object twice. If it does, we would duplicate the mcount | ||
| 392 | # section and it will cause the function tracer self test | ||
| 393 | # to fail. Check if the mcount section exists, and if it does, | ||
| 394 | # warn and exit. | ||
| 395 | # | ||
| 396 | print STDERR "ERROR: $mcount_section already in $inputfile\n" . | ||
| 397 | "\tThis may be an indication that your build is corrupted.\n" . | ||
| 398 | "\tDelete $inputfile and try again. If the same object file\n" . | ||
| 399 | "\tstill causes an issue, then disable CONFIG_DYNAMIC_FTRACE.\n"; | ||
| 400 | exit(-1); | ||
| 374 | } | 401 | } |
| 375 | 402 | ||
| 376 | # is this a call site to mcount? If so, record it to print later | 403 | # is this a call site to mcount? If so, record it to print later |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index f6946cf99ce1..47e75b69a2e9 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
| @@ -21,7 +21,7 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then | |||
| 21 | 21 | ||
| 22 | # Is this git on svn? | 22 | # Is this git on svn? |
| 23 | if git config --get svn-remote.svn.url >/dev/null; then | 23 | if git config --get svn-remote.svn.url >/dev/null; then |
| 24 | printf -- '-svn%s' "`git-svn find-rev $head`" | 24 | printf -- '-svn%s' "`git svn find-rev $head`" |
| 25 | fi | 25 | fi |
| 26 | 26 | ||
| 27 | # Are there uncommitted changes? | 27 | # Are there uncommitted changes? |
| @@ -58,14 +58,7 @@ fi | |||
| 58 | # Check for svn and a svn repo. | 58 | # Check for svn and a svn repo. |
| 59 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then | 59 | if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then |
| 60 | rev=`echo $rev | awk '{print $NF}'` | 60 | rev=`echo $rev | awk '{print $NF}'` |
| 61 | changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l` | 61 | printf -- '-svn%s' "$rev" |
| 62 | |||
| 63 | # Are there uncommitted changes? | ||
| 64 | if [ $changes != 0 ]; then | ||
| 65 | printf -- '-svn%s%s' "$rev" -dirty | ||
| 66 | else | ||
| 67 | printf -- '-svn%s' "$rev" | ||
| 68 | fi | ||
| 69 | 62 | ||
| 70 | # All done with svn | 63 | # All done with svn |
| 71 | exit | 64 | exit |
diff --git a/scripts/strip-symbols b/scripts/strip-symbols deleted file mode 100644 index 29ee8c1a014b..000000000000 --- a/scripts/strip-symbols +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 1 | <*> | ||
| 2 | *.h | ||
| 3 | __compound_literal[$.][0-9]* | ||
| 4 | __crc_[a-zA-Z_]* | ||
| 5 | __exitcall_[a-zA-Z_]* | ||
| 6 | __func__[$.][0-9]* | ||
| 7 | __FUNCTION__[$.][0-9]* | ||
| 8 | gcc[0-9]_compiled[$.] | ||
| 9 | __initcall_[a-zA-Z_]* | ||
| 10 | __kcrctab_[a-zA-Z_]* | ||
| 11 | __kstrtab_[a-zA-Z_]* | ||
| 12 | __ksymtab_[a-zA-Z_]* | ||
| 13 | __mod_[a-zA-Z_]*[0-9] | ||
| 14 | __module_depends | ||
| 15 | __param_[a-zA-Z_]* | ||
| 16 | __pci_fixup_*PCI_ANY_IDPCI_ANY_ID* | ||
| 17 | __pci_fixup_*PCI_ANY_IDPCI_DEVICE_ID_* | ||
| 18 | __pci_fixup_*PCI_VENDOR_ID_*PCI_ANY_ID* | ||
| 19 | __pci_fixup_*PCI_VENDOR_ID_*PCI_DEVICE_ID_* | ||
| 20 | __PRETTY_FUNCTION__[$.][0-9]* | ||
| 21 | __setup_[a-zA-Z_]* | ||
| 22 | ____versions | ||
diff --git a/scripts/tags.sh b/scripts/tags.sh index fdbe78bb5e2b..5bd8b1003d44 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
| @@ -76,7 +76,10 @@ all_sources() | |||
| 76 | 76 | ||
| 77 | all_kconfigs() | 77 | all_kconfigs() |
| 78 | { | 78 | { |
| 79 | find_sources $ALLSOURCE_ARCHS 'Kconfig*' | 79 | for arch in $ALLSOURCE_ARCHS; do |
| 80 | find_sources $arch 'Kconfig*' | ||
| 81 | done | ||
| 82 | find_other_sources 'Kconfig*' | ||
| 80 | } | 83 | } |
| 81 | 84 | ||
| 82 | all_defconfigs() | 85 | all_defconfigs() |
| @@ -99,7 +102,8 @@ exuberant() | |||
| 99 | -I ____cacheline_internodealigned_in_smp \ | 102 | -I ____cacheline_internodealigned_in_smp \ |
| 100 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | 103 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ |
| 101 | --extra=+f --c-kinds=+px \ | 104 | --extra=+f --c-kinds=+px \ |
| 102 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' | 105 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ |
| 106 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' | ||
| 103 | 107 | ||
| 104 | all_kconfigs | xargs $1 -a \ | 108 | all_kconfigs | xargs $1 -a \ |
| 105 | --langdef=kconfig --language-force=kconfig \ | 109 | --langdef=kconfig --language-force=kconfig \ |
| @@ -117,7 +121,9 @@ exuberant() | |||
| 117 | 121 | ||
| 118 | emacs() | 122 | emacs() |
| 119 | { | 123 | { |
| 120 | all_sources | xargs $1 -a | 124 | all_sources | xargs $1 -a \ |
| 125 | --regex='/^ENTRY(\([^)]*\)).*/\1/' \ | ||
| 126 | --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' | ||
| 121 | 127 | ||
| 122 | all_kconfigs | xargs $1 -a \ | 128 | all_kconfigs | xargs $1 -a \ |
| 123 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' | 129 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' |
diff --git a/scripts/trace/power.pl b/scripts/tracing/power.pl index 4f729b3501e0..4f729b3501e0 100644 --- a/scripts/trace/power.pl +++ b/scripts/tracing/power.pl | |||
diff --git a/scripts/unifdef.c b/scripts/unifdef.c index 552025e72acb..05a31a6c7e1b 100644 --- a/scripts/unifdef.c +++ b/scripts/unifdef.c | |||
| @@ -206,7 +206,7 @@ static void done(void); | |||
| 206 | static void error(const char *); | 206 | static void error(const char *); |
| 207 | static int findsym(const char *); | 207 | static int findsym(const char *); |
| 208 | static void flushline(bool); | 208 | static void flushline(bool); |
| 209 | static Linetype getline(void); | 209 | static Linetype get_line(void); |
| 210 | static Linetype ifeval(const char **); | 210 | static Linetype ifeval(const char **); |
| 211 | static void ignoreoff(void); | 211 | static void ignoreoff(void); |
| 212 | static void ignoreon(void); | 212 | static void ignoreon(void); |
| @@ -512,7 +512,7 @@ process(void) | |||
| 512 | 512 | ||
| 513 | for (;;) { | 513 | for (;;) { |
| 514 | linenum++; | 514 | linenum++; |
| 515 | lineval = getline(); | 515 | lineval = get_line(); |
| 516 | trans_table[ifstate[depth]][lineval](); | 516 | trans_table[ifstate[depth]][lineval](); |
| 517 | debug("process %s -> %s depth %d", | 517 | debug("process %s -> %s depth %d", |
| 518 | linetype_name[lineval], | 518 | linetype_name[lineval], |
| @@ -526,7 +526,7 @@ process(void) | |||
| 526 | * help from skipcomment(). | 526 | * help from skipcomment(). |
| 527 | */ | 527 | */ |
| 528 | static Linetype | 528 | static Linetype |
| 529 | getline(void) | 529 | get_line(void) |
| 530 | { | 530 | { |
| 531 | const char *cp; | 531 | const char *cp; |
| 532 | int cursym; | 532 | int cursym; |
