mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 4/6] kbuild: gen-dtb-s: use Makefile.lib instead of duplicating cmd_lzo
Date: Wed, 13 Jul 2022 11:57:28 +0200	[thread overview]
Message-ID: <20220713095730.1878941-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220713095730.1878941-1-a.fatoum@pengutronix.de>

From: Ahmad Fatoum <ahmad@a3f.at>

We call lzop in two places: in gen-dtb-s to generate a compressed device
tree symbol and in Makefile.lib, which is used everywhere else.
Replace the duplication in gen-dtb-s by compressing the DT outside with
the existing cmd_lzo command. This will come in handy later when
extending gen-dtb-s to support multiple compression formats.

No functional change intended.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - new patch
---
 arch/arm/dts/Makefile  | 2 +-
 arch/mips/dts/Makefile | 2 +-
 scripts/Makefile.build | 4 ++--
 scripts/Makefile.lib   | 5 ++++-
 scripts/gen-dtb-s      | 8 ++------
 5 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 34192641dd1f..4e935a763260 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -199,4 +199,4 @@ lwl-$(CONFIG_MACH_TQMLS1046A) += fsl-tqmls1046a-mbls10xxa.dtb.o
 lwl-$(CONFIG_MACH_ZEDBOARD) += zynq-zed.dtb.o
 lwl-$(CONFIG_MACH_MNT_REFORM) += imx8mq-mnt-reform2.dtb.o
 
-clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.lzo
+clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.z
diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefile
index e4cc3b44a53e..d99c4c63584d 100644
--- a/arch/mips/dts/Makefile
+++ b/arch/mips/dts/Makefile
@@ -18,4 +18,4 @@ pbl-$(CONFIG_BOARD_RZX50) += rzx50.dtb.o
 pbl-$(CONFIG_BOARD_TPLINK_MR3020) += ar9331_tl_mr3020.dtb.o
 pbl-$(CONFIG_BOARD_TPLINK_WDR4300) += ar9344-tl-wdr4300-v1.7.dtb.o
 
-clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.lzo
+clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.z
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 1614a1ac58f8..216f03677bd1 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -262,8 +262,8 @@ intermediate_targets = $(foreach sfx, $(2), \
 # %.lex.o <- %.lex.c <- %.l
 # %.tab.o <- %.tab.[ch] <- %.y
 targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \
-	   $(call intermediate_targets, .dtb.o, .dtb.S .dtb) \
-	   $(call intermediate_targets, .dtb.pbl.o, .dtb.S .dtb) \
+	   $(call intermediate_targets, .dtb.o, .dtb.S .dtb.z .dtb) \
+	   $(call intermediate_targets, .dtb.pbl.o, .dtb.S .dtb.z .dtb) \
 	   $(call intermediate_targets, .lex.o, .lex.c) \
 	   $(call intermediate_targets, .tab.o, .tab.c .tab.h)
 
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index a830364a8bab..c2301b5370da 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -333,9 +333,12 @@ endif
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb = DTB     $@
 cmd_dt_S_dtb = $(srctree)/scripts/gen-dtb-s $(subst -,_,$(*F)) $< $(CONFIG_IMD) > $@
-$(obj)/%.dtb.S: $(obj)/%.dtb $(srctree)/scripts/gen-dtb-s FORCE
+$(obj)/%.dtb.S: $(obj)/%.dtb $(obj)/%.dtb.z $(srctree)/scripts/gen-dtb-s FORCE
 	$(call if_changed,dt_S_dtb)
 
+$(obj)/%.dtb.z: $(obj)/%.dtb FORCE
+	$(call if_changed,lzo)
+
 dts-frags = $(subst $(quote),,$(CONFIG_EXTERNAL_DTS_FRAGMENTS))
 quiet_cmd_dtc = DTC     $@
 # For compatibility between make 4.2 and 4.3
diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index 868d434664ec..eadf4d76f313 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -51,11 +51,7 @@ echo "__dtb_${name}_end:"
 echo ".global __dtb_${name}_end"
 echo ".balign STRUCT_ALIGNMENT"
 
-lzop -f -9 $dtb -o $dtb.lzo
-if [ $? != 0 ]; then
-	exit 1
-fi
-compressed=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $dtb.lzo)
+compressed=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $dtb.z)
 uncompressed=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $dtb)
 
 echo "#if defined(CONFIG_USE_COMPRESSED_DTB) && defined(__PBL__)"
@@ -66,7 +62,7 @@ echo "__dtb_z_${name}_start:"
 printf ".int 0x%08x\n"  0x7b66bcbd
 printf ".int 0x%08x\n"  $compressed
 printf ".int 0x%08x\n"  $uncompressed
-echo ".incbin \"$dtb.lzo\""
+echo ".incbin \"$dtb.z\""
 echo "__dtb_z_${name}_end:"
 echo ".global __dtb_z_${name}_end"
 echo ".balign STRUCT_ALIGNMENT"
-- 
2.30.2




  parent reply	other threads:[~2022-07-13  9:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13  9:57 [PATCH v2 1/6] common: don't allow compressing in-barebox binaries again Ahmad Fatoum
2022-07-13  9:57 ` [PATCH v2 2/6] pbl: make USE_COMPRESSED_DTB a PBL-only feature Ahmad Fatoum
2022-07-13  9:57 ` [PATCH v2 3/6] pbl: remove redundant select UNCOMRPESS Ahmad Fatoum
2022-07-13  9:57 ` Ahmad Fatoum [this message]
2022-07-13  9:57 ` [PATCH v2 5/6] pbl: compressed-dtb: use flexible array member to access data Ahmad Fatoum
2022-07-13  9:57 ` [PATCH v2 6/6] kbuild: pbl: use same compression algo for both barebox and DTB Ahmad Fatoum
2022-07-15 10:53   ` Sascha Hauer
2022-07-15 15:57     ` [PATCH] fixup! " Ahmad Fatoum
2022-07-14  8:08 ` [PATCH v2 1/6] common: don't allow compressing in-barebox binaries again 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=20220713095730.1878941-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --subject='Re: [PATCH v2 4/6] kbuild: gen-dtb-s: use Makefile.lib instead of duplicating cmd_lzo' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox