[U-Boot] [RFC PATCH 1/3] add file with a default boot environment based heavily on Stephen Warrens recent tegra work.

Stephen Warren
2014-02-19T17:40:15Z

On 02/17/2014 10:56 AM, Dennis Gilmore wrote:
> Signed-off-by: Dennis Gilmore <dennis@ausil.us>

Patch description?

> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h

> +#ifndef _CONFIG_CMD_DISTRO_BOOTCMD_H
> +#define _CONFIG_CMD_DISTRO_BOOTCMD_H
> +
> +

Is there a need for 2 blank lines there?

> +#define BOOTCMDS_COMMON \
> + "rootpart=1\0" \

We should really stop hard-coding that. I meant to (but evidently never
got around to) re-write the commands so that they could automatically
determine which partition to use, based on the MBR bootable flag or GPT
partition flags.

Still, we can probably make that enhancement separately later.

> +#define BOOT_TARGETS_MMC "mmc1 mmc0"

We really ought to make the order of multiple MMC devices in
BOOT_TARGETS configurable. For example, we may have 2 boards that both
want to boot from SD card if present, else fall back to internal eMMC,
yet one has mmc0=eMMC,mmc1=SD, and the other mmc0=SD,mmc1=eMMC. On
Tegra, we're just lucky that hasn't been an issue yet. Equally, not all
boards have 2 eMMC devices.

> + "scan_boot=" \
> + "echo Scanning ${devtype} ${devnum}...; " \
> + "for prefix in ${boot_prefixes}; do " \
> + "run sysboot_boot; " \
> + "run envimport; " \
> + "run script_boot; " \

This isn't quite right for the Raspberry Pi at least.

What I wanted was for uEnv.txt to *always* be loaded from SD card before
any other boot activity. The SD card is known to exist on this platform,
since it's the only place the SoC's boot ROM can load the initial binary
firmware from.

The idea is that since the Pi has nowhere to store any environment, and
the default environment's boot_targets is hard-coded in the U-Boot
binary, we need some way for the user to configure the value of
boot_targets to e.g. force network or USB boot. We want to do this
before executing bootcmd, so that bootcmd looks at the user's desired
boot_targets, rather than part way through executing bootcmd, which is
far too late.

Now, on the Pi, this all happens via CONFIG_PREBOOT, so it will still
work even with the "run envimport" as above. However, I think we want to
make the "run envimport" within scan_boot optional, so it doesn't get
repeated.

I wouldn't be surprised if other platforms ought to be working in the
exact same way?

> + "boot_targets=" \
> + BOOT_TARGETS_MMC " " \
> + BOOT_TARGETS_USB " " \
> + BOOT_TARGETS_SATA " " \
> + BOOT_TARGETS_PXE " " \
> + BOOT_TARGETS_DHCP " " \
> + "\0" \

I'd be tempted to require the board-specific config to set boot_targets,
so that appropriate customization can be applied?

> + "boot_envs=uEnv.txt\0" \

I wonder if boards want to customize that for backwards-compatibility?