mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: "Sascha Hauer" <s.hauer@pengutronix.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Steffen Trumtrar" <s.trumtrar@pengutronix.de>,
	"Ahmad Fatoum" <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: 'of_compatible' and 'model' imd records are unusable
Date: Sat, 2 Oct 2021 02:47:07 +0300	[thread overview]
Message-ID: <20211002024707.a75f2fd7ed905739c5f14aea@gmail.com> (raw)
In-Reply-To: <20211001144619.6db15b8269c912722bf0f2d0@gmail.com>

On Fri, 1 Oct 2021 14:46:19 +0300
Antony Pavlov <antonynpavlov@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@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@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@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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2021-10-01 23:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 11:46 Antony Pavlov
2021-10-01 23:47 ` Antony Pavlov [this message]
     [not found] <20211001142453.4a3c0ba9bd7bb909125e2a5f@gmail.com>
2021-10-02  8:48 ` Sascha Hauer
2021-10-02  9:44   ` Antony Pavlov
2021-10-04  7:52     ` 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=20211002024707.a75f2fd7ed905739c5f14aea@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s.trumtrar@pengutronix.de \
    --cc=u.kleine-koenig@pengutronix.de \
    /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