Patchwork improve support for parallel make in kconfig

login
register
about
Submitter Patrick Georgi
Date 2010-01-27 23:51:58
Message ID <4B60D19E.6090206@georgi-clan.de>
Download mbox | patch
Permalink /patch/845/
State Accepted
Commit r5062
Headers show

Comments

Patrick Georgi - 2010-01-27 23:51:58
Hi,

attached patch helps with parallel make (make -j) on Kconfig builds on
my system.

Basically, $(obj)/build.h is made an explicit dependency of all the
various object files, so make doesn't try to build any of these with
build.h not around.

Also, build.h is atomically generated by writing to some other file,
then renaming.

I don't say that this "fixes" parallel make, as there might be more issues.

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
ron minnich - 2010-01-27 23:55:14
Acked-by: Ronald G. Minnich <rminnich@gmail.com>
Peter Stuge - 2010-01-28 01:54:17
Patrick Georgi wrote:
> Also, build.h is atomically generated by writing to some other
> file, then renaming.

> +	printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" > $(obj)/build.ht
> +	printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" >> $(obj)/build.ht
> +	printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.ht
> +	printf "\n" >> $(obj)/build.ht
> +	printf "#define COREBOOT_COMPILER \"$(shell LANG= $(CC) --version | head -n1)\"\n" >> $(obj)/build.ht
> +	printf "#define COREBOOT_ASSEMBLER \"$(shell LANG= $(AS) --version | head -n1)\"\n" >> $(obj)/build.ht
> +	printf "#define COREBOOT_LINKER \"$(shell LANG= $(LD) --version | head -n1)\"\n" >> $(obj)/build.ht
> +	printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.ht
> +	printf "#define COREBOOT_COMPILE_BY \"$(subst \,@,$(shell PATH=$$PATH:/usr/ucb whoami))\"\n" >> $(obj)/build.ht
> +	printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname)\"\n" >> $(obj)/build.ht
> +	printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname)\"\n" >> $(obj)/build.ht
> +	printf "#include \"config.h\"\n" >> $(obj)/build.ht
> +	mv $(obj)/build.ht $(obj)/build.h

Is build.h strictly neccessary for the build? If yes, why?


//Peter
Patrick Georgi - 2010-01-28 08:10:46
Am 28.01.2010 02:54, schrieb Peter Stuge:
>> +	printf "#include \"config.h\"\n" >> $(obj)/build.ht
>> +	mv $(obj)/build.ht $(obj)/build.h
> 
> Is build.h strictly neccessary for the build? If yes, why?
It's included in lots of places, and drags in config.h (see last printf
line).
If that one doesn't exist completely, you'll get lots of warnings/errors
about non-existant symbols, and sure miscompiles.


Patrick

Patch

Index: Makefile

===================================================================
--- Makefile	(Revision 5060)

+++ Makefile	(Arbeitskopie)

@@ -140,7 +140,7 @@ 

 
 
 define c_dsl_template
-$(obj)/$(1)%.c: src/$(1)%.dsl
+$(obj)/$(1)%.c: src/$(1)%.dsl $(obj)/build.h
 	@printf "    IASL       $$(subst $$(shell pwd)/,,$$(@))\n"
 	iasl -p $$(basename $$@) -tc $$<
 	perl -pi -e 's/AmlCode/AmlCode_$$(notdir $$(basename $$@))/g' $$(basename $$@).hex
@@ -148,31 +148,31 @@ 

 endef
 
 define objs_c_template
-$(obj)/$(1)%.o: src/$(1)%.c
+$(obj)/$(1)%.o: src/$(1)%.c $(obj)/build.h
 	@printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
 	$(CC) -m32 $$(CFLAGS) -c -o $$@ $$<
 endef
 
 define objs_S_template
-$(obj)/$(1)%.o: src/$(1)%.S
+$(obj)/$(1)%.o: src/$(1)%.S $(obj)/build.h
 	@printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
 	$(CC) -m32 -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
 endef
 
 define initobjs_c_template
-$(obj)/$(1)%.o: src/$(1)%.c
+$(obj)/$(1)%.o: src/$(1)%.c $(obj)/build.h
 	@printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
 	$(CC) -m32 $$(CFLAGS) -c -o $$@ $$<
 endef
 
 define initobjs_S_template
-$(obj)/$(1)%.o: src/$(1)%.S
+$(obj)/$(1)%.o: src/$(1)%.S $(obj)/build.h
 	@printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
 	$(CC) -m32 -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
 endef
 
 define drivers_c_template
-$(obj)/$(1)%.o: src/$(1)%.c
+$(obj)/$(1)%.o: src/$(1)%.c $(obj)/build.h
 	@printf "    CC         $$(subst $$(obj)/,,$$(@))\n"
 	$(CC) -m32 $$(CFLAGS) -c -o $$@ $$<
 endef
@@ -257,20 +257,24 @@ 

 	mkdir -p $(obj)/util/kconfig/lxdialog
 	test -n "$(alldirs)" && mkdir -p $(alldirs) || true
 
-prepare2:
+prepare2: $(obj)/build.h
+
+$(obj)/build.h:
 	@printf "    GEN        build.h\n"
-	printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" > $(obj)/build.h
-	printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" >> $(obj)/build.h
-	printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.h
-	printf "\n" >> $(obj)/build.h
-	printf "#define COREBOOT_COMPILER \"$(shell LANG= $(CC) --version | head -n1)\"\n" >> $(obj)/build.h
-	printf "#define COREBOOT_ASSEMBLER \"$(shell LANG= $(AS) --version | head -n1)\"\n" >> $(obj)/build.h
-	printf "#define COREBOOT_LINKER \"$(shell LANG= $(LD) --version | head -n1)\"\n" >> $(obj)/build.h
-	printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.h
-	printf "#define COREBOOT_COMPILE_BY \"$(shell PATH=$$PATH:/usr/ucb whoami)\"\n" >> $(obj)/build.h
-	printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname)\"\n" >> $(obj)/build.h
-	printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname)\"\n" >> $(obj)/build.h
-	printf "#include \"config.h\"\n" >> $(obj)/build.h
+	rm -f $(obj)/build.h
+	printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" > $(obj)/build.ht
+	printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" >> $(obj)/build.ht
+	printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.ht
+	printf "\n" >> $(obj)/build.ht
+	printf "#define COREBOOT_COMPILER \"$(shell LANG= $(CC) --version | head -n1)\"\n" >> $(obj)/build.ht
+	printf "#define COREBOOT_ASSEMBLER \"$(shell LANG= $(AS) --version | head -n1)\"\n" >> $(obj)/build.ht
+	printf "#define COREBOOT_LINKER \"$(shell LANG= $(LD) --version | head -n1)\"\n" >> $(obj)/build.ht
+	printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.ht
+	printf "#define COREBOOT_COMPILE_BY \"$(subst \,@,$(shell PATH=$$PATH:/usr/ucb whoami))\"\n" >> $(obj)/build.ht
+	printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname)\"\n" >> $(obj)/build.ht
+	printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname)\"\n" >> $(obj)/build.ht
+	printf "#include \"config.h\"\n" >> $(obj)/build.ht
+	mv $(obj)/build.ht $(obj)/build.h
 
 doxy: doxygen
 doxygen: