Skip to contentSkip to conversation

arm: Tegra2: Add a useful default boot env

PATCH New Tom Warren 4 participants 10 messages Apr 20, 2012 – Apr 23, 2012 Tegra architecture support

lore
Share & tools
lore

Tom Warren

author
#0 lore raw

PATCH 1/1 arm: Tegra2: Add a useful default boot env

This set of boot cmds from Stephen Warren provides a simple default for booting a linux kernel and DT from mmc (eMMC or SD-Card, in that order). Tested on Seaboard w/an SD card.

---
 include/configs/tegra2-common.h |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
include/configs/tegra2-common.h +9 -3
index 068ce88..b8c08ef 100644
@@ -140,9 +140,15 @@
 					"stderr=serial\0"
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"console=ttyS0,115200n8\0" \
-	"mem=" TEGRA2_SYSMEM "\0" \
-	"smpflag=smp\0" \
+	"bootdelay=2\0" \
+	"bootcmd=run mmc1_boot ; run mmc0_boot\0" \
+	"mmc0_boot=setenv devnum 0; run mmc_boot;\0" \
+	"mmc1_boot=setenv devnum 1; run mmc_boot;\0" \
+	"mmc_boot=setenv devtype mmc;mmc dev ${devnum};run scr_boot;\0" \
+	"scriptaddr=0x400000\0" \
+	"script=/boot.scr.uimg\0" \
+	"scr_boot=ext2load ${devtype} ${devnum}:1 ${scriptaddr} ${script};" \
+		"source ${scriptaddr};\0" \
 	TEGRA2_DEVICE_SETTINGS
 
 #define CONFIG_LOADADDR		0x408000	/* def. location for kernel */
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 arm: Tegra2: Add a useful default boot env

include/configs/tegra2-common.h line 151

Quoted 11 lines · Tom Warren

This set of boot cmds from Stephen Warren provides a simple default for booting a linux kernel and DT from mmc (eMMC or SD-Card, in that order). Tested on Seaboard w/an SD card.

---

...

include/configs/tegra2-common.h +2 -0
+	"scr_boot=ext2load ${devtype} ${devnum}:1 ${scriptaddr} ${script};" \
+		"source ${scriptaddr};\0" \

Should this be fatload? From what I've seen most other boards load boot.scr from a FAT fs.

-Allen
nvpublic

#2 lore raw

PATCH 1/1 arm: Tegra2: Add a useful default boot env

Quoted 8 lines · Allen Martin
Quoted 7 lines · Tom Warren

This set of boot cmds from Stephen Warren provides a simple default for booting a linux kernel and DT from mmc (eMMC or SD-Card, in that order). Tested on Seaboard w/an SD card.

---

Quoted 7 lines

include/configs/tegra2-common.h line 151

Quoted 4 lines

...

include/configs/tegra2-common.h +2 -0
+	"scr_boot=ext2load ${devtype} ${devnum}:1 ${scriptaddr} ${script};" \
+		"source ${scriptaddr};\0" \

Should this be fatload? From what I've seen most other boards load boot.scr from a FAT fs.

All depends on the distro, etc. Angstrom for example loads from ext* since then the kernel is provided by the distro and under package control.

Signature · 1 line
Tom
#3 lore raw

PATCH 1/1 arm: Tegra2: Add a useful default boot env

In reply to Tom Warren
Quoted 3 lines · Tom Warren

This set of boot cmds from Stephen Warren provides a simple default for booting a linux kernel and DT from mmc (eMMC or SD-Card, in that order). Tested on Seaboard w/an SD card.

...

Quoted 1 line
include/configs/tegra2-common.h +0 -0

...

Quoted 1 line

#define CONFIG_EXTRA_ENV_SETTINGS \

...

include/configs/tegra2-common.h line 149

Quoted 1 line
include/configs/tegra2-common.h +1 -0
+	"script=/boot.scr.uimg\0" \

It might be best to make that just /boot.scr. The reason being that I looked at the Ubuntu Precise images for OMAP, and they don't have ".uimg" in the filename, even though they're uImage files. It's probably best to be consistent with the Ubuntu images given the only other precedent is what I do locally, which can easily be adjusted.

author
#4 lore raw

PATCH 1/1 arm: Tegra2: Add a useful default boot env

Stephen,

Quoted 8 lines · Stephen Warren
Quoted 3 lines · Tom Warren

This set of boot cmds from Stephen Warren provides a simple default for booting a linux kernel and DT from mmc (eMMC or SD-Card, in that order). Tested on Seaboard w/an SD card.

...

Quoted 1 line
include/configs/tegra2-common.h +0 -0

...

Quoted 1 line

?#define CONFIG_EXTRA_ENV_SETTINGS \

Quoted 8 lines

...

Quoted 1 line

+ ? ? "script=/boot.scr.uimg\0" \

It might be best to make that just /boot.scr. The reason being that I looked at the Ubuntu Precise images for OMAP, and they don't have ".uimg" in the filename, even though they're uImage files. It's probably best to be consistent with the Ubuntu images given the only other precedent is what I do locally, which can easily be adjusted.

I'll change it to /boot.scr, but do we have any stats on other/more distros and what they use?

As to using fat instead of ext2, this is just an example, and would be (should be) customized for each vendor/distro.
I could also add a USB boot example.

Tom

#5 lore raw

PATCH 1/1 arm: Tegra2: Add a useful default boot env

Quoted 14 lines · Tom Warren

Stephen,

Quoted 11 lines · Stephen Warren
Quoted 3 lines · Tom Warren

This set of boot cmds from Stephen Warren provides a simple default for booting a linux kernel and DT from mmc (eMMC or SD-Card, in that order). Tested on Seaboard w/an SD card.

...

Quoted 1 line
include/configs/tegra2-common.h +0 -0

...

Quoted 1 line

#define CONFIG_EXTRA_ENV_SETTINGS \

...

Quoted 1 line

+ "script=/boot.scr.uimg\0" \

Quoted 8 lines
Quoted 5 lines

It might be best to make that just /boot.scr. The reason being that I looked at the Ubuntu Precise images for OMAP, and they don't have ".uimg" in the filename, even though they're uImage files. It's probably best to be consistent with the Ubuntu images given the only other precedent is what I do locally, which can easily be adjusted.

I'll change it to /boot.scr, but do we have any stats on other/more distros and what they use?

I don't believe any other distros are creating packages/images for Tegra yet.

Quoted 3 lines

As to using fat instead of ext2, this is just an example, and would be (should be) customized for each vendor/distro.
I could also add a USB boot example.

Really, we should be defining the boot architecture for Tegra, and distros following suite. So, I think we should just say:

* Partition 1 of the media is /boot.
* Partition 1 should be ext2 or compatible.
* boot.scr should exist there and be a uImage script file.

Distros certainly can't customize the U-Boot environment for themselves, since there's no generally applicable way of doing so. That's exactly why I pushed to load a boot.scr rather than having U-Boot load the kernel directly (and define the command-line), to give distros the ability to customize boot.scr; generating files in a filesystem is much easier for distros.

#6 lore raw

PATCH 1/1 arm: Tegra2: Add a useful default boot env

Quoted 1 line · Stephen Warren

On 04/23/2012 10:22 AM, Tom Warren wrote:

[snip]

Quoted 2 lines

Distros certainly can't customize the U-Boot environment for themselves, since there's no generally applicable way of doing so. That's exactly

That is (very recently) no longer true! We've had for a while now the ability to append to the environment from a file and much more recently the ability for the whole environment to be a plain text file read from FAT (and written back to). And to repeat what I just now said in another email, I'd really like it if we can come up with something that's common across multiple SoCs.

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/20120423/0d099bf4/attachment.pgp>
#7 lore raw

PATCH 1/1 arm: Tegra2: Add a useful default boot env

In reply to Tom Warren
Quoted 14 lines · Tom Warren

Stephen,

Quoted 11 lines · Stephen Warren
Quoted 3 lines · Tom Warren

This set of boot cmds from Stephen Warren provides a simple default for booting a linux kernel and DT from mmc (eMMC or SD-Card, in that order). Tested on Seaboard w/an SD card.

...

Quoted 1 line
include/configs/tegra2-common.h +0 -0

...

Quoted 1 line

?#define CONFIG_EXTRA_ENV_SETTINGS \

...

Quoted 1 line

+ ? ? "script=/boot.scr.uimg\0" \

Quoted 8 lines
Quoted 5 lines

It might be best to make that just /boot.scr. The reason being that I looked at the Ubuntu Precise images for OMAP, and they don't have ".uimg" in the filename, even though they're uImage files. It's probably best to be consistent with the Ubuntu images given the only other precedent is what I do locally, which can easily be adjusted.

I'll change it to /boot.scr, but do we have any stats on other/more distros and what they use?

Can I suggest that instead of using boot.scr files we just use a text file that can be imported to the environment and a command run? The omap3_beagle example (uEnv.txt + uenvcmd) is something I plan to propogate to more TI boards and I think it'd be good if we picked it up on other SoCs. Or came up with a better plan for everyone :) The main benefit of uEnv.txt over boot.scr is that it's now plain text, rather than text that needs to be mkimage'd at each change.

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/20120423/1741a6db/attachment.pgp>
#8 lore raw

PATCH 1/1 arm: Tegra2: Add a useful default boot env

Quoted 21 lines · Tom Rini
Quoted 20 lines · Tom Warren

Stephen,

Quoted 16 lines · Stephen Warren
Quoted 3 lines · Tom Warren

This set of boot cmds from Stephen Warren provides a simple default for booting a linux kernel and DT from mmc (eMMC or SD-Card, in that order). Tested on Seaboard w/an SD card.

...

Quoted 1 line
include/configs/tegra2-common.h +0 -0

...

Quoted 1 line

?#define CONFIG_EXTRA_ENV_SETTINGS \

...

Quoted 1 line

+ ? ? "script=/boot.scr.uimg\0" \

It might be best to make that just /boot.scr. The reason being that I looked at the Ubuntu Precise images for OMAP, and they don't have ".uimg" in the filename, even though they're uImage files. It's probably best to be consistent with the Ubuntu images given the only other precedent is what I do locally, which can easily be adjusted.

Quoted 5 lines
Quoted 2 lines

I'll change it to /boot.scr, but do we have any stats on other/more distros and what they use?

Can I suggest that instead of using boot.scr files we just use a text file that can be imported to the environment and a command run?

That sounds like a great idea; it avoids a mkimage call and generally simplifies things. Looking at the code, it's just a list of name=value, one per line.

TomW, I'd suggest looking at ./include/configs/omap3_beagle.h. In particular:

a) The load from MMC is only attempted if "mmc rescan" succeeds, rather than just blasting through the script with lots of failures. The hush shell might be needed for this; is it enabled on Tegra?

b) See the macros loadbootenv/importbootenv which are the replacement for boot.scr.

TomR, is there a reason OMAP3 uses FAT for /boot rather than ext2? Perhaps it's due to the need to load intermediate boot loaders from the filesystem, and that code needs FAT? On Tegra, we jump straight to U-Boot from the boot ROM without the need for intermediate filesystem access, and could make /boot ext2 - do you see any reason not to do this?

#9 lore raw

PATCH 1/1 arm: Tegra2: Add a useful default boot env

On Mon, Apr 23, 2012 at 11:39:30AM -0600, Stephen Warren wrote:

[snip]

Quoted 5 lines

TomR, is there a reason OMAP3 uses FAT for /boot rather than ext2? Perhaps it's due to the need to load intermediate boot loaders from the filesystem, and that code needs FAT? On Tegra, we jump straight to U-Boot from the boot ROM without the need for intermediate filesystem access, and could make /boot ext2 - do you see any reason not to do this?

Correct. Our ROMs will read FAT looking for 'MLO' (which is u-boot-spl these days) and that loads U-Boot. It can also raw read the card. The other reason for having the first partition be FAT by default is ease of replacement since everything can read/write FAT but ext2/3/4 is limited (largely/easily...) to Linux. Distro do change this behavior and Angstrom for example changes to ext2load (or ext4load) from /boot.

And I don't think omap3_beagle is perfect just yet. I really want to switch to the whole env being a file on the SD card, but I can't easily do that until we can tell at run time if we're on beagleboard classic or xM (which we can now) and then change where the environment is (we can't do that yet, but perhaps soon).

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/20120423/16690186/attachment.pgp>