[Pdbg] [PATCH] build: Allow device tree headers to be generated in subdirs
Alistair Popple
alistair at popple.id.au
Tue Oct 23 14:35:28 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 1bed1c2..4e5968f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -209,10 +209,10 @@ 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 $@
MOSTLYCLEANFILES = *.dtb *.dts *.dt.h p9-fsi.dtsi
diff --git a/generate_dt_header.sh b/generate_dt_header.sh
index 75350d4..4609d60 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="_biary_${SYMBOL}_o_end"
SYM_SIZE="_biary_${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