From: Rasmus Villemoes <ravi@prevas.dk>
To: Quentin Schulz <quentin.schulz@cherry.de>
Cc: <u-boot@lists.denx.de>, Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH v2 2/2] cmd/part.c: implement "part name" subcommand
Date: Mon, 03 Nov 2025 21:38:14 +0100 [thread overview]
Message-ID: <87tszadf7t.fsf@prevas.dk> (raw)
In-Reply-To: <fc2149cf-97ee-4ac4-ada3-c4797607a5ec@cherry.de> (Quentin Schulz's message of "Mon, 3 Nov 2025 15:14:10 +0100")
On Mon, Nov 03 2025, Quentin Schulz <quentin.schulz@cherry.de> wrote:
> Hi Rasmus,
>
> On 10/20/25 2:11 PM, Rasmus Villemoes wrote:
>> This is a natural buddy to the existing "part number", allowing one to
>> get the partition name for a given partition number.
>>
>
> Acked-by: Quentin Schuloz <quentin.schulz@cherry.de>
>
Thanks.
>
> Reading the code, it seems the part command tries to auto-detect the
> base of the part number as passed by the user, which isn't that usual
> I believe in U-Boot (usually either forced hex or dec?), so maybe it's
> worth mentioning in the docs.
Fun story: I started doing this because I have a legacy stand-alone app
which is involved in the bootflow, and it communicates the partition to
load the kernel from by setting an env variable via
sprintf(buf, "%d", kernel_part);
env_set("kernel_part", buf);
and on the U-Boot side, that $kernel_part is/was used with various "read
mmc ..." or "mmc read ..." commands. Guess how well that works when
kernel_part ends up being >= 10 and the U-Boot commands unconditionally
interprets the partition argument as hex...
So what I wanted to do on the U-Boot side is to translate that
$kernel_part into a name ASAP and then use that name exclusively, and
for that the sane semantics of the "part" command came in handy. Except
it lacked the ability to do the translation.
As for the "[not] that usual", `git grep strto -- cmd/` says that the
base argument can be 0, 10 or 16 depending on the phase of the moon -
it's a constant source of pain to figure out how numeric arguments
to commands will be interpreted.
Rasmus
next prev parent reply other threads:[~2025-11-03 20:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 12:10 [PATCH v2 0/2] 'part name' subcommand and some robustification Rasmus Villemoes
2025-10-20 12:10 ` [PATCH v2 1/2] disk/part.c: ensure strings in struct disk_partition are valid after successful get_info Rasmus Villemoes
2025-11-03 14:07 ` Quentin Schulz
2025-10-20 12:11 ` [PATCH v2 2/2] cmd/part.c: implement "part name" subcommand Rasmus Villemoes
2025-11-03 14:14 ` Quentin Schulz
2025-11-03 20:38 ` Rasmus Villemoes [this message]
2025-11-04 9:36 ` Quentin Schulz
2025-11-07 20:19 ` [PATCH v2 0/2] 'part name' subcommand and some robustification Tom Rini
2025-11-08 0:02 ` Rasmus Villemoes
2025-11-08 15:01 ` Tom Rini
2025-11-10 0:33 ` Rasmus Villemoes
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=87tszadf7t.fsf@prevas.dk \
--to=ravi@prevas.dk \
--cc=quentin.schulz@cherry.de \
--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