From: Miquel Raynal <miquel.raynal@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v7 05/13] cmd: mtdparts: remove mandatory 'mtdparts=' prefix
Date: Mon, 3 Sep 2018 09:13:31 +0200 [thread overview]
Message-ID: <20180903091331.24927011@xps13> (raw)
In-Reply-To: <1a5afaf5-3860-e9f9-3345-2a7f0ff7d4c0@denx.de>
Hi Stefan,
Stefan Roese <sr@denx.de> wrote on Sat, 1 Sep 2018 10:50:54 +0200:
> On 31.08.2018 16:57, Miquel Raynal wrote:
> > All U-Boot users must define the mtdparts environment variable with:
> > setenv mtdparts mtdparts=...
> > > While this may ease the partition declaration job to be passed to
> > Linux, this is a pure software limitation and forcing this prefix is a
> > complete non-sense. Let the user to declare manually the mtdparts
> > variable without the prefix.
> > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > Acked-by: Jagan Teki <jagan@openedev.com>
> > ---
> > cmd/mtdparts.c | 17 ++++++-----------
> > 1 file changed, 6 insertions(+), 11 deletions(-)
> > > diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
> > index 2e547894c6..f7ed1a0779 100644
> > --- a/cmd/mtdparts.c
> > +++ b/cmd/mtdparts.c
> > @@ -44,7 +44,7 @@
> > *
> > * 'mtdparts' - partition list
> > *
> > - * mtdparts=mtdparts=<mtd-def>[;<mtd-def>...]
> > + * mtdparts=[mtdparts=]<mtd-def>[;<mtd-def>...]
> > *
> > * <mtd-def> := <mtd-id>:<part-def>[,<part-def>...]
> > * <mtd-id> := unique device tag used by linux kernel to find mtd device (mtd->name)
> > @@ -62,11 +62,11 @@
> > *
> > * 1 NOR Flash, with 1 single writable partition:
> > * mtdids=nor0=edb7312-nor
> > - * mtdparts=mtdparts=edb7312-nor:-
> > + * mtdparts=[mtdparts=]edb7312-nor:-
> > *
> > * 1 NOR Flash with 2 partitions, 1 NAND with one
> > * mtdids=nor0=edb7312-nor,nand0=edb7312-nand
> > - * mtdparts=mtdparts=edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home)
> > + * mtdparts=[mtdparts=]edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home)
> > *
> > */
> > > @@ -1099,9 +1099,6 @@ static int generate_mtdparts(char *buf, u32 buflen)
> > return 0;
> > }
> > > - strcpy(p, "mtdparts=");
> > - p += 9;
> > -
> > list_for_each(dentry, &devices) {
> > dev = list_entry(dentry, struct mtd_device, link);
> > > @@ -1572,11 +1569,9 @@ static int parse_mtdparts(const char *const mtdparts)
> > if (!p)
> > p = mtdparts;
> > > - if (strncmp(p, "mtdparts=", 9) != 0) {
> > - printf("mtdparts variable doesn't start with 'mtdparts='\n");
> > - return err;
> > - }
> > - p += 9;
> > + /* Skip the useless prefix, if any */
> > + if (strncmp(p, "mtdparts=", 9) == 0)
> > + p += 9;
> > > while (*p != '\0') {
> > err = 1;
> >
> I always wondered about this double mtdparts thing but was never brave
> enough to touch it. ;)
If I understand correctly, this double mtdparts thing comes from lazy
people who decided to build the bootargs this way:
setenv mtdparts "mtdparts=mtddev0:-(all)"
setenv bootargs "console=/dev/tty0 [...] ${mtdparts}"
instead of this way:
setenv mtdparts "mtddev0:-(all)"
setenv bootargs "console=/dev/tty0 [...] mtdparts=${mtdparts}"
Which, personally, I find much clearer.
I'm still puzzled by the real use of mtdids, I will check this week if
I didn't broke anything in the way U-Boot and Linux share the
MTD devices and their partitions.
Thanks,
Miquèl
next prev parent reply other threads:[~2018-09-03 7:13 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-31 14:57 [U-Boot] [PATCH v7 00/13] Cleaner MTD devices management Miquel Raynal
2018-08-31 14:57 ` [U-Boot] [PATCH v7 01/13] lib: strto: parse all lowercase metric prefixes in ustrtoul[l] Miquel Raynal
2018-09-01 8:43 ` Stefan Roese
2018-09-03 6:47 ` Miquel Raynal
2018-08-31 14:57 ` [U-Boot] [PATCH v7 02/13] lib: strto: fix metric suffix parsing in strtoul[l] Miquel Raynal
2018-09-01 8:48 ` Stefan Roese
2018-09-03 6:49 ` Miquel Raynal
2018-09-03 7:41 ` Stefan
2018-08-31 14:57 ` [U-Boot] [PATCH v7 03/13] mtd: Kconfig: remove MTD_PARTITIONS duplicated symbol Miquel Raynal
2018-09-01 8:48 ` Stefan Roese
2018-08-31 14:57 ` [U-Boot] [PATCH v7 04/13] cmd: mtdparts: accept spi-nand devices Miquel Raynal
2018-09-01 8:49 ` Stefan Roese
2018-08-31 14:57 ` [U-Boot] [PATCH v7 05/13] cmd: mtdparts: remove mandatory 'mtdparts=' prefix Miquel Raynal
2018-09-01 8:50 ` Stefan Roese
2018-09-03 7:13 ` Miquel Raynal [this message]
2018-08-31 14:57 ` [U-Boot] [PATCH v7 06/13] mtd: uclass: add probe function Miquel Raynal
2018-09-01 8:51 ` Stefan Roese
2018-08-31 14:57 ` [U-Boot] [PATCH v7 07/13] mtd: uclass: add a generic 'mtdparts' parser Miquel Raynal
2018-09-01 8:52 ` Stefan Roese
2018-08-31 14:57 ` [U-Boot] [PATCH v7 08/13] mtd: uclass: search for an equivalent MTD name with the mtdids Miquel Raynal
2018-09-01 8:54 ` Stefan Roese
2018-08-31 14:57 ` [U-Boot] [PATCH v7 09/13] mtd: mtdpart: implement proper partition handling Miquel Raynal
2018-09-01 8:56 ` Stefan Roese
2018-08-31 14:57 ` [U-Boot] [PATCH v7 10/13] cmd: mtd: add 'mtd' command Miquel Raynal
2018-09-01 8:59 ` Stefan Roese
2018-09-03 6:54 ` Miquel Raynal
2018-09-03 7:43 ` Stefan
2018-09-03 8:04 ` Jagan Teki
2018-09-03 8:27 ` Miquel Raynal
2018-08-31 14:57 ` [U-Boot] [PATCH v7 11/13] cmd: mtdparts: try to probe the MTD devices as a fallback Miquel Raynal
2018-09-01 9:02 ` Stefan Roese
2018-09-03 7:02 ` Miquel Raynal
2018-08-31 14:57 ` [U-Boot] [PATCH v7 12/13] cmd: ubi: clean the partition handling Miquel Raynal
2018-09-01 9:03 ` Stefan Roese
2018-08-31 14:57 ` [U-Boot] [PATCH v7 13/13] cmd: mtdparts: describe as legacy Miquel Raynal
2018-09-01 9:04 ` 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=20180903091331.24927011@xps13 \
--to=miquel.raynal@bootlin.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