diff mbox series

[2/7] board: MCR3000: Modernise the settings to properly work on lastest u-boot version

Message ID f717eb0762b2a82aae9ec6376f4a2da4664f7656.1675088759.git.christophe.leroy@csgroup.eu
State Superseded
Delegated to: Tom Rini
Headers show
Series Add new equipment from CSSI | expand

Commit Message

Christophe Leroy Jan. 30, 2023, 2:34 p.m. UTC
Both U-boot and Linux kernel have grown over the last releases
and don't fit anymore in the 2M EPROM of the board.

So, rework the setup to allow storing the Linux kernel image
on the UBIFS NAND Flash.

Also add support to FIT images as this is what the Linux kernel
look like nowadays.

Also increase CONFIG_SYS_BOOTMAPSZ to 32Mbytes and define
CONFIG_SYS_BOOTM_LEN with the same value, otherwise it defaults
to 8M which is not sufficient anymore with nowadays Linux kernels.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: FRANJOU Stephane <stephane.franjou@csgroup.eu>
---
 configs/MCR3000_defconfig |  8 ++++++--
 include/configs/MCR3000.h | 42 ++++++++++++++++++---------------------
 2 files changed, 25 insertions(+), 25 deletions(-)

Comments

Tom Rini Jan. 30, 2023, 5:23 p.m. UTC | #1
On Mon, Jan 30, 2023 at 03:34:01PM +0100, Christophe Leroy wrote:

> Both U-boot and Linux kernel have grown over the last releases
> and don't fit anymore in the 2M EPROM of the board.
> 
> So, rework the setup to allow storing the Linux kernel image
> on the UBIFS NAND Flash.
> 
> Also add support to FIT images as this is what the Linux kernel
> look like nowadays.
> 
> Also increase CONFIG_SYS_BOOTMAPSZ to 32Mbytes and define
> CONFIG_SYS_BOOTM_LEN with the same value, otherwise it defaults
> to 8M which is not sufficient anymore with nowadays Linux kernels.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Reviewed-by: FRANJOU Stephane <stephane.franjou@csgroup.eu>
> ---
>  configs/MCR3000_defconfig |  8 ++++++--
>  include/configs/MCR3000.h | 42 ++++++++++++++++++---------------------
>  2 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/configs/MCR3000_defconfig b/configs/MCR3000_defconfig
> index 6c41d7c88d1..2e9d8c24329 100644
> --- a/configs/MCR3000_defconfig
> +++ b/configs/MCR3000_defconfig
> @@ -20,6 +20,7 @@ CONFIG_SYS_SCCR=0x00C20000
>  CONFIG_SYS_SCCR_MASK=0x60000000
>  CONFIG_SYS_DER=0x2002000F
>  CONFIG_SYS_MONITOR_LEN=327680
> +CONFIG_FIT=y
>  CONFIG_OF_BOARD_SETUP=y
>  CONFIG_SYS_MONITOR_BASE=0x04000000
>  CONFIG_BOOTDELAY=5
> @@ -35,11 +36,12 @@ CONFIG_HUSH_PARSER=y
>  CONFIG_SYS_PBSIZE=278
>  # CONFIG_CMD_BDI is not set
>  # CONFIG_CMD_CONSOLE is not set
> -CONFIG_SYS_BOOTM_LEN=0x800000
> +CONFIG_SYS_BOOTM_LEN=0x2000000
>  # CONFIG_CMD_IMI is not set
>  CONFIG_CMD_ASKENV=y
>  # CONFIG_CMD_LOADB is not set
>  # CONFIG_CMD_LOADS is not set
> +CONFIG_CMD_MTD=y
>  CONFIG_CMD_NAND=y
>  # CONFIG_CMD_ECHO is not set
>  # CONFIG_CMD_ITEST is not set
> @@ -50,6 +52,8 @@ CONFIG_CMD_MII=y
>  CONFIG_MII_INIT=y
>  CONFIG_CMD_PING=y
>  # CONFIG_CMD_SLEEP is not set
> +CONFIG_CMD_MTDPARTS=y
> +CONFIG_CMD_UBI=y
>  CONFIG_OF_CONTROL=y
>  CONFIG_ENV_OVERWRITE=y
>  CONFIG_ENV_IS_IN_FLASH=y
> @@ -80,6 +84,7 @@ CONFIG_SYS_BR7_PRELIM=0x1C000001
>  CONFIG_SYS_OR7_PRELIM=0xFFFF810A
>  # CONFIG_MMC is not set
>  CONFIG_MTD=y
> +CONFIG_DM_MTD=y
>  CONFIG_MTD_NOR_FLASH=y
>  CONFIG_FLASH_CFI_DRIVER=y
>  CONFIG_SYS_FLASH_CFI=y
> @@ -89,5 +94,4 @@ CONFIG_MPC8XX_FEC=y
>  # CONFIG_PCI is not set
>  CONFIG_DM_SERIAL=y
>  CONFIG_WDT=y
> -CONFIG_SHA256=y
>  CONFIG_LZMA=y
> diff --git a/include/configs/MCR3000.h b/include/configs/MCR3000.h
> index b0809332bb5..62c3404415c 100644
> --- a/include/configs/MCR3000.h
> +++ b/include/configs/MCR3000.h
> @@ -12,45 +12,40 @@
>  #define CONFIG_EXTRA_ENV_SETTINGS					\
>  	"sdram_type=SDRAM\0"						\
>  	"flash_type=AM29LV160DB\0"					\
> -	"loadaddr=0x400000\0"						\
> -	"filename=uImage.lzma\0"					\
> -	"nfsroot=/opt/ofs\0"						\
> +	"loadaddr=0x1200000\0"						\
> +	"filename=mcr3000.itb\0"					\
>  	"dhcp_ip=ip=:::::eth0:dhcp\0"					\
>  	"console_args=console=ttyCPM0,115200N8\0"			\
> +	"loadkernel=ubi part nand0;ubifsmount ubi0;"			\
> +		"ubifsload ${loadaddr} /boot/${filename};"		\
> +		"ubifsumount; ubi detach\0"				\
> +	"bootcmd=run flashboot\0" 					\
>  	"flashboot=setenv bootargs "					\
>  		"${console_args} "					\
>  		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:"	\
>  		"mcr3k:eth0:off;"					\
>  		"${ofl_args}; "						\
> -		"bootm 0x04060000 - 0x04050000\0"			\
> +		"run loadkernel; "					\
> +		"bootm ${loadaddr}\0"                                   \
>  	"tftpboot=setenv bootargs "					\
>  		"${console_args} "					\
>  		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:"	\
>  		"mcr3k:eth0:off "					\
>  		"${ofl_args}; "						\
>  		"tftp ${loadaddr} ${filename};"				\
> -		"tftp 0xf00000 mcr3000.dtb;"				\
> -		"bootm ${loadaddr} - 0xf00000\0"			\
> -	"netboot=dhcp ${loadaddr} ${filename};"				\
> -		"tftp 0xf00000 mcr3000.dtb;"				\
> -		"setenv bootargs "					\
> -		"root=/dev/nfs rw "					\
> -		"${console_args} "					\
> -		"${dhcp_ip};"						\
> -		"bootm ${loadaddr} - 0xf00000\0"			\
> -	"nfsboot=setenv bootargs "					\
> -		"root=/dev/nfs rw nfsroot=${serverip}:${nfsroot} "	\
> -		"${console_args} "					\
> -		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:"	\
> -		"mcr3k:eth0:off;"					\
> -		"bootm 0x04060000 - 0x04050000\0"			\
> +		"bootm ${loadaddr}\0"                                   \
>  	"dhcpboot=dhcp ${loadaddr} ${filename};"			\
> -		"tftp 0xf00000 mcr3000.dtb;"				\
>  		"setenv bootargs "					\
>  		"${console_args} "					\
>  		"${dhcp_ip} "						\
>  		"${ofl_args}; "						\
> -		"bootm ${loadaddr} - 0xf00000\0"
> +		"bootm ${loadaddr}\0"					\
> +	"update=echo 'Updating ubi image'; "				\
> +		"if tftp 0x2000 $ubifile; then "			\
> +		"nand erase.chip; "					\
> +		"nand write 0x2000 0x00 $filesize; "			\
> +		"fi;\0 "
> +

I would like to see this move instead to using the plain text
environment as can be see in commits such as 5c3f6a320678
("dragonboard410c: Migrate to using CONFIG_EXTRA_ENV_TEXT").
diff mbox series

Patch

diff --git a/configs/MCR3000_defconfig b/configs/MCR3000_defconfig
index 6c41d7c88d1..2e9d8c24329 100644
--- a/configs/MCR3000_defconfig
+++ b/configs/MCR3000_defconfig
@@ -20,6 +20,7 @@  CONFIG_SYS_SCCR=0x00C20000
 CONFIG_SYS_SCCR_MASK=0x60000000
 CONFIG_SYS_DER=0x2002000F
 CONFIG_SYS_MONITOR_LEN=327680
+CONFIG_FIT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_MONITOR_BASE=0x04000000
 CONFIG_BOOTDELAY=5
@@ -35,11 +36,12 @@  CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=278
 # CONFIG_CMD_BDI is not set
 # CONFIG_CMD_CONSOLE is not set
-CONFIG_SYS_BOOTM_LEN=0x800000
+CONFIG_SYS_BOOTM_LEN=0x2000000
 # CONFIG_CMD_IMI is not set
 CONFIG_CMD_ASKENV=y
 # CONFIG_CMD_LOADB is not set
 # CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MTD=y
 CONFIG_CMD_NAND=y
 # CONFIG_CMD_ECHO is not set
 # CONFIG_CMD_ITEST is not set
@@ -50,6 +52,8 @@  CONFIG_CMD_MII=y
 CONFIG_MII_INIT=y
 CONFIG_CMD_PING=y
 # CONFIG_CMD_SLEEP is not set
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_FLASH=y
@@ -80,6 +84,7 @@  CONFIG_SYS_BR7_PRELIM=0x1C000001
 CONFIG_SYS_OR7_PRELIM=0xFFFF810A
 # CONFIG_MMC is not set
 CONFIG_MTD=y
+CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_CFI=y
@@ -89,5 +94,4 @@  CONFIG_MPC8XX_FEC=y
 # CONFIG_PCI is not set
 CONFIG_DM_SERIAL=y
 CONFIG_WDT=y
-CONFIG_SHA256=y
 CONFIG_LZMA=y
diff --git a/include/configs/MCR3000.h b/include/configs/MCR3000.h
index b0809332bb5..62c3404415c 100644
--- a/include/configs/MCR3000.h
+++ b/include/configs/MCR3000.h
@@ -12,45 +12,40 @@ 
 #define CONFIG_EXTRA_ENV_SETTINGS					\
 	"sdram_type=SDRAM\0"						\
 	"flash_type=AM29LV160DB\0"					\
-	"loadaddr=0x400000\0"						\
-	"filename=uImage.lzma\0"					\
-	"nfsroot=/opt/ofs\0"						\
+	"loadaddr=0x1200000\0"						\
+	"filename=mcr3000.itb\0"					\
 	"dhcp_ip=ip=:::::eth0:dhcp\0"					\
 	"console_args=console=ttyCPM0,115200N8\0"			\
+	"loadkernel=ubi part nand0;ubifsmount ubi0;"			\
+		"ubifsload ${loadaddr} /boot/${filename};"		\
+		"ubifsumount; ubi detach\0"				\
+	"bootcmd=run flashboot\0" 					\
 	"flashboot=setenv bootargs "					\
 		"${console_args} "					\
 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:"	\
 		"mcr3k:eth0:off;"					\
 		"${ofl_args}; "						\
-		"bootm 0x04060000 - 0x04050000\0"			\
+		"run loadkernel; "					\
+		"bootm ${loadaddr}\0"                                   \
 	"tftpboot=setenv bootargs "					\
 		"${console_args} "					\
 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:"	\
 		"mcr3k:eth0:off "					\
 		"${ofl_args}; "						\
 		"tftp ${loadaddr} ${filename};"				\
-		"tftp 0xf00000 mcr3000.dtb;"				\
-		"bootm ${loadaddr} - 0xf00000\0"			\
-	"netboot=dhcp ${loadaddr} ${filename};"				\
-		"tftp 0xf00000 mcr3000.dtb;"				\
-		"setenv bootargs "					\
-		"root=/dev/nfs rw "					\
-		"${console_args} "					\
-		"${dhcp_ip};"						\
-		"bootm ${loadaddr} - 0xf00000\0"			\
-	"nfsboot=setenv bootargs "					\
-		"root=/dev/nfs rw nfsroot=${serverip}:${nfsroot} "	\
-		"${console_args} "					\
-		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:"	\
-		"mcr3k:eth0:off;"					\
-		"bootm 0x04060000 - 0x04050000\0"			\
+		"bootm ${loadaddr}\0"                                   \
 	"dhcpboot=dhcp ${loadaddr} ${filename};"			\
-		"tftp 0xf00000 mcr3000.dtb;"				\
 		"setenv bootargs "					\
 		"${console_args} "					\
 		"${dhcp_ip} "						\
 		"${ofl_args}; "						\
-		"bootm ${loadaddr} - 0xf00000\0"
+		"bootm ${loadaddr}\0"					\
+	"update=echo 'Updating ubi image'; "				\
+		"if tftp 0x2000 $ubifile; then "			\
+		"nand erase.chip; "					\
+		"nand write 0x2000 0x00 $filesize; "			\
+		"fi;\0 "
+
 
 #define CONFIG_IPADDR			192.168.0.3
 #define CONFIG_SERVERIP			192.168.0.1
@@ -70,10 +65,11 @@ 
 
 /*
  * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
+ * have to be in the first 32 MB of memory, since this is
  * the maximum mapped by the Linux kernel during initialization.
  */
-#define	CONFIG_SYS_BOOTMAPSZ		(8 << 20)
+#define	CONFIG_SYS_BOOTMAPSZ		(32 << 20)
+
 
 /* Environment Configuration */