diff mbox

[U-Boot,v5,5/16] cmd: Add Kconfig option for CMD_MTDPARTS and related options

Message ID 1bdf2d72d782d9ee61d8f5564b7018b6b8a2817b.1488215509.git-series.maxime.ripard@free-electrons.com
State Accepted
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Maxime Ripard Feb. 27, 2017, 5:22 p.m. UTC
CMD_MTDPARTS is something the user might or might not want to select, and
might depends on (or be selected by) other options too.

This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT options that
might change from one board to another, or from one user to the other,
depending on what it expects and what storage devices are available.

In order to ease that configuration, add those options to Kconfig.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
 cmd/Kconfig    | 20 ++++++++++++++++++++
 cmd/mtdparts.c |  8 ++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

Comments

Jörg Krause May 30, 2017, 7:39 a.m. UTC | #1
Hi Maxime,

On Mon, 2017-02-27 at 18:22 +0100, Maxime Ripard wrote:
> CMD_MTDPARTS is something the user might or might not want to select,
> and
> might depends on (or be selected by) other options too.
> 
> This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT
> options that
> might change from one board to another, or from one user to the
> other,
> depending on what it expects and what storage devices are available.
> 
> In order to ease that configuration, add those options to Kconfig.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> ---
>  cmd/Kconfig    | 20 ++++++++++++++++++++
>  cmd/mtdparts.c |  8 ++++++++
>  2 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index ef5315631476..0734d669dbd7 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -801,6 +801,26 @@ config CMD_FS_GENERIC
>  	help
>  	  Enables filesystem commands (e.g. load, ls) that work for
> multiple
>  	  fs types.
> +
> +config CMD_MTDPARTS
> +	depends on ARCH_SUNXI

Is there any reason to limit the command for the sunxi arch only?

Best regards
Jörg Krause
Maxime Ripard May 30, 2017, 9:09 p.m. UTC | #2
Hi Jörg,

On Tue, May 30, 2017 at 09:39:57AM +0200, Jörg Krause wrote:
> On Mon, 2017-02-27 at 18:22 +0100, Maxime Ripard wrote:
> > CMD_MTDPARTS is something the user might or might not want to select,
> > and
> > might depends on (or be selected by) other options too.
> > 
> > This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT
> > options that
> > might change from one board to another, or from one user to the
> > other,
> > depending on what it expects and what storage devices are available.
> > 
> > In order to ease that configuration, add those options to Kconfig.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > Reviewed-by: Tom Rini <trini@konsulko.com>
> > ---
> >  cmd/Kconfig    | 20 ++++++++++++++++++++
> >  cmd/mtdparts.c |  8 ++++++++
> >  2 files changed, 28 insertions(+), 0 deletions(-)
> > 
> > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > index ef5315631476..0734d669dbd7 100644
> > --- a/cmd/Kconfig
> > +++ b/cmd/Kconfig
> > @@ -801,6 +801,26 @@ config CMD_FS_GENERIC
> >  	help
> >  	  Enables filesystem commands (e.g. load, ls) that work for
> > multiple
> >  	  fs types.
> > +
> > +config CMD_MTDPARTS
> > +	depends on ARCH_SUNXI
> 
> Is there any reason to limit the command for the sunxi arch only?

Yes, if we don't, this will generate warnings for each architecture
that has not moved that option from their header to Kconfig.

Maxime
Jörg Krause May 31, 2017, 6:27 a.m. UTC | #3
Hi Maxime,

On Tue, 2017-05-30 at 23:09 +0200, Maxime Ripard wrote:
> Hi Jörg,
> 
> On Tue, May 30, 2017 at 09:39:57AM +0200, Jörg Krause wrote:
> > On Mon, 2017-02-27 at 18:22 +0100, Maxime Ripard wrote:
> > > CMD_MTDPARTS is something the user might or might not want to
> > > select,
> > > and
> > > might depends on (or be selected by) other options too.
> > > 
> > > This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT
> > > options that
> > > might change from one board to another, or from one user to the
> > > other,
> > > depending on what it expects and what storage devices are
> > > available.
> > > 
> > > In order to ease that configuration, add those options to
> > > Kconfig.
> > > 
> > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > > Reviewed-by: Tom Rini <trini@konsulko.com>
> > > ---
> > >  cmd/Kconfig    | 20 ++++++++++++++++++++
> > >  cmd/mtdparts.c |  8 ++++++++
> > >  2 files changed, 28 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > > index ef5315631476..0734d669dbd7 100644
> > > --- a/cmd/Kconfig
> > > +++ b/cmd/Kconfig
> > > @@ -801,6 +801,26 @@ config CMD_FS_GENERIC
> > >  	help
> > >  	  Enables filesystem commands (e.g. load, ls) that work
> > > for
> > > multiple
> > >  	  fs types.
> > > +
> > > +config CMD_MTDPARTS
> > > +	depends on ARCH_SUNXI
> > 
> > Is there any reason to limit the command for the sunxi arch only?
> 
> Yes, if we don't, this will generate warnings for each architecture
> that has not moved that option from their header to Kconfig.

I see! However, wouldn't it be best to migrate all architectures to
Kconfig instead of doing it seperately?

Jörg
Maxime Ripard May 31, 2017, 7:47 p.m. UTC | #4
On Wed, May 31, 2017 at 08:27:33AM +0200, Jörg Krause wrote:
> Hi Maxime,
> 
> On Tue, 2017-05-30 at 23:09 +0200, Maxime Ripard wrote:
> > Hi Jörg,
> > 
> > On Tue, May 30, 2017 at 09:39:57AM +0200, Jörg Krause wrote:
> > > On Mon, 2017-02-27 at 18:22 +0100, Maxime Ripard wrote:
> > > > CMD_MTDPARTS is something the user might or might not want to
> > > > select,
> > > > and
> > > > might depends on (or be selected by) other options too.
> > > > 
> > > > This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT
> > > > options that
> > > > might change from one board to another, or from one user to the
> > > > other,
> > > > depending on what it expects and what storage devices are
> > > > available.
> > > > 
> > > > In order to ease that configuration, add those options to
> > > > Kconfig.
> > > > 
> > > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > > > Reviewed-by: Tom Rini <trini@konsulko.com>
> > > > ---
> > > >  cmd/Kconfig    | 20 ++++++++++++++++++++
> > > >  cmd/mtdparts.c |  8 ++++++++
> > > >  2 files changed, 28 insertions(+), 0 deletions(-)
> > > > 
> > > > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > > > index ef5315631476..0734d669dbd7 100644
> > > > --- a/cmd/Kconfig
> > > > +++ b/cmd/Kconfig
> > > > @@ -801,6 +801,26 @@ config CMD_FS_GENERIC
> > > >  	help
> > > >  	  Enables filesystem commands (e.g. load, ls) that work
> > > > for
> > > > multiple
> > > >  	  fs types.
> > > > +
> > > > +config CMD_MTDPARTS
> > > > +	depends on ARCH_SUNXI
> > > 
> > > Is there any reason to limit the command for the sunxi arch only?
> > 
> > Yes, if we don't, this will generate warnings for each architecture
> > that has not moved that option from their header to Kconfig.
> 
> I see! However, wouldn't it be best to migrate all architectures to
> Kconfig instead of doing it seperately?

Probably, but there was a quite significant number of Kconfig symbols
introduced, used by a very significant number of boards and
architectures.

This was really to unreasonable to do at the time, but we can
definitely do that now.

Maxime
Jörg Krause June 1, 2017, 5:53 a.m. UTC | #5
Hi Maxime,

On Wed, 2017-05-31 at 21:47 +0200, Maxime Ripard wrote:
> On Wed, May 31, 2017 at 08:27:33AM +0200, Jörg Krause wrote:
> > Hi Maxime,
> > 
> > On Tue, 2017-05-30 at 23:09 +0200, Maxime Ripard wrote:
> > > Hi Jörg,
> > > 
> > > On Tue, May 30, 2017 at 09:39:57AM +0200, Jörg Krause wrote:
> > > > On Mon, 2017-02-27 at 18:22 +0100, Maxime Ripard wrote:
> > > > > CMD_MTDPARTS is something the user might or might not want to
> > > > > select,
> > > > > and
> > > > > might depends on (or be selected by) other options too.
> > > > > 
> > > > > This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT
> > > > > options that
> > > > > might change from one board to another, or from one user to the
> > > > > other,
> > > > > depending on what it expects and what storage devices are
> > > > > available.
> > > > > 
> > > > > In order to ease that configuration, add those options to
> > > > > Kconfig.
> > > > > 
> > > > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > > > > Reviewed-by: Tom Rini <trini@konsulko.com>
> > > > > ---
> > > > >  cmd/Kconfig    | 20 ++++++++++++++++++++
> > > > >  cmd/mtdparts.c |  8 ++++++++
> > > > >  2 files changed, 28 insertions(+), 0 deletions(-)
> > > > > 
> > > > > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > > > > index ef5315631476..0734d669dbd7 100644
> > > > > --- a/cmd/Kconfig
> > > > > +++ b/cmd/Kconfig
> > > > > @@ -801,6 +801,26 @@ config CMD_FS_GENERIC
> > > > >  	help
> > > > >  	  Enables filesystem commands (e.g. load, ls) that work
> > > > > for
> > > > > multiple
> > > > >  	  fs types.
> > > > > +
> > > > > +config CMD_MTDPARTS
> > > > > +	depends on ARCH_SUNXI
> > > > 
> > > > Is there any reason to limit the command for the sunxi arch only?
> > > 
> > > Yes, if we don't, this will generate warnings for each architecture
> > > that has not moved that option from their header to Kconfig.
> > 
> > I see! However, wouldn't it be best to migrate all architectures to
> > Kconfig instead of doing it seperately?
> 
> Probably, but there was a quite significant number of Kconfig symbols
> introduced, used by a very significant number of boards and
> architectures.

I see!

> This was really to unreasonable to do at the time, but we can
> definitely do that now.

That would be great! Many thanks!

Jörg
Jörg Krause June 1, 2017, 5:57 a.m. UTC | #6
Hi Maxime,

On Wed, 2017-05-31 at 21:47 +0200, Maxime Ripard wrote:
> On Wed, May 31, 2017 at 08:27:33AM +0200, Jörg Krause wrote:
> > Hi Maxime,
> > 
> > On Tue, 2017-05-30 at 23:09 +0200, Maxime Ripard wrote:
> > > Hi Jörg,
> > > 
> > > On Tue, May 30, 2017 at 09:39:57AM +0200, Jörg Krause wrote:
> > > > On Mon, 2017-02-27 at 18:22 +0100, Maxime Ripard wrote:
> > > > > CMD_MTDPARTS is something the user might or might not want to
> > > > > select,
> > > > > and
> > > > > might depends on (or be selected by) other options too.
> > > > > 
> > > > > This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT
> > > > > options that
> > > > > might change from one board to another, or from one user to the
> > > > > other,
> > > > > depending on what it expects and what storage devices are
> > > > > available.
> > > > > 
> > > > > In order to ease that configuration, add those options to
> > > > > Kconfig.
> > > > > 
> > > > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > > > > Reviewed-by: Tom Rini <trini@konsulko.com>
> > > > > ---
> > > > >  cmd/Kconfig    | 20 ++++++++++++++++++++
> > > > >  cmd/mtdparts.c |  8 ++++++++
> > > > >  2 files changed, 28 insertions(+), 0 deletions(-)
> > > > > 
> > > > > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > > > > index ef5315631476..0734d669dbd7 100644
> > > > > --- a/cmd/Kconfig
> > > > > +++ b/cmd/Kconfig
> > > > > @@ -801,6 +801,26 @@ config CMD_FS_GENERIC
> > > > >  	help
> > > > >  	  Enables filesystem commands (e.g. load, ls) that work
> > > > > for
> > > > > multiple
> > > > >  	  fs types.
> > > > > +
> > > > > +config CMD_MTDPARTS
> > > > > +	depends on ARCH_SUNXI
> > > > 
> > > > Is there any reason to limit the command for the sunxi arch only?
> > > 
> > > Yes, if we don't, this will generate warnings for each architecture
> > > that has not moved that option from their header to Kconfig.
> > 
> > I see! However, wouldn't it be best to migrate all architectures to
> > Kconfig instead of doing it seperately?
> 
> Probably, but there was a quite significant number of Kconfig symbols
> introduced, used by a very significant number of boards and
> architectures.

I see!

> This was really to unreasonable to do at the time, but we can
> definitely do that now.

That would be great! Many thanks!

Jörg
diff mbox

Patch

diff --git a/cmd/Kconfig b/cmd/Kconfig
index ef5315631476..0734d669dbd7 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -801,6 +801,26 @@  config CMD_FS_GENERIC
 	help
 	  Enables filesystem commands (e.g. load, ls) that work for multiple
 	  fs types.
+
+config CMD_MTDPARTS
+	depends on ARCH_SUNXI
+	bool "MTD partition support"
+	help
+	  MTD partition support
+
+config MTDIDS_DEFAULT
+	string "Default MTD IDs"
+	depends on CMD_MTDPARTS
+	help
+	  Defines a default MTD ID
+
+config MTDPARTS_DEFAULT
+	string "Default MTD partition scheme"
+	depends on CMD_MTDPARTS
+	help
+	  Defines a default MTD partitioning scheme in the Linux MTD command
+	  line partitions format
+
 endmenu
 
 config CMD_UBI
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index b9b160dc1e2f..112bf1f3e3cd 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -110,11 +110,19 @@  DECLARE_GLOBAL_DATA_PTR;
 
 /* default values for mtdids and mtdparts variables */
 #if !defined(MTDIDS_DEFAULT)
+#ifdef CONFIG_MTDIDS_DEFAULT
+#define MTDIDS_DEFAULT CONFIG_MTDIDS_DEFAULT
+#else
 #define MTDIDS_DEFAULT NULL
 #endif
+#endif
 #if !defined(MTDPARTS_DEFAULT)
+#ifdef CONFIG_MTDPARTS_DEFAULT
+#define MTDPARTS_DEFAULT CONFIG_MTDPARTS_DEFAULT
+#else
 #define MTDPARTS_DEFAULT NULL
 #endif
+#endif
 #if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
 extern void board_mtdparts_default(const char **mtdids, const char **mtdparts);
 #endif