Patchwork [U-Boot,V4,4/5] ARM: OMAP4/5: Change the default boot command to work with device tree

login
register
mail settings
Submitter SRICHARAN R
Date April 1, 2013, 3:52 p.m.
Message ID <1364831562-28868-5-git-send-email-r.sricharan@ti.com>
Download mbox | patch
Permalink /patch/232775/
State Changes Requested
Delegated to: Tom Rini
Headers show

Comments

SRICHARAN R - April 1, 2013, 3:52 p.m.
Now with kernel moving to all device tree, the default
boot command is changed to pass the device tree blob.
Also, adding the findfdt command to get the dt-blob
based on the board.

Thanks to Tom Rini <trini@ti.com> for suggesting this.

Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
[V4] Added environment variables bootdir, bootpart
     and added loadimage, loadfdt commands as per
     Tom's suggestion.

 include/configs/omap4_common.h |   22 +++++++++++++++++++---
 include/configs/omap5_common.h |   20 +++++++++++++++++---
 2 files changed, 36 insertions(+), 6 deletions(-)
Tom Rini - April 1, 2013, 7:20 p.m.
On Mon, Apr 01, 2013 at 09:22:41PM +0530, Sricharan R wrote:

> Now with kernel moving to all device tree, the default
> boot command is changed to pass the device tree blob.
> Also, adding the findfdt command to get the dt-blob
> based on the board.
> 
> Thanks to Tom Rini <trini@ti.com> for suggesting this.
> 
> Signed-off-by: Sricharan R <r.sricharan@ti.com>
[snip]
> @@ -145,6 +149,10 @@
>  	"loadaddr=0x82000000\0" \
>  	"console=ttyO2,115200n8\0" \
>  	"fdt_high=0xffffffff\0" \
> +	"fdtaddr=0x80f80000\0" \
> +	"bootpart=0:1\0" \
> +	"bootdir=\0" \
> +	"bootfile=uImage\0" \

What about 0:2 and /boot, ala am335x_evm as well?  I'm not aware of any
distributions being really clever and mounting the FAT partition to
/boot and I know some that have been expecting and using their
ext*-located kernels for a while for various TI platforms.  And wer're
moving in that latter direction too :)  Thanks!
SRICHARAN R - April 2, 2013, 3:33 p.m.
Hi Tom,

On Tuesday 02 April 2013 12:50 AM, Tom Rini wrote:
> On Mon, Apr 01, 2013 at 09:22:41PM +0530, Sricharan R wrote:
> 
>> Now with kernel moving to all device tree, the default
>> boot command is changed to pass the device tree blob.
>> Also, adding the findfdt command to get the dt-blob
>> based on the board.
>>
>> Thanks to Tom Rini <trini@ti.com> for suggesting this.
>>
>> Signed-off-by: Sricharan R <r.sricharan@ti.com>
> [snip]
>> @@ -145,6 +149,10 @@
>>  	"loadaddr=0x82000000\0" \
>>  	"console=ttyO2,115200n8\0" \
>>  	"fdt_high=0xffffffff\0" \
>> +	"fdtaddr=0x80f80000\0" \
>> +	"bootpart=0:1\0" \
>> +	"bootdir=\0" \
>> +	"bootfile=uImage\0" \
> 
> What about 0:2 and /boot, ala am335x_evm as well?  I'm not aware of any
> distributions being really clever and mounting the FAT partition to
> /boot and I know some that have been expecting and using their
> ext*-located kernels for a while for various TI platforms.  And wer're
> moving in that latter direction too :)  Thanks!
> 
  Sorry, i am not clear here. You mean default partition should be '2' and
  not '1'. why ?. Is there any ordering like FAT-1, EXT2-2, etc ?
  The reason i added 0:1, was we generally have boot FAT as partition '1'
  and directly take images from there, without any hierarchies (/boot)

Regards,
 Sricharan
Tom Rini - April 2, 2013, 4:13 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/02/2013 11:33 AM, Sricharan R wrote:
> Hi Tom,
> 
> On Tuesday 02 April 2013 12:50 AM, Tom Rini wrote:
>> On Mon, Apr 01, 2013 at 09:22:41PM +0530, Sricharan R wrote:
>> 
>>> Now with kernel moving to all device tree, the default boot
>>> command is changed to pass the device tree blob. Also, adding
>>> the findfdt command to get the dt-blob based on the board.
>>> 
>>> Thanks to Tom Rini <trini@ti.com> for suggesting this.
>>> 
>>> Signed-off-by: Sricharan R <r.sricharan@ti.com>
>> [snip]
>>> @@ -145,6 +149,10 @@ "loadaddr=0x82000000\0" \ 
>>> "console=ttyO2,115200n8\0" \ "fdt_high=0xffffffff\0" \ +
>>> "fdtaddr=0x80f80000\0" \ +	"bootpart=0:1\0" \ +	"bootdir=\0" \ 
>>> +	"bootfile=uImage\0" \
>> 
>> What about 0:2 and /boot, ala am335x_evm as well?  I'm not aware
>> of any distributions being really clever and mounting the FAT
>> partition to /boot and I know some that have been expecting and
>> using their ext*-located kernels for a while for various TI
>> platforms.  And wer're moving in that latter direction too :)
>> Thanks!
>> 
> Sorry, i am not clear here. You mean default partition should be
> '2' and not '1'. why ?. Is there any ordering like FAT-1, EXT2-2,
> etc ? The reason i added 0:1, was we generally have boot FAT as
> partition '1' and directly take images from there, without any
> hierarchies (/boot)

Right.  I'm saying we should be pulling from the Linux filesystem for
our kernel / device tree and move people toward pulling from EXT*
(where the distro or vendor has provided them with a reasonable
kernel, or they've updated their own there) and away from FAT.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRWwONAAoJENk4IS6UOR1WnNsP/2H1huM1H3Ii+DtanBGyRBKu
+dqQaNB/N2GJ6GjyJv7etxvs6BV5I7n5LaP40Tp8M9m8O7cMBvjXGFqFi1+/Tngo
zuQTu7UHcfsDO4fp3mNoYvj0e74M4bPoWqgOh5HxRifTwzoB4JeFvRH9OsahjFDu
AUtL9XdyZolHBukJHUS0NHEe4Z/k66IglXw+dlJJaIG4Gz32qyp3sz8FgxlYiA/9
Wn0gR/mOj0boVKK03HNi7Twfwlyj67oAUsekI0boDbwr292++3+zBqsccBv9t3Jo
354+XcUUXY8en2v6oFPp/54Tno0qO3ix4YzG3eB1GNmdF564KGkPFlLGALGl/d95
mearLR2wH2ejZ5X9O2q72tdTNDQ5eBSVWVvb2DjzXVIDQ1v9gQ76FvqGpPiYYxrt
kQF4ghO5/hisWFtEXgoDDEbWp9ywVDRJpDLmo6e8yg06j+2z3Atg+iEFdVrTnSNu
Blarhi3nGVOHoVDFRnvlyGMp+30b1YkCwoxy3+ocYuWgcctWJMnOvb+x8rKGVgNU
irjJAztBAjN0LLivwYMNL8grHaSqCoTdKhM/9Ocm9wi9gHMLGA5+pPfpMampIMX2
7fKP0rgR53S+ycPxF7U/yjwJ6jT8QqYjpTZywI02+88q2iV5gWeDQv91tnjEsyhA
T8dz3YqF94lmFMD0HWDU
=+duh
-----END PGP SIGNATURE-----
SRICHARAN R - April 2, 2013, 5:07 p.m.
On Tuesday 02 April 2013 09:43 PM, Tom Rini wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 04/02/2013 11:33 AM, Sricharan R wrote:
>> Hi Tom,
>>
>> On Tuesday 02 April 2013 12:50 AM, Tom Rini wrote:
>>> On Mon, Apr 01, 2013 at 09:22:41PM +0530, Sricharan R wrote:
>>>
>>>> Now with kernel moving to all device tree, the default boot
>>>> command is changed to pass the device tree blob. Also, adding
>>>> the findfdt command to get the dt-blob based on the board.
>>>>
>>>> Thanks to Tom Rini <trini@ti.com> for suggesting this.
>>>>
>>>> Signed-off-by: Sricharan R <r.sricharan@ti.com>
>>> [snip]
>>>> @@ -145,6 +149,10 @@ "loadaddr=0x82000000\0" \ 
>>>> "console=ttyO2,115200n8\0" \ "fdt_high=0xffffffff\0" \ +
>>>> "fdtaddr=0x80f80000\0" \ +	"bootpart=0:1\0" \ +	"bootdir=\0" \ 
>>>> +	"bootfile=uImage\0" \
>>>
>>> What about 0:2 and /boot, ala am335x_evm as well?  I'm not aware
>>> of any distributions being really clever and mounting the FAT
>>> partition to /boot and I know some that have been expecting and
>>> using their ext*-located kernels for a while for various TI
>>> platforms.  And wer're moving in that latter direction too :)
>>> Thanks!
>>>
>> Sorry, i am not clear here. You mean default partition should be
>> '2' and not '1'. why ?. Is there any ordering like FAT-1, EXT2-2,
>> etc ? The reason i added 0:1, was we generally have boot FAT as
>> partition '1' and directly take images from there, without any
>> hierarchies (/boot)
> 
> Right.  I'm saying we should be pulling from the Linux filesystem for
> our kernel / device tree and move people toward pulling from EXT*
> (where the distro or vendor has provided them with a reasonable
> kernel, or they've updated their own there) and away from FAT.
> 
 ok, get it. Will change then.

Regards,
 Sricharan

Patch

diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h
index 6ae6a0f..18cd98f 100644
--- a/include/configs/omap4_common.h
+++ b/include/configs/omap4_common.h
@@ -138,6 +138,10 @@ 
  */
 
 #define CONFIG_BOOTDELAY	3
+#define CONFIG_ENV_VARS_UBOOT_CONFIG
+#define CONFIG_CMD_FS_GENERIC
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_EXT4
 
 #define CONFIG_ENV_OVERWRITE
 
@@ -145,6 +149,10 @@ 
 	"loadaddr=0x82000000\0" \
 	"console=ttyO2,115200n8\0" \
 	"fdt_high=0xffffffff\0" \
+	"fdtaddr=0x80f80000\0" \
+	"bootpart=0:1\0" \
+	"bootdir=\0" \
+	"bootfile=uImage\0" \
 	"usbtty=cdc_acm\0" \
 	"vram=16M\0" \
 	"mmcdev=0\0" \
@@ -160,12 +168,19 @@ 
 	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \
 	"importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
 		"env import -t ${loadaddr} ${filesize}\0" \
-	"loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
+	"loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
 	"mmcboot=echo Booting from mmc${mmcdev} ...; " \
 		"run mmcargs; " \
-		"bootm ${loadaddr}\0" \
+		"bootm ${loadaddr} - ${fdtaddr}\0" \
+	"findfdt="\
+		"if test $board_name = sdp4430; then " \
+			"setenv fdtfile omap4-sdp.dtb; fi; " \
+		"if test $board_name = panda; then " \
+			"setenv fdtfile omap4-panda-es.dtb; fi\0" \
+	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
 
 #define CONFIG_BOOTCOMMAND \
+	"run findfdt; " \
 	"mmc dev ${mmcdev}; if mmc rescan; then " \
 		"echo SD/MMC found on device ${mmcdev};" \
 		"if run loadbootscript; then " \
@@ -179,7 +194,8 @@ 
 				"run uenvcmd;" \
 			"fi;" \
 		"fi;" \
-		"if run loaduimage; then " \
+		"if run loadimage; then " \
+			"run loadfdt;" \
 			"run mmcboot; " \
 		"fi; " \
 	"fi"
diff --git a/include/configs/omap5_common.h b/include/configs/omap5_common.h
index 6d7aa7b..24c9ecc 100644
--- a/include/configs/omap5_common.h
+++ b/include/configs/omap5_common.h
@@ -137,6 +137,10 @@ 
  */
 
 #define CONFIG_BOOTDELAY	3
+#define CONFIG_ENV_VARS_UBOOT_CONFIG
+#define CONFIG_CMD_FS_GENERIC
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_EXT4
 
 #define CONFIG_ENV_OVERWRITE
 
@@ -144,6 +148,10 @@ 
 	"loadaddr=0x82000000\0" \
 	"console=ttyO2,115200n8\0" \
 	"fdt_high=0xffffffff\0" \
+	"fdtaddr=0x80f80000\0" \
+	"bootpart=0:1\0" \
+	"bootdir=\0" \
+	"bootfile=uImage\0" \
 	"usbtty=cdc_acm\0" \
 	"vram=16M\0" \
 	"mmcdev=0\0" \
@@ -159,12 +167,17 @@ 
 	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \
 	"importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
 		"env import -t ${loadaddr} ${filesize}\0" \
-	"loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
+	"loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
 	"mmcboot=echo Booting from mmc${mmcdev} ...; " \
 		"run mmcargs; " \
-		"bootm ${loadaddr}\0" \
+		"bootm ${loadaddr} - ${fdtaddr}\0" \
+	"findfdt="\
+		"if test $board_name = omap5_uevm; then " \
+			"setenv fdtfile omap5-uevm.dtb; fi;\0 " \
+	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};\0" \
 
 #define CONFIG_BOOTCOMMAND \
+	"run findfdt; " \
 	"mmc dev ${mmcdev}; if mmc rescan; then " \
 		"if run loadbootscript; then " \
 			"run bootscript; " \
@@ -177,7 +190,8 @@ 
 				"run uenvcmd;" \
 			"fi;" \
 		"fi;" \
-		"if run loaduimage; then " \
+		"if run loadimage; then " \
+			"run loadfdt; " \
 			"run mmcboot; " \
 		"fi; " \
 	"fi"