public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Federico Fuga <fuga@studiofuga.com>,
	Tom Rini <trini@konsulko.com>,
	Federico Fuga <fuga@studiofuga.com>,
	Maxime Ripard <maxime@cerno.tech>,
	u-boot@lists.denx.de
Subject: Re: [PATCH] Fix fastboot handling of partitions when no slots are, supported
Date: Tue, 28 Jan 2025 09:44:28 +0100	[thread overview]
Message-ID: <874j1js4yb.fsf@baylibre.com> (raw)
In-Reply-To: <a70b19e6-4436-4fcf-bebd-b6877b66779e@studiofuga.com>

Hi Federico,

Thank you for the patch.

On ven., janv. 24, 2025 at 11:49, Federico Fuga <fuga@studiofuga.com> wrote:

> The fastboot module has a bug that prevents some command to work
> properly on devices that haven't an Android-like partition scheme, that
> is, just one spl and one kernel partition, instead of the redundant
> scheme with _a and _b slots.
>
> This is the schema of our NAND storage (board is based on an AllWinner
> A33 sunxi chip):
>
> => mtdparts
>
> device nand0 <1c03000.nand>, # parts = 4
>   #: name         size            net size        offset mask_flags
>   0: spl          0x00020000      0x00020000      0x00000000      0
>   1: uboot        0x00100000      0x00100000      0x00020000      0
>   2: kernel       0x00400000      0x00400000      0x00120000      0
>   3: ubi          0x07ae0000      0x079e0000 (!)  0x00520000      0
>
> active partition: nand0,0 - (spl) 0x00020000 @ 0x00000000
>
> This happens when we try to erase the spl partition using fastboot:
>
> $ fastboot erase spl
> Erasing 'spl_a'               FAILED (remote: 'invalid NAND device')
> fastboot: error: Command failed
>
> The error occurs because getvars fails to handle the error returned by
> nand layer when a partition cannot be found.
>
> Indeed, getvar_get_part_info returns what is returned by
> fastboot_nand_get_part_info (0 on success, 1 on failure) but it should
> return -ENODEV or -EINVAL instead. Since the cause of failure is not
> returned by the nand function, I decided to return -EINVAL to make it
> simple.
>
> Signed-off-by: Federico Fuga <fuga@studiofuga.com>

Unfortunately, I'm unable to apply this. I've tried using b4 and via git am.

$ b4 shazam -s -l --check a70b19e6-4436-4fcf-bebd-b6877b66779e@studiofuga.com

Grabbing thread from lore.kernel.org/all/a70b19e6-4436-4fcf-bebd-b6877b66779e@studiofuga.com/t.mbox.gz
Checking for newer revisions
Grabbing search results from lore.kernel.org
Analyzing 2 messages in the thread
Assuming new revision: v2 ([PATCH] Fix fastboot handling of partitions when no slots are, supported)
Analyzing 0 code-review messages
Will use the latest revision: v2
You can pick other revisions using the -vN flag
Checking attestation on all messages, may take a moment...
---
  [PATCH] Fix fastboot handling of partitions when no slots are, supported
    + Link: https://lore.kernel.org/r/add4f6ac-3dd5-4707-a40c-a41191e62912@studiofuga.com
    + Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Traceback (most recent call last):
  File "/mnt/work/upstream/b4/src/b4/command.py", line 435, in <module>
    cmd()
    ~~~^^
  File "/mnt/work/upstream/b4/src/b4/command.py", line 417, in cmd
    cmdargs.func(cmdargs)


Downloading the thread from this patchwork link (clicking on "mbox"):
https://patchwork.ozlabs.org/project/uboot/patch/a70b19e6-4436-4fcf-bebd-b6877b66779e@studiofuga.com/

$ git am Fix-fastboot-handling-of-partitions-when-no-slots-are-supported.patch
Applying: Fix fastboot handling of partitions when no slots are, supported
error: corrupt patch at line 13
error: could not build fake ancestor
Patch failed at 0001 Fix fastboot handling of partitions when no slots are, supported
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"

Can you please confirm that you are able to apply it yourself?
Maybe the email client is misconfigured somehow?

I've also tried to apply the one that has been send yesterday
(https://patchwork.ozlabs.org/project/uboot/patch/add4f6ac-3dd5-4707-a40c-a41191e62912@studiofuga.com/)
but I'm encountering the same problem.

> ---
>   drivers/fastboot/fb_getvar.c | 5 ++++-
>   drivers/fastboot/fb_nand.c   | 2 +-
>   2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
> index 93cbd598e0..f5d8b03301 100644
> --- a/drivers/fastboot/fb_getvar.c
> +++ b/drivers/fastboot/fb_getvar.c
> @@ -121,8 +121,11 @@ static int getvar_get_part_info(const char 
> *part_name, char *response,
>               *size = disk_part.size * disk_part.blksz;
>       } else if (IS_ENABLED(CONFIG_FASTBOOT_FLASH_NAND)) {
>           r = fastboot_nand_get_part_info(part_name, &part_info, response);
> -        if (r >= 0 && size)
> +        if (r == 0 && size) {
>               *size = part_info->size;
> +        } else {
> +            r = -EINVAL;
> +        }
>       } else {
>           fastboot_fail("this storage is not supported in bootloader", 
> response);
>           r = -ENODEV;
> diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
> index 5a55144479..3ee0f40ea8 100644
> --- a/drivers/fastboot/fb_nand.c
> +++ b/drivers/fastboot/fb_nand.c
> @@ -141,7 +141,7 @@ static lbaint_t fb_nand_sparse_reserve(struct 
> sparse_storage *info,
>    *
>    * @part_name: Named device to lookup
>    * @part_info: Pointer to returned part_info pointer
> - * @response: Pointer to fastboot response buffer
> + * @response: 0 on success, 1 otherwise
>    */
>   int fastboot_nand_get_part_info(const char *part_name,
>                   struct part_info **part_info, char *response)
> -- 
> 2.48.1

  parent reply	other threads:[~2025-01-28  8:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24 10:49 [PATCH] Fix fastboot handling of partitions when no slots are, supported Federico Fuga
2025-01-27  9:39 ` Federico Fuga
2025-01-28  8:44 ` Mattijs Korpershoek [this message]
2025-01-28  9:07   ` Federico Fuga
  -- strict thread matches above, loose matches on Subject: below --
2025-01-28  9:09 [PATCH] Fix fastboot handling of partitions when no slots are supported Federico Fuga
2025-01-28 11:18 Federico Fuga via B4 Relay
2025-01-30 13:49 ` Mattijs Korpershoek
2025-01-30 15:03   ` Federico Fuga
2025-01-31  7:26     ` Mattijs Korpershoek

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=874j1js4yb.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=fuga@studiofuga.com \
    --cc=maxime@cerno.tech \
    --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