'of_compatible' and 'model' imd records are unusable
Hi all!
I have cloned barebox c67ada0024da (v2021.08.0) and found that 'of_compatible' and 'model' imd records are unusable.
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.
So there is no chance to imd_find_type(..., IMD_TYPE_OF_COMPATIBLE) (see common/bbu.c) in a barebox image file.
scripts/gen-dtb-s puts IMD_TYPE_OF_COMPATIBLE and IMD_TYPE_MODEL records into barebox_imd_0 section.
BAREBOX_IMD macro (include/asm-generic/barebox.lds.h) does not KEEP barebox_imd_0 section":
#define BAREBOX_IMD \
STRUCT_ALIGN(); \
KEEP(*(.barebox_imd_start)) \
KEEP(*(.barebox_imd_1*)) \
*(.barebox_imd_0*) \
KEEP(*(.barebox_imd_end))KEEPing barebox_imd_0 leads to several 'of_compatible' and 'model' records in one barebox image file, e.g.:
barebox$ ./scripts/bareboximd images/barebox-prt-prt8mm.img
build: #2 Fri Oct 1 10:19:07 UTC 2021
buildsystem version:
crc32: 0x00000000
release: 2021.08.0-dirtyof_compatible: fsl,imx8mm-evk fsl,imx8mm
model: FSL i.MX8MM EVK boardof_compatible: prt,prt8mm fsl,imx8mm
model: Protonic PRT8MMof_compatible: fsl,imx8mp-evk fsl,imx8mp
model: NXP i.MX8MPlus EVK boardof_compatible: fsl,imx8mq-evk fsl,imx8mq
model: NXP i.MX8MQ EVKof_compatible: phytec,imx8mq-pcl066 fsl,imx8mq
model: Phytec phyCORE-i.MX8of_compatible: zii,imx8mq-ultra-rmb3 zii,imx8mq-ultra fsl,imx8mq
model: ZII Ultra RMB3 Boardof_compatible: zii,imx8mq-ultra-zest zii,imx8mq-ultra fsl,imx8mq
model: ZII Ultra Zest Board builduser@ae676260680c:~/barebox$
Signature · 7 lines
Best regards, Antony Pavlov _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
On Fri, 1 Oct 2021 14:46:19 +0300
Antony Pavlov <[email protected]> wrote:
Hi all!
Quoted 2 lines
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 <[email protected]> Date: Mon Jul 28 07:22:40 2014 +0200
Add support for metadata in barebox images
the commit
commit 58eae8361c10fea661bcb48c4c5e75e7ad19e1c1
Author: Sascha Hauer <[email protected]> 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 <[email protected]> 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
scripts/gen-dtb-s +6 -2
@@ -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-dirtyof_compatible: raspberrypi,3-model-b brcm,bcm2837
model: Raspberry Pi 3 Model B
barebox$
Quoted 22 lines
E.g.
barebox$ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
imx_v8_defconfigbarebox$ 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.imgbarebox$
./scripts/bareboximdimages/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.
Signature · 7 lines
Best regards, Antony Pavlov _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox