diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-22 23:48:16 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-22 23:48:16 -0700 |
commit | a8c1914f6231dc62a4b1525e3a394b49e3675ebe (patch) | |
tree | 9071ac3f8509b2e62835c35c5ce431ae912e1a6f /scripts | |
parent | c3adda8107af12219941bc5de635ab121c72afd0 (diff) | |
parent | a2c665b04fb8acd2de0216cf38215ef11904fbcd (diff) | |
download | history-a8c1914f6231dc62a4b1525e3a394b49e3675ebe.tar.gz |
Merge bk://linux-sam.bkbits.net/kbuild
into ppc970.osdl.org:/home/torvalds/v2.6/linux
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile | 17 | ||||
-rw-r--r-- | scripts/Makefile.build | 115 | ||||
-rw-r--r-- | scripts/Makefile.clean | 44 | ||||
-rw-r--r-- | scripts/Makefile.host | 154 | ||||
-rw-r--r-- | scripts/Makefile.lib | 52 | ||||
-rw-r--r-- | scripts/Makefile.modpost | 3 | ||||
-rw-r--r-- | scripts/basic/Makefile | 4 | ||||
-rw-r--r-- | scripts/basic/fixdep.c | 2 | ||||
-rw-r--r-- | scripts/binoffset.c | 12 | ||||
-rw-r--r-- | scripts/genksyms/Makefile | 4 | ||||
-rw-r--r-- | scripts/kconfig/Makefile | 2 | ||||
-rw-r--r-- | scripts/kconfig/confdata.c | 17 | ||||
-rw-r--r-- | scripts/lxdialog/Makefile | 4 | ||||
-rw-r--r-- | scripts/mksysmap | 44 | ||||
-rw-r--r-- | scripts/mod/Makefile | 4 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 7 | ||||
-rw-r--r-- | scripts/mod/sumversion.c | 2 | ||||
-rw-r--r-- | scripts/package/Makefile | 6 | ||||
-rwxr-xr-x | scripts/patch-kernel | 113 |
19 files changed, 404 insertions, 202 deletions
diff --git a/scripts/Makefile b/scripts/Makefile index 81c913c1ee3f92..67763eeb8a3e7f 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -2,14 +2,21 @@ # scripts contains sources for various helper programs used throughout # the kernel for the build process. # --------------------------------------------------------------------------- -# docproc: Preprocess .tmpl file in order to generate .sgml docs +# kallsyms: Find all symbols in vmlinux +# pnmttologo: Convert pnm files to logo files +# conmakehash: Create chartable # conmakehash: Create arrays for initializing the kernel console tables -host-progs := conmakehash kallsyms pnmtologo bin2c -always := $(host-progs) +hostprogs-$(CONFIG_KALLSYMS) += kallsyms +hostprogs-$(CONFIG_LOGO) += pnmtologo +hostprogs-$(CONFIG_VT) += conmakehash +hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash +hostprogs-$(CONFIG_IKCONFIG) += bin2c -subdir-$(CONFIG_MODVERSIONS) += genksyms -subdir-y += mod +always := $(hostprogs-y) + +subdir-$(CONFIG_MODVERSIONS) += genksyms +subdir-$(CONFIG_MODULES) += mod # Let clean descend into subdirs subdir- += basic lxdialog kconfig package diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 008ac6cfd40511..21cb20586b47d1 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -14,6 +14,18 @@ include $(obj)/Makefile include scripts/Makefile.lib +ifdef host-progs +ifneq ($(hostprogs-y),$(host-progs)) +$(warning kbuild: $(obj)/Makefile - Usage of host-progs is deprecated. Please replace with hostprogs-y!) +hostprogs-y += $(host-progs) +endif +endif + +# Do not include host rules unles needed +ifneq ($(hostprogs-y)$(hostprogs-m),) +include scripts/Makefile.host +endif + ifneq ($(KBUILD_SRC),) # Create output directory if not already present _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) @@ -71,8 +83,13 @@ __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ # Linus' kernel sanity checking tool ifneq ($(KBUILD_CHECKSRC),0) -quiet_cmd_checksrc = CHECK $< - cmd_checksrc = $(CHECK) $(c_flags) $< ; + ifeq ($(KBUILD_CHECKSRC),2) + quiet_cmd_force_checksrc = CHECK $< + cmd_force_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + else + quiet_cmd_checksrc = CHECK $< + cmd_checksrc = $(CHECK) $(CHECKFLAGS) $(c_flags) $< ; + endif endif @@ -170,11 +187,13 @@ endef # Built-in and composite module parts %.o: %.c FORCE + $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) # Single-part modules are special since we need to mark them in $(MODVERDIR) $(single-used-m): %.o: %.c FORCE + $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) @{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod) @@ -209,6 +228,14 @@ cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< targets += $(real-objs-y) $(real-objs-m) $(lib-y) targets += $(extra-y) $(MAKECMDGOALS) $(always) +# Linker scripts preprocessor (.lds.S -> .lds) +# --------------------------------------------------------------------------- +quiet_cmd_cpp_lds_S = LDS $@ + cmd_cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -o $@ $< + +%.lds: %.lds.S FORCE + $(call if_changed_dep,cpp_lds_S) + # Build the compiled-in targets # --------------------------------------------------------------------------- @@ -275,90 +302,6 @@ $(multi-used-m) : %.o: $(multi-objs-m) FORCE targets += $(multi-used-y) $(multi-used-m) -# Compile programs on the host -# =========================================================================== -# host-progs := bin2hex -# Will compile bin2hex.c and create an executable named bin2hex -# -# host-progs := lxdialog -# lxdialog-objs := checklist.o lxdialog.o -# Will compile lxdialog.c and checklist.c, and then link the executable -# lxdialog, based on checklist.o and lxdialog.o -# -# host-progs := qconf -# qconf-cxxobjs := qconf.o -# qconf-objs := menu.o -# Will compile qconf as a C++ program, and menu as a C program. -# They are linked as C++ code to the executable qconf - -# host-progs := conf -# conf-objs := conf.o libkconfig.so -# libkconfig-objs := expr.o type.o -# Will create a shared library named libkconfig.so that consist of -# expr.o and type.o (they are both compiled as C code and the object file -# are made as position independent code). -# conf.c is compiled as a c program, and conf.o is linked together with -# libkconfig.so as the executable conf. -# Note: Shared libraries consisting of C++ files are not supported -# - -# Create executable from a single .c file -# host-csingle -> Executable -quiet_cmd_host-csingle = HOSTCC $@ - cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $< -$(host-csingle): %: %.c FORCE - $(call if_changed_dep,host-csingle) - -# Link an executable based on list of .o files, all plain c -# host-cmulti -> executable -quiet_cmd_host-cmulti = HOSTLD $@ - cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ - $(addprefix $(obj)/,$($(@F)-objs)) \ - $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -$(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE - $(call if_changed,host-cmulti) - -# Create .o file from a single .c file -# host-cobjs -> .o -quiet_cmd_host-cobjs = HOSTCC $@ - cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $< -$(host-cobjs): %.o: %.c FORCE - $(call if_changed_dep,host-cobjs) - -# Link an executable based on list of .o files, a mixture of .c and .cc -# host-cxxmulti -> executable -quiet_cmd_host-cxxmulti = HOSTLD $@ - cmd_host-cxxmulti = $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \ - $(foreach o,objs cxxobjs,\ - $(addprefix $(obj)/,$($(@F)-$(o)))) \ - $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -$(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE - $(call if_changed,host-cxxmulti) - -# Create .o file from a single .cc (C++) file -quiet_cmd_host-cxxobjs = HOSTCXX $@ - cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $< -$(host-cxxobjs): %.o: %.cc FORCE - $(call if_changed_dep,host-cxxobjs) - -# Compile .c file, create position independent .o file -# host-cshobjs -> .o -quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ - cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< -$(host-cshobjs): %.o: %.c FORCE - $(call if_changed_dep,host-cshobjs) - -# Link a shared library, based on position independent .o files -# *.o -> .so shared library (host-cshlib) -quiet_cmd_host-cshlib = HOSTLLD -shared $@ - cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \ - $(addprefix $(obj)/,$($(@F:.so=-objs))) \ - $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) -$(host-cshlib): %: $(host-cshobjs) FORCE - $(call if_changed,host-cshlib) - -targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ - $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) # Descending # --------------------------------------------------------------------------- diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 7277dd208ead79..b02ab1fb28e38d 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -29,21 +29,49 @@ subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) # Add subdir path subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) -__clean-files := $(wildcard $(addprefix $(obj)/, \ - $(extra-y) $(EXTRA_TARGETS) $(always) $(host-progs) \ - $(targets) $(clean-files))) + +# build a list of files to remove, usually releative to the current +# directory + +__clean-files := $(extra-y) $(EXTRA_TARGETS) $(always) \ + $(targets) $(clean-files) \ + $(host-progs) \ + $(hostprogs-y) $(hostprogs-m) $(hostprogs-) + +# as clean-files is given relative to the current directory, this adds +# a $(obj) prefix, except for absolute paths + +__clean-files := $(wildcard \ + $(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \ + $(filter /%, $(__clean-files))) + +# as clean-dirs is given relative to the current directory, this adds +# a $(obj) prefix, except for absolute paths + +__clean-dirs := $(wildcard \ + $(addprefix $(obj)/, $(filter-out /%, $(clean-dirs))) \ + $(filter /%, $(clean-dirs))) # ========================================================================== -quiet_cmd_clean = CLEAN $(obj) - cmd_clean = rm -f $(__clean-files); $(clean-rule) +quiet_cmd_clean = CLEAN $(obj) + cmd_clean = rm -f $(__clean-files) +quiet_cmd_cleandir = CLEAN $(__clean-dirs) + cmd_cleandir = rm -rf $(__clean-dirs) + __clean: $(subdir-ymn) -ifneq ($(strip $(__clean-files) $(clean-rule)),) +ifneq ($(strip $(__clean-files)),) +$(call cmd,clean) -else - @: endif +ifneq ($(strip $(__clean-dirs)),) + +$(call cmd,cleandir) +endif +ifneq ($(strip $(clean-rule)),) + +$(clean-rule) +endif + @: + # =========================================================================== # Generic stuff diff --git a/scripts/Makefile.host b/scripts/Makefile.host new file mode 100644 index 00000000000000..0a5d8cafa135b7 --- /dev/null +++ b/scripts/Makefile.host @@ -0,0 +1,154 @@ +# ========================================================================== +# Building binaries on the host system +# Binaries are used during the compilation of the kernel, for example +# to preprocess a data file. +# +# Both C and C++ is supported, but preferred language is C for such utilities. +# +# Samle syntax (see Documentation/kbuild/makefile.txt for reference) +# hostprogs-y := bin2hex +# Will compile bin2hex.c and create an executable named bin2hex +# +# hostprogs-y := lxdialog +# lxdialog-objs := checklist.o lxdialog.o +# Will compile lxdialog.c and checklist.c, and then link the executable +# lxdialog, based on checklist.o and lxdialog.o +# +# hostprogs-y := qconf +# qconf-cxxobjs := qconf.o +# qconf-objs := menu.o +# Will compile qconf as a C++ program, and menu as a C program. +# They are linked as C++ code to the executable qconf + +# hostprogs-y := conf +# conf-objs := conf.o libkconfig.so +# libkconfig-objs := expr.o type.o +# Will create a shared library named libkconfig.so that consist of +# expr.o and type.o (they are both compiled as C code and the object file +# are made as position independent code). +# conf.c is compiled as a c program, and conf.o is linked together with +# libkconfig.so as the executable conf. +# Note: Shared libraries consisting of C++ files are not supported + +__hostprogs := $(sort $(hostprogs-y)$(hostprogs-m)) + +# hostprogs-y := tools/build may have been specified. Retreive directory +obj-dirs += $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) +obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs)))) + + +# C code +# Executables compiled from a single .c file +host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m))) + +# C executables linked based on several .o files +host-cmulti := $(foreach m,$(__hostprogs),\ + $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m)))) + +# Object (.o) files compiled from .c files +host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs))) + +# C++ code +# C++ executables compiled from at least on .cc file +# and zero or more .c files +host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m))) + +# C++ Object (.o) files compiled from .cc files +host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) + +# Shared libaries (only .c supported) +# Shared libraries (.so) - all .so files referenced in "xxx-objs" +host-cshlib := $(sort $(filter %.so, $(host-cobjs))) +# Remove .so files from "xxx-objs" +host-cobjs := $(filter-out %.so,$(host-cobjs)) + +#Object (.o) files used by the shared libaries +host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) + +__hostprogs := $(addprefix $(obj)/,$(__hostprogs)) +host-csingle := $(addprefix $(obj)/,$(host-csingle)) +host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) +host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) +host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) +host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) +host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) +host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) + +##### +# Handle options to gcc. Support building with separate output directory + +_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o) +_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o) + +ifeq ($(KBUILD_SRC),) +__hostc_flags = $(_hostc_flags) +__hostcxx_flags = $(_hostcxx_flags) +else +__hostc_flags = -I$(obj) $(call flags,_hostc_flags) +__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) +endif + +hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags) +hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) + +##### +# Compile programs on the host + +# Create executable from a single .c file +# host-csingle -> Executable +quiet_cmd_host-csingle = HOSTCC $@ + cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $< +$(host-csingle): %: %.c FORCE + $(call if_changed_dep,host-csingle) + +# Link an executable based on list of .o files, all plain c +# host-cmulti -> executable +quiet_cmd_host-cmulti = HOSTLD $@ + cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ + $(addprefix $(obj)/,$($(@F)-objs)) \ + $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) +$(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE + $(call if_changed,host-cmulti) + +# Create .o file from a single .c file +# host-cobjs -> .o +quiet_cmd_host-cobjs = HOSTCC $@ + cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $< +$(host-cobjs): %.o: %.c FORCE + $(call if_changed_dep,host-cobjs) + +# Link an executable based on list of .o files, a mixture of .c and .cc +# host-cxxmulti -> executable +quiet_cmd_host-cxxmulti = HOSTLD $@ + cmd_host-cxxmulti = $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \ + $(foreach o,objs cxxobjs,\ + $(addprefix $(obj)/,$($(@F)-$(o)))) \ + $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) +$(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE + $(call if_changed,host-cxxmulti) + +# Create .o file from a single .cc (C++) file +quiet_cmd_host-cxxobjs = HOSTCXX $@ + cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $< +$(host-cxxobjs): %.o: %.cc FORCE + $(call if_changed_dep,host-cxxobjs) + +# Compile .c file, create position independent .o file +# host-cshobjs -> .o +quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ + cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< +$(host-cshobjs): %.o: %.c FORCE + $(call if_changed_dep,host-cshobjs) + +# Link a shared library, based on position independent .o files +# *.o -> .so shared library (host-cshlib) +quiet_cmd_host-cshlib = HOSTLLD -shared $@ + cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \ + $(addprefix $(obj)/,$($(@F:.so=-objs))) \ + $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) +$(host-cshlib): %: $(host-cshobjs) FORCE + $(call if_changed,host-cshlib) + +targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ + $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) + diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index a47abc8af0a6e4..3a7663b901f067 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -60,41 +60,11 @@ subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o) # $(obj-dirs) is a list of directories that contain object files obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) -obj-dirs += $(foreach f,$(host-progs), $(if $(dir $(f)),$(dir $(f)))) -obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs)))) # Replace multi-part objects by their individual parts, look at local dir only real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) -# C code -# Executables compiled from a single .c file -host-csingle := $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m))) - -# C executables linked based on several .o files -host-cmulti := $(foreach m,$(host-progs),\ - $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m)))) - -# Object (.o) files compiled from .c files -host-cobjs := $(sort $(foreach m,$(host-progs),$($(m)-objs))) - -# C++ code -# C++ executables compiled from at least on .cc file -# and zero or more .c files -host-cxxmulti := $(foreach m,$(host-progs),$(if $($(m)-cxxobjs),$(m))) - -# C++ Object (.o) files compiled from .cc files -host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) - -# Shared libaries (only .c supported) -# Shared libraries (.so) - all .so files referenced in "xxx-objs" -host-cshlib := $(sort $(filter %.so, $(host-cobjs))) -# Remove .so files from "xxx-objs" -host-cobjs := $(filter-out %.so,$(host-cobjs)) - -#Object (.o) files used by the shared libaries -host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) - # Add subdir path extra-y := $(addprefix $(obj)/,$(extra-y)) @@ -113,14 +83,6 @@ multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) -host-progs := $(addprefix $(obj)/,$(host-progs)) -host-csingle := $(addprefix $(obj)/,$(host-csingle)) -host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) -host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) -host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) -host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) -host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) -host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) # The temporary file to save gcc -MD generated dependencies must not # contain a comma @@ -136,12 +98,9 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d) basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname)))) - _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) -_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o) -_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o) - +_cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) # If building the kernel in a separate objtree expand all occurrences # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). @@ -149,8 +108,7 @@ _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o) ifeq ($(KBUILD_SRC),) __c_flags = $(_c_flags) __a_flags = $(_a_flags) -__hostc_flags = $(_hostc_flags) -__hostcxx_flags = $(_hostcxx_flags) +__cpp_flags = $(_cpp_flags) else # Prefix -I with $(srctree) if it is not an absolute path @@ -164,8 +122,7 @@ flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) # FIXME: Replace both with specific CFLAGS* statements in the makefiles __c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags) __a_flags = $(call flags,_a_flags) -__hostc_flags = -I$(obj) $(call flags,_hostc_flags) -__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags) +__cpp_flags = $(call flags,_cpp_flags) endif c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ @@ -175,8 +132,7 @@ c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ $(__a_flags) $(modkern_aflags) -hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags) -hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) +cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags) ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 19f5345279ac56..c5d201f660c9fc 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -50,7 +50,8 @@ _modpost: $(modules) # Step 2), invoke modpost # Includes step 3,4 quiet_cmd_modpost = MODPOST - cmd_modpost = scripts/mod/modpost \ + cmd_modpost = scripts/mod/modpost \ + $(if $(CONFIG_MODVERSIONS),-m) \ $(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \ $(filter-out FORCE,$^) diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile index 3afb3bf4d12cec..f22e94c3a2d14d 100644 --- a/scripts/basic/Makefile +++ b/scripts/basic/Makefile @@ -11,8 +11,8 @@ # include/config/... # docproc: Used in Documentation/docbook -host-progs := fixdep split-include docproc -always := $(host-progs) +hostprogs-y := fixdep split-include docproc +always := $(hostprogs-y) # fixdep is needed to compile other host programs $(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 8bd6442229cf06..9c03a6673aad6e 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -104,7 +104,7 @@ #include <stdio.h> #include <limits.h> #include <ctype.h> -#include <netinet/in.h> +#include <arpa/inet.h> #define INT_CONF ntohl(0x434f4e46) #define INT_ONFI ntohl(0x4f4e4649) diff --git a/scripts/binoffset.c b/scripts/binoffset.c index 7b8100d8e10660..591309d855186b 100644 --- a/scripts/binoffset.c +++ b/scripts/binoffset.c @@ -41,7 +41,7 @@ char *progname; char *inputname; int inputfd; -int bix; /* buf index */ +unsigned int bix; /* buf index */ unsigned char patterns [PAT_SIZE] = {0}; /* byte-sized pattern array */ int pat_len; /* actual number of pattern bytes */ unsigned char *madr; /* mmap address */ @@ -58,7 +58,7 @@ void usage (void) exit (1); } -int get_pattern (int pat_count, char *pats []) +void get_pattern (int pat_count, char *pats []) { int ix, err, tmp; @@ -81,7 +81,7 @@ int get_pattern (int pat_count, char *pats []) pat_len = pat_count; } -int search_pattern (void) +void search_pattern (void) { for (bix = 0; bix < filesize; bix++) { if (madr[bix] == patterns[0]) { @@ -109,7 +109,7 @@ size_t get_filesize (int fd) struct stat stat; err = fstat (fd, &stat); - fprintf (stderr, "filesize: %d\n", err < 0 ? err : stat.st_size); + fprintf (stderr, "filesize: %ld\n", err < 0 ? (long)err : stat.st_size); if (err < 0) return err; return (size_t) stat.st_size; @@ -154,8 +154,8 @@ int main (int argc, char *argv []) fprintf (stderr, "number of pattern matches = %d\n", num_matches); if (num_matches == 0) firstloc = ~0; - printf ("%d\n", firstloc); - fprintf (stderr, "%d\n", firstloc); + printf ("%ld\n", firstloc); + fprintf (stderr, "%ld\n", firstloc); exit (num_matches ? 0 : 2); } diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile index 76f1fd10e16fb2..5875f29a86025a 100644 --- a/scripts/genksyms/Makefile +++ b/scripts/genksyms/Makefile @@ -1,6 +1,6 @@ -host-progs := genksyms -always := $(host-progs) +hostprogs-y := genksyms +always := $(hostprogs-y) genksyms-objs := genksyms.o parse.o lex.o diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 89b986abd75346..6377641dd59926 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -67,7 +67,7 @@ help: libkconfig-objs := zconf.tab.o -host-progs := conf mconf qconf gconf +hostprogs-y := conf mconf qconf gconf conf-objs := conf.o libkconfig.so mconf-objs := mconf.o libkconfig.so diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 90247d2e88ce04..7b6285e7c8f9b3 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -8,6 +8,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <time.h> #include <unistd.h> #define LKC_DIRECT_LINK @@ -268,6 +269,7 @@ int conf_write(const char *name) char dirname[128], tmpname[128], newname[128]; int type, l; const char *str; + time_t now; dirname[0] = 0; if (name && name[0]) { @@ -301,14 +303,25 @@ int conf_write(const char *name) if (!out_h) return 1; } + sym = sym_lookup("KERNELRELEASE", 0); + sym_calc_value(sym); + time(&now); fprintf(out, "#\n" "# Automatically generated make config: don't edit\n" - "#\n"); + "# Linux kernel version: %s\n" + "# %s" + "#\n", + sym_get_string_value(sym), + ctime(&now)); if (out_h) fprintf(out_h, "/*\n" " * Automatically generated C config: don't edit\n" + " * Linux kernel version: %s\n" + " * %s" " */\n" - "#define AUTOCONF_INCLUDED\n"); + "#define AUTOCONF_INCLUDED\n", + sym_get_string_value(sym), + ctime(&now)); if (!sym_change_count) sym_clear_all_valid(); diff --git a/scripts/lxdialog/Makefile b/scripts/lxdialog/Makefile index 2f22b2f69d8cd3..cdc4024a8830ee 100644 --- a/scripts/lxdialog/Makefile +++ b/scripts/lxdialog/Makefile @@ -15,8 +15,8 @@ endif endif endif -host-progs := lxdialog -always := ncurses $(host-progs) +hostprogs-y := lxdialog +always := ncurses $(hostprogs-y) lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ util.o lxdialog.o msgbox.o diff --git a/scripts/mksysmap b/scripts/mksysmap new file mode 100644 index 00000000000000..2904d3b383ed30 --- /dev/null +++ b/scripts/mksysmap @@ -0,0 +1,44 @@ +#!/bin/sh -x +# Based on the vmlinux file create the System.map file +# System.map is used by module-init tools and some debugging +# tools to retreive the actual addresses of symbols in the kernel. +# +# Usage +# mksysmap vmlinux System.map + + +##### +# Generate System.map (actual filename passed as second argument) + +# $NM produces the following output: +# f0081e80 T alloc_vfsmnt + +# The second row specify the type of the symbol: +# A = Absolute +# B = Uninitialised data (.bss) +# C = Comon symbol +# D = Initialised data +# G = Initialised data for small objects +# I = Indirect reference to another symbol +# N = Debugging symbol +# R = Read only +# S = Uninitialised data for small objects +# T = Text code symbol +# U = Undefined symbol +# V = Weak symbol +# W = Weak symbol +# Corresponding small letters are local symbols + +# For System.map filter away: +# a - local absolute symbols +# U - undefined global symbols +# w - local weak symbols + +# readprofile starts reading symbols when _stext is found, and +# continue until it finds a symbol which is not either of 'T', 't', +# 'W' or 'w'. __crc_ are 'A' and placed in the middle +# so we just ignore them to let readprofile continue to work. +# (At least sparc64 has __crc_ in the middle). + +$NM -n $1 | grep -v '\( [aUw] \)\|\(__crc_\)' > $2 + diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index f66bf5262aae32..11d69c35e5b4a1 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -1,5 +1,5 @@ -host-progs := modpost mk_elfconfig -always := $(host-progs) empty.o +hostprogs-y := modpost mk_elfconfig +always := $(hostprogs-y) empty.o modpost-objs := modpost.o file2alias.o sumversion.o diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 662e75b2f780bb..65072d76a101e3 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -343,7 +343,6 @@ handle_modversions(struct module *mod, struct elf_info *info, crc = (unsigned int) sym->st_value; add_exported_symbol(symname + strlen(CRC_PFX), mod, &crc); - modversions = 1; } break; case SHN_UNDEF: @@ -649,7 +648,6 @@ read_dump(const char *fname) if (!(mod = find_module(modname))) { if (is_vmlinux(modname)) { - modversions = 1; have_vmlinux = 1; } mod = new_module(NOFAIL(strdup(modname))); @@ -696,11 +694,14 @@ main(int argc, char **argv) char *dump_read = NULL, *dump_write = NULL; int opt; - while ((opt = getopt(argc, argv, "i:o:")) != -1) { + while ((opt = getopt(argc, argv, "i:mo:")) != -1) { switch(opt) { case 'i': dump_read = optarg; break; + case 'm': + modversions = 1; + break; case 'o': dump_write = optarg; break; diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index b41b718edffefa..631430d09e4ded 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -1,4 +1,4 @@ -#include <netinet/in.h> +#include <arpa/inet.h> #include <stdint.h> #include <ctype.h> #include <errno.h> diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 48f89e17a3cf5e..3b1f2eff258448 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -51,7 +51,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec $(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz rm ../$(KERNELPATH).tar.gz -clean-rule += rm -f $(objtree)/kernel.spec +clean-files := $(objtree)/kernel.spec # binrpm-pkg .PHONY: binrpm-pkg @@ -67,7 +67,7 @@ binrpm-pkg: $(objtree)/binkernel.spec $(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $< -clean-rule += rm -f $(objtree)/binkernel.spec +clean-files += $(objtree)/binkernel.spec # Deb target # --------------------------------------------------------------------------- @@ -77,7 +77,7 @@ deb-pkg: $(MAKE) $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb -clean-rule += && rm -rf $(objtree)/debian/ +clean-dirs += $(objtree)/debian/ # Help text displayed when executing 'make help' diff --git a/scripts/patch-kernel b/scripts/patch-kernel index 3f316b6c4d9cd7..43af01075612a5 100755 --- a/scripts/patch-kernel +++ b/scripts/patch-kernel @@ -40,17 +40,24 @@ # # Added -ac option, use -ac or -ac9 (say) to stop at a particular version # Dave Gilbert <linux@treblig.org>, 29th September 2001. +# +# Add support for (use of) EXTRAVERSION (to support 2.6.8.x, e.g.); +# update usage message; +# fix some whitespace damage; +# be smarter about stopping when current version is larger than requested; +# Randy Dunlap <rddunlap@osdl.org>, 2004-AUG-18. # Set directories from arguments, or use defaults. sourcedir=${1-/usr/src/linux} patchdir=${2-.} -stopvers=${3-imnotaversion} +stopvers=${3-default} -if [ "$1" = -h -o "$1" = --help -o ! -r "$sourcedir/Makefile" ]; then +if [ "$1" == -h -o "$1" == --help -o ! -r "$sourcedir/Makefile" ]; then cat << USAGE usage: patch-kernel [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ] - The source directory defaults to /usr/src/linux, and - the patch directory defaults to the current directory. + source directory defaults to /usr/src/linux, + patch directory defaults to the current directory, + stopversion defaults to <all in patchdir>. USAGE exit 1 fi @@ -77,7 +84,7 @@ findFile () { uncomp="gunzip -dc" elif [ -r ${filebase}.bz ]; then ext=".bz" - name="bzip" + name="bzip" uncomp="bunzip -dc" elif [ -r ${filebase}.bz2 ]; then ext=".bz2" @@ -96,8 +103,8 @@ findFile () { name="plaintext" uncomp="cat" else - return 1; - fi + return 1; + fi return 0; } @@ -126,48 +133,100 @@ applyPatch () { return 0; } -# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTERVERSION -eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' $sourcedir/Makefile` +# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION +TMPFILE=`mktemp .tmpver.XXXXXX` || { echo "cannot make temp file" ; exit 1; } +grep -E "^(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)" $sourcedir/Makefile > $TMPFILE +tr -d [:blank:] < $TMPFILE > $TMPFILE.1 +source $TMPFILE.1 +rm -f $TMPFILE* if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ] then echo "unable to determine current kernel version" >&2 exit 1 fi -echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}" +NAME=`grep ^NAME $sourcedir/Makefile` +NAME=${NAME##*=} +echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} ($NAME)" + +# strip EXTRAVERSION to just a number (drop leading '.' and trailing additions) +EXTRAVER= if [ x$EXTRAVERSION != "x" ] then - echo "I'm sorry but patch-kernel can't work with a kernel source tree that is not a base version" - exit 1; + if [ ${EXTRAVERSION:0:1} == "." ]; then + EXTRAVER=${EXTRAVERSION:1} + else + EXTRAVER=$EXTRAVERSION + fi + EXTRAVER=${EXTRAVER%%[[:punct:]]*} + #echo "patch-kernel: changing EXTRAVERSION from $EXTRAVERSION to $EXTRAVER" +fi + +#echo "stopvers=$stopvers" +if [ $stopvers != "default" ]; then + STOPSUBLEVEL=`echo $stopvers | cut -d. -f3` + STOPEXTRA=`echo $stopvers | cut -d. -f4` + #echo "STOPSUBLEVEL=$STOPSUBLEVEL, STOPEXTRA=$STOPEXTRA" +else + STOPSUBLEVEL=9999 + STOPEXTRA=9999 fi -while : +while : # incrementing SUBLEVEL (s in v.p.s) do - CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" - if [ $stopvers = $CURRENTFULLVERSION ] - then - echo "Stoping at $CURRENTFULLVERSION base as requested." + if [ x$EXTRAVER != "x" ]; then + CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL.$EXTRAVER" + else + CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" + fi + + if [ $stopvers == $CURRENTFULLVERSION ]; then + echo "Stopping at $CURRENTFULLVERSION base as requested." break fi - SUBLEVEL=`expr $SUBLEVEL + 1` + while : # incrementing EXTRAVER (x in v.p.s.x) + do + EXTRAVER=$((EXTRAVER + 1)) + FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL.$EXTRAVER" + #echo "... trying $FULLVERSION ..." + + patch=patch-$FULLVERSION + + # See if the file exists and find extension + findFile $patchdir/${patch} || break + + # Apply the patch and check all is OK + applyPatch $patch || break + + continue 2 + done + + EXTRAVER= + SUBLEVEL=$((SUBLEVEL + 1)) FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" + #echo "___ trying $FULLVERSION ___" + + if [ $((SUBLEVEL)) -gt $((STOPSUBLEVEL)) ]; then + echo "Stopping since sublevel ($SUBLEVEL) is beyond stop-sublevel ($STOPSUBLEVEL)" + exit 1 + fi patch=patch-$FULLVERSION - # See if the file exists and find extension - findFile $patchdir/${patch} || break + # See if the file exists and find extension + findFile $patchdir/${patch} || break # Apply the patch and check all is OK applyPatch $patch || break done +#echo "base all done" if [ x$gotac != x ]; then # Out great user wants the -ac patches # They could have done -ac (get latest) or -acxx where xx=version they want - if [ $gotac == "-ac" ] - then + if [ $gotac == "-ac" ]; then # They want the latest version HIGHESTPATCH=0 for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.* @@ -176,18 +235,16 @@ if [ x$gotac != x ]; then # Check it is actually a recognised patch type findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${ACVALUE} || break - if [ $ACVALUE -gt $HIGHESTPATCH ] - then + if [ $ACVALUE -gt $HIGHESTPATCH ]; then HIGHESTPATCH=$ACVALUE fi done - if [ $HIGHESTPATCH -ne 0 ] - then + if [ $HIGHESTPATCH -ne 0 ]; then findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH} || break applyPatch patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH} else - echo "No ac patches found" + echo "No -ac patches found" fi else # They want an exact version @@ -198,5 +255,3 @@ if [ x$gotac != x ]; then applyPatch patch-${CURRENTFULLVERSION}${gotac} fi fi - - |