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 2/6] pbl: make USE_COMPRESSED_DTB a PBL-only feature
Date: Wed, 13 Jul 2022 11:57:26 +0200	[thread overview]
Message-ID: <20220713095730.1878941-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220713095730.1878941-1-a.fatoum@pengutronix.de>

From: Ahmad Fatoum <ahmad@a3f.at>

All in-tree boards that reference __dtb_z_ symbols are already
multi-image capable and allow us to compress barebox proper by having
the prebootloader decompress it using the algorithm specified by the
CONFIG_IMAGE_COMPRESSION_* option.

DTB on the other hand, is handled specially and the optional compression
is always using LZO. It makes sense to use the same
CONFIG_IMAGE_COMPRESSION_* options for the DT too to make build system
integration easier.

To avoid special casing non-PBL support which lacks this options, just
drop USE_COMPRESSED_DTB there. If linking barebox for your downstream
board is broken by this:

  - If not multi-image capable, consider porting it to use
    ENTRY_FUNCTION(_WITHSTACK) instead

  - If you are using __dtb_z_* in barebox proper, use normal __dtb_
    and compress barebox as a whole instead with
    CONFIG_IMAGE_COMPRESSION_*

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - new patch
---
 common/Kconfig    | 6 ------
 pbl/Kconfig       | 6 ++++++
 scripts/gen-dtb-s | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index 6278866006b1..60f52a10e11d 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -41,12 +41,6 @@ config BLOCK
 config BLOCK_WRITE
 	bool
 
-config USE_COMPRESSED_DTB
-	bool
-	depends on ARM || RISCV
-	select UNCOMPRESS
-	select LZO_DECOMPRESS
-
 config FILETYPE
 	bool
 
diff --git a/pbl/Kconfig b/pbl/Kconfig
index ce0acbb646c7..ec1886073e42 100644
--- a/pbl/Kconfig
+++ b/pbl/Kconfig
@@ -28,6 +28,12 @@ config PBL_SINGLE_IMAGE
 
 if PBL_IMAGE
 
+config USE_COMPRESSED_DTB
+	bool
+	depends on ARM || RISCV
+	select UNCOMPRESS
+	select LZO_DECOMPRESS
+
 config PBL_RELOCATABLE
 	depends on ARM || MIPS || RISCV
 	bool "relocatable pbl image"
diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index 1027db28044f..868d434664ec 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -58,7 +58,7 @@ fi
 compressed=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $dtb.lzo)
 uncompressed=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $dtb)
 
-echo "#ifdef CONFIG_USE_COMPRESSED_DTB"
+echo "#if defined(CONFIG_USE_COMPRESSED_DTB) && defined(__PBL__)"
 echo ".section .dtbz.rodata.${name},\"a\""
 echo ".balign STRUCT_ALIGNMENT"
 echo ".global __dtb_z_${name}_start"
-- 
2.30.2




  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 ` Ahmad Fatoum [this message]
2022-07-13  9:57 ` [PATCH v2 3/6] pbl: remove redundant select UNCOMRPESS Ahmad Fatoum
2022-07-13  9:57 ` [PATCH v2 4/6] kbuild: gen-dtb-s: use Makefile.lib instead of duplicating cmd_lzo Ahmad Fatoum
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-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@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