diff mbox series

cmd: mtdparts: add SYS_MTDPARTS_RUNTIME dependency on CONFIG_MTDIDS/MTDPARTS_DEFAULT

Message ID 20221208091010.1.I87acf9c65e708df1d5a45a57ce8508a14dfeb6a6@changeid
State Accepted
Commit 6762c8dd890f1e0b70822bd9b59a9003476dad2e
Delegated to: Tom Rini
Headers show
Series cmd: mtdparts: add SYS_MTDPARTS_RUNTIME dependency on CONFIG_MTDIDS/MTDPARTS_DEFAULT | expand

Commit Message

Patrick Delaunay Dec. 8, 2022, 8:10 a.m. UTC
The two configuration CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
are not needed with mtd configuration CONFIG_SYS_MTDPARTS_RUNTIME which
allows the MTDIDS and MTDPARTS to be configured at runtime.

This patch has no defconfig impacts because CONFIG_SYS_MTDPARTS_RUNTIME
is only used by two platforms (stm32mp and igep00x0) which don't define
CONFIG_MTDIDS_DEFAULT or CONFIG_MTDPARTS_DEFAULT.

This patch solves an UBI environment load issue for NAND boot for
stm32mp15 platform. In mtd_uboot.c, when GD_FLG_ENV_READY is not set,
env_get_f() return a EMPTY string, define in default_environment[]
because CONFIG_MTDIDS_DEFAULT="" and CONFIG_MTDPARTS_DEFAULT="",
but a NULL pointer is expected to allow call of board_mtdparts_default.
Without mtdparts, the env partition [CONFIG_ENV_UBI_PART="UBI"] is not
found in env/ubi.c [CONFIG_ENV_IS_IN_UBI].

It is not a problem when env becomes ready, as these empty variables are
removed form U-Boot environment in env_import() / himport_r().

Fixes: a331017c237c ("Complete migration of MTDPARTS_DEFAULT / MTDIDS_DEFAULT, include in environment")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 cmd/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

Comments

Patrice CHOTARD Dec. 12, 2022, 10:17 a.m. UTC | #1
Hi Patrick

On 12/8/22 09:10, Patrick Delaunay wrote:
> The two configuration CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
> are not needed with mtd configuration CONFIG_SYS_MTDPARTS_RUNTIME which
> allows the MTDIDS and MTDPARTS to be configured at runtime.
> 
> This patch has no defconfig impacts because CONFIG_SYS_MTDPARTS_RUNTIME
> is only used by two platforms (stm32mp and igep00x0) which don't define
> CONFIG_MTDIDS_DEFAULT or CONFIG_MTDPARTS_DEFAULT.
> 
> This patch solves an UBI environment load issue for NAND boot for
> stm32mp15 platform. In mtd_uboot.c, when GD_FLG_ENV_READY is not set,
> env_get_f() return a EMPTY string, define in default_environment[]
> because CONFIG_MTDIDS_DEFAULT="" and CONFIG_MTDPARTS_DEFAULT="",
> but a NULL pointer is expected to allow call of board_mtdparts_default.
> Without mtdparts, the env partition [CONFIG_ENV_UBI_PART="UBI"] is not
> found in env/ubi.c [CONFIG_ENV_IS_IN_UBI].
> 
> It is not a problem when env becomes ready, as these empty variables are
> removed form U-Boot environment in env_import() / himport_r().
> 
> Fixes: a331017c237c ("Complete migration of MTDPARTS_DEFAULT / MTDIDS_DEFAULT, include in environment")
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  cmd/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index d93731f2af68..cae6ed22fcd1 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -2535,6 +2535,7 @@ config CMD_MTDPARTS_SHOW_NET_SIZES
>  config MTDIDS_DEFAULT
>  	string "Default MTD IDs"
>  	depends on MTD || SPI_FLASH
> +	depends on !SYS_MTDPARTS_RUNTIME
>  	help
>  	  Defines a default MTD IDs list for use with MTD partitions in the
>  	  Linux MTD command line partitions format.
> @@ -2542,6 +2543,7 @@ config MTDIDS_DEFAULT
>  config MTDPARTS_DEFAULT
>  	string "Default MTD partition scheme"
>  	depends on MTD || SPI_FLASH
> +	depends on !SYS_MTDPARTS_RUNTIME
>  	help
>  	  Defines a default MTD partitioning scheme in the Linux MTD command
>  	  line partitions format
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice
Tom Rini Jan. 12, 2023, 3:17 p.m. UTC | #2
On Thu, Dec 08, 2022 at 09:10:13AM +0100, Patrick Delaunay wrote:

> The two configuration CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
> are not needed with mtd configuration CONFIG_SYS_MTDPARTS_RUNTIME which
> allows the MTDIDS and MTDPARTS to be configured at runtime.
> 
> This patch has no defconfig impacts because CONFIG_SYS_MTDPARTS_RUNTIME
> is only used by two platforms (stm32mp and igep00x0) which don't define
> CONFIG_MTDIDS_DEFAULT or CONFIG_MTDPARTS_DEFAULT.
> 
> This patch solves an UBI environment load issue for NAND boot for
> stm32mp15 platform. In mtd_uboot.c, when GD_FLG_ENV_READY is not set,
> env_get_f() return a EMPTY string, define in default_environment[]
> because CONFIG_MTDIDS_DEFAULT="" and CONFIG_MTDPARTS_DEFAULT="",
> but a NULL pointer is expected to allow call of board_mtdparts_default.
> Without mtdparts, the env partition [CONFIG_ENV_UBI_PART="UBI"] is not
> found in env/ubi.c [CONFIG_ENV_IS_IN_UBI].
> 
> It is not a problem when env becomes ready, as these empty variables are
> removed form U-Boot environment in env_import() / himport_r().
> 
> Fixes: a331017c237c ("Complete migration of MTDPARTS_DEFAULT / MTDIDS_DEFAULT, include in environment")
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/cmd/Kconfig b/cmd/Kconfig
index d93731f2af68..cae6ed22fcd1 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -2535,6 +2535,7 @@  config CMD_MTDPARTS_SHOW_NET_SIZES
 config MTDIDS_DEFAULT
 	string "Default MTD IDs"
 	depends on MTD || SPI_FLASH
+	depends on !SYS_MTDPARTS_RUNTIME
 	help
 	  Defines a default MTD IDs list for use with MTD partitions in the
 	  Linux MTD command line partitions format.
@@ -2542,6 +2543,7 @@  config MTDIDS_DEFAULT
 config MTDPARTS_DEFAULT
 	string "Default MTD partition scheme"
 	depends on MTD || SPI_FLASH
+	depends on !SYS_MTDPARTS_RUNTIME
 	help
 	  Defines a default MTD partitioning scheme in the Linux MTD command
 	  line partitions format