Commit 4800be295c34268fd3211d49828bfaa6bf62867f

Authored by Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild

* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild:
  kbuild: fix first module build
  kconfig: update kconfig-language text
  kbuild: introduce cc-cross-prefix
  kbuild: disable depmod in cross-compile kernel build
  kbuild: make deb-pkg - add 'Provides:' line
  kconfig: comment typo in scripts/kconfig/Makefile.
  kbuild: stop docproc segfaulting when SRCTREE isn't set.
  kbuild: modpost problem when symbols move from one module to another
  kbuild: cscope - filter out .tmp_* in find_sources
  kbuild: mailing list has moved
  kbuild: check asm symlink when building a kernel

Showing 9 changed files Side-by-side Diff

Documentation/kbuild/kconfig-language.txt
... ... @@ -77,7 +77,12 @@
77 77 Optionally, dependencies only for this default value can be added with
78 78 "if".
79 79  
80   -- dependencies: "depends on"/"requires" <expr>
  80 +- type definition + default value:
  81 + "def_bool"/"def_tristate" <expr> ["if" <expr>]
  82 + This is a shorthand notation for a type definition plus a value.
  83 + Optionally dependencies for this default value can be added with "if".
  84 +
  85 +- dependencies: "depends on" <expr>
81 86 This defines a dependency for this menu entry. If multiple
82 87 dependencies are defined, they are connected with '&&'. Dependencies
83 88 are applied to all other options within this menu entry (which also
... ... @@ -289,4 +294,11 @@
289 294 "source" <prompt>
290 295  
291 296 This reads the specified configuration file. This file is always parsed.
  297 +
  298 +mainmenu:
  299 +
  300 + "mainmenu" <prompt>
  301 +
  302 +This sets the config program's title bar if the config program chooses
  303 +to use it.
Documentation/kbuild/makefiles.txt
... ... @@ -518,6 +518,28 @@
518 518 In this example for a specific GCC version the build will error out explaining
519 519 to the user why it stops.
520 520  
  521 + cc-cross-prefix
  522 + cc-cross-prefix is used to check if there exist a $(CC) in path with
  523 + one of the listed prefixes. The first prefix where there exist a
  524 + prefix$(CC) in the PATH is returned - and if no prefix$(CC) is found
  525 + then nothing is returned.
  526 + Additional prefixes are separated by a single space in the
  527 + call of cc-cross-prefix.
  528 + This functionality is usefull for architecture Makefile that try
  529 + to set CROSS_COMPILE to well know values but may have several
  530 + values to select between.
  531 + It is recommended only to try to set CROSS_COMPILE is it is a cross
  532 + build (host arch is different from target arch). And is CROSS_COMPILE
  533 + is already set then leave it with the old value.
  534 +
  535 + Example:
  536 + #arch/m68k/Makefile
  537 + ifneq ($(SUBARCH),$(ARCH))
  538 + ifeq ($(CROSS_COMPILE),)
  539 + CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu-)
  540 + endif
  541 + endif
  542 +
521 543 === 4 Host Program support
522 544  
523 545 Kbuild supports building executables on the host for use during the
... ... @@ -2178,7 +2178,7 @@
2178 2178 KCONFIG
2179 2179 P: Roman Zippel
2180 2180 M: zippel@linux-m68k.org
2181   -L: kbuild-devel@lists.sourceforge.net
  2181 +L: linux-kbuild@vger.kernel.org
2182 2182 S: Maintained
2183 2183  
2184 2184 KDUMP
... ... @@ -2207,6 +2207,7 @@
2207 2207 P: Sam Ravnborg
2208 2208 M: sam@ravnborg.org
2209 2209 T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git
  2210 +L: linux-kbuild@vger.kernel.org
2210 2211 S: Maintained
2211 2212  
2212 2213 KERNEL JANITORS
... ... @@ -887,10 +887,7 @@
887 887  
888 888 prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
889 889 include/asm include/config/auto.conf
890   -ifneq ($(KBUILD_MODULES),)
891   - $(Q)mkdir -p $(MODVERDIR)
892   - $(Q)rm -f $(MODVERDIR)/*
893   -endif
  890 + $(cmd_crmodverdir)
894 891  
895 892 archprepare: prepare1 scripts_basic
896 893  
897 894  
... ... @@ -906,14 +903,24 @@
906 903  
907 904 export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
908 905  
909   -# FIXME: The asm symlink changes when $(ARCH) changes. That's
910   -# hard to detect, but I suppose "make mrproper" is a good idea
911   -# before switching between archs anyway.
  906 +# The asm symlink changes when $(ARCH) changes.
  907 +# Detect this and ask user to run make mrproper
912 908  
913   -include/asm:
914   - @echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'
915   - $(Q)if [ ! -d include ]; then mkdir -p include; fi;
916   - @ln -fsn asm-$(SRCARCH) $@
  909 +include/asm: FORCE
  910 + $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
  911 + if [ -L include/asm ]; then \
  912 + if [ "$$asmlink" != "$(SRCARCH)" ]; then \
  913 + echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
  914 + echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
  915 + exit 1; \
  916 + fi; \
  917 + else \
  918 + echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
  919 + if [ ! -d include ]; then \
  920 + mkdir -p include; \
  921 + fi; \
  922 + ln -fsn asm-$(SRCARCH) $@; \
  923 + fi
917 924  
918 925 # Generate some files
919 926 # ---------------------------------------------------------------------------
920 927  
921 928  
... ... @@ -1023,19 +1030,12 @@
1023 1030 fi
1024 1031 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1025 1032  
1026   -# If System.map exists, run depmod. This deliberately does not have a
1027   -# dependency on System.map since that would run the dependency tree on
1028   -# vmlinux. This depmod is only for convenience to give the initial
  1033 +# This depmod is only for convenience to give the initial
1029 1034 # boot a modules.dep even before / is mounted read-write. However the
1030 1035 # boot script depmod is the master version.
1031   -ifeq "$(strip $(INSTALL_MOD_PATH))" ""
1032   -depmod_opts :=
1033   -else
1034   -depmod_opts := -b $(INSTALL_MOD_PATH) -r
1035   -endif
1036 1036 PHONY += _modinst_post
1037 1037 _modinst_post: _modinst_
1038   - if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
  1038 + $(call cmd,depmod)
1039 1039  
1040 1040 else # CONFIG_MODULES
1041 1041  
... ... @@ -1223,8 +1223,7 @@
1223 1223 KBUILD_MODULES := 1
1224 1224 PHONY += crmodverdir
1225 1225 crmodverdir:
1226   - $(Q)mkdir -p $(MODVERDIR)
1227   - $(Q)rm -f $(MODVERDIR)/*
  1226 + $(cmd_crmodverdir)
1228 1227  
1229 1228 PHONY += $(objtree)/Module.symvers
1230 1229 $(objtree)/Module.symvers:
... ... @@ -1252,15 +1251,6 @@
1252 1251 $(Q)mkdir -p $(MODLIB)/$(install-dir)
1253 1252 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1254 1253  
1255   -# Run depmod only is we have System.map and depmod is executable
1256   -quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
1257   - cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \
1258   - $(DEPMOD) -ae -F System.map \
1259   - $(if $(strip $(INSTALL_MOD_PATH)), \
1260   - -b $(INSTALL_MOD_PATH) -r) \
1261   - $(KERNELRELEASE); \
1262   - fi
1263   -
1264 1254 PHONY += _emodinst_post
1265 1255 _emodinst_post: _emodinst_
1266 1256 $(call cmd,depmod)
... ... @@ -1344,7 +1334,7 @@
1344 1334 find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
1345 1335 -name $1 -print; \
1346 1336 find $(__srctree) $(RCS_FIND_IGNORE) \
1347   - \( -name include -o -name arch \) -prune -o \
  1337 + \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \
1348 1338 -name $1 -print; \
1349 1339 )
1350 1340 endef
1351 1341  
... ... @@ -1493,9 +1483,11 @@
1493 1483  
1494 1484 # Modules
1495 1485 / %/: prepare scripts FORCE
  1486 + $(cmd_crmodverdir)
1496 1487 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1497 1488 $(build)=$(build-dir)
1498 1489 %.ko: prepare scripts FORCE
  1490 + $(cmd_crmodverdir)
1499 1491 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1500 1492 $(build)=$(build-dir) $(@:.ko=.o)
1501 1493 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
... ... @@ -1508,6 +1500,19 @@
1508 1500  
1509 1501 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
1510 1502 cmd_rmfiles = rm -f $(rm-files)
  1503 +
  1504 +# Run depmod only is we have System.map and depmod is executable
  1505 +# and we build for the host arch
  1506 +quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
  1507 + cmd_depmod = \
  1508 + if [ -r System.map -a -x $(DEPMOD) -a "$(SUBARCH)" == "$(ARCH)" ]; then \
  1509 + $(DEPMOD) -ae -F System.map \
  1510 + $(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) -r) \
  1511 + $(KERNELRELEASE); \
  1512 + fi
  1513 +
  1514 +# Create temporary dir for module support files
  1515 +cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR); rm -f $(MODVERDIR)/*
1511 1516  
1512 1517  
1513 1518 a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
scripts/Kbuild.include
... ... @@ -56,6 +56,17 @@
56 56 # gcc support functions
57 57 # See documentation in Documentation/kbuild/makefiles.txt
58 58  
  59 +# cc-cross-prefix
  60 +# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
  61 +# Return first prefix where a prefix$(CC) is found in PATH.
  62 +# If no $(CC) found in PATH with listed prefixes return nothing
  63 +cc-cross-prefix = \
  64 + $(word 1, $(foreach c,$(1), \
  65 + $(shell set -e; \
  66 + if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \
  67 + echo $(c); \
  68 + fi)))
  69 +
59 70 # output directory for tests below
60 71 TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
61 72  
scripts/basic/docproc.c
... ... @@ -66,12 +66,15 @@
66 66 #define FUNCTION "-function"
67 67 #define NOFUNCTION "-nofunction"
68 68  
  69 +char *srctree;
  70 +
69 71 void usage (void)
70 72 {
71 73 fprintf(stderr, "Usage: docproc {doc|depend} file\n");
72 74 fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n");
73 75 fprintf(stderr, "doc: frontend when generating kernel documentation\n");
74 76 fprintf(stderr, "depend: generate list of files referenced within file\n");
  77 + fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n");
75 78 }
76 79  
77 80 /*
... ... @@ -90,7 +93,7 @@
90 93 exit(1);
91 94 case 0:
92 95 memset(real_filename, 0, sizeof(real_filename));
93   - strncat(real_filename, getenv("SRCTREE"), PATH_MAX);
  96 + strncat(real_filename, srctree, PATH_MAX);
94 97 strncat(real_filename, KERNELDOCPATH KERNELDOC,
95 98 PATH_MAX - strlen(real_filename));
96 99 execvp(real_filename, svec);
... ... @@ -171,7 +174,7 @@
171 174 if (filename_exist(filename) == NULL) {
172 175 char real_filename[PATH_MAX + 1];
173 176 memset(real_filename, 0, sizeof(real_filename));
174   - strncat(real_filename, getenv("SRCTREE"), PATH_MAX);
  177 + strncat(real_filename, srctree, PATH_MAX);
175 178 strncat(real_filename, filename,
176 179 PATH_MAX - strlen(real_filename));
177 180 sym = add_new_file(filename);
... ... @@ -338,6 +341,10 @@
338 341 int main(int argc, char *argv[])
339 342 {
340 343 FILE * infile;
  344 +
  345 + srctree = getenv("SRCTREE");
  346 + if (!srctree)
  347 + srctree = getcwd(NULL, 0);
341 348 if (argc != 3) {
342 349 usage();
343 350 exit(1);
scripts/kconfig/Makefile
... ... @@ -84,7 +84,7 @@
84 84 # lxdialog stuff
85 85 check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
86 86  
87   -# Use reursively expanded variables so we do not call gcc unless
  87 +# Use recursively expanded variables so we do not call gcc unless
88 88 # we really need to do so. (Do not call gcc as part of make mrproper)
89 89 HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
90 90 HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
scripts/mod/modpost.c
... ... @@ -268,6 +268,9 @@
268 268 "was in %s%s\n", mod->name, name,
269 269 s->module->name,
270 270 is_vmlinux(s->module->name) ?"":".ko");
  271 + } else {
  272 + /* In case Modules.symvers was out of date */
  273 + s->module = mod;
271 274 }
272 275 }
273 276 s->preloaded = 0;
scripts/package/builddeb
... ... @@ -83,6 +83,7 @@
83 83 Standards-Version: 3.6.1
84 84  
85 85 Package: $packagename
  86 +Provides: kernel-image-$version, linux-image-$version
86 87 Architecture: any
87 88 Description: User Mode Linux kernel, version $version
88 89 User-mode Linux is a port of the Linux kernel to its own system call
... ... @@ -104,6 +105,7 @@
104 105 Standards-Version: 3.6.1
105 106  
106 107 Package: $packagename
  108 +Provides: kernel-image-$version, linux-image-$version
107 109 Architecture: any
108 110 Description: Linux kernel, version $version
109 111 This package contains the Linux kernel, modules and corresponding other