Commit 6a7cb773 authored by Sam Ravnborg's avatar Sam Ravnborg

Merge bk://linux-sam.bkbits.net/kbuild

into mars.ravnborg.org:/home/sam/bk/to-linus
parents 403f2912 1ceee1b7
...@@ -58,14 +58,14 @@ MAKEMAN = $(PERL) $(srctree)/scripts/makeman ...@@ -58,14 +58,14 @@ MAKEMAN = $(PERL) $(srctree)/scripts/makeman
# The following rules are used to generate the .sgml documentation # The following rules are used to generate the .sgml documentation
# required to generate the final targets. (ps, pdf, html). # required to generate the final targets. (ps, pdf, html).
quiet_cmd_docproc = DOCPROC $@ quiet_cmd_docproc = DOCPROC $@
cmd_docproc = $(DOCPROC) doc $< >$@ cmd_docproc = SRCTREE=$(srctree)/ $(DOCPROC) doc $< >$@
define rule_docproc define rule_docproc
set -e; \ set -e; \
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \ $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
$(cmd_$(1)); \ $(cmd_$(1)); \
( \ ( \
echo 'cmd_$@ := $(cmd_$(1))'; \ echo 'cmd_$@ := $(cmd_$(1))'; \
echo $@: `$(DOCPROC) depend $<`; \ echo $@: `SRCTREE=$(srctree) $(DOCPROC) depend $<`; \
) > $(dir $@).$(notdir $@).cmd ) > $(dir $@).$(notdir $@).cmd
endef endef
...@@ -129,6 +129,9 @@ quiet_cmd_db2html = DB2HTML $@ ...@@ -129,6 +129,9 @@ quiet_cmd_db2html = DB2HTML $@
# Rule to generate man files - output is placed in the man subdirectory # Rule to generate man files - output is placed in the man subdirectory
%.9: %.sgml %.9: %.sgml
ifneq ($(KBUILD_SRC),)
$(Q)mkdir -p $(objtree)/Documentation/DocBook/man
endif
$(SPLITMAN) $< $(objtree)/Documentation/DocBook/man "$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)" $(SPLITMAN) $< $(objtree)/Documentation/DocBook/man "$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)"
$(MAKEMAN) convert $(objtree)/Documentation/DocBook/man $< $(MAKEMAN) convert $(objtree)/Documentation/DocBook/man $<
......
...@@ -997,6 +997,21 @@ When kbuild executes the following steps are followed (roughly): ...@@ -997,6 +997,21 @@ When kbuild executes the following steps are followed (roughly):
option. When $(biarch) equals to y the expanded variables $(aflags-y) option. When $(biarch) equals to y the expanded variables $(aflags-y)
and $(cflags-y) will be assigned the values -a32 and -m32. and $(cflags-y) will be assigned the values -a32 and -m32.
cc-option-align
gcc version >= 3.0 shifted type of options used to speify
alignment of functions, loops etc. $(cc-option-align) whrn used
as prefix to the align options will select the right prefix:
gcc < 3.00
cc-option-align = -malign
gcc >= 3.00
cc-option-align = -falign
Example:
CFLAGS += $(cc-option-align)-functions=4
In the above example the option -falign-functions=4 is used for
gcc >= 3.00. For gcc < 3.00 -malign-functions=4 is used.
cc-version cc-version
cc-version return a numerical version of the $(CC) compiler version. cc-version return a numerical version of the $(CC) compiler version.
The format is <major><minor> where both are two digits. So for example The format is <major><minor> where both are two digits. So for example
......
...@@ -157,7 +157,7 @@ endif ...@@ -157,7 +157,7 @@ endif
LOCALVERSION = $(subst $(space),, \ LOCALVERSION = $(subst $(space),, \
$(shell cat /dev/null $(localversion-files)) \ $(shell cat /dev/null $(localversion-files)) \
$(subst ",,$(CONFIG_LOCALVERSION))) $(patsubst "%",%,$(CONFIG_LOCALVERSION)))
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION) KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION)
...@@ -295,6 +295,11 @@ check_gcc = $(warning check_gcc is deprecated - use cc-option) \ ...@@ -295,6 +295,11 @@ check_gcc = $(warning check_gcc is deprecated - use cc-option) \
cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "y"; else echo "n"; fi;) > /dev/null 2>&1; then echo "y"; else echo "n"; fi;)
# cc-option-align
# Prefix align with either -falign or -malign
cc-option-align = $(subst -functions=0,,\
$(call cc-option,-falign-functions=0,-malign-functions=0))
# cc-version # cc-version
# Usage gcc-ver := $(call cc-version $(CC)) # Usage gcc-ver := $(call cc-version $(CC))
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
...@@ -379,6 +384,18 @@ RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CV ...@@ -379,6 +384,18 @@ RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CV
scripts_basic: scripts_basic:
$(Q)$(MAKE) $(build)=scripts/basic $(Q)$(MAKE) $(build)=scripts/basic
.PHONY: outputmakefile
# outputmakefile generate a Makefile to be placed in output directory, if
# using a seperate output directory. This allows convinient use
# of make in output directory
outputmakefile:
$(Q)if /usr/bin/env test ! $(srctree) -ef $(objtree); then \
$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \
> $(objtree)/Makefile; \
echo ' GEN $(objtree)/Makefile'; \
fi
# To make sure we do not include .config for any of the *config targets # To make sure we do not include .config for any of the *config targets
# catch them early, and hand them over to scripts/kconfig/Makefile # catch them early, and hand them over to scripts/kconfig/Makefile
# It is allowed to specify more targets when calling make, including # It is allowed to specify more targets when calling make, including
...@@ -423,9 +440,9 @@ ifeq ($(config-targets),1) ...@@ -423,9 +440,9 @@ ifeq ($(config-targets),1)
# *config targets only - make sure prerequisites are updated, and descend # *config targets only - make sure prerequisites are updated, and descend
# in scripts/kconfig to make the *config target # in scripts/kconfig to make the *config target
config: scripts_basic FORCE config: scripts_basic outputmakefile FORCE
$(Q)$(MAKE) $(build)=scripts/kconfig $@ $(Q)$(MAKE) $(build)=scripts/kconfig $@
%config: scripts_basic FORCE %config: scripts_basic outputmakefile FORCE
$(Q)$(MAKE) $(build)=scripts/kconfig $@ $(Q)$(MAKE) $(build)=scripts/kconfig $@
else else
...@@ -486,7 +503,16 @@ else ...@@ -486,7 +503,16 @@ else
CFLAGS += -O2 CFLAGS += -O2
endif endif
ifndef CONFIG_FRAME_POINTER #Add align options if CONFIG_CC_* is not equal to 0
add-align = $(if $(filter-out 0,$($(1))),$(cc-option-align)$(2)=$($(1)))
CFLAGS += $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,-functions)
CFLAGS += $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels)
CFLAGS += $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops)
CFLAGS += $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps)
ifdef CONFIG_FRAME_POINTER
CFLAGS += -fno-omit-frame-pointer
else
CFLAGS += -fomit-frame-pointer CFLAGS += -fomit-frame-pointer
endif endif
...@@ -711,22 +737,12 @@ $(vmlinux-dirs): prepare-all scripts ...@@ -711,22 +737,12 @@ $(vmlinux-dirs): prepare-all scripts
.PHONY: prepare-all prepare prepare0 prepare1 prepare2 .PHONY: prepare-all prepare prepare0 prepare1 prepare2
# prepare 2 generate Makefile to be placed in output directory, if # prepare2 is used to check if we are building in a separate output directory,
# using a seperate output directory. This allows convinient use
# of make in output directory
prepare2:
$(Q)if /usr/bin/env test ! $(srctree) -ef $(objtree); then \
$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \
> $(objtree)/Makefile; \
fi
# prepare1 is used to check if we are building in a separate output directory,
# and if so do: # and if so do:
# 1) Check that make has not been executed in the kernel src $(srctree) # 1) Check that make has not been executed in the kernel src $(srctree)
# 2) Create the include2 directory, used for the second asm symlink # 2) Create the include2 directory, used for the second asm symlink
prepare1: prepare2 prepare2:
ifneq ($(KBUILD_SRC),) ifneq ($(KBUILD_SRC),)
@echo ' Using $(srctree) as source for kernel' @echo ' Using $(srctree) as source for kernel'
$(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \ $(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \
...@@ -738,6 +754,9 @@ ifneq ($(KBUILD_SRC),) ...@@ -738,6 +754,9 @@ ifneq ($(KBUILD_SRC),)
$(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm
endif endif
# prepare1 creates a makefile if using a separate output directory
prepare1: prepare2 outputmakefile
prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER
ifneq ($(KBUILD_MODULES),) ifneq ($(KBUILD_MODULES),)
$(Q)rm -rf $(MODVERDIR) $(Q)rm -rf $(MODVERDIR)
......
...@@ -25,7 +25,7 @@ CFLAGS += -pipe -msoft-float ...@@ -25,7 +25,7 @@ CFLAGS += -pipe -msoft-float
# prevent gcc from keeping the stack 16 byte aligned # prevent gcc from keeping the stack 16 byte aligned
CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2) CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2)
align := $(subst -functions=0,,$(call cc-option,-falign-functions=0,-malign-functions=0)) align := $(cc-option-align)
cflags-$(CONFIG_M386) += -march=i386 cflags-$(CONFIG_M386) += -march=i386
cflags-$(CONFIG_M486) += -march=i486 cflags-$(CONFIG_M486) += -march=i486
cflags-$(CONFIG_M586) += -march=i586 cflags-$(CONFIG_M586) += -march=i586
......
...@@ -325,6 +325,43 @@ config SHMEM ...@@ -325,6 +325,43 @@ config SHMEM
option replaces shmem and tmpfs with the much simpler ramfs code, option replaces shmem and tmpfs with the much simpler ramfs code,
which may be appropriate on small systems without swap. which may be appropriate on small systems without swap.
config CC_ALIGN_FUNCTIONS
int "Function alignment"
default 0
help
Align the start of functions to the next power-of-two greater than n,
skipping up to n bytes. For instance, 32 aligns functions
to the next 32-byte boundary, but 24 would align to the next
32-byte boundary only if this can be done by skipping 23 bytes or less.
Zero means use compiler's default.
config CC_ALIGN_LABELS
int "Label alignment"
default 0
help
Align all branch targets to a power-of-two boundary, skipping
up to n bytes like ALIGN_FUNCTIONS. This option can easily
make code slower, because it must insert dummy operations for
when the branch target is reached in the usual flow of the code.
Zero means use compiler's default.
config CC_ALIGN_LOOPS
int "Loop alignment"
default 0
help
Align loops to a power-of-two boundary, skipping up to n bytes.
Zero means use compiler's default.
config CC_ALIGN_JUMPS
int "Jump alignment"
default 0
help
Align branch targets to a power-of-two boundary, for branch
targets where the targets can only be reached by jumping,
skipping up to n bytes like ALIGN_FUNCTIONS. In this case,
no dummy operations need be executed.
Zero means use compiler's default.
endmenu # General setup endmenu # General setup
config TINY_SHMEM config TINY_SHMEM
......
...@@ -46,7 +46,7 @@ config DEBUG_SLAB ...@@ -46,7 +46,7 @@ config DEBUG_SLAB
help help
Say Y here to have the kernel do limited verification on memory Say Y here to have the kernel do limited verification on memory
allocation as well as poisoning memory on free to catch use of freed allocation as well as poisoning memory on free to catch use of freed
memory. memory. This can make kmalloc/kfree-intensive workloads much slower.
config DEBUG_SPINLOCK config DEBUG_SPINLOCK
bool "Spinlock debugging" bool "Spinlock debugging"
......
...@@ -19,7 +19,10 @@ __modinst: $(modules) ...@@ -19,7 +19,10 @@ __modinst: $(modules)
quiet_cmd_modules_install = INSTALL $@ quiet_cmd_modules_install = INSTALL $@
cmd_modules_install = mkdir -p $(2); cp $@ $(2) cmd_modules_install = mkdir -p $(2); cp $@ $(2)
modinst_dir = $(MODLIB)/$(if $(filter ../% /%,$@),extra/,kernel/$(@D)) # Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra
modinst_dir = $(MODLIB)/$(if $(filter ../% /%,$@),$(INSTALL_MOD_DIR)/,kernel/$(@D))
$(modules): $(modules):
$(call cmd,modules_install,$(modinst_dir)) $(call cmd,modules_install,$(modinst_dir))
...@@ -79,6 +79,7 @@ void exec_kernel_doc(char **svec) ...@@ -79,6 +79,7 @@ void exec_kernel_doc(char **svec)
{ {
pid_t pid; pid_t pid;
int ret; int ret;
char real_filename[PATH_MAX + 1];
/* Make sure output generated so far are flushed */ /* Make sure output generated so far are flushed */
fflush(stdout); fflush(stdout);
switch(pid=fork()) { switch(pid=fork()) {
...@@ -86,8 +87,13 @@ void exec_kernel_doc(char **svec) ...@@ -86,8 +87,13 @@ void exec_kernel_doc(char **svec)
perror("fork"); perror("fork");
exit(1); exit(1);
case 0: case 0:
execvp(KERNELDOCPATH KERNELDOC, svec); memset(real_filename, 0, sizeof(real_filename));
perror("exec " KERNELDOCPATH KERNELDOC); strncat(real_filename, getenv("SRCTREE"), PATH_MAX);
strncat(real_filename, KERNELDOCPATH KERNELDOC,
PATH_MAX - strlen(real_filename));
execvp(real_filename, svec);
fprintf(stderr, "exec ");
perror(real_filename);
exit(1); exit(1);
default: default:
waitpid(pid, &ret ,0); waitpid(pid, &ret ,0);
...@@ -160,12 +166,17 @@ void find_export_symbols(char * filename) ...@@ -160,12 +166,17 @@ void find_export_symbols(char * filename)
struct symfile *sym; struct symfile *sym;
char line[MAXLINESZ]; char line[MAXLINESZ];
if (filename_exist(filename) == NULL) { if (filename_exist(filename) == NULL) {
char real_filename[PATH_MAX + 1];
memset(real_filename, 0, sizeof(real_filename));
strncat(real_filename, getenv("SRCTREE"), PATH_MAX);
strncat(real_filename, filename,
PATH_MAX - strlen(real_filename));
sym = add_new_file(filename); sym = add_new_file(filename);
fp = fopen(filename, "r"); fp = fopen(real_filename, "r");
if (fp == NULL) if (fp == NULL)
{ {
fprintf(stderr, "docproc: "); fprintf(stderr, "docproc: ");
perror(filename); perror(real_filename);
} }
while(fgets(line, MAXLINESZ, fp)) { while(fgets(line, MAXLINESZ, fp)) {
char *p; char *p;
......
...@@ -270,6 +270,8 @@ int conf_write(const char *name) ...@@ -270,6 +270,8 @@ int conf_write(const char *name)
int type, l; int type, l;
const char *str; const char *str;
time_t now; time_t now;
int use_timestamp = 1;
char *env;
dirname[0] = 0; dirname[0] = 0;
if (name && name[0]) { if (name && name[0]) {
...@@ -306,22 +308,28 @@ int conf_write(const char *name) ...@@ -306,22 +308,28 @@ int conf_write(const char *name)
sym = sym_lookup("KERNELRELEASE", 0); sym = sym_lookup("KERNELRELEASE", 0);
sym_calc_value(sym); sym_calc_value(sym);
time(&now); time(&now);
env = getenv("KCONFIG_NOTIMESTAMP");
if (env && *env)
use_timestamp = 0;
fprintf(out, "#\n" fprintf(out, "#\n"
"# Automatically generated make config: don't edit\n" "# Automatically generated make config: don't edit\n"
"# Linux kernel version: %s\n" "# Linux kernel version: %s\n"
"# %s" "%s%s"
"#\n", "#\n",
sym_get_string_value(sym), sym_get_string_value(sym),
ctime(&now)); use_timestamp ? "# " : "",
use_timestamp ? ctime(&now) : "");
if (out_h) if (out_h)
fprintf(out_h, "/*\n" fprintf(out_h, "/*\n"
" * Automatically generated C config: don't edit\n" " * Automatically generated C config: don't edit\n"
" * Linux kernel version: %s\n" " * Linux kernel version: %s\n"
" * %s" "%s%s"
" */\n" " */\n"
"#define AUTOCONF_INCLUDED\n", "#define AUTOCONF_INCLUDED\n",
sym_get_string_value(sym), sym_get_string_value(sym),
ctime(&now)); use_timestamp ? " * " : "",
use_timestamp ? ctime(&now) : "");
if (!sym_change_count) if (!sym_change_count)
sym_clear_all_valid(); sym_clear_all_valid();
......
...@@ -1531,7 +1531,7 @@ sub process_state3_type($$) { ...@@ -1531,7 +1531,7 @@ sub process_state3_type($$) {
} }
sub process_file($) { sub process_file($) {
my ($file) = @_; my ($file) = "$ENV{'SRCTREE'}@_";
my $identifier; my $identifier;
my $func; my $func;
my $initial_section_counter = $section_counter; my $initial_section_counter = $section_counter;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment