[Pdbg] [PATCH v3 06/16] build: Allow device tree headers to be generated in subdirs

Alistair Popple alistair at popple.id.au
Thu Nov 8 12:10:53 AEDT 2018


From: Amitay Isaacs <amitay at ozlabs.org>

Using dts avoids unnecessary prefixes in case building device tree
headers in subdirs.

Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 Makefile.am           | 4 ++--
 generate_dt_header.sh | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 94a112d..ad2bbec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -242,11 +242,11 @@ p9z-fsi.dts: p9z-fsi.dts.m4 p9-fsi.dtsi
 %.dtb: %.dts
 	$(DTC_V)$(DTC) -i$(dir $@) -I dts $< -O dtb > $@
 
-%.dt.h: %.dtb
+%.dt.h: %.dts
 	$(GEN_V)$(srcdir)/generate_dt_header.sh $< > $@
 
 %.dtb.o: %.dtb
-	$(AM_V_CC)$(CC) -c $(srcdir)/template.S -DSYMBOL_PREFIX=$(shell echo $@ | tr '.-' '_') -DFILENAME=\"$<\" -o $@
+	$(AM_V_CC)$(CC) -c $(srcdir)/template.S -DSYMBOL_PREFIX=$(shell basename $@ | tr '.-' '_') -DFILENAME=\"$<\" -o $@
 
 %.c: %.rl
 	$(RAGEL_V)$(RAGEL) -o $@ $<
diff --git a/generate_dt_header.sh b/generate_dt_header.sh
index 7f61d1f..b7abfb5 100755
--- a/generate_dt_header.sh
+++ b/generate_dt_header.sh
@@ -1,15 +1,14 @@
 #!/bin/sh
 
 if [ $# -ne 1 ] ; then
-	echo "Usage: $0 <file.dtb>"
+	echo "Usage: $0 <file.dts>"
 	exit 1
 fi
 
-SYMBOL=$(echo "$1" | tr '.-' '_')
+SYMBOL=$(basename "$1" | sed 's/dts/dtb/' | tr '.-' '_')
 SYM_START="_binary_${SYMBOL}_o_start"
 SYM_END="_binary_${SYMBOL}_o_end"
 SYM_SIZE="_binary_${SYMBOL}_o_size"
-HEADER="$f.h"
 
 cat - <<EOF
 /* This file is auto-generated from generate_dt_header.sh */
-- 
2.11.0



More information about the Pdbg mailing list