From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/6] make: Use shell script to generate .dtb.S files
Date: Thu, 31 Jul 2014 14:27:36 +0200 [thread overview]
Message-ID: <1406809657-2489-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1406809657-2489-1-git-send-email-s.hauer@pengutronix.de>
Using shell in make to generate an assembly file is not very
readable and extendable. Add an external shell script instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
scripts/Makefile.lib | 18 +++---------------
scripts/gen-dtb-s | 14 ++++++++++++++
2 files changed, 17 insertions(+), 15 deletions(-)
create mode 100755 scripts/gen-dtb-s
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0a6302b..ea086fe 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -210,21 +210,9 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
# Generate an assembly file to wrap the output of the device tree compiler
quiet_cmd_dt_S_dtb = DTB $@
-cmd_dt_S_dtb= \
-( \
- echo '\#include <asm-generic/barebox.lds.h>'; \
- echo '.section .dtb.rodata.$(subst -,_,$(*F)),"a"'; \
- echo '.balign STRUCT_ALIGNMENT'; \
- echo '.global __dtb_$(subst -,_,$(*F))_start'; \
- echo '__dtb_$(subst -,_,$(*F))_start:'; \
- echo '.incbin "$<" '; \
- echo '__dtb_$(subst -,_,$(*F))_end:'; \
- echo '.global __dtb_$(subst -,_,$(*F))_end'; \
- echo '.balign STRUCT_ALIGNMENT'; \
-) > $@
-
-$(obj)/%.dtb.S: $(obj)/%.dtb
- $(call cmd,dt_S_dtb)
+cmd_dt_S_dtb= ( $(srctree)/scripts/gen-dtb-s $(subst -,_,$(*F)) $< > $@
+$(obj)/%.dtb.S: $(obj)/%.dtb $(srctree)/scripts/gen-dtb-s FORCE
+ $(call if_changed,dt_S_dtb)
quiet_cmd_dtc = DTC $@
cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
new file mode 100755
index 0000000..44136b0
--- /dev/null
+++ b/scripts/gen-dtb-s
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+name=$1
+dtb=$2
+
+echo "#include <asm-generic/barebox.lds.h>"
+echo ".section .dtb.rodata.${name},\"a\""
+echo ".balign STRUCT_ALIGNMENT"
+echo ".global __dtb_${name}_start"
+echo "__dtb_${name}_start:"
+echo ".incbin \"$dtb\""
+echo "__dtb_${name}_end:"
+echo ".global __dtb_${name}_end"
+echo ".balign STRUCT_ALIGNMENT"
--
2.0.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-07-31 12:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-31 12:27 [PATCH] Introduce barebox Image Metadata Sascha Hauer
2014-07-31 12:27 ` [PATCH 1/6] move file helper functions to separate file Sascha Hauer
2014-07-31 12:27 ` [PATCH 2/6] read_file: introduce read_file_2 Sascha Hauer
2014-07-31 12:27 ` [PATCH 3/6] make: build device trees with obj-dtb-y and pbl-dtb-y Sascha Hauer
2014-07-31 12:27 ` [PATCH 4/6] dtc: compile fdtget Sascha Hauer
2014-07-31 12:27 ` Sascha Hauer [this message]
2014-07-31 12:27 ` [PATCH 6/6] Add support for metadata in barebox images Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1406809657-2489-6-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox