diff options
author | Andrew Morton <akpm@osdl.org> | 2004-03-15 15:15:05 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-03-15 15:15:05 -0800 |
commit | 952a0ae394f450c878aa2e408c23236896a2efac (patch) | |
tree | 80f2bc92563ea25c4ce0d6614e164972cf170e59 /scripts | |
parent | 6f2dbcb9d373d13170c1ec0a5f72ac3fe8b77c7a (diff) | |
download | history-952a0ae394f450c878aa2e408c23236896a2efac.tar.gz |
[PATCH] Fix early parallel make failures
From: Sam Ravnborg <sam@ravnborg.org>
Ingo said:
Starting at around 2.6.4-rc2-mm1, I keep seeing 'scripts/fixdep: Text
file busy' messages when doing a -j10 bzImage build - which seems to
suggest that by the time fixdep is used by the build system it's not
built yet.
Sam said:
I was pretty sure it was something I had caused, so I gave it a spin. What
actually happened was that we tried to build the target 'silentoldconfig'
in parrallel with 'scripts'. Since 'silentoldconfig' started a new make
and then the config target needed 'scripts' we saw two parallel runs.
The way I decided to fix it was to split scripts/ in two parts. The first
part is now the very basic stuff - moved to scripts/basic/. The second
part is dependent on kernel config etc. and kept in scripts/
In the 2.7 timeframe i will redo this initial stuff - it's becoming too
messy for anyone to understand today.
Description:
Fix dependencies in early phases of kernel build. This solves a few
problems nively: modpost is no longer rebuild twicewhen reaching the
'target' state 'make -j10' now works nicely again
The patch is rather large due to the following file moves:
mkdir scripts/basic
mv scripts/fixdep.c scripts/basic
mv scripts/split-include.c scripts/basic
mv scripts/docproc.c scripts/basic
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile | 11 | ||||
-rw-r--r-- | scripts/Makefile.build | 2 | ||||
-rw-r--r-- | scripts/Makefile.lib | 2 | ||||
-rw-r--r-- | scripts/basic/Makefile | 18 | ||||
-rw-r--r-- | scripts/basic/docproc.c (renamed from scripts/docproc.c) | 16 | ||||
-rw-r--r-- | scripts/basic/fixdep.c (renamed from scripts/fixdep.c) | 26 | ||||
-rw-r--r-- | scripts/basic/split-include.c (renamed from scripts/split-include.c) | 2 |
7 files changed, 44 insertions, 33 deletions
diff --git a/scripts/Makefile b/scripts/Makefile index 044afd55a77d0d..8de642c6e8b608 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -2,14 +2,10 @@ # scripts contains sources for various helper programs used throughout # the kernel for the build process. # --------------------------------------------------------------------------- -# fix-dep: Used to generate dependency information during build process -# split-include: Divide all config symbols up in a number of files in -# include/config/... # docproc: Preprocess .tmpl file in order to generate .sgml docs # conmakehash: Create arrays for initializing the kernel console tables -host-progs := fixdep split-include conmakehash docproc kallsyms modpost \ - mk_elfconfig pnmtologo bin2c +host-progs := conmakehash kallsyms modpost mk_elfconfig pnmtologo bin2c always := $(host-progs) empty.o modpost-objs := modpost.o file2alias.o sumversion.o @@ -17,10 +13,7 @@ modpost-objs := modpost.o file2alias.o sumversion.o subdir-$(CONFIG_MODVERSIONS) += genksyms # Let clean descend into subdirs -subdir- += lxdialog kconfig - -# fixdep is needed to compile other host programs -$(addprefix $(obj)/,$(filter-out fixdep,$(always)) $(subdir-y)): $(obj)/fixdep +subdir- += basic lxdialog kconfig # dependencies on generated files need to be listed explicitly diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 5451610fff0d7e..008ac6cfd40511 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -162,7 +162,7 @@ define rule_cc_o_c $(if $($(quiet)cmd_cc_o_c),echo ' $($(quiet)cmd_cc_o_c)';) \ $(cmd_cc_o_c); \ $(cmd_modversions) \ - scripts/fixdep $(depfile) $@ '$(cmd_cc_o_c)' > $(@D)/.$(@F).tmp; \ + scripts/basic/fixdep $(depfile) $@ '$(cmd_cc_o_c)' > $(@D)/.$(@F).tmp; \ rm -f $(depfile); \ mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd endef diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 51831e5381f6b4..a47abc8af0a6e4 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -249,7 +249,7 @@ if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ @set -e; \ $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \ $(cmd_$(1)); \ - scripts/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ + scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ rm -f $(depfile); \ mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile new file mode 100644 index 00000000000000..3afb3bf4d12cec --- /dev/null +++ b/scripts/basic/Makefile @@ -0,0 +1,18 @@ +### +# Makefile.basic list the most basic programs used during the build process. +# The programs listed herein is what is needed to do the basic stuff, +# such as splitting .config and fix dependency file. +# This initial step is needed to avoid files to be recompiled +# when kernel configuration changes (which is what happens when +# .config is included by main Makefile. +# --------------------------------------------------------------------------- +# fixdep: Used to generate dependency information during build process +# split-include: Divide all config symbols up in a number of files in +# include/config/... +# docproc: Used in Documentation/docbook + +host-progs := fixdep split-include docproc +always := $(host-progs) + +# fixdep is needed to compile other host programs +$(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep diff --git a/scripts/docproc.c b/scripts/basic/docproc.c index 18e1d45a7ff9fd..d28f883cb37ac7 100644 --- a/scripts/docproc.c +++ b/scripts/basic/docproc.c @@ -28,7 +28,7 @@ * !Ifilename * !Dfilename * !Ffilename - * + * */ #include <stdio.h> @@ -125,7 +125,7 @@ void add_new_symbol(struct symfile *sym, char * symname) struct symfile * add_new_file(char * filename) { symfilelist[symfilecnt++].filename = strdup(filename); - return &symfilelist[symfilecnt - 1]; + return &symfilelist[symfilecnt - 1]; } /* Check if file already are present in the list */ struct symfile * filename_exist(char * filename) @@ -149,8 +149,8 @@ void noaction2(char * file, char * line) { file = file; line = line; } /* Echo the line without further action */ void printline(char * line) { printf("%s", line); } -/* - * Find all symbols exported with EXPORT_SYMBOL and EXPORT_SYMBOL_GPL +/* + * Find all symbols exported with EXPORT_SYMBOL and EXPORT_SYMBOL_GPL * in filename. * All symbols located are stored in symfilelist. */ @@ -210,7 +210,7 @@ void docfunctions(char * filename, char * type) int symcnt = 0; int idx = 0; char **vec; - + for (i=0; i <= symfilecnt; i++) symcnt += symfilelist[i].symbolcnt; vec = malloc((2 + 2 * symcnt + 2) * sizeof(char*)); @@ -250,7 +250,7 @@ void singfunc(char * filename, char * line) vec[idx++] = KERNELDOC; vec[idx++] = DOCBOOK; - /* Split line up in individual parameters preceeded by FUNCTION */ + /* Split line up in individual parameters preceeded by FUNCTION */ for (i=0; line[i]; i++) { if (isspace(line[i])) { line[i] = '\0'; @@ -318,7 +318,7 @@ void parse_file(FILE *infile) } fflush(stdout); } - + int main(int argc, char *argv[]) { @@ -359,7 +359,7 @@ int main(int argc, char *argv[]) externalfunctions = extfunc; symbolsonly = printline; singlefunctions = singfunc; - + parse_file(infile); } else if (strcmp("depend", argv[1]) == 0) diff --git a/scripts/fixdep.c b/scripts/basic/fixdep.c index 84ee2a6c89bda7..1e9b8d4fde3801 100644 --- a/scripts/fixdep.c +++ b/scripts/basic/fixdep.c @@ -1,5 +1,5 @@ /* - * "Optimize" a list of dependencies as spit out by gcc -MD + * "Optimize" a list of dependencies as spit out by gcc -MD * for the kernel build * =========================================================================== * @@ -11,7 +11,7 @@ * * * Introduction: - * + * * gcc produces a very nice and correct list of dependencies which * tells make when to remake a file. * @@ -23,21 +23,21 @@ * regenerated. make notices that and will rebuild every file which * includes autoconf.h, i.e. basically all files. This is extremely * annoying if the user just changed CONFIG_HIS_DRIVER from n to m. - * + * * So we play the same trick that "mkdep" played before. We replace * the dependency on linux/autoconf.h by a dependency on every config * option which is mentioned in any of the listed prequisites. - * + * * To be exact, split-include populates a tree in include/config/, * e.g. include/config/his/driver.h, which contains the #define/#undef * for the CONFIG_HIS_DRIVER option. * * So if the user changes his CONFIG_HIS_DRIVER option, only the objects * which depend on "include/linux/config/his/driver.h" will be rebuilt, - * so most likely only his driver ;-) + * so most likely only his driver ;-) * * The idea above dates, by the way, back to Michael E Chastain, AFAIK. - * + * * So to get dependencies right, there two issues: * o if any of the files the compiler read changed, we need to rebuild * o if the command line given to the compile the file changed, we @@ -89,7 +89,7 @@ * we cannot miss a rebuild. Since people tend to not mention totally * unrelated CONFIG_ options all over the place, it's not an * efficiency problem either. - * + * * (Note: it'd be easy to port over the complete mkdep state machine, * but I don't think the added complexity is worth it) */ @@ -233,7 +233,7 @@ void parse_config_file(char *map, size_t len) } continue; - found: + found: use_config(p+7, q-p-7); } } @@ -243,10 +243,10 @@ int strrcmp(char *s, char *sub) { int slen = strlen(s); int sublen = strlen(sub); - + if (sublen > slen) return 1; - + return memcmp(s + slen - sublen, sub, sublen); } @@ -273,7 +273,7 @@ void do_config_file(char *filename) close(fd); return; } - + parse_config_file(map, st.st_size); munmap(map, st.st_size); @@ -344,7 +344,7 @@ void print_deps(void) close(fd); return; } - + parse_dep_file(map, st.st_size); munmap(map, st.st_size); @@ -369,7 +369,7 @@ int main(int argc, char *argv[]) if (argc != 4) usage(); - + depfile = argv[1]; target = argv[2]; cmdline = argv[3]; diff --git a/scripts/split-include.c b/scripts/basic/split-include.c index 0f7f9ef347a0b3..459c45276cb1a4 100644 --- a/scripts/split-include.c +++ b/scripts/basic/split-include.c @@ -96,7 +96,7 @@ int main(int argc, const char * argv []) /* Change to output directory. */ if (chdir(str_dir_config) != 0) ERROR_EXIT(str_dir_config); - + /* Put initial separator into target list. */ ptarget = list_target; *ptarget++ = '\n'; |