All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Pierre Bourdon <delroth@gmail.com>
Cc: "Marek Behún" <kabel@kernel.org>, "Stefan Roese" <sr@denx.de>,
	u-boot@lists.denx.de, "Marek Behún" <marek.behun@nic.cz>
Subject: Re: [PATCH u-boot-marvell 09/11] tools: kwbimage: Fill the real header size into the main header
Date: Sat, 25 Dec 2021 18:57:10 +0100	[thread overview]
Message-ID: <20211225175710.vtr35zodwypfgp2u@pali> (raw)
In-Reply-To: <CA+V6dmj6O-iXbBPVCM-1BYih3pHzMqCOwjF023CbR5cd=u+dYQ@mail.gmail.com>

On Saturday 25 December 2021 18:48:22 Pierre Bourdon wrote:
> Hi Marek, Pali,
> 
> On Mon, Nov 8, 2021 at 6:14 PM Marek Behún <kabel@kernel.org> wrote:
> > Fill the real header size without padding into the main header
> >
> > This allows to reduce final image when converting image to another format
> > which does not need additional padding.
> >
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > Signed-off-by: Marek Behún <marek.behun@nic.cz>
> 
> This patch seems to cause mkimage to generate v1 images with invalid
> checksums (which fail to verify with kwboot or mkimage -l). Could you
> double check whether you can reproduce on the latest u-boot master?

Hello! I'm using this patch for more than month and I have not seen any
boot issue related to this patch A385 board.

> I don't really understand how this patch is supposed to work
> (headersz_lsb/headersz_msb get updated *after* csum8 has already been
> computed!).

Ou. Now I see, this is of course wrong in this patch! Checksum in
main_hdr->checksum must be filled *after* updating main_hdr->headersz_*
fields.

Just moving "main_hdr->checksum = image_checksum8(main_hdr, headersz);"
after the "main_hdr->headersz_msb = (headersz & 0xFFFF0000) >> 16;"
should be enough. Are you going to prepare a fixup for master branch?

I'm not sure how it could happen... but probably "real header size" is
the same as it was before and therefore checksum did not change.

> $ tools/mkimage -n ./board/qnap/qsw-98dx3236/kwbimage.cfg -T kwbimage
> -a 0x00800000 -e 0x00800000 -d u-boot.bin u-boot.kwb
> Image Type:   MVEBU Boot from nand Image
> Image version:1
> BIN Hdr Size: 76224 Bytes = 74.44 KiB = 0.07 MiB
> Data Size:    735764 Bytes = 718.52 KiB = 0.70 MiB
> Load Address: 00800000
> Entry Point:  00800000
> 
> $ sudo tools/kwboot -a -b u-boot.kwb -t -B 115200 /dev/ttyUSB0
> kwboot version 2022.01-rc4-00075-g3bd6c62cf4-dirty
> u-boot.kwb: Invalid image.
> 
> (The specific kwbimage.cfg/board is still a WIP, I can try to provide
> some more repro if somehow there is something specific to my setup,
> but I doubt it.)
> 
> Best,
> 
> -- 
> Pierre Bourdon <delroth@gmail.com>
> Software Engineer @ Zürich, Switzerland
> https://delroth.net/

  reply	other threads:[~2021-12-25 17:57 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 17:12 [PATCH u-boot-marvell 00/11] Another kwbimage series Marek Behún
2021-11-08 17:12 ` [PATCH u-boot-marvell 01/11] tools: kwbimage: Add support for new commands UART_PORT and UART_MPP Marek Behún
2021-11-10  8:23   ` Stefan Roese
2021-11-08 17:12 ` [PATCH u-boot-marvell 02/11] tools: kwbimage: Explicitly set version also for kwbimage v0 Marek Behún
2021-11-10  8:23   ` Stefan Roese
2021-11-08 17:12 ` [PATCH u-boot-marvell 03/11] tools: kwbimage: Set BOOT_FROM by default to SPI Marek Behún
2021-11-10  8:23   ` Stefan Roese
2021-11-08 17:12 ` [PATCH u-boot-marvell 04/11] tools: kwbimage: Fix validation of kwbimage v0 Marek Behún
2021-11-10  8:24   ` Stefan Roese
2021-11-08 17:12 ` [PATCH u-boot-marvell 05/11] tools: kwbimage: Remove unused enums and prototypes Marek Behún
2021-11-10  8:25   ` Stefan Roese
2021-11-08 17:12 ` [PATCH u-boot-marvell 06/11] tools: kwbimage: Align final UART image to 128 bytes Marek Behún
2021-11-10  8:28   ` Stefan Roese
2021-11-08 17:12 ` [PATCH u-boot-marvell 07/11] tools: kwbimage: Do not put final image padding to the image data size Marek Behún
2021-11-10  8:28   ` Stefan Roese
2021-11-08 17:12 ` [PATCH u-boot-marvell 08/11] tools: kwbimage: Align kwbimage header to proper size Marek Behún
2021-11-10  8:28   ` Stefan Roese
2021-11-08 17:12 ` [PATCH u-boot-marvell 09/11] tools: kwbimage: Fill the real header size into the main header Marek Behún
2021-11-10  8:29   ` Stefan Roese
2021-12-25 17:48   ` Pierre Bourdon
2021-12-25 17:57     ` Pali Rohár [this message]
2021-12-25 18:06       ` Pierre Bourdon
2021-12-25 18:10         ` Pali Rohár
2021-12-25 18:18           ` Pierre Bourdon
2021-12-25 19:11             ` Pali Rohár
2021-12-25 19:48               ` Pierre Bourdon
2021-12-25 20:01                 ` Pali Rohár
2021-12-25 20:15                   ` Pierre Bourdon
2021-12-25 20:42                     ` Pali Rohár
2021-11-08 17:12 ` [PATCH u-boot-marvell 10/11] tools: kwbimage: Properly calculate and align kwbimage v0 header size Marek Behún
2021-11-10  8:30   ` Stefan Roese
2021-11-08 17:12 ` [PATCH u-boot-marvell 11/11] tools: kwbimage: Properly set srcaddr in kwbimage v0 Marek Behún
2021-11-10  8:30   ` Stefan Roese
2021-11-10  5:41 ` [PATCH u-boot-marvell 00/11] Another kwbimage series Stefan Roese
2021-11-10  8:19   ` Pali Rohár
2021-11-10 13:52 ` Stefan Roese

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=20211225175710.vtr35zodwypfgp2u@pali \
    --to=pali@kernel.org \
    --cc=delroth@gmail.com \
    --cc=kabel@kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=sr@denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.