using binman fails boot

Simon Glass sjg at chromium.org
Sat Jul 17 00:11:31 CEST 2021


() which has
Hi Tim,

On Fri, 16 Jul 2021 at 15:43, Tim Harvey <tharvey at gateworks.com> wrote:
>
> On Thu, Jul 15, 2021 at 9:30 PM Simon Glass <sjg at chromium.org> wrote:
> >
> > Hi Tim,
> >
> > On Thu, 15 Jul 2021 at 16:58, Tim Harvey <tharvey at gateworks.com> wrote:
> > >
> > > Greetings,
> > >
> > > I'm taking a look at moving imx8mm-venice to use binman for packaging.
> > > After doing so U-Boot proper fails to boot:
> > >
> > > U-Boot SPL 2021.07-00475-g1126252f40 (Jul 15 2021 - 11:09:02 -0700)
> > > GSC     : v58 0xf098 RST:VIN Thermal Protection Disabled
> > > Model   : GW7300-00-B1B
> > > Serial  : 852420
> > > MFGDate : 10-26-2020
> > > RTC     : 122
> > > PMIC    : MP5416
> > > DRAM    : LPDDR4 1 GiB
> > > WDT:   Not starting
> > > Trying to boot from MMC1
> > > DTB     : imx8mm-venice-gw73xx-0x
> > >
> > >
> > > U-Boot 2021.07-00475-g1126252f40 (Jul 15 2021 - 11:09:02 -0700)
> > >
> > > CPU:   Freescale i.MX8MMQ rev1.0 1600 MHz (running at 1200 MHz)
> > > CPU:   Industrial temperature grade (-40C to 105C) at 43C
> > > Reset cause: POR
> > > Model: Gateworks Venice GW73xx-0x i.MX8MM Development Kit
> > > DRAM:  1 GiB
> > > temp    : 38.3C
> > > vdd_bat : 0.000V
> > > vdd_vin : 15.731V
> > > vdd_adc1: 0.000V
> > > vdd_adc2: 0.000V
> > > vdd_dram: 1.093V
> > > vdd_1p2 : 1.193V
> > > vdd_1p0 : 0.985V
> > > vdd_2p5 : 2.470V
> > > vdd_3p3 : 3.250V
> > > vdd_0p95: 0.948V
> > > vdd_1p8 : 1.799V
> > > vdd_gsc : 3.262V
> > > initcall sequence 000000007ffc4f58 failed at call 0000000040255910 (err=-2)
> > > ### ERROR ### Please RESET the board ###
> > >
> > > Any ideas what this could be?
> >
> > I don't have much idea. What is the initcall that is failing? Can you
> > check u-boot.map ? That might give a clue as to what is failing. I
> > assume the DT is passed to U-Boot somehow from SPL?
> >
>
> Simon,
>
> Thanks for the help!
>
> The initcall addr doesn't match anything in u-boot.map (maybe
> u-boot.map doesn't show what's in lib/binman.o?) but I was able to

It certainly should show up, but if you have CONFIG_LTO enabled lots
of functions disappear. Still if you get an initcall address I would
expect a function to be present. Make sure you use the unallocated
address.

> track it down to initr_binman() failing due to
> binman_init()->find_image_node(&binman->image)' returning -EINVAL.
> This is because my imx8mm-venice-gw73xx-0x-uboot.dtsi doesn't have a
> binman node (my CONFIG_DEFAULT_DEVICE_TREE did but not my actual
> dtbs). So I have it working now!

OK good progress! Perhaps we should put an error message in initr_binman() ?

>
> > >
> <snip>
> > >
> > > A follow-on question is that I would like to investigate using binman
> > > in the SPL to dynamically access the IMX8M ddr training blobs so that
> > > we don't have to waste padding space taking them onto the end of the
> > > SPL which is currently done. The lpddr4 training blobs I'm using
> > > currently take up 57k without padding compared to 81k with padding.
> > > The location of them is handled in ddr_load_train_firmware.
> > >
> > > If I add the following to my SPL:
> > > diff --git a/board/gateworks/venice/spl.c b/board/gateworks/venice/spl.c
> > > index d0a490b0e6..62eb67fa5e 100644
> > > --- a/board/gateworks/venice/spl.c
> > > +++ b/board/gateworks/venice/spl.c
> > > @@ -3,6 +3,7 @@
> > >   * Copyright 2021 Gateworks Corporation
> > >   */
> > >
> > > +#include <binman_sym.h>
> > >  #include <common.h>
> > >  #include <cpu_func.h>
> > >  #include <hang.h>
> > > @@ -252,6 +253,8 @@ static int power_init_board(void)
> > >         return 0;
> > >  }
> > >
> > > +binman_sym_declare(ulong, blob_1, image_pos);
> > > +
> > >  void board_init_f(ulong dummy)
> > >  {
> > >         struct udevice *dev;
> > > @@ -291,6 +294,8 @@ void board_init_f(ulong dummy)
> > >         gpio_request(PCIE_RSTN, "perst#");
> > >         gpio_direction_output(PCIE_RSTN, 0);
> > >
> > > +       printf("%s: blob_1:0x%0lx\n", __func__, binman_sym(ulong,
> > > blob_1, image_pos));
> > > +
> > >         /* GSC */
> > >         dram_sz = gsc_init(0);
> > >
> > > I get 'blob_1:0x0' which is not what I expected.
> > >
> > > If I understand correctly binman is using linker symbols to determine
> > > where things are in the image? What I don't quite understand is what
> > > symbols are valid to use assuming my dtsi above. The binman.rst docs
> > > talk use 'u_boot_any' as an example which apparently can match
> > > 'u-boot.bin', 'u-boot.img', and 'u-boot-nodtb.bin' but I can't find
> > > the code that somehow translates this meaning.
> >
> > Actually any symbol can be used. It basically depends on the name of
> > the entry in your image description. So here it would be
> > blob-ext at 1...I think that translates to blob_ext_1 but I'm not sure
> > about the @. You could try blob-ext-1 instead. It does not know about
> > phandles or labels.
> >
> > If you pass BINMAN_VERBOSE=4 to the build you should see it talking
> > about writing symbols into the SPL image.
> >
>
> For the following:
>          u-boot-spl-ddr {
>                 filename = "u-boot-spl-ddr.bin";
>                 pad-byte = <0xff>;
>                 align-size = <4>;
>                 align = <4>;
>
>                 u-boot-spl {
>                         align-end = <4>;
>                 };
>
>                 blob-ext at 1 {
>                         filename = "lpddr4_pmu_train_1d_imem.bin";
>                         size = <0x8000>;
>                 };
>
>                 blob-ext at 2 {
>                         filename = "lpddr4_pmu_train_1d_dmem.bin";
>                         size = <0x4000>;
>                 };
>
>                 blob-ext at 3 {
>                         filename = "lpddr4_pmu_train_2d_imem.bin";
>                         size = <0x8000>;
>                 };
>
>                 blob-ext at 4 {
>                         filename = "lpddr4_pmu_train_2d_dmem.bin";
>                         size = <0x4000>;
>                 };
>         };
>
> I tried 'blob_ext_1' and 'blob_ext1' and both formats resolve to 0x0.
> The 'ext-blob' is an entry type supported by binman so if I had
> multiple they must be called blob-ext at 1, blob-ext at 2, ... right?
>
> The entry_name used in binman_sym_declare/binman_sym certainly can't
> support non C varname characters so '-' and '@' characters must get
> translated somewhere. Where would that be done in order to figure out
> what to use?

If you want to look at the internals, see section.py LookupSymbol().

It takes the ELF symbol and replaces _ by - but does not (cannot)
replace _ with @. So I think you'll have to use - instead of @

I suppose we could do the search in the other direction (take the
entry and try to find the symbol that matches it), but I'd need to
think about it. A simple translation is easier.

In this case binman should really give an error for your chosen entry
name (blob-ext at 4) but it doesn't know you are using it as a symbol. I
think it should complain about this (see the Warning in section.py
LookupSymbol()) but apparently it does not in your case.

If you can push your tree somewhere (with this problem) I'll see if I
can figure out why.

>
> BINMAN_VERBOSE=4 indeed prints out a tone of stuff but I'm not seeing
> anything for 'blob' below that would seem to indicate one node name vs
> another:

Oops you need BINMAN_VERBOSE=5 - see elf.py LookupAndWriteSymbols()
which has tout.Debug() which is level 5.

>   BINMAN  flash.bin
> Node '/binman/u-boot-spl-ddr/u-boot-spl': etype 'u-boot-spl':
> u-boot-spl-expanded selected
> Node '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-nodtb': Packing:
> offset=None, size=None, content_size=215d0
> Node '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-nodtb':    -
> packed: offset=0x0, size=0x215d0, content_size=0x215d0,
> next_offset=215d0
> Node '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-dtb': Packing:
> offset=None, size=None, content_size=131c
> Node '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-dtb':    - packed:
> offset=0x215d0, size=0x131c, content_size=0x131c, next_offset=228ec
> Node '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-nodtb': GetData: size 0x215d0
> Node '/binman/u-boot-spl-ddr/u-boot-spl': GetPaddedDataForEntry: size None
> Node '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-dtb': GetData: size 0x131c
> Node '/binman/u-boot-spl-ddr/u-boot-spl': GetPaddedDataForEntry: size None
> Node '/binman/u-boot-spl-ddr/u-boot-spl': GetData: 2 entries, total size 0x228ec
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size None
> Node '/binman/u-boot-spl-ddr/u-boot-spl': Packing: offset=None,
> size=0x228ec, content_size=228ec
> Node '/binman/u-boot-spl-ddr/u-boot-spl':    - packed: offset=0x0,
> size=0x228ec, content_size=0x228ec, next_offset=228ec
> Node '/binman/u-boot-spl-ddr/blob-ext at 1': Packing: offset=None,
> size=0x8000, content_size=7df4
> Node '/binman/u-boot-spl-ddr/blob-ext at 1':    - packed: offset=0x228ec,
> size=0x8000, content_size=0x7df4, next_offset=2a8ec
> Node '/binman/u-boot-spl-ddr/blob-ext at 2': Packing: offset=None,
> size=0x4000, content_size=684
> Node '/binman/u-boot-spl-ddr/blob-ext at 2':    - packed: offset=0x2a8ec,
> size=0x4000, content_size=0x684, next_offset=2e8ec
> Node '/binman/u-boot-spl-ddr/blob-ext at 3': Packing: offset=None,
> size=0x8000, content_size=5ac0
> Node '/binman/u-boot-spl-ddr/blob-ext at 3':    - packed: offset=0x2e8ec,
> size=0x8000, content_size=0x5ac0, next_offset=368ec
> Node '/binman/u-boot-spl-ddr/blob-ext at 4': Packing: offset=None,
> size=0x4000, content_size=564
> Node '/binman/u-boot-spl-ddr/blob-ext at 4':    - packed: offset=0x368ec,
> size=0x4000, content_size=0x564, next_offset=3a8ec
> Node '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-nodtb': GetData: size 0x215d0
> Node '/binman/u-boot-spl-ddr/u-boot-spl': GetPaddedDataForEntry: size 0x228ec
> Node '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-dtb': GetData: size 0x131c
> Node '/binman/u-boot-spl-ddr/u-boot-spl': GetPaddedDataForEntry: size 0x228ec
> Node '/binman/u-boot-spl-ddr/u-boot-spl': GetData: 2 entries, total size 0x228ec
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size None
> Node '/binman/u-boot-spl-ddr/blob-ext at 1': GetData: size 0x7df4
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size None
> Node '/binman/u-boot-spl-ddr/blob-ext at 2': GetData: size 0x684
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size None
> Node '/binman/u-boot-spl-ddr/blob-ext at 3': GetData: size 0x5ac0
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size None
> Node '/binman/u-boot-spl-ddr/blob-ext at 4': GetData: size 0x564
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size None
>  Node '/binman/u-boot-spl-ddr': GetData: 5 entries, total size 0x3a8ec
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size 0x3a8ec
>  Node '/binman/u-boot-spl-ddr': Packing: offset=None, size=0x3a8ec,
> content_size=3a8ec
>  Node '/binman/u-boot-spl-ddr':    - packed: offset=0x0, size=0x3a8ec,
> content_size=0x3a8ec, next_offset=3a8ec
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr' prop 'offset' to 0x0
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr' prop
> 'size' to 0x3a8ec
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr' prop
> 'image-pos' to 0x0
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/u-boot-spl'
> prop 'offset' to 0x0
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/u-boot-spl'
> prop 'size' to 0x228ec
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/u-boot-spl'
> prop 'image-pos' to 0x0
> File ./u-boot.dtb.out: Update node
> '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-nodtb' prop 'offset' to
> 0x0
> File ./u-boot.dtb.out: Update node
> '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-nodtb' prop 'size' to
> 0x215d0
> File ./u-boot.dtb.out: Update node
> '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-nodtb' prop 'image-pos'
> to 0x0
> File ./u-boot.dtb.out: Update node
> '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-dtb' prop 'offset' to
> 0x215d0
> File ./u-boot.dtb.out: Update node
> '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-dtb' prop 'size' to
> 0x131c
> File ./u-boot.dtb.out: Update node
> '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-dtb' prop 'image-pos' to
> 0x215d0
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 1'
> prop 'offset' to 0x228ec
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 1'
> prop 'size' to 0x8000
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 1'
> prop 'image-pos' to 0x228ec
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 2'
> prop 'offset' to 0x2a8ec
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 2'
> prop 'size' to 0x4000
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 2'
> prop 'image-pos' to 0x2a8ec
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 3'
> prop 'offset' to 0x2e8ec
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 3'
> prop 'size' to 0x8000
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 3'
> prop 'image-pos' to 0x2e8ec
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 4'
> prop 'offset' to 0x368ec
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 4'
> prop 'size' to 0x4000
> File ./u-boot.dtb.out: Update node '/binman/u-boot-spl-ddr/blob-ext at 4'
> prop 'image-pos' to 0x368ec
> Pack completed after 1 pass(es)
> Writing image to './u-boot-spl-ddr.bin'
> Node '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-nodtb': GetData: size 0x215d0
> Node '/binman/u-boot-spl-ddr/u-boot-spl': GetPaddedDataForEntry: size 0x228ec
> Node '/binman/u-boot-spl-ddr/u-boot-spl/u-boot-spl-dtb': GetData: size 0x131c
> Node '/binman/u-boot-spl-ddr/u-boot-spl': GetPaddedDataForEntry: size 0x228ec
> Node '/binman/u-boot-spl-ddr/u-boot-spl': GetData: 2 entries, total size 0x228ec
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size 0x3a8ec
> Node '/binman/u-boot-spl-ddr/blob-ext at 1': GetData: size 0x7df4
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size 0x3a8ec
> Node '/binman/u-boot-spl-ddr/blob-ext at 2': GetData: size 0x684
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size 0x3a8ec
> Node '/binman/u-boot-spl-ddr/blob-ext at 3': GetData: size 0x5ac0
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size 0x3a8ec
> Node '/binman/u-boot-spl-ddr/blob-ext at 4': GetData: size 0x564
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size 0x3a8ec
>  Node '/binman/u-boot-spl-ddr': GetData: 5 entries, total size 0x3a8ec
>  Node '/binman/u-boot-spl-ddr': GetPaddedDataForEntry: size 0x3a8ec
> Wrote 0x3a8ec bytes
> Node '/binman/flash/mkimage/blob': GetData: size 0x3a8ec
>   Node '/binman/flash/mkimage': Packing: offset=None, size=None,
> content_size=3ca00
>   Node '/binman/flash/mkimage':    - packed: offset=0x0, size=0x3ca00,
> content_size=0x3ca00, next_offset=3ca00
>   Node '/binman/flash/mkimage': GetData: size 0x3ca00
>           Node '/binman/flash': GetPaddedDataForEntry: size None
>           Node '/binman/flash': GetData: 1 entries, total size 0x3ca00
>           Node '/binman/flash': GetPaddedDataForEntry: size 0x3ca00
>           Node '/binman/flash': Packing: offset=None, size=0x3ca00,
> content_size=3ca00
>           Node '/binman/flash':    - packed: offset=0x0, size=0x3ca00,
> content_size=0x3ca00, next_offset=3ca00
> File ./u-boot.dtb.out: Update node '/binman/flash' prop 'offset' to 0x0
> File ./u-boot.dtb.out: Update node '/binman/flash' prop 'size' to 0x3ca00
> File ./u-boot.dtb.out: Update node '/binman/flash' prop 'image-pos' to 0x0
> File ./u-boot.dtb.out: Update node '/binman/flash/mkimage' prop 'offset' to 0x0
> File ./u-boot.dtb.out: Update node '/binman/flash/mkimage' prop 'size'
> to 0x3ca00
> File ./u-boot.dtb.out: Update node '/binman/flash/mkimage' prop
> 'image-pos' to 0x0
> Pack completed after 1 pass(es)
> Writing image to './flash.bin'
>   Node '/binman/flash/mkimage': GetData: size 0x3ca00
>           Node '/binman/flash': GetPaddedDataForEntry: size 0x3ca00
>           Node '/binman/flash': GetData: 1 entries, total size 0x3ca00
>           Node '/binman/flash': GetPaddedDataForEntry: size 0x3ca00
> Wrote 0x3ca00 bytes
> Node '/binman/itb/fit/images/uboot/blob-ext': Packing: offset=None,
> size=None, content_size=aa978
> Node '/binman/itb/fit/images/uboot/blob-ext':    - packed: offset=0x0,
> size=0xaa978, content_size=0xaa978, next_offset=aa978
> Node '/binman/itb/fit/images/uboot/blob-ext': GetData: size 0xaa978
> Node '/binman/itb/fit/images/uboot': GetPaddedDataForEntry: size None
> Node '/binman/itb/fit/images/uboot': GetData: 1 entries, total size 0xaa978
>             Node '/binman/itb': GetPaddedDataForEntry: size None
> Node '/binman/itb/fit/images/uboot': Packing: offset=None,
> size=0xaa978, content_size=aa978
> Node '/binman/itb/fit/images/uboot':    - packed: offset=0x0,
> size=0xaa978, content_size=0xaa978, next_offset=aa978
> Node '/binman/itb/fit/images/uboot/blob-ext': GetData: size 0xaa978
> Node '/binman/itb/fit/images/uboot': GetPaddedDataForEntry: size 0xaa978
> Node '/binman/itb/fit/images/uboot': GetData: 1 entries, total size 0xaa978
> Node '/binman/itb/fit/images/atf/blob-ext': Packing: offset=None,
> size=None, content_size=9159
> Node '/binman/itb/fit/images/atf/blob-ext':    - packed: offset=0x0,
> size=0x9159, content_size=0x9159, next_offset=9159
> Node '/binman/itb/fit/images/atf/blob-ext': GetData: size 0x9159
> Node '/binman/itb/fit/images/atf': GetPaddedDataForEntry: size None
> Node '/binman/itb/fit/images/atf': GetData: 1 entries, total size 0x9159
>             Node '/binman/itb': GetPaddedDataForEntry: size None
> Node '/binman/itb/fit/images/atf': Packing: offset=None, size=0x9159,
> content_size=9159
> Node '/binman/itb/fit/images/atf':    - packed: offset=0x0,
> size=0x9159, content_size=0x9159, next_offset=9159
> Node '/binman/itb/fit/images/atf/blob-ext': GetData: size 0x9159
> Node '/binman/itb/fit/images/atf': GetPaddedDataForEntry: size 0x9159
> Node '/binman/itb/fit/images/atf': GetData: 1 entries, total size 0x9159
>         Node '/binman/itb/fit': Packing: offset=None, size=None,
> content_size=e5f64
>         Node '/binman/itb/fit':    - packed: offset=0x0, size=0xe5f64,
> content_size=0xe5f64, next_offset=e5f64
>         Node '/binman/itb/fit': GetData: size 0xe5f64
>             Node '/binman/itb': GetPaddedDataForEntry: size None
>             Node '/binman/itb': GetData: 1 entries, total size 0xe5f64
>             Node '/binman/itb': GetPaddedDataForEntry: size 0xe5f64
>             Node '/binman/itb': Packing: offset=None, size=0xe5f64,
> content_size=e5f64
>             Node '/binman/itb':    - packed: offset=0x0, size=0xe5f64,
> content_size=0xe5f64, next_offset=e5f64
> File ./u-boot.dtb.out: Update node '/binman/itb' prop 'offset' to 0x0
> File ./u-boot.dtb.out: Update node '/binman/itb' prop 'size' to 0xe5f64
> File ./u-boot.dtb.out: Update node '/binman/itb' prop 'image-pos' to 0x0
> File ./u-boot.dtb.out: Update node '/binman/itb/fit' prop 'offset' to 0x0
> File ./u-boot.dtb.out: Update node '/binman/itb/fit' prop 'size' to 0xe5f64
> File ./u-boot.dtb.out: Update node '/binman/itb/fit' prop 'image-pos' to 0x0
> Pack completed after 1 pass(es)
>
> Regards,

Regards,
SImon


More information about the U-Boot mailing list