Skip to contentSkip to conversation

try to merge different i.MX environment

RFC In review Stefano Babic 5 participants 7 messages Feb 14, 2014 – Feb 18, 2014

lore
Share & tools
lore
#0 lore raw

RFC 1/1 try to merge different i.MX environment

CC Fabio Estevam <[email protected]>
CC Otavio Salvador <[email protected]>
CC Marek Vasut <[email protected]>
CC Leo Sartre <[email protected]>
CC Jon Nettleton <[email protected]>
CC Eric Nelson <[email protected]>
CC b18965 at freescale.com

Hi everybody,

the current built-in environment in most i.MX boards is very similar. Even if I always thought that the default environemt is something that the user want always customize, I see from all you submitters the not hidden desire to have such a common default environment for all boards. At least, for i.MX boards.
Checking in the board configuration files, I see at least the following boards that hase "quite" the same built-in environment:

	mx23evk
	mx23_olinuxino
	mx28evk
	mx51evk
	mx53evk
	mx53loco
	mx53smd
	mx6qarm2
	mx6slevk
	mx6qsabre* (all of them)
	wandboard
	cgtqmx6eval
	hummingbird
	udoo

and I am sure, I have missed some of them. The default environment is quite the same, and CONFIG_EXTRA_ENV_SETTINGS is more or less a cut&paste from another board. There are inconsistency and each fix must be repeated for all boards.

I will try to address this issue. Maybe can we find a common built-in environment, that all other boards can simply include instead of redefining ?
I want to try to find some useful blocks, that we can reuse for each board (mmc, nand, net,..).

Then each board could simply define something like:

+#include <configs/default_env.h>

#define CONFIG_EXTRA_ENV_SETTINGS \
	CONFIG_BOARD_EXTRA_ENV_SETTINGS \
	CONFIG_COMMON_SCRIPTS \
	CONFIG_BOOTCOMMAND

Where CONFIG_BOARD_EXTRA_ENV_SETTINGS still contains extra defines specific for the board

This patch is only a proposal: it is not complete and it want not to be. It is for me only a way to start the discussion: how can we make order in the big mess of built-in environment ?

Comments ?

Best regards,
Stefano Babic

---
 include/configs/cgtqmx6eval.h     |   62 +++++------------
 include/configs/default_env.h     |  133 +++++++++++++++++++++++++++++++++++++
 include/configs/hummingboard.h    |   80 +---------------------
 include/configs/mx23_olinuxino.h  |   90 +++++--------------------
 include/configs/mx6sabre_common.h |  119 ++++-----------------------------
 include/configs/sandbox.h         |   30 ++++++++-
 include/configs/wandboard.h       |   97 ++++-----------------------
 7 files changed, 221 insertions(+), 390 deletions(-)
 create mode 100644 include/configs/default_env.h
include/configs/cgtqmx6eval.h +15 -47
index b189bf1..4fe8a58 100644
@@ -73,58 +73,26 @@
 
 #define CONFIG_DEFAULT_FDT_FILE "imx6q-congatec.dtb"
 
-#define CONFIG_EXTRA_ENV_SETTINGS \
-	"script=boot.scr\0" \
-	"image=zImage\0" \
-	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
-	"boot_dir=/boot\0" \
-	"console=ttymxc1\0" \
+#define CONFIG_PREFIX_IMAGE "z" 
+#define CONFIG_MMCROOT	"/dev/mmcblk0p1"
+#define CONFIG_CONSOLE_DEV "ttymxc1"
+
+#define CONFIG_BOARD_EXTRA_ENV_SETTINGS \
 	"fdt_high=0xffffffff\0" \
 	"initrd_high=0xffffffff\0" \
 	"fdt_addr=0x18000000\0" \
 	"boot_fdt=try\0" \
 	"mmcdev=1\0" \
-	"mmcpart=1\0" \
-	"mmcroot=/dev/mmcblk0p1 rootwait rw\0" \
-	"mmcargs=setenv bootargs console=${console},${baudrate} " \
-		"root=${mmcroot}\0" \
-	"loadbootscript=" \
-		"ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
-	"bootscript=echo Running bootscript from mmc ...; " \
-		"source\0" \
-	"loadimage=ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} " \
-		"${boot_dir}/${image}\0" \
-	"loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdt_addr} " \
-		"${boot_dir}/${fdt_file}\0" \
-	"mmcboot=echo Booting from mmc ...; " \
-		"run mmcargs; " \
-		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
-			"if run loadfdt; then " \
-				"bootz ${loadaddr} - ${fdt_addr}; " \
-			"else " \
-				"if test ${boot_fdt} = try; then " \
-					"bootz; " \
-				"else " \
-					"echo WARN: Cannot load the DT; " \
-				"fi; " \
-			"fi; " \
-		"else " \
-			"bootz; " \
-		"fi;\0"
-
-#define CONFIG_BOOTCOMMAND \
-	   "mmc dev ${mmcdev};" \
-	   "mmc dev ${mmcdev}; if mmc rescan; then " \
-		   "if run loadbootscript; then " \
-			   "run bootscript; " \
-		   "else " \
-			   "if run loadimage; then " \
-				   "run mmcboot; " \
-			   "else "\
-				   "echo ERR: Fail to boot from mmc; " \
-			   "fi; " \
-		   "fi; " \
-	   "else echo ERR: Fail to boot from mmc; fi"
+	"mmcpart=1\0"
+
+#define MMC_SCRIPT_FILESYSTEM ext2
+
+#include <configs/default_env.h>
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	CONFIG_BOARD_EXTRA_ENV_SETTINGS \
+	CONFIG_COMMON_SCRIPTS \
+	CONFIG_BOOTCOMMAND
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP
include/configs/default_env.h new file +133 -0

133 lines not on this page · raw message

include/configs/hummingboard.h +3 -77

96 lines not on this page · raw message

include/configs/mx23_olinuxino.h +16 -74

103 lines not on this page · raw message

include/configs/mx6sabre_common.h +13 -106

128 lines not on this page · raw message

include/configs/sandbox.h +27 -3
index a6d5582..3951485 100644
@@ -120,9 +120,6 @@
 
 #define CONFIG_BOOTARGS ""
 
-#define CONFIG_EXTRA_ENV_SETTINGS	"stdin=serial\0" \
-					"stdout=serial\0" \
-					"stderr=serial\0"
 
 #define CONFIG_GZIP_COMPRESSED
 #define CONFIG_BZIP2
@@ -131,4 +128,31 @@
 
 #define CONFIG_TPM_TIS_SANDBOX
 
+#include <configs/default_env.h>
+
+#define CONFIG_CONSOLE_DEV	"ttymxc1"
+#define CONFIG_MMCROOT	"/dev/mmcblk0p1" 
+#define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_PREFIX_IMAGE
+
+#define CONFIG_BOARD_EXTRA_ENV_SETTINGS \
+	"stdin=serial\0" \
+	"stdout=serial\0" \
+	"stderr=serial\0" \
+	"console=ttymxc1\0" \
+	"fdt_high=0xffffffff\0" \
+	"initrd_high=0xffffffff\0" \
+	"fdt_addr=0x18000000\0" \
+	"boot_fdt=try\0" \
+	"mmcdev=1\0" \
+	"mmcpart=1\0"
+
+#include <configs/default_env.h>
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	CONFIG_BOARD_EXTRA_ENV_SETTINGS \
+	CONFIG_COMMON_SCRIPTS \
+	CONFIG_BOOTCOMMAND
+
+
 #endif
include/configs/wandboard.h +14 -83

107 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

Hello Stefano,

before anything I'd like to thank you for this as it does need to be improved and it needs to be shared to avoid same fix to be done everywhere.

Quoted 11 lines · Stefano Babic
CC Fabio Estevam <[email protected]>
CC Otavio Salvador <[email protected]>
CC Marek Vasut <[email protected]>
CC Leo Sartre <[email protected]>
CC Jon Nettleton <[email protected]>
CC Eric Nelson <[email protected]>
CC b18965 at freescale.com

Hi everybody,

Quoted 7 lines

the current built-in environment in most i.MX boards is very similar. Even if I always thought that the default environemt is something that the user want always customize, I see from all you submitters the not hidden desire to have such a common default environment for all boards. At least, for i.MX boards.
Checking in the board configuration files, I see at least the following boards that hase "quite" the same built-in environment:

...

Fully agreed. This is especially important with the common distro environment in mind.

...

include/configs/default_env.h

Quoted 5 lines
include/configs/default_env.h new file +0 -0
new file mode 100644
index 0000000..b898156

I'd prefer this to be named

default_env_imx.h

include/configs/default_env.h line 7

Quoted 8 lines
include/configs/default_env.h new file +7 -0
@@ -0,0 +1,133 @@
+
+#ifndef _DEFAULT_ENV_H
+#define _DEFAULT_ENV_H
+
+#ifdef CONFIG_PREFIX_IMAGE
+#define CONFIG_BOOT_SUFFIX "z"
+#define CONFIG_DEFIMAGE        "zimage"

zImage

include/configs/default_env.h line 15

Quoted 8 lines
include/configs/default_env.h new file +8 -0
+#else
+#define CONFIG_BOOT_SUFFIX
+#define CONFIG_DEFIMAGE        "uImage"
+#endif
+
+#ifndef MMC_SCRIPT_FILESYSTEM
+#define MMC_SCRIPT_FILESYSTEM fat
+#endif

We could move to generic filesystem and avoid this.

Quoted 9 lines
include/configs/default_env.h new file +9 -0
+#ifndef CONFIG_DEFAULT_FDT_FILE
+#define CONFIG_DEFAULT_FDT_FILE
+#endif
+
+#ifndef MMC_WRITE_OFFSET
+#define MMC_WRITE_OFFSET 0x2
+#endif
+
+#ifdef CONFIG_SUPPORT_EMMC_BOOT

include/configs/default_env.h line 35

Quoted 10 lines
include/configs/default_env.h new file +10 -0
+#define EMMC_ENV \
+       "update_emmc_firmware=" \
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "if ${get_cmd} ${update_sd_firmware_filename}; then " \
+                       "if mmc dev ${emmcdev} && " \
+                               "mmc open ${emmcdev} 1; then "  \

This must to be adapter with Tom's work in emmc; I think this just fails now...

Quoted 7 lines
include/configs/default_env.h new file +7 -0
+                               "setexpr fw_sz ${filesize} / 0x200; " \
+                               "setexpr fw_sz ${fw_sz} + 1; "  \
+                               "mmc write ${loadaddr} " __stringify(MMC_WRITE_OFFSET) " ${fw_sz}; " \
+                               "mmc close ${emmcdev} 1; " \
+                       "fi; "  \
+               "fi\0"
+#else

include/configs/default_env.h line 52

Quoted 10 lines
include/configs/default_env.h new file +10 -0
+#define EMMC_ENV ""
+#endif
+
+#define CONFIG_COMMON_SCRIPTS \
+       "bootscript=echo Running bootscript from mmc ...; " \
+               "source\0" \
+       "script=boot.scr\0" \
+       "image=" CONFIG_DEFIMAGE "\0" \
+       "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
+       "fdt_addr=0x18000000\0" \

This must to be set by SoC type; so we don't need to re-define it in every board. This also need to be overridable in case we have a board with reduced memory.

Quoted 36 lines
include/configs/default_env.h new file +36 -0
+       "console=" CONFIG_CONSOLE_DEV "\0" \
+       "fdt_high=0xffffffff\0"   \
+       "initrd_high=0xffffffff\0" \
+       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+       "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
+       "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+       "update_sd_firmware=" \
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "if mmc dev ${mmcdev}; then "   \
+                       "if ${get_cmd} ${update_sd_firmware_filename}; then " \
+                               "setexpr fw_sz ${filesize} / 0x200; " \
+                               "setexpr fw_sz ${fw_sz} + 1; "  \
+                               "mmc write ${loadaddr} " __stringify(MMC_WRITE_OFFSET) " ${fw_sz}; " \
+                       "fi; "  \
+               "fi\0" \
+       "mmcargs=setenv bootargs console=${console},${baudrate} " \
+               "root=${mmcroot}\0" \
+       "loadbootscript=" \
+               __stringify(MMC_SCRIPT_FILESYSTEM)"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+       "loadimage=" \
+               __stringify(MMC_SCRIPT_FILESYSTEM)"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
+       "loadfdt=" \
+               __stringify(MMC_SCRIPT_FILESYSTEM) "load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+       "mmcboot=echo Booting from mmc ...; " \
+               "run mmcargs; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if run loadfdt; then " \
+                               "boot" CONFIG_BOOT_SUFFIX " ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "boot" CONFIG_BOOT_SUFFIX "; " \
+                               "else " \

include/configs/default_env.h line 98

Quoted 10 lines
include/configs/default_env.h new file +10 -0
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "boot" CONFIG_BOOT_SUFFIX "; " \
+               "fi;\0" \
+       "netargs=setenv bootargs console=${console},${baudrate} " \
+               "root=/dev/nfs " \
+               "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+       "netboot=echo Booting from net ...; " \

netboot and mmc might be split; some board may don't have ethernet or mmc.

Quoted 148 lines
include/configs/default_env.h new file +35 -0
+               "run netargs; " \
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "${get_cmd} ${image}; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+                               "boot" CONFIG_BOOT_SUFFIX " ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "boot" CONFIG_BOOT_SUFFIX "; " \
+                               "else " \
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "boot" CONFIG_BOOT_SUFFIX "; " \
+               "fi;\0"
+
+#define CONFIG_BOOTCOMMAND \
+       "mmc dev ${mmcdev};" \
+       "if mmc rescan; then " \
+               "if run loadbootscript; then " \
+               "run bootscript; " \
+               "else " \
+                       "if run loadimage; then " \
+                               "run mmcboot; " \
+                       "else run netboot; " \
+                       "fi; " \
+               "fi; " \
+       "else run netboot; fi"
+
+#endif
include/configs/hummingboard.h +3 -77
index ac65620..5c00c4b 100644
@@ -90,93 +90,19 @@
 #define CONFIG_DEFAULT_FDT_FILE                "imx6dl-hummingboard.dtb"
 #endif
 
-#define CONFIG_EXTRA_ENV_SETTINGS \
-       "script=boot.scr\0" \
-       "image=zImage\0" \
+#define CONFIG_PREFIX_IMAGE z
+
+#define CONFIG_BOARD_EXTRA_ENV_SETTINGS \
        "console=ttymxc0\0" \
        "splashpos=m,m\0" \
        "fdt_high=0xffffffff\0" \
        "initrd_high=0xffffffff\0" \
-       "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
        "fdt_addr=0x18000000\0" \
        "boot_fdt=try\0" \
        "ip_dyn=yes\0" \
        "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
        "mmcpart=1\0" \
        "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \
-       "update_sd_firmware_filename=u-boot.imx\0" \
-       "update_sd_firmware=" \
-               "if test ${ip_dyn} = yes; then " \
-                       "setenv get_cmd dhcp; " \
-               "else " \
-                       "setenv get_cmd tftp; " \
-               "fi; " \
-               "if mmc dev ${mmcdev}; then "   \
-                       "if ${get_cmd} ${update_sd_firmware_filename}; then " \
-                               "setexpr fw_sz ${filesize} / 0x200; " \
-                               "setexpr fw_sz ${fw_sz} + 1; "  \
-                               "mmc write ${loadaddr} 0x2 ${fw_sz}; " \
-                       "fi; "  \
-               "fi\0" \
-       "mmcargs=setenv bootargs console=${console},${baudrate} " \
-               "root=${mmcroot}\0" \
-       "loadbootscript=" \
-               "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
-       "bootscript=echo Running bootscript from mmc ...; " \
-               "source\0" \
-       "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
-       "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
-       "mmcboot=echo Booting from mmc ...; " \
-               "run mmcargs; " \
-               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
-                       "if run loadfdt; then " \
-                               "bootz ${loadaddr} - ${fdt_addr}; " \
-                       "else " \
-                               "if test ${boot_fdt} = try; then " \
-                                       "bootz; " \
-                               "else " \
-                                       "echo WARN: Cannot load the DT; " \
-                               "fi; " \
-                       "fi; " \
-               "else " \
-                       "bootz; " \
-               "fi;\0" \
-       "netargs=setenv bootargs console=${console},${baudrate} " \
-               "root=/dev/nfs " \
-       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
-               "netboot=echo Booting from net ...; " \
-               "run netargs; " \
-               "if test ${ip_dyn} = yes; then " \
-                       "setenv get_cmd dhcp; " \
-               "else " \
-                       "setenv get_cmd tftp; " \
-               "fi; " \
-               "${get_cmd} ${image}; " \
-               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
-                       "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
-                               "bootz ${loadaddr} - ${fdt_addr}; " \
-                       "else " \
-                               "if test ${boot_fdt} = try; then " \
-                                       "bootz; " \
-                               "else " \
-                                       "echo WARN: Cannot load the DT; " \
-                               "fi; " \
-                       "fi; " \
-               "else " \
-                       "bootz; " \
-               "fi;\0"
-
-#define CONFIG_BOOTCOMMAND \
-          "mmc dev ${mmcdev}; if mmc rescan; then " \
-                  "if run loadbootscript; then " \
-                          "run bootscript; " \
-                  "else " \
-                          "if run loadimage; then " \
-                                  "run mmcboot; " \
-                          "else run netboot; " \
-                          "fi; " \
-                  "fi; " \
-          "else run netboot; fi"
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP
include/configs/mx23_olinuxino.h +1 -3
index e377fea..08df31d 100644
@@ -71,9 +71,17 @@
 #define CONFIG_LOADADDR                0x42000000
 #define CONFIG_SYS_LOAD_ADDR   CONFIG_LOADADDR
 
-/* Extra Environment */
-#define CONFIG_EXTRA_ENV_SETTINGS \
-       "update_sd_firmware_filename=u-boot.sd\0" \
+#define CONFIG_DEFAULT_FDT_FILE "imx23-olinuxino.dtb"

include/configs/mx23_olinuxino.h line 84

Quoted 10 lines
include/configs/mx23_olinuxino.h +10 -0
+#define MMC_WRITE_OFFSET 0x800
+
+#define CONFIG_BOARD_EXTRA_ENV_SETTINGS \
+       "boot_fdt=try\0" \
+       "ip_dyn=yes\0" \
+       "mmcdev=0\0" \
+       "mmcpart=2\0" \
+       "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
+       "console=ttyAMA0\0" \
+       "fdt_addr=0x41000000\0" \

I think this can reuse the common setting.

...

Basically I do like this idea and I would like to help in getting it as good and as flexible as possible; this reduces a lot the maintenance burden and easy customization to all of us.

Regards,

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#2 lore raw

Hi Otavio,

Quoted 3 lines · Otavio Salvador

Fully agreed. This is especially important with the common distro environment in mind.

Right - we should also take care of Dennis' efforts in this direction.

Quoted 11 lines

...

include/configs/default_env.h

Quoted 5 lines
include/configs/default_env.h new file +0 -0
new file mode 100644
index 0000000..b898156

I'd prefer this to be named

default_env_imx.h

Agree.

Quoted 2 lines

We could move to generic filesystem and avoid this.

Agree.

Quoted 14 lines
Quoted 14 lines
include/configs/default_env.h new file +13 -0
+#ifndef CONFIG_DEFAULT_FDT_FILE
+#define CONFIG_DEFAULT_FDT_FILE
+#endif
+
+#ifndef MMC_WRITE_OFFSET
+#define MMC_WRITE_OFFSET 0x2
+#endif
+
+#ifdef CONFIG_SUPPORT_EMMC_BOOT
+#define EMMC_ENV \
+       "update_emmc_firmware=" \
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
Quoted 8 lines

include/configs/default_env.h line 35

Quoted 6 lines
include/configs/default_env.h new file +6 -0
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "if ${get_cmd} ${update_sd_firmware_filename}; then " \
+                       "if mmc dev ${emmcdev} && " \
+                               "mmc open ${emmcdev} 1; then "  \

This must to be adapter with Tom's work in emmc; I think this just fails now...

Ok, I will take a look. We could also drop at the moment EMMC_ENV and put it again after Tom's patches are in.

Quoted 14 lines
Quoted 14 lines
include/configs/default_env.h new file +13 -0
+                               "setexpr fw_sz ${filesize} / 0x200; " \
+                               "setexpr fw_sz ${fw_sz} + 1; "  \
+                               "mmc write ${loadaddr} " __stringify(MMC_WRITE_OFFSET) " ${fw_sz}; " \
+                               "mmc close ${emmcdev} 1; " \
+                       "fi; "  \
+               "fi\0"
+#else
+#define EMMC_ENV ""
+#endif
+
+#define CONFIG_COMMON_SCRIPTS \
+       "bootscript=echo Running bootscript from mmc ...; " \
+               "source\0" \
Quoted 9 lines

include/configs/default_env.h line 52

Quoted 4 lines
include/configs/default_env.h new file +4 -0
+       "script=boot.scr\0" \
+       "image=" CONFIG_DEFIMAGE "\0" \
+       "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
+       "fdt_addr=0x18000000\0" \

This must to be set by SoC type; so we don't need to re-define it in every board. This also need to be overridable in case we have a board with reduced memory.

Fully agree. I think, after making order to the built-in environment, we could go on and factorize also a lot of defines that are SOC common. Without reinventing the wheel, we can do as Stephen (Warren) prepared for Tegra.

We can have:
- config file with built-in environment
- config with defines related to the SOC
- board configuration file that includes the first two.

Quoted 47 lines
Quoted 36 lines
include/configs/default_env.h new file +36 -0
+       "console=" CONFIG_CONSOLE_DEV "\0" \
+       "fdt_high=0xffffffff\0"   \
+       "initrd_high=0xffffffff\0" \
+       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+       "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
+       "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+       "update_sd_firmware=" \
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "if mmc dev ${mmcdev}; then "   \
+                       "if ${get_cmd} ${update_sd_firmware_filename}; then " \
+                               "setexpr fw_sz ${filesize} / 0x200; " \
+                               "setexpr fw_sz ${fw_sz} + 1; "  \
+                               "mmc write ${loadaddr} " __stringify(MMC_WRITE_OFFSET) " ${fw_sz}; " \
+                       "fi; "  \
+               "fi\0" \
+       "mmcargs=setenv bootargs console=${console},${baudrate} " \
+               "root=${mmcroot}\0" \
+       "loadbootscript=" \
+               __stringify(MMC_SCRIPT_FILESYSTEM)"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+       "loadimage=" \
+               __stringify(MMC_SCRIPT_FILESYSTEM)"load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
+       "loadfdt=" \
+               __stringify(MMC_SCRIPT_FILESYSTEM) "load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+       "mmcboot=echo Booting from mmc ...; " \
+               "run mmcargs; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if run loadfdt; then " \
+                               "boot" CONFIG_BOOT_SUFFIX " ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "boot" CONFIG_BOOT_SUFFIX "; " \
+                               "else " \

include/configs/default_env.h line 98

Quoted 10 lines
include/configs/default_env.h new file +10 -0
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "boot" CONFIG_BOOT_SUFFIX "; " \
+               "fi;\0" \
+       "netargs=setenv bootargs console=${console},${baudrate} " \
+               "root=/dev/nfs " \
+               "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+       "netboot=echo Booting from net ...; " \
Quoted 1 line

netboot and mmc might be split; some board may don't have ethernet or mmc.

Fully agree. We need also quite the same for NAND. Marek has already prepared (he sended to me out of the list) an environment for NAND based boards (m28evk and m52evk). I will try to merge all together and see what's happen. My hope is that we can find a common set of scripts/rules for the environment that can be used directly by the boards.

Quoted 26 lines
Quoted 26 lines
include/configs/default_env.h new file +25 -0
+               "run netargs; " \
+               "if test ${ip_dyn} = yes; then " \
+                       "setenv get_cmd dhcp; " \
+               "else " \
+                       "setenv get_cmd tftp; " \
+               "fi; " \
+               "${get_cmd} ${image}; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+                               "boot" CONFIG_BOOT_SUFFIX " ${loadaddr} - ${fdt_addr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "boot" CONFIG_BOOT_SUFFIX "; " \
+                               "else " \
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "boot" CONFIG_BOOT_SUFFIX "; " \
+               "fi;\0"
+
+#define CONFIG_BOOTCOMMAND \
+       "mmc dev ${mmcdev};" \
+       "if mmc rescan; then " \
+               "if run loadbootscript; then " \
Quoted 8 lines

include/configs/default_env.h line 131

Quoted 8 lines
include/configs/default_env.h new file +8 -0
+               "run bootscript; " \
+               "else " \
+                       "if run loadimage; then " \
+                               "run mmcboot; " \
+                       "else run netboot; " \
+                       "fi; " \
+               "fi; " \
+       "else run netboot; fi"

Or we can do as it is done in include/configs/tegra-common-post.h

Quoted 5 lines

include/configs/hummingboard.h

Quoted 5 lines
include/configs/default_env.h new file +1 -0
+#endif
include/configs/hummingboard.h +0 -0
index ac65620..5c00c4b 100644

I think the sense is clear - we can try first to concentrate on the common file (default_env_imx.h), and then we can move the boards to use it.

Quoted 105 lines
Quoted 105 lines
include/configs/hummingboard.h +3 -77
@@ -90,93 +90,19 @@
 #define CONFIG_DEFAULT_FDT_FILE                "imx6dl-hummingboard.dtb"
 #endif
 
-#define CONFIG_EXTRA_ENV_SETTINGS \
-       "script=boot.scr\0" \
-       "image=zImage\0" \
+#define CONFIG_PREFIX_IMAGE z
+
+#define CONFIG_BOARD_EXTRA_ENV_SETTINGS \
        "console=ttymxc0\0" \
        "splashpos=m,m\0" \
        "fdt_high=0xffffffff\0" \
        "initrd_high=0xffffffff\0" \
-       "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
        "fdt_addr=0x18000000\0" \
        "boot_fdt=try\0" \
        "ip_dyn=yes\0" \
        "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \
        "mmcpart=1\0" \
        "mmcroot=/dev/mmcblk0p2 rootwait rw\0" \
-       "update_sd_firmware_filename=u-boot.imx\0" \
-       "update_sd_firmware=" \
-               "if test ${ip_dyn} = yes; then " \
-                       "setenv get_cmd dhcp; " \
-               "else " \
-                       "setenv get_cmd tftp; " \
-               "fi; " \
-               "if mmc dev ${mmcdev}; then "   \
-                       "if ${get_cmd} ${update_sd_firmware_filename}; then " \
-                               "setexpr fw_sz ${filesize} / 0x200; " \
-                               "setexpr fw_sz ${fw_sz} + 1; "  \
-                               "mmc write ${loadaddr} 0x2 ${fw_sz}; " \
-                       "fi; "  \
-               "fi\0" \
-       "mmcargs=setenv bootargs console=${console},${baudrate} " \
-               "root=${mmcroot}\0" \
-       "loadbootscript=" \
-               "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
-       "bootscript=echo Running bootscript from mmc ...; " \
-               "source\0" \
-       "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
-       "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
-       "mmcboot=echo Booting from mmc ...; " \
-               "run mmcargs; " \
-               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
-                       "if run loadfdt; then " \
-                               "bootz ${loadaddr} - ${fdt_addr}; " \
-                       "else " \
-                               "if test ${boot_fdt} = try; then " \
-                                       "bootz; " \
-                               "else " \
-                                       "echo WARN: Cannot load the DT; " \
-                               "fi; " \
-                       "fi; " \
-               "else " \
-                       "bootz; " \
-               "fi;\0" \
-       "netargs=setenv bootargs console=${console},${baudrate} " \
-               "root=/dev/nfs " \
-       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
-               "netboot=echo Booting from net ...; " \
-               "run netargs; " \
-               "if test ${ip_dyn} = yes; then " \
-                       "setenv get_cmd dhcp; " \
-               "else " \
-                       "setenv get_cmd tftp; " \
-               "fi; " \
-               "${get_cmd} ${image}; " \
-               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
-                       "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
-                               "bootz ${loadaddr} - ${fdt_addr}; " \
-                       "else " \
-                               "if test ${boot_fdt} = try; then " \
-                                       "bootz; " \
-                               "else " \
-                                       "echo WARN: Cannot load the DT; " \
-                               "fi; " \
-                       "fi; " \
-               "else " \
-                       "bootz; " \
-               "fi;\0"
-
-#define CONFIG_BOOTCOMMAND \
-          "mmc dev ${mmcdev}; if mmc rescan; then " \
-                  "if run loadbootscript; then " \
-                          "run bootscript; " \
-                  "else " \
-                          "if run loadimage; then " \
-                                  "run mmcboot; " \
-                          "else run netboot; " \
-                          "fi; " \
-                  "fi; " \
-          "else run netboot; fi"
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP
include/configs/mx23_olinuxino.h +0 -0
index e377fea..08df31d 100644
@@ -71,9 +71,17 @@
 #define CONFIG_LOADADDR                0x42000000
 #define CONFIG_SYS_LOAD_ADDR   CONFIG_LOADADDR
 
Quoted 16 lines
Quoted 4 lines
include/configs/mx23_olinuxino.h +1 -3
-/* Extra Environment */
-#define CONFIG_EXTRA_ENV_SETTINGS \
-       "update_sd_firmware_filename=u-boot.sd\0" \
+#define CONFIG_DEFAULT_FDT_FILE "imx23-olinuxino.dtb"

include/configs/mx23_olinuxino.h line 84

Quoted 10 lines
include/configs/mx23_olinuxino.h +10 -0
+#define MMC_WRITE_OFFSET 0x800
+
+#define CONFIG_BOARD_EXTRA_ENV_SETTINGS \
+       "boot_fdt=try\0" \
+       "ip_dyn=yes\0" \
+       "mmcdev=0\0" \
+       "mmcpart=2\0" \
+       "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
+       "console=ttyAMA0\0" \
+       "fdt_addr=0x41000000\0" \

I think this can reuse the common setting.

Do you mean only for fdt_addr ? Yes, agree.

Quoted 3 lines

Basically I do like this idea and I would like to help in getting it as good and as flexible as possible; this reduces a lot the maintenance burden and easy customization to all of us.

Fully agree.

Regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw
In reply to Stefano Babic
Quoted 11 lines · On Fri, 14 Feb 2014 16:06:55 +0100 Stefano Babic <[email protected]> wrote:
CC Fabio Estevam <[email protected]>
CC Otavio Salvador <[email protected]>
CC Marek Vasut <[email protected]>
CC Leo Sartre <[email protected]>
CC Jon Nettleton <[email protected]>
CC Eric Nelson <[email protected]>
CC b18965 at freescale.com

Hi everybody,

Quoted 8 lines

the current built-in environment in most i.MX boards is very similar. Even if I always thought that the default environemt is something that the user want always customize, I see from all you submitters the not hidden desire to have such a common default environment for all boards. At least, for i.MX boards.
Checking in the board configuration files, I see at least the following boards that hase "quite" the same built-in environment:

I'm working on building a common set environment based on the work by Stephen Warren for tegra, that would provide for a very usable experience.

Its the next step forward from the distro config options. Id rather us get a solution that works across the board than something different per soc family. looking at how tegra is being done should provide a solid guide.

Dennis

#4 lore raw

Hi Dennis,

Quoted 23 lines · Dennis Gilmore
Quoted 11 lines · On Fri, 14 Feb 2014 16:06:55 +0100 Stefano Babic <[email protected]> wrote:
CC Fabio Estevam <[email protected]>
CC Otavio Salvador <[email protected]>
CC Marek Vasut <[email protected]>
CC Leo Sartre <[email protected]>
CC Jon Nettleton <[email protected]>
CC Eric Nelson <[email protected]>
CC b18965 at freescale.com

Hi everybody,

Quoted 8 lines

the current built-in environment in most i.MX boards is very similar. Even if I always thought that the default environemt is something that the user want always customize, I see from all you submitters the not hidden desire to have such a common default environment for all boards. At least, for i.MX boards.
Checking in the board configuration files, I see at least the following boards that hase "quite" the same built-in environment:

Quoted 7 lines

I'm working on building a common set environment based on the work by Stephen Warren for tegra, that would provide for a very usable experience.

Its the next step forward from the distro config options. Id rather us get a solution that works across the board than something different per soc family.

Fully agree. I will check again tegra-common-post.h. As far as I have understood, the built-in environment for Tegra sets a minimal set of rules and scripts that allow to load a full environment from another script stored on a media (mmc or usb). This is also a good statement, because the environment is not so fine defined and let easy customization.

Quoted 2 lines

looking at how tegra is being done should provide a solid guide.

Thanks,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw
Quoted 34 lines · Stefano Babic

Hi Dennis,

Quoted 23 lines · Dennis Gilmore
Quoted 11 lines · On Fri, 14 Feb 2014 16:06:55 +0100 Stefano Babic <[email protected]> wrote:
CC Fabio Estevam <[email protected]>
CC Otavio Salvador <[email protected]>
CC Marek Vasut <[email protected]>
CC Leo Sartre <[email protected]>
CC Jon Nettleton <[email protected]>
CC Eric Nelson <[email protected]>
CC b18965 at freescale.com

Hi everybody,

Quoted 8 lines

the current built-in environment in most i.MX boards is very similar. Even if I always thought that the default environemt is something that the user want always customize, I see from all you submitters the not hidden desire to have such a common default environment for all boards. At least, for i.MX boards.
Checking in the board configuration files, I see at least the following boards that hase "quite" the same built-in environment:

Quoted 7 lines

I'm working on building a common set environment based on the work by Stephen Warren for tegra, that would provide for a very usable experience.

Its the next step forward from the distro config options. Id rather us get a solution that works across the board than something different per soc family.

Quoted 5 lines

Fully agree. I will check again tegra-common-post.h. As far as I have understood, the built-in environment for Tegra sets a minimal set of rules and scripts that allow to load a full environment from another script stored on a media (mmc or usb). This is also a good statement, because the environment is not so fine defined and let easy customization.

Dan has adapted the tegra form to work with the TI boards that use ti_armv7_common.h and similar so I think we should be able to get i.MX also using something similar.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140218/c5605e2c/attachment.pgp>
#6 lore raw
In reply to Stefano Babic

Dear Stefano Babic,

include/configs/cgtqmx6eval.h line 80

Quoted 6 lines · In message <[email protected]> you wrote:
include/configs/cgtqmx6eval.h +5 -0
+#define CONFIG_PREFIX_IMAGE "z" 
+#define CONFIG_MMCROOT	"/dev/mmcblk0p1"
+#define CONFIG_CONSOLE_DEV "ttymxc1"
+
+#define CONFIG_BOARD_EXTRA_ENV_SETTINGS \

Please keep in mind that all new CONFIG_ setting must be properly documented in the README.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The optimum committee has no members.
                                                   - Norman Augustine