diff options
| author | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-02-10 14:45:43 -0500 |
|---|---|---|
| committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-02-10 14:45:43 -0500 |
| commit | 81b7bbd1932a04869d4c8635a75222dfc6089f96 (patch) | |
| tree | 285ae868a1e3a41fb0dbfe346c28e380949bcb55 /scripts | |
| parent | 98051995ab44b993f992946055edc6115351f725 (diff) | |
| parent | 66efc5a7e3061c3597ac43a8bb1026488d57e66b (diff) | |
Merge branch 'linus'
Conflicts:
drivers/scsi/ipr.c
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Kbuild.include | 84 | ||||
| -rw-r--r-- | scripts/gen_initramfs_list.sh | 43 | ||||
| -rwxr-xr-x | scripts/makelst | 34 |
3 files changed, 85 insertions, 76 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index f01f8c072852..06c1a377c4c5 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #### | 1 | #### |
| 2 | # kbuild: Generic definitions | 2 | # kbuild: Generic definitions |
| 3 | 3 | ||
| 4 | # Convinient variables | 4 | # Convenient variables |
| 5 | comma := , | 5 | comma := , |
| 6 | squote := ' | 6 | squote := ' |
| 7 | empty := | 7 | empty := |
| @@ -59,32 +59,40 @@ endef | |||
| 59 | # output directory for tests below | 59 | # output directory for tests below |
| 60 | TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) | 60 | TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) |
| 61 | 61 | ||
| 62 | # try-run | ||
| 63 | # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise) | ||
| 64 | # Exit code chooses option. "$$TMP" is can be used as temporary file and | ||
| 65 | # is automatically cleaned up. | ||
| 66 | try-run = $(shell set -e; \ | ||
| 67 | TMP="$(TMPOUT).$$$$.tmp"; \ | ||
| 68 | if ($(1)) >/dev/null 2>&1; \ | ||
| 69 | then echo "$(2)"; \ | ||
| 70 | else echo "$(3)"; \ | ||
| 71 | fi; \ | ||
| 72 | rm -f "$$TMP") | ||
| 73 | |||
| 62 | # as-option | 74 | # as-option |
| 63 | # Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) | 75 | # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) |
| 64 | 76 | ||
| 65 | as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ | 77 | as-option = $(call try-run,\ |
| 66 | -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ | 78 | $(CC) $(CFLAGS) $(1) -c -xassembler /dev/null -o "$$TMP",$(1),$(2)) |
| 67 | else echo "$(2)"; fi ;) | ||
| 68 | 79 | ||
| 69 | # as-instr | 80 | # as-instr |
| 70 | # Usage: cflags-y += $(call as-instr, instr, option1, option2) | 81 | # Usage: cflags-y += $(call as-instr,instr,option1,option2) |
| 71 | 82 | ||
| 72 | as-instr = $(shell if echo -e "$(1)" | \ | 83 | as-instr = $(call try-run,\ |
| 73 | $(CC) $(AFLAGS) -c -xassembler - \ | 84 | echo -e "$(1)" | $(CC) $(AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3)) |
| 74 | -o $(TMPOUT)astest$$$$.out > /dev/null 2>&1; \ | ||
| 75 | then rm $(TMPOUT)astest$$$$.out; echo "$(2)"; \ | ||
| 76 | else echo "$(3)"; fi) | ||
| 77 | 85 | ||
| 78 | # cc-option | 86 | # cc-option |
| 79 | # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) | 87 | # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) |
| 80 | 88 | ||
| 81 | cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | 89 | cc-option = $(call try-run,\ |
| 82 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) | 90 | $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",$(1),$(2)) |
| 83 | 91 | ||
| 84 | # cc-option-yn | 92 | # cc-option-yn |
| 85 | # Usage: flag := $(call cc-option-yn, -march=winchip-c6) | 93 | # Usage: flag := $(call cc-option-yn,-march=winchip-c6) |
| 86 | cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | 94 | cc-option-yn = $(call try-run,\ |
| 87 | > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) | 95 | $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n) |
| 88 | 96 | ||
| 89 | # cc-option-align | 97 | # cc-option-align |
| 90 | # Prefix align with either -falign or -malign | 98 | # Prefix align with either -falign or -malign |
| @@ -92,20 +100,19 @@ cc-option-align = $(subst -functions=0,,\ | |||
| 92 | $(call cc-option,-falign-functions=0,-malign-functions=0)) | 100 | $(call cc-option,-falign-functions=0,-malign-functions=0)) |
| 93 | 101 | ||
| 94 | # cc-version | 102 | # cc-version |
| 95 | # Usage gcc-ver := $(call cc-version, $(CC)) | 103 | # Usage gcc-ver := $(call cc-version,$(CC)) |
| 96 | cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) | 104 | cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) |
| 97 | 105 | ||
| 98 | # cc-ifversion | 106 | # cc-ifversion |
| 99 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) | 107 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) |
| 100 | cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ | 108 | cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) |
| 101 | echo $(3); fi;) | ||
| 102 | 109 | ||
| 103 | # ld-option | 110 | # ld-option |
| 104 | # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) | 111 | # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) |
| 105 | ld-option = $(shell if $(CC) $(1) -nostdlib -xc /dev/null \ | 112 | ld-option = $(call try-run,\ |
| 106 | -o $(TMPOUT)ldtest$$$$.out > /dev/null 2>&1; \ | 113 | $(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2)) |
| 107 | then rm $(TMPOUT)ldtest$$$$.out; echo "$(1)"; \ | 114 | |
| 108 | else echo "$(2)"; fi) | 115 | ###### |
| 109 | 116 | ||
| 110 | ### | 117 | ### |
| 111 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= | 118 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= |
| @@ -113,19 +120,25 @@ ld-option = $(shell if $(CC) $(1) -nostdlib -xc /dev/null \ | |||
| 113 | # $(Q)$(MAKE) $(build)=dir | 120 | # $(Q)$(MAKE) $(build)=dir |
| 114 | build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj | 121 | build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj |
| 115 | 122 | ||
| 116 | # Prefix -I with $(srctree) if it is not an absolute path | 123 | # Prefix -I with $(srctree) if it is not an absolute path. |
| 117 | addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1) | 124 | addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1) |
| 125 | |||
| 118 | # Find all -I options and call addtree | 126 | # Find all -I options and call addtree |
| 119 | flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) | 127 | flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) |
| 120 | 128 | ||
| 121 | # If quiet is set, only print short version of command | 129 | # echo command. |
| 130 | # Short version is used, if $(quiet) equals `quiet_', otherwise full one. | ||
| 131 | echo-cmd = $(if $($(quiet)cmd_$(1)),\ | ||
| 132 | echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';) | ||
| 133 | |||
| 134 | # printing commands | ||
| 122 | cmd = @$(echo-cmd) $(cmd_$(1)) | 135 | cmd = @$(echo-cmd) $(cmd_$(1)) |
| 123 | 136 | ||
| 124 | # Add $(obj)/ for paths that is not absolute | 137 | # Add $(obj)/ for paths that are not absolute |
| 125 | objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) | 138 | objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) |
| 126 | 139 | ||
| 127 | ### | 140 | ### |
| 128 | # if_changed - execute command if any prerequisite is newer than | 141 | # if_changed - execute command if any prerequisite is newer than |
| 129 | # target, or command line has changed | 142 | # target, or command line has changed |
| 130 | # if_changed_dep - as if_changed, but uses fixdep to reveal dependencies | 143 | # if_changed_dep - as if_changed, but uses fixdep to reveal dependencies |
| 131 | # including used config symbols | 144 | # including used config symbols |
| @@ -133,16 +146,12 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) | |||
| 133 | # See Documentation/kbuild/makefiles.txt for more info | 146 | # See Documentation/kbuild/makefiles.txt for more info |
| 134 | 147 | ||
| 135 | ifneq ($(KBUILD_NOCMDDEP),1) | 148 | ifneq ($(KBUILD_NOCMDDEP),1) |
| 136 | # Check if both arguments has same arguments. Result in empty string if equal | 149 | # Check if both arguments has same arguments. Result is empty string if equal. |
| 137 | # User may override this check using make KBUILD_NOCMDDEP=1 | 150 | # User may override this check using make KBUILD_NOCMDDEP=1 |
| 138 | arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ | 151 | arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ |
| 139 | $(filter-out $(cmd_$@), $(cmd_$(1))) ) | 152 | $(filter-out $(cmd_$@), $(cmd_$(1))) ) |
| 140 | endif | 153 | endif |
| 141 | 154 | ||
| 142 | # echo command. Short version is $(quiet) equals quiet, otherwise full command | ||
| 143 | echo-cmd = $(if $($(quiet)cmd_$(1)), \ | ||
| 144 | echo ' $(call escsq,$($(quiet)cmd_$(1)))$(echo-why)';) | ||
| 145 | |||
| 146 | # >'< substitution is for echo to work, | 155 | # >'< substitution is for echo to work, |
| 147 | # >$< substitution to preserve $ when reloading .cmd file | 156 | # >$< substitution to preserve $ when reloading .cmd file |
| 148 | # note: when using inline perl scripts [perl -e '...$$t=1;...'] | 157 | # note: when using inline perl scripts [perl -e '...$$t=1;...'] |
| @@ -153,15 +162,14 @@ make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))) | |||
| 153 | # PHONY targets skipped in both cases. | 162 | # PHONY targets skipped in both cases. |
| 154 | any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) | 163 | any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) |
| 155 | 164 | ||
| 156 | # Execute command if command has changed or prerequisitei(s) are updated | 165 | # Execute command if command has changed or prerequisite(s) are updated. |
| 157 | # | 166 | # |
| 158 | if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ | 167 | if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ |
| 159 | @set -e; \ | 168 | @set -e; \ |
| 160 | $(echo-cmd) $(cmd_$(1)); \ | 169 | $(echo-cmd) $(cmd_$(1)); \ |
| 161 | echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) | 170 | echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) |
| 162 | 171 | ||
| 163 | # execute the command and also postprocess generated .d dependencies | 172 | # Execute the command and also postprocess generated .d dependencies file. |
| 164 | # file | ||
| 165 | if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ | 173 | if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ |
| 166 | @set -e; \ | 174 | @set -e; \ |
| 167 | $(echo-cmd) $(cmd_$(1)); \ | 175 | $(echo-cmd) $(cmd_$(1)); \ |
| @@ -170,8 +178,8 @@ if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ | |||
| 170 | mv -f $(dot-target).tmp $(dot-target).cmd) | 178 | mv -f $(dot-target).tmp $(dot-target).cmd) |
| 171 | 179 | ||
| 172 | # Usage: $(call if_changed_rule,foo) | 180 | # Usage: $(call if_changed_rule,foo) |
| 173 | # will check if $(cmd_foo) changed, or any of the prequisites changed, | 181 | # Will check if $(cmd_foo) or any of the prerequisites changed, |
| 174 | # and if so will execute $(rule_foo) | 182 | # and if so will execute $(rule_foo). |
| 175 | if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \ | 183 | if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \ |
| 176 | @set -e; \ | 184 | @set -e; \ |
| 177 | $(rule_$(1))) | 185 | $(rule_$(1))) |
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 4c723fd18648..43f75d6e4d96 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | # Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org> | 2 | # Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org> |
| 3 | # Copyright (c) 2006 Sam Ravnborg <sam@ravnborg.org> | 3 | # Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org> |
| 4 | # | 4 | # |
| 5 | # Released under the terms of the GNU GPL | 5 | # Released under the terms of the GNU GPL |
| 6 | # | 6 | # |
| @@ -17,15 +17,15 @@ 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 gzipped initramfs file named <file> using |
| 20 | gen_init_cpio and gzip | 20 | gen_init_cpio and gzip |
| 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> | 22 | <uid> is only meaningful if <cpio_source> |
| 23 | is a directory. | 23 | is a directory. |
| 24 | -g <gid> Group ID to map to group ID 0 (root). | 24 | -g <gid> Group ID to map to group ID 0 (root). |
| 25 | <gid> is only meaningful if <cpio_source> | 25 | <gid> is only meaningful if <cpio_source> |
| 26 | is a directory. | 26 | is a directory. |
| 27 | <cpio_source> File list or directory for cpio archive. | 27 | <cpio_source> File list or directory for cpio archive. |
| 28 | If <cpio_source> is a .cpio file it will be used | 28 | If <cpio_source> is a .cpio file it will be used |
| 29 | as direct input to initramfs. | 29 | as direct input to initramfs. |
| 30 | -d Output the default cpio list. | 30 | -d Output the default cpio list. |
| 31 | 31 | ||
| @@ -36,6 +36,12 @@ to reset the root/group mapping. | |||
| 36 | EOF | 36 | EOF |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | # awk style field access | ||
| 40 | # $1 - field number; rest is argument string | ||
| 41 | field() { | ||
| 42 | shift $1 ; echo $1 | ||
| 43 | } | ||
| 44 | |||
| 39 | list_default_initramfs() { | 45 | list_default_initramfs() { |
| 40 | # echo usr/kinit/kinit | 46 | # echo usr/kinit/kinit |
| 41 | : | 47 | : |
| @@ -119,22 +125,17 @@ parse() { | |||
| 119 | str="${ftype} ${name} ${location} ${str}" | 125 | str="${ftype} ${name} ${location} ${str}" |
| 120 | ;; | 126 | ;; |
| 121 | "nod") | 127 | "nod") |
| 122 | local dev_type= | 128 | local dev=`LC_ALL=C ls -l "${location}"` |
| 123 | local maj=$(LC_ALL=C ls -l "${location}" | \ | 129 | local maj=`field 5 ${dev}` |
| 124 | gawk '{sub(/,/, "", $5); print $5}') | 130 | local min=`field 6 ${dev}` |
| 125 | local min=$(LC_ALL=C ls -l "${location}" | \ | 131 | maj=${maj%,} |
| 126 | gawk '{print $6}') | 132 | |
| 127 | 133 | [ -b "${location}" ] && dev="b" || dev="c" | |
| 128 | if [ -b "${location}" ]; then | 134 | |
| 129 | dev_type="b" | 135 | str="${ftype} ${name} ${str} ${dev} ${maj} ${min}" |
| 130 | else | ||
| 131 | dev_type="c" | ||
| 132 | fi | ||
| 133 | str="${ftype} ${name} ${str} ${dev_type} ${maj} ${min}" | ||
| 134 | ;; | 136 | ;; |
| 135 | "slink") | 137 | "slink") |
| 136 | local target=$(LC_ALL=C ls -l "${location}" | \ | 138 | local target=`field 11 $(LC_ALL=C ls -l "${location}")` |
| 137 | gawk '{print $11}') | ||
| 138 | str="${ftype} ${name} ${target} ${str}" | 139 | str="${ftype} ${name} ${target} ${str}" |
| 139 | ;; | 140 | ;; |
| 140 | *) | 141 | *) |
diff --git a/scripts/makelst b/scripts/makelst index 34bd72391238..4fc80f2b7e19 100755 --- a/scripts/makelst +++ b/scripts/makelst | |||
| @@ -1,31 +1,31 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/sh |
| 2 | # A script to dump mixed source code & assembly | 2 | # A script to dump mixed source code & assembly |
| 3 | # with correct relocations from System.map | 3 | # with correct relocations from System.map |
| 4 | # Requires the following lines in Rules.make. | 4 | # Requires the following lines in makefile: |
| 5 | # Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) | ||
| 6 | # William Stearns <wstearns@pobox.com> | ||
| 7 | #%.lst: %.c | 5 | #%.lst: %.c |
| 8 | # $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $< | 6 | # $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $< |
| 9 | # $(TOPDIR)/scripts/makelst $*.o $(TOPDIR)/System.map $(OBJDUMP) | 7 | # $(srctree)/scripts/makelst $*.o $(objtree)/System.map $(OBJDUMP) |
| 10 | # | 8 | # |
| 11 | # Copyright (C) 2000 IBM Corporation | 9 | # Copyright (C) 2000 IBM Corporation |
| 12 | # Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) | 10 | # Author(s): DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) |
| 11 | # William Stearns <wstearns@pobox.com> | ||
| 13 | # | 12 | # |
| 14 | 13 | ||
| 15 | t1=`$3 --syms $1 | grep .text | grep " F " | head -n 1` | 14 | # awk style field access |
| 15 | field() { | ||
| 16 | shift $1 ; echo $1 | ||
| 17 | } | ||
| 18 | |||
| 19 | t1=`$3 --syms $1 | grep .text | grep -m1 " F "` | ||
| 16 | if [ -n "$t1" ]; then | 20 | if [ -n "$t1" ]; then |
| 17 | t2=`echo $t1 | gawk '{ print $6 }'` | 21 | t2=`field 6 $t1` |
| 18 | if [ ! -r $2 ]; then | 22 | if [ ! -r $2 ]; then |
| 19 | echo "No System.map" >&2 | 23 | echo "No System.map" >&2 |
| 20 | t7=0 | ||
| 21 | else | 24 | else |
| 22 | t3=`grep $t2 $2` | 25 | t3=`grep $t2 $2` |
| 23 | t4=`echo $t3 | gawk '{ print $1 }'` | 26 | t4=`field 1 $t3` |
| 24 | t5=`echo $t1 | gawk '{ print $1 }'` | 27 | t5=`field 1 $t1` |
| 25 | t6=`echo $t4 - $t5 | tr a-f A-F` | 28 | t6=`printf "%lu" $((0x$t4 - 0x$t5))` |
| 26 | t7=`( echo ibase=16 ; echo $t6 ) | bc` | ||
| 27 | fi | 29 | fi |
| 28 | else | ||
| 29 | t7=0 | ||
| 30 | fi | 30 | fi |
| 31 | $3 -r --source --adjust-vma=$t7 $1 | 31 | $3 -r --source --adjust-vma=${t6:-0} $1 |
