'of_compatible' and 'model' imd records are unusable

Antony Pavlov antonynpavlov at gmail.com
Fri Oct 1 16:47:07 PDT 2021


On Fri, 1 Oct 2021 14:46:19 +0300
Antony Pavlov <antonynpavlov at gmail.com> wrote:

Hi all!

> I have cloned barebox c67ada0024da (v2021.08.0) and found that
> 'of_compatible' and 'model' imd records are unusable.

I have found a quick-and-dirty solution for the problem.

of_compatible and model imd types were introduced in

commit 97e81f2d78f30fb4936f0f6fe52b317d8dbc9881
Author: Sascha Hauer <s.hauer at pengutronix.de>
Date:   Mon Jul 28 07:22:40 2014 +0200

    Add support for metadata in barebox images


the commit
commit 58eae8361c10fea661bcb48c4c5e75e7ad19e1c1
Author: Sascha Hauer <s.hauer at pengutronix.de>
Date:   Fri Oct 23 09:14:54 2015 +0200

    ARM: Allow compressed dtb binaries

breaks adding of of_compatible and model records
by changing in scripts/gen-dtb-s.


the commit 
commit c1c818735caa8222d88aa9286a219d6055c1699d
Author: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
Date:   Thu Feb 21 11:25:30 2019 +0100

    imd: create new helper macro to add data from oftree to image meta data

introduces macro for explicit adding of of_compatible
imd record from C code.


You can resurrect of_compatible and model imd records adding
by partialy reverting c1c818735caa822:scripts/gen-dtb-s and 58eae8361c10fea66:scripts/gen-dtb-s
e.g.

barebox$ make rpi_defconfig
...
barebox$ make
...
barebox$ ./scripts/bareboximd images/barebox-raspberry-pi-3.img
buildsystem version: 
crc32: 0x00000000
build: #8 Fri Oct 1 23:23:30 UTC 2021
release: 2021.08.0

barebox$ patch -p1 <<EOF
diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index 4f8c62a0b..649021e20 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -18,8 +18,8 @@ FDTGET=scripts/dtc/fdtget
 
 if [ "$imd" = "y" ]; then
 	echo ".section .barebox_imd_0.${name},\"a\""
-	echo ".global __barebox_imd_OF_${name}"
-	echo "__barebox_imd_OF_${name}:"
+	echo ".global __imd_${name}_start"
+	echo "__imd_${name}_start:"
 
 	compat=$($FDTGET -d notfound -t bi "$dtb" / compatible | sed "s^ ^,^g")
 	if [ "$compat" != "notfound" ]; then
@@ -51,6 +51,10 @@ echo "__dtb_${name}_end:"
 echo ".global __dtb_${name}_end"
 echo ".balign STRUCT_ALIGNMENT"
 
+if [ "$imd" = "y" ]; then
+	echo ".word __imd_${name}_start"
+fi
+
 lzop -f -9 $dtb -o $dtb.lzo
 if [ $? != 0 ]; then
 	exit 1
EOF
patching file scripts/gen-dtb-s

barebox$ make
...
barebox$ ./scripts/bareboximd images/barebox-raspberry-pi-3.img
buildsystem version: 
crc32: 0x00000000
build: #9 Fri Oct 1 23:24:06 UTC 2021
release: 2021.08.0-dirty
of_compatible: raspberrypi,3-model-b brcm,bcm2837
model: Raspberry Pi 3 Model B
barebox$

 
> E.g.
> 
> barebox$ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- imx_v8_defconfig
> barebox$ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
> ...
> images built:
> barebox-nxp-imx8mm-evk.img
> barebox-prt-prt8mm.img
> barebox-nxp-imx8mp-evk.img
> barebox-nxp-imx8mq-evk.img
> barebox-zii-imx8mq-dev.img
> barebox-phytec-phycore-imx8mq.img
> 
> barebox$ ./scripts/bareboximd images/barebox-nxp-imx8mm-evk.img
> build: #1 Fri Oct 1 10:16:30 UTC 2021
> buildsystem version: 
> crc32: 0x00000000
> release: 2021.08.0
> barebox$ 
> 
> There is no 'of_compatible' and 'model' imd records in bareboximd output.
> 

-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list