U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@cherry.de>
To: Simon Glass <sjg@chromium.org>
Cc: Jonas Karlman <jonas@kwiboo.se>,
	Kever Yang <kever.yang@rock-chips.com>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Tom Rini <trini@konsulko.com>, FUKAUMI Naoki <naoki@radxa.com>,
	u-boot@lists.denx.de
Subject: Re: [PATCH v4 08/10] rockchip: binman: Use the skip-at-start prop in simple-bin image
Date: Mon, 14 Apr 2025 17:09:53 +0200	[thread overview]
Message-ID: <fbd407cb-e0dd-4055-91d1-0b57b45a180e@cherry.de> (raw)
In-Reply-To: <CAFLszTh0et26pngJK1e6JjeLHaNsm7XDhZn3kfZZc7LBeAt-iw@mail.gmail.com>

Hi Simon,

On 4/9/25 4:30 PM, Simon Glass wrote:
> Hi Quentin,
> 
> On Wed, 9 Apr 2025 at 07:35, Quentin Schulz <quentin.schulz@cherry.de> wrote:
>>
>> Hi Simon,
>>
>> On 4/9/25 3:33 PM, Simon Glass wrote:
>>> Hi Quentin,
>>>
>>> On Wed, 9 Apr 2025 at 07:32, Quentin Schulz <quentin.schulz@cherry.de> wrote:
>>>>
>>>> Hi Simon,
>>>>
>>>> On 4/9/25 3:22 PM, Simon Glass wrote:
>>>>> Hi Quentin,
>>>>>
>>>>> On Wed, 9 Apr 2025 at 04:57, Quentin Schulz <quentin.schulz@cherry.de> wrote:
>>>>>>
>>>>>> Hi Jonas, Simon,
>>>>>>
>>>>>> On 3/29/25 4:06 PM, Jonas Karlman wrote:
>>>>>>> From: Simon Glass <sjg@chromium.org>
>>>>>>>
>>>>>>> The simple-bin image is normally written to MMC media at block 64, which
>>>>>>> is a 32K offset from start of storage media.
>>>>>>>
>>>>>>> Set the skip-at-start property to 0x8000 (32 KiB) so that fdtmap and
>>>>>>> other embedded binman symbols in the output binary is referencing image
>>>>>>> offsets correctly.
>>>>>>>
>>>>>>
>>>>>> Shouldn't we have this commit BEFORE we add the `fdtmap` node since we
>>>>>> know it's wrong before this commit?
>>>>>>
>>>>>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>>>>>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>>>>>>> ---
>>>>>>> Changes in v4:
>>>>>>> - Drop defconfig changes
>>>>>>> - Split from "VBE serial part H: Implement VBE on Rockchip RK3399"
>>>>>>>
>>>>>>> Changes in v2:
>>>>>>> - Move this patch to the end of the series
>>>>>>> - Drop 0x8000 offset for SPI
>>>>>>> ---
>>>>>>>      arch/arm/dts/rockchip-u-boot.dtsi | 3 ++-
>>>>>>>      1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>>>
>>>>>>> diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
>>>>>>> index fb38b7b80c43..65b81bf58626 100644
>>>>>>> --- a/arch/arm/dts/rockchip-u-boot.dtsi
>>>>>>> +++ b/arch/arm/dts/rockchip-u-boot.dtsi
>>>>>>> @@ -154,6 +154,7 @@
>>>>>>>          simple-bin {
>>>>>>>                  filename = "u-boot-rockchip.bin";
>>>>>>>                  pad-byte = <0xff>;
>>>>>>> +             skip-at-start = <0x8000>;
>>>>>>>
>>>>>>>                  mkimage {
>>>>>>>                          filename = "idbloader.img";
>>>>>>> @@ -178,7 +179,7 @@
>>>>>>>      #else
>>>>>>>                  u-boot-img {
>>>>>>>      #endif
>>>>>>> -                     offset = <CONFIG_SPL_PAD_TO>;
>>>>>>> +                     offset = <(CONFIG_SPL_PAD_TO + 0x8000)>;
>>>>>>
>>>>>> This is confusing. The documentation states:
>>>>>>
>>>>>> """
>>>>>> offset:
>>>>>>         This sets the offset of an entry within the image or section containing
>>>>>>         it.
>>>>>> """
>>>>>>
>>>>>> My understanding is that it should be relative to the beginning of the
>>>>>> image but this now needs the knowledge of where it will be stored on the
>>>>>> MMC device (via the value in skip-at-start).
>>>>>>
>>>>>> Why is skip-at-start automatically deducted from offset?
>>>>>
>>>>> This is how binman works[1]. We are trying to use the feature designs
>>>>
>>>> Why is it deducted?
>>>
>>> Are you asking why skip-at-start is deducted from the offset?
>>>
>>
>> Yes
> 
> It is confusing, unfortunately.
> 
> When you use an offset (say 0x78000) then normally the entry will
> start at that offset in the image.
> 
> When you use skip-at-start 0x8000, its value is added to all top-level
> offsets in the image, so the offset becomes 0x80000
> 
> BUT the image built by binman does not contain the first 0x8000 bytes.
> It is expected that the image is written to offset 0x8000 so that the
> offsets will be correct when used within U-Boot itself.
> 

I would assume all offsets are relative to the beginning of the image in 
the binary? Adding skip-at-start doesn't add 0x8000 bytes at the 
beginning of the binary file, so why would the offsets need to be modified?

Also, while 0x8000 is the typical address the image can be flashed, it 
is not necessarily where it will be as the BootROM tries a few other 
offsets if it cannot find one at 32KiB offset in the storage medium. 
This seems to me to be a case of "somewhat helps in one case, but makes 
things more confusing in others"? Will we need different offsets 
depending on where the FIT is flashed? What happens for A/B updates then?

I understand that we currently essentially have skip-at-start = 0; and 
that it is bad because it doesn't reflect the actual address, but how is 
that worse than hardcoding a different offset?

Cheers,
Quentin

  reply	other threads:[~2025-04-14 15:10 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-29 15:06 [PATCH v4 00/10] rockchip: binman: Use a template for FIT and other improvements Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 01/10] rockchip: binman: Correct the OS prop for U-Boot Jonas Karlman
2025-04-06 15:17   ` Kever Yang
2025-04-09  9:15   ` Quentin Schulz
2025-04-09 11:35     ` Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 02/10] rockchip: binman: Factor out arch and compression Jonas Karlman
2025-04-06 15:18   ` Kever Yang
2025-04-09  9:28   ` Quentin Schulz
2025-04-09 11:56     ` Jonas Karlman
2025-04-09 12:27       ` Quentin Schulz
2025-04-09 15:52         ` Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 03/10] rockchip: binman: Add an fdtmap Jonas Karlman
2025-04-06 15:18   ` Kever Yang
2025-04-09  9:32   ` Quentin Schulz
2025-03-29 15:06 ` [PATCH v4 04/10] rockchip: binman: Create a template for the FIT Jonas Karlman
2025-04-06 15:32   ` Kever Yang
2025-04-09  9:39   ` Quentin Schulz
2025-04-09 11:58     ` Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 05/10] rockchip: binman: Un-indent the FIT template Jonas Karlman
2025-04-06 15:33   ` Kever Yang
2025-04-09  9:41   ` Quentin Schulz
2025-03-29 15:06 ` [PATCH v4 06/10] rockchip: binman: Use the FIT template in the SPI image Jonas Karlman
2025-04-06 15:33   ` Kever Yang
2025-04-09  9:42   ` Quentin Schulz
2025-03-29 15:06 ` [PATCH v4 07/10] rockchip: binman: Include a compatible string in each configuration Jonas Karlman
2025-04-06 15:33   ` Kever Yang
2025-04-09 10:02   ` Quentin Schulz
2025-04-09 13:23     ` Simon Glass
2025-04-09 15:05     ` Jonas Karlman
2025-04-09 15:26       ` Quentin Schulz
2025-03-29 15:06 ` [PATCH v4 08/10] rockchip: binman: Use the skip-at-start prop in simple-bin image Jonas Karlman
2025-04-06 15:33   ` Kever Yang
2025-04-09 10:57   ` Quentin Schulz
2025-04-09 13:22     ` Simon Glass
2025-04-09 13:32       ` Quentin Schulz
2025-04-09 13:33         ` Simon Glass
2025-04-09 13:35           ` Quentin Schulz
2025-04-09 14:30             ` Simon Glass
2025-04-14 15:09               ` Quentin Schulz [this message]
2025-04-17 21:35                 ` Simon Glass
2025-04-09 15:17     ` Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 09/10] rockchip: binman: Support use of crc32 for SPL_FIT_SIGNATURE Jonas Karlman
2025-04-06 15:34   ` Kever Yang
2025-04-09 11:06   ` Quentin Schulz
2025-04-09 15:38     ` Jonas Karlman
2025-04-09 16:11       ` Quentin Schulz
2025-04-09 16:35         ` Simon Glass
2025-04-09 17:02           ` Quentin Schulz
2025-04-09 17:26         ` Jonas Karlman
2025-03-29 15:06 ` [PATCH v4 10/10] rockchip: Add SPL_PAD_TO Kconfig default value Jonas Karlman
2025-04-06 15:34   ` Kever Yang
2025-04-09 11:14   ` Quentin Schulz

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=fbd407cb-e0dd-4055-91d1-0b57b45a180e@cherry.de \
    --to=quentin.schulz@cherry.de \
    --cc=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --cc=naoki@radxa.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.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