Patchwork [U-Boot,v3] mx51evk: Update environment in order to allow booting a dt kernel

login
register
mail settings
Submitter Fabio Estevam
Date April 19, 2013, 2:15 p.m.
Message ID <1366380924-27047-1-git-send-email-festevam@gmail.com>
Download mbox | patch
Permalink /patch/237986/
State Superseded
Delegated to: Stefano Babic
Headers show

Comments

Fabio Estevam - April 19, 2013, 2:15 p.m.
From: Fabio Estevam <fabio.estevam@freescale.com>

Update the environment as done in other imx boards to allow easy switching 
between booting a non-dt kernel and a dt kernel.

Change CONFIG_LOADADDR to 0x92000000, so that we can have the:

- uImage at 0x92000000
- imx51-babbage.dtb at 0x91000000 

,which are adequate locations in RAM to avoid overlapping.
 
Boot tested the following kernels:

- 2.6.35 from FSL (11.09 branch)
- 3.9-rc7 non-dt
- 3.9-rc7 dt

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v2:
- Mention the LOADADDR change in the commit log
Changes since v1:
- Do not remove mmcrootfstype
- Fix typo in Subject
- Improve commit log by adding the tested booted kernels

 include/configs/mx51evk.h |   42 +++++++++++++++++++++++++++++++++++++++---
 1 file changed, 39 insertions(+), 3 deletions(-)
Otavio Salvador - April 19, 2013, 3:31 p.m.
On Fri, Apr 19, 2013 at 11:15 AM, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Update the environment as done in other imx boards to allow easy switching
> between booting a non-dt kernel and a dt kernel.
>
> Change CONFIG_LOADADDR to 0x92000000, so that we can have the:
>
> - uImage at 0x92000000
> - imx51-babbage.dtb at 0x91000000
>
> ,which are adequate locations in RAM to avoid overlapping.
>
> Boot tested the following kernels:
>
> - 2.6.35 from FSL (11.09 branch)
> - 3.9-rc7 non-dt
> - 3.9-rc7 dt
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

So I think this patch could be split in two:

* one for loadaddr fix (which is the real fix here)
* another to sync the environment  with other boards (and thus doing
all the sync in a single patch)

What do you think?

--
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
Fabio Estevam - April 19, 2013, 4:11 p.m.
On Fri, Apr 19, 2013 at 12:31 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:

> So I think this patch could be split in two:

I do not agree.


> * one for loadaddr fix (which is the real fix here)

My patch does not do any fix. We are able to load a non-dt kernel currently.

I am adding a new feature: allow booting a dt kernel.
Otavio Salvador - April 19, 2013, 4:39 p.m.
On Fri, Apr 19, 2013 at 1:11 PM, Fabio Estevam <festevam@gmail.com> wrote:
> On Fri, Apr 19, 2013 at 12:31 PM, Otavio Salvador
> <otavio@ossystems.com.br> wrote:
>
>> So I think this patch could be split in two:
>
> I do not agree.
>
>
>> * one for loadaddr fix (which is the real fix here)
>
> My patch does not do any fix. We are able to load a non-dt kernel currently.
>
> I am adding a new feature: allow booting a dt kernel.

So in this case could you make a new patch to sync the other changes
in the env? So it is kept in sync and avoid divertion from other
boards we did it already?

--
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
Fabio Estevam - April 19, 2013, 4:50 p.m.
On Fri, Apr 19, 2013 at 1:39 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:

> So in this case could you make a new patch to sync the other changes
> in the env? So it is kept in sync and avoid divertion from other
> boards we did it already?

Sorry, but I don't plan have any plans to work on such cleanup.

I am not saying it is not important, just that I do not have the
bandwidth to work on this right now.

Feel free to submit patches for this env cleanup, if you like.
Otavio Salvador - April 19, 2013, 4:55 p.m.
On Fri, Apr 19, 2013 at 1:50 PM, Fabio Estevam <festevam@gmail.com> wrote:
> On Fri, Apr 19, 2013 at 1:39 PM, Otavio Salvador
> <otavio@ossystems.com.br> wrote:
>
>> So in this case could you make a new patch to sync the other changes
>> in the env? So it is kept in sync and avoid divertion from other
>> boards we did it already?
>
> Sorry, but I don't plan have any plans to work on such cleanup.
>
> I am not saying it is not important, just that I do not have the
> bandwidth to work on this right now.
>
> Feel free to submit patches for this env cleanup, if you like.

I don't have the board to test, neither I am working on the board, so
it more logical as you're changing it to make this change. It more
logical to make this now and avoid dealing with it in future again ...
isn't it?

--
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
Fabio Estevam - April 19, 2013, 5:09 p.m.
On Fri, Apr 19, 2013 at 1:55 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:

> I don't have the board to test, neither I am working on the board, so
> it more logical as you're changing it to make this change. It more
> logical to make this now and avoid dealing with it in future again ...
> isn't it?

Again, cleaning up the envs for all the imx boards is a huge effort
and beyond the scope of this patch.

Patch

diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
index cb3d938..4545a80 100644
--- a/include/configs/mx51evk.h
+++ b/include/configs/mx51evk.h
@@ -149,11 +149,15 @@ 
 
 #define CONFIG_ETHPRIME		"FEC0"
 
-#define CONFIG_LOADADDR		0x90800000	/* loadaddr env var */
+#define CONFIG_LOADADDR		0x92000000	/* loadaddr env var */
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"script=boot.scr\0" \
 	"uimage=uImage\0" \
+	"fdt_file=imx51-babbage.dtb\0" \
+	"fdt_addr=0x91000000\0" \
+	"boot_fdt=try\0" \
+	"ip_dyn=yes\0" \
 	"mmcdev=0\0" \
 	"mmcpart=2\0" \
 	"mmcroot=/dev/mmcblk0p3 rw\0" \
@@ -166,15 +170,47 @@ 
 	"bootscript=echo Running bootscript from mmc ...; " \
 		"source\0" \
 	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
 	"mmcboot=echo Booting from mmc ...; " \
 		"run mmcargs; " \
-		"bootm\0" \
+		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+			"if run loadfdt; then " \
+				"bootm ${loadaddr} - ${fdt_addr}; " \
+			"else " \
+				"if test ${boot_fdt} = try; then " \
+					"bootm; " \
+				"else " \
+					"echo WARN: Cannot load the DT; " \
+				"fi; " \
+			"fi; " \
+		"else " \
+			"bootm; " \
+		"fi;\0" \
 	"netargs=setenv bootargs console=ttymxc0,${baudrate} " \
 		"root=/dev/nfs " \
 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
 	"netboot=echo Booting from net ...; " \
 		"run netargs; " \
-		"dhcp ${uimage}; bootm\0" \
+		"if test ${ip_dyn} = yes; then " \
+			"setenv get_cmd dhcp; " \
+		"else " \
+			"setenv get_cmd tftp; " \
+		"fi; " \
+		"${get_cmd} ${uimage}; " \
+		"if test ${boot_fdt} = yes ||  test ${boot_fdt} = try; then " \
+			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+				"bootm ${loadaddr} - ${fdt_addr}; " \
+			"else " \
+				"if test ${boot_fdt} = try; then " \
+					"bootm; " \
+				"else " \
+					"echo ERROR: Cannot load the DT; " \
+					"exit; " \
+				"fi; " \
+			"fi; " \
+		"else " \
+			"bootm; " \
+		"fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
 	"mmc dev ${mmcdev}; if mmc rescan; then " \