Skip to contentSkip to conversation

powerpc: Fix make rules for dtc

PATCH David Gibson 2 participants 6 messages Oct 4, 2006 – Oct 10, 2006 PowerPC

lore
Share & tools
lore
#0 lore raw

Paulus, please apply to the powerpc prep2 branch. Not sure if it also need to go in the powerpc master branch.

There are a couple of errors in the make rules for invoking dtc in arch/powerpc/boot. First, dtc does not generate gcc -MD style .d files, so should be invoked via the 'if_changed' macro, rather than 'if_changed_dep'. Secondly, the clean-files target was missing an entry to clean the generated .dtb files.

arch/powerpc/boot/Makefile +2 -2
Index: working-2.6/arch/powerpc/boot/Makefile
===================================================================
@@ -74,7 +74,7 @@ $(obj)/zImage.lds $(obj)/zImage.coff.lds
 	@cp $< $@
 
 clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
-		$(obj)/empty.c
+		$(obj)/empty.c *.dtb
 
 quiet_cmd_bootcc = BOOTCC  $@
       cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
@@ -93,7 +93,7 @@ $(patsubst %.c,%.o, $(filter %.c, $(src-
 $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
 	$(call if_changed_dep,bootas)
 $(obj)/%.dtb: $(srctree)/$(src)/dts/%.dts
-	$(call if_changed_dep,dtc)
+	$(call if_changed,dtc)
 
 $(obj)/wrapper.a: $(obj-wlib)
 	$(call cmd,bootar)
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#1 lore raw

powerpc: Fix clean target for empty.c

Paulus, another tiny fix. Applies after by fix for the dtc make rules.

The files listed in the clean-files variable should not include the $(obj) prefix. This patch corrects this for arch/powerpc/boot/empty.c, which was not previously removed on "make clean" for this reason.

arch/powerpc/boot/Makefile +1 -1
Index: working-2.6/arch/powerpc/boot/Makefile
===================================================================
@@ -74,7 +74,7 @@ $(obj)/zImage.lds $(obj)/zImage.coff.lds
 	@cp $< $@
 
 clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
-		$(obj)/empty.c *.dtb
+		empty.c *.dtb
 
 quiet_cmd_bootcc = BOOTCC  $@
       cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#2 lore raw
In reply to David Gibson

arch/powerpc/boot/Makefile $(obj)/zImage.lds $(obj)/zImage.coff.lds · line 77

Quoted 3 lines

clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \

arch/powerpc/boot/Makefile +1 -1
-		$(obj)/empty.c
+		$(obj)/empty.c *.dtb

If this wildcard works at all, it will still do the wrong thing:
deleting all .dtb files (even the ones that the Makefile cannot create again, e.g., the user put them in the tree manually) is at best not very polite.

Segher

#3 lore raw
Quoted 8 lines · Segher Boessenkool

arch/powerpc/boot/Makefile $(obj)/zImage.lds $(obj)/zImage.coff.lds · line 77

Quoted 3 lines

clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \

arch/powerpc/boot/Makefile +1 -1
-		$(obj)/empty.c
+		$(obj)/empty.c *.dtb

If this wildcard works at all, it will still do the wrong thing:
deleting all .dtb files (even the ones that the Makefile cannot create again, e.g., the user put them in the tree manually) is at best not very polite.

It certainly works at all (the preceding $(obj)/empty.c, however, is wrong, I've sent a separate patch for that). One could say the same thing for *.o in clean targets, though I guess adding .dtb files is rather more likely. However, I can't seen an obvious way of generating a list of the re-creatable dtbs, without an explicit listing of every file in arch/powerpc/boot/dts which sounds like a bit of a pain. Suggestions?

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#4 lore raw
Quoted 10 lines
Quoted 8 lines

arch/powerpc/boot/Makefile $(obj)/zImage.lds $(obj)/zImage.coff.lds · line 77

Quoted 3 lines

clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \

arch/powerpc/boot/Makefile +1 -1
-		$(obj)/empty.c
+		$(obj)/empty.c *.dtb

If this wildcard works at all, it will still do the wrong thing:
deleting all .dtb files (even the ones that the Makefile cannot create again, e.g., the user put them in the tree manually) is at best not very polite.

It certainly works at all

My problem with it is the := which might be expanded at the wrong time. Or maybe that won't glob the *.dtb yet, who knows. It's not obviously "working" either way.

Quoted 3 lines

(the preceding $(obj)/empty.c, however, is
wrong, I've sent a separate patch for that). One could say the same thing for *.o in clean targets,

Yes, and that's a very well-known problem.

Quoted 5 lines

though I guess adding .dtb files is
rather more likely. However, I can't seen an obvious way of generating a list of the re-creatable dtbs, without an explicit listing of every file in arch/powerpc/boot/dts which sounds like a bit of a pain. Suggestions?

You shouldn't clean _all_ dtb's that you could build, only the dtb's that you _did_ build. You already have a rule for what dtb's to build I assume; just copy the logic from there.

Segher

#5 lore raw
Quoted 9 lines · Segher Boessenkool
Quoted 9 lines
Quoted 8 lines

arch/powerpc/boot/Makefile $(obj)/zImage.lds $(obj)/zImage.coff.lds · line 77

Quoted 3 lines

clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \

arch/powerpc/boot/Makefile +1 -1
-		$(obj)/empty.c
+		$(obj)/empty.c *.dtb

If this wildcard works at all, it will still do the wrong thing:
deleting all .dtb files (even the ones that the Makefile cannot create again, e.g., the user put them in the tree manually) is at best not very polite.

Quoted 4 lines
Quoted 1 line

It certainly works at all

My problem with it is the := which might be expanded at the wrong time. Or maybe that won't glob the *.dtb yet, who knows.

*I* know, because I checked the Kbuild rules first, and verified that globs are legal in the clean-files variable.

Quoted 15 lines

It's
not obviously "working" either way.

Quoted 3 lines

(the preceding $(obj)/empty.c, however, is
wrong, I've sent a separate patch for that). One could say the same thing for *.o in clean targets,

Yes, and that's a very well-known problem.

Quoted 5 lines

though I guess adding .dtb files is
rather more likely. However, I can't seen an obvious way of generating a list of the re-creatable dtbs, without an explicit listing of every file in arch/powerpc/boot/dts which sounds like a bit of a pain. Suggestions?

Quoted 3 lines

You shouldn't clean _all_ dtb's that you could build, only the dtb's that you _did_ build. You already have a rule for what dtb's to build I assume; just copy the logic from there.

No. clean rules never work this way, because if you change the config between building and cleaning, things won't get cleaned (which is why clean rules are just about the only place one uses globs in makefiles, rather than expanding variables appropriately).

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson