diff mbox series

build: Allow device tree headers to be generated in subdirs

Message ID 20181023033528.31256-10-alistair@popple.id.au
State Superseded
Headers show
Series build: Allow device tree headers to be generated in subdirs | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/build-multiarch fail Test build-multiarch on branch master

Commit Message

Alistair Popple Oct. 23, 2018, 3:35 a.m. UTC
From: Amitay Isaacs <amitay@ozlabs.org>

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

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

Patch

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 */