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
This commit is contained in:
Linus Torvalds 2007-10-19 13:47:38 -07:00
commit 4800be295c
9 changed files with 100 additions and 37 deletions

View file

@ -77,7 +77,12 @@ applicable everywhere (see syntax).
Optionally, dependencies only for this default value can be added with Optionally, dependencies only for this default value can be added with
"if". "if".
- dependencies: "depends on"/"requires" <expr> - type definition + default value:
"def_bool"/"def_tristate" <expr> ["if" <expr>]
This is a shorthand notation for a type definition plus a value.
Optionally dependencies for this default value can be added with "if".
- dependencies: "depends on" <expr>
This defines a dependency for this menu entry. If multiple This defines a dependency for this menu entry. If multiple
dependencies are defined, they are connected with '&&'. Dependencies dependencies are defined, they are connected with '&&'. Dependencies
are applied to all other options within this menu entry (which also are applied to all other options within this menu entry (which also
@ -289,3 +294,10 @@ source:
"source" <prompt> "source" <prompt>
This reads the specified configuration file. This file is always parsed. This reads the specified configuration file. This file is always parsed.
mainmenu:
"mainmenu" <prompt>
This sets the config program's title bar if the config program chooses
to use it.

View file

@ -518,6 +518,28 @@ more details, with real examples.
In this example for a specific GCC version the build will error out explaining In this example for a specific GCC version the build will error out explaining
to the user why it stops. to the user why it stops.
cc-cross-prefix
cc-cross-prefix is used to check if there exist a $(CC) in path with
one of the listed prefixes. The first prefix where there exist a
prefix$(CC) in the PATH is returned - and if no prefix$(CC) is found
then nothing is returned.
Additional prefixes are separated by a single space in the
call of cc-cross-prefix.
This functionality is usefull for architecture Makefile that try
to set CROSS_COMPILE to well know values but may have several
values to select between.
It is recommended only to try to set CROSS_COMPILE is it is a cross
build (host arch is different from target arch). And is CROSS_COMPILE
is already set then leave it with the old value.
Example:
#arch/m68k/Makefile
ifneq ($(SUBARCH),$(ARCH))
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu-)
endif
endif
=== 4 Host Program support === 4 Host Program support
Kbuild supports building executables on the host for use during the Kbuild supports building executables on the host for use during the

View file

@ -2178,7 +2178,7 @@ S: Maintained
KCONFIG KCONFIG
P: Roman Zippel P: Roman Zippel
M: zippel@linux-m68k.org M: zippel@linux-m68k.org
L: kbuild-devel@lists.sourceforge.net L: linux-kbuild@vger.kernel.org
S: Maintained S: Maintained
KDUMP KDUMP
@ -2207,6 +2207,7 @@ KERNEL BUILD (kbuild: Makefile, scripts/Makefile.*)
P: Sam Ravnborg P: Sam Ravnborg
M: sam@ravnborg.org M: sam@ravnborg.org
T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git
L: linux-kbuild@vger.kernel.org
S: Maintained S: Maintained
KERNEL JANITORS KERNEL JANITORS

View file

@ -887,10 +887,7 @@ prepare2: prepare3 outputmakefile
prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
include/asm include/config/auto.conf include/asm include/config/auto.conf
ifneq ($(KBUILD_MODULES),) $(cmd_crmodverdir)
$(Q)mkdir -p $(MODVERDIR)
$(Q)rm -f $(MODVERDIR)/*
endif
archprepare: prepare1 scripts_basic archprepare: prepare1 scripts_basic
@ -906,14 +903,24 @@ prepare: prepare0
export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
# FIXME: The asm symlink changes when $(ARCH) changes. That's # The asm symlink changes when $(ARCH) changes.
# hard to detect, but I suppose "make mrproper" is a good idea # Detect this and ask user to run make mrproper
# before switching between archs anyway.
include/asm: include/asm: FORCE
@echo ' SYMLINK $@ -> include/asm-$(SRCARCH)' $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
$(Q)if [ ! -d include ]; then mkdir -p include; fi; if [ -L include/asm ]; then \
@ln -fsn asm-$(SRCARCH) $@ if [ "$$asmlink" != "$(SRCARCH)" ]; then \
echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
exit 1; \
fi; \
else \
echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
if [ ! -d include ]; then \
mkdir -p include; \
fi; \
ln -fsn asm-$(SRCARCH) $@; \
fi
# Generate some files # Generate some files
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -1023,19 +1030,12 @@ _modinst_:
fi fi
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# If System.map exists, run depmod. This deliberately does not have a # This depmod is only for convenience to give the initial
# dependency on System.map since that would run the dependency tree on
# vmlinux. This depmod is only for convenience to give the initial
# boot a modules.dep even before / is mounted read-write. However the # boot a modules.dep even before / is mounted read-write. However the
# boot script depmod is the master version. # boot script depmod is the master version.
ifeq "$(strip $(INSTALL_MOD_PATH))" ""
depmod_opts :=
else
depmod_opts := -b $(INSTALL_MOD_PATH) -r
endif
PHONY += _modinst_post PHONY += _modinst_post
_modinst_post: _modinst_ _modinst_post: _modinst_
if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi $(call cmd,depmod)
else # CONFIG_MODULES else # CONFIG_MODULES
@ -1223,8 +1223,7 @@ else # KBUILD_EXTMOD
KBUILD_MODULES := 1 KBUILD_MODULES := 1
PHONY += crmodverdir PHONY += crmodverdir
crmodverdir: crmodverdir:
$(Q)mkdir -p $(MODVERDIR) $(cmd_crmodverdir)
$(Q)rm -f $(MODVERDIR)/*
PHONY += $(objtree)/Module.symvers PHONY += $(objtree)/Module.symvers
$(objtree)/Module.symvers: $(objtree)/Module.symvers:
@ -1252,15 +1251,6 @@ _emodinst_:
$(Q)mkdir -p $(MODLIB)/$(install-dir) $(Q)mkdir -p $(MODLIB)/$(install-dir)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# Run depmod only is we have System.map and depmod is executable
quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \
$(DEPMOD) -ae -F System.map \
$(if $(strip $(INSTALL_MOD_PATH)), \
-b $(INSTALL_MOD_PATH) -r) \
$(KERNELRELEASE); \
fi
PHONY += _emodinst_post PHONY += _emodinst_post
_emodinst_post: _emodinst_ _emodinst_post: _emodinst_
$(call cmd,depmod) $(call cmd,depmod)
@ -1344,7 +1334,7 @@ define find-sources
find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
-name $1 -print; \ -name $1 -print; \
find $(__srctree) $(RCS_FIND_IGNORE) \ find $(__srctree) $(RCS_FIND_IGNORE) \
\( -name include -o -name arch \) -prune -o \ \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \
-name $1 -print; \ -name $1 -print; \
) )
endef endef
@ -1493,9 +1483,11 @@ endif
# Modules # Modules
/ %/: prepare scripts FORCE / %/: prepare scripts FORCE
$(cmd_crmodverdir)
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
$(build)=$(build-dir) $(build)=$(build-dir)
%.ko: prepare scripts FORCE %.ko: prepare scripts FORCE
$(cmd_crmodverdir)
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
$(build)=$(build-dir) $(@:.ko=.o) $(build)=$(build-dir) $(@:.ko=.o)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
@ -1509,6 +1501,19 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
cmd_rmfiles = rm -f $(rm-files) cmd_rmfiles = rm -f $(rm-files)
# Run depmod only is we have System.map and depmod is executable
# and we build for the host arch
quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
cmd_depmod = \
if [ -r System.map -a -x $(DEPMOD) -a "$(SUBARCH)" == "$(ARCH)" ]; then \
$(DEPMOD) -ae -F System.map \
$(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) -r) \
$(KERNELRELEASE); \
fi
# Create temporary dir for module support files
cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR); rm -f $(MODVERDIR)/*
a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
$(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \

View file

@ -56,6 +56,17 @@ endef
# gcc support functions # gcc support functions
# See documentation in Documentation/kbuild/makefiles.txt # See documentation in Documentation/kbuild/makefiles.txt
# cc-cross-prefix
# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
# Return first prefix where a prefix$(CC) is found in PATH.
# If no $(CC) found in PATH with listed prefixes return nothing
cc-cross-prefix = \
$(word 1, $(foreach c,$(1), \
$(shell set -e; \
if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \
echo $(c); \
fi)))
# output directory for tests below # output directory for tests below
TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)

View file

@ -66,12 +66,15 @@ FILELINE * entity_system;
#define FUNCTION "-function" #define FUNCTION "-function"
#define NOFUNCTION "-nofunction" #define NOFUNCTION "-nofunction"
char *srctree;
void usage (void) void usage (void)
{ {
fprintf(stderr, "Usage: docproc {doc|depend} file\n"); fprintf(stderr, "Usage: docproc {doc|depend} file\n");
fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n");
fprintf(stderr, "doc: frontend when generating kernel documentation\n"); fprintf(stderr, "doc: frontend when generating kernel documentation\n");
fprintf(stderr, "depend: generate list of files referenced within file\n"); fprintf(stderr, "depend: generate list of files referenced within file\n");
fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n");
} }
/* /*
@ -90,7 +93,7 @@ void exec_kernel_doc(char **svec)
exit(1); exit(1);
case 0: case 0:
memset(real_filename, 0, sizeof(real_filename)); memset(real_filename, 0, sizeof(real_filename));
strncat(real_filename, getenv("SRCTREE"), PATH_MAX); strncat(real_filename, srctree, PATH_MAX);
strncat(real_filename, KERNELDOCPATH KERNELDOC, strncat(real_filename, KERNELDOCPATH KERNELDOC,
PATH_MAX - strlen(real_filename)); PATH_MAX - strlen(real_filename));
execvp(real_filename, svec); execvp(real_filename, svec);
@ -171,7 +174,7 @@ void find_export_symbols(char * filename)
if (filename_exist(filename) == NULL) { if (filename_exist(filename) == NULL) {
char real_filename[PATH_MAX + 1]; char real_filename[PATH_MAX + 1];
memset(real_filename, 0, sizeof(real_filename)); memset(real_filename, 0, sizeof(real_filename));
strncat(real_filename, getenv("SRCTREE"), PATH_MAX); strncat(real_filename, srctree, PATH_MAX);
strncat(real_filename, filename, strncat(real_filename, filename,
PATH_MAX - strlen(real_filename)); PATH_MAX - strlen(real_filename));
sym = add_new_file(filename); sym = add_new_file(filename);
@ -338,6 +341,10 @@ void parse_file(FILE *infile)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
FILE * infile; FILE * infile;
srctree = getenv("SRCTREE");
if (!srctree)
srctree = getcwd(NULL, 0);
if (argc != 3) { if (argc != 3) {
usage(); usage();
exit(1); exit(1);

View file

@ -84,7 +84,7 @@ help:
# lxdialog stuff # lxdialog stuff
check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
# Use reursively expanded variables so we do not call gcc unless # Use recursively expanded variables so we do not call gcc unless
# we really need to do so. (Do not call gcc as part of make mrproper) # we really need to do so. (Do not call gcc as part of make mrproper)
HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))

View file

@ -268,6 +268,9 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod,
"was in %s%s\n", mod->name, name, "was in %s%s\n", mod->name, name,
s->module->name, s->module->name,
is_vmlinux(s->module->name) ?"":".ko"); is_vmlinux(s->module->name) ?"":".ko");
} else {
/* In case Modules.symvers was out of date */
s->module = mod;
} }
} }
s->preloaded = 0; s->preloaded = 0;

View file

@ -83,6 +83,7 @@ Maintainer: $name
Standards-Version: 3.6.1 Standards-Version: 3.6.1
Package: $packagename Package: $packagename
Provides: kernel-image-$version, linux-image-$version
Architecture: any Architecture: any
Description: User Mode Linux kernel, version $version Description: User Mode Linux kernel, version $version
User-mode Linux is a port of the Linux kernel to its own system call User-mode Linux is a port of the Linux kernel to its own system call
@ -104,6 +105,7 @@ Maintainer: $name
Standards-Version: 3.6.1 Standards-Version: 3.6.1
Package: $packagename Package: $packagename
Provides: kernel-image-$version, linux-image-$version
Architecture: any Architecture: any
Description: Linux kernel, version $version Description: Linux kernel, version $version
This package contains the Linux kernel, modules and corresponding other This package contains the Linux kernel, modules and corresponding other