mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>,
	barebox@lists.infradead.org
Subject: Re: 'of_compatible' and 'model' imd records are unusable
Date: Mon, 4 Oct 2021 09:52:55 +0200
Message-ID: <20211004075255.GM28453@pengutronix.de> (raw)
In-Reply-To: <20211002124447.74a231c6c07697e9042b905e@gmail.com>

On Sat, Oct 02, 2021 at 12:44:47PM +0300, Antony Pavlov wrote:
> On Sat, 2 Oct 2021 10:48:50 +0200
> Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> Hi Sascha!
> 
> > On Fri, Oct 01, 2021 at 02:24:53PM +0300, Antony Pavlov wrote:
> > > 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":
> > 
> > This is done on purpose because otherwise...
> > 
> > > 
> > > #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.:
> > 
> > ...exactly this would happen.
> > 
> > To get the of_compatible and model imd tags in an image you have to put
> > IMD_USED_OF() explicitly into the entry function of the image handling
> > this compatible, there's no way for the build process to know which
> > image handles which device tree. See below for an example which adds the
> > tags for the boards you are currently compiling.
> 
> There are two remarks:
> 
> 1. It looks like we still able to automatically add of_compatible and model imd tags.
> Please see my message http://lists.infradead.org/pipermail/barebox/2021-October/037412.html

I gave it a try, it works and looks like a good solution. We'll need
another

if [ "$imd" = "y" ]; then
       echo ".word __imd_${name}_start"
fi

at the end of scripts/gen-dtb-s to make it work with compressed dtbs as
well.

> 
> Can we automaticaly generate of_compatible and model imd tags for most of the boards
> and explicitly generate tags with IMD_USED_OF() just for selected boards?

With your approach we can drop IMD_USED_OF(), at least I see no more
need for it.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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


  reply	other threads:[~2021-10-04  7:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2021-10-01 11:46 Antony Pavlov
2021-10-01 23:47 ` Antony Pavlov

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=20211004075255.GM28453@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.trumtrar@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

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git