diff mbox

[U-Boot] arm: Tegra2: Add a useful default boot env

Message ID 1334951458-31987-1-git-send-email-twarren@nvidia.com
State Superseded
Headers show

Commit Message

Tom Warren April 20, 2012, 7:50 p.m. UTC
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.

Signed-off-by: Tom Warren <twarren@nvidia.com>
---
 include/configs/tegra2-common.h |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

Comments

Allen Martin April 20, 2012, 8:24 p.m. UTC | #1
On Fri, Apr 20, 2012 at 12:50:58PM -0700, Tom Warren wrote:
> 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.
> 
> Signed-off-by: Tom Warren <twarren@nvidia.com>
> ---
>
> ...
>
> +	"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
Tom Rini April 20, 2012, 8:46 p.m. UTC | #2
On Fri, Apr 20, 2012 at 01:24:54PM -0700, Allen Martin wrote:
> On Fri, Apr 20, 2012 at 12:50:58PM -0700, Tom Warren wrote:
> > 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.
> > 
> > Signed-off-by: Tom Warren <twarren@nvidia.com>
> > ---
> >
> > ...
> >
> > +	"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.
Stephen Warren April 20, 2012, 9:40 p.m. UTC | #3
On 04/20/2012 01:50 PM, Tom Warren wrote:
> 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.
...
> diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
...
>  #define CONFIG_EXTRA_ENV_SETTINGS \
...
> +	"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.
Tom Warren April 23, 2012, 4:22 p.m. UTC | #4
Stephen,

On Fri, Apr 20, 2012 at 2:40 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 04/20/2012 01:50 PM, Tom Warren wrote:
>> 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.
> ...
>> diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
> ...
>>  #define CONFIG_EXTRA_ENV_SETTINGS \
> ...
>> +     "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
Stephen Warren April 23, 2012, 4:36 p.m. UTC | #5
On 04/23/2012 10:22 AM, Tom Warren wrote:
> Stephen,
> 
> On Fri, Apr 20, 2012 at 2:40 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 04/20/2012 01:50 PM, Tom Warren wrote:
>>> 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.
>> ...
>>> diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
>> ...
>>>  #define CONFIG_EXTRA_ENV_SETTINGS \
>> ...
>>> +     "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?

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

> 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.
Tom Rini April 23, 2012, 5:14 p.m. UTC | #6
On Mon, Apr 23, 2012 at 09:22:22AM -0700, Tom Warren wrote:
> Stephen,
> 
> On Fri, Apr 20, 2012 at 2:40 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> > On 04/20/2012 01:50 PM, Tom Warren wrote:
> >> 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.
> > ...
> >> diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
> > ...
> >> ?#define CONFIG_EXTRA_ENV_SETTINGS \
> > ...
> >> + ? ? "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?

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.
Tom Rini April 23, 2012, 5:17 p.m. UTC | #7
On Mon, Apr 23, 2012 at 10:36:37AM -0600, Stephen Warren wrote:
> On 04/23/2012 10:22 AM, Tom Warren wrote:
[snip]
> 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.
Stephen Warren April 23, 2012, 5:39 p.m. UTC | #8
On 04/23/2012 11:14 AM, Tom Rini wrote:
> On Mon, Apr 23, 2012 at 09:22:22AM -0700, Tom Warren wrote:
>> Stephen,
>>
>> On Fri, Apr 20, 2012 at 2:40 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>>> On 04/20/2012 01:50 PM, Tom Warren wrote:
>>>> 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.
>>> ...
>>>> diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
>>> ...
>>>> ?#define CONFIG_EXTRA_ENV_SETTINGS \
>>> ...
>>>> + ? ? "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?
> 
> 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?
Tom Rini April 23, 2012, 5:47 p.m. UTC | #9
On Mon, Apr 23, 2012 at 11:39:30AM -0600, Stephen Warren wrote:

[snip]
> 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).
diff mbox

Patch

diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
index 068ce88..b8c08ef 100644
--- a/include/configs/tegra2-common.h
+++ b/include/configs/tegra2-common.h
@@ -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 */