summaryrefslogtreecommitdiffstats
path: root/scripts/gen-dtb-s
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-10-23 09:14:54 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-10-27 10:02:28 +0100
commit58eae8361c10fea661bcb48c4c5e75e7ad19e1c1 (patch)
treef25d31a025cfea28348d4279090877e3da72862a /scripts/gen-dtb-s
parentfcc6020164362f0c4877e6f50fb0d323d50ee540 (diff)
downloadbarebox-58eae8361c10fea661bcb48c4c5e75e7ad19e1c1.tar.gz
barebox-58eae8361c10fea661bcb48c4c5e75e7ad19e1c1.tar.xz
ARM: Allow compressed dtb binaries
In the current multi image build process the DTBs end up uncompressed in the PBL. This can be annoying because the PBL is often very size constrained. This patch allows to put the DTBs in as lzo compressed binary into the PBL. Since lzo offers quite good compression ratios for DTBs no other compression algorithm has been implemented for now. Boards which want to use the compressed DTBs only have to change the __dtb_ prefix in the DTB name to __dtb_z_. Also they should select ARM_USE_COMPRESSED_DTB to make sure barebox supports uncompressing the DTB. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts/gen-dtb-s')
-rwxr-xr-xscripts/gen-dtb-s19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index a920495567..40c60855ec 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -51,6 +51,25 @@ 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=$(stat $dtb.lzo -c "%s")
+uncompressed=$(stat $dtb -c "%s")
+
+echo ".section .dtb.rodata.${name}.z,\"a\""
+echo ".balign STRUCT_ALIGNMENT"
+echo ".global __dtb_z_${name}_start"
+echo "__dtb_z_${name}_start:"
+printf ".word 0x%08x\n" 0x7b66bcbd
+printf ".word 0x%08x\n" $compressed
+printf ".word 0x%08x\n" $uncompressed
+echo ".incbin \"$dtb.lzo\""
+echo "__dtb_z_${name}_end:"
+echo ".global __dtb_z_${name}_end"
+echo ".balign STRUCT_ALIGNMENT"
+
if [ "$imd" = "y" ]; then
echo ".word __imd_${name}_start"
fi