Compressed DTB - builtin DTB

Sascha Hauer s.hauer at pengutronix.de
Fri Oct 14 02:52:19 PDT 2016


Hi Daniel,

On Thu, Oct 13, 2016 at 12:32:31PM +0200, Daniel Krüger wrote:
> Hello,
> 
> I'm currently porting our board support to device tree. Currently, I don't
> use multi-PBL, but include the device tree via CONFIG_BUILTIN_DTB. This
> works, but the DTB seems to be included twice in the image: once as plain
> DTB and once as compressed DTB. I think this isn't intended this way.
> 
> Extract from System.map:
> 87e82b80 R __dtb_imx35_systec_hmi_start
> 87e82b80 R __dtb_start
> 87e8501c R __dtb_imx35_systec_hmi_end
> 87e85020 R __dtb_z_imx35_systec_hmi_start
> 87e85ad0 R __dtb_z_imx35_systec_hmi_end
> 87e85b00 B __bss_start
> 87e85b00 R __dtb_end

No, indeed that's not intended. Could you test the appended patch? It
should solve this.

> 
> Just using the compressed DTB would be really good. Because it makes the
> image much smaller. However, how should that be done? The extract code might
> be simple. But I don't have an idea how to let the linker select the right
> version.

If you are using uncompressed binary you should switch to PBL support to
get a compressed binary. Then, if you are using PBL the dtb is
compressed already as part of the whole binary.

Sascha

------------------------------------8<--------------------------------

>From c24a6bd6eabc3f73375080e6fc500aa955795a27 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer at pengutronix.de>
Date: Fri, 14 Oct 2016 11:42:00 +0200
Subject: [PATCH] gen-dtb-s: Put compressed dtb in different section

For builtin dtbs all compiled dtbs matching section .dtb.rodata.*
are collected in a single section. Since every dtb is compiled as
uncompressed and also as compressed binary each dtb ends up twice
in the section. Let's put the compressed variants in .dtbz.rodata.*
sections rather than .dtb.rodata.*.z so they end up in the binary
only once.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 scripts/gen-dtb-s | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index 40c6085..4215461 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -58,7 +58,7 @@ fi
 compressed=$(stat $dtb.lzo -c "%s")
 uncompressed=$(stat $dtb -c "%s")
 
-echo ".section .dtb.rodata.${name}.z,\"a\""
+echo ".section .dtbz.rodata.${name},\"a\""
 echo ".balign STRUCT_ALIGNMENT"
 echo ".global __dtb_z_${name}_start"
 echo "__dtb_z_${name}_start:"
-- 
2.9.3

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list