[U-Boot] [PATCH 2/6] add header with a generic set of boot commands defined.

Marek Vasut
2014-03-21T18:37:52Z

On Thursday, March 20, 2014 at 11:12:57 PM, Dennis Gilmore wrote:
> As the next step in a generic config we are introducing a set of generic
> boot paramaters. Depending on the hardwares configuration, booting from
> supported hardware will be enabled, mmc, usb, sata, scsi, ide, pxe and
> dhcp.
>
> There is nothing to stop this being extended to support nand and any other
> type of storage that comes along. An ideal future enhancement will be to
> allow the user to dynamically reorder the boot devices, and allow one off
> boots. for example simply be able to pxe boot to reinstall
>
> Signed-off-by: Dennis Gilmore <dennis@ausil.us>
> ---
> include/config_distro_bootcmd.h | 208
> ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+)
> create mode 100644 include/config_distro_bootcmd.h
>
> diff --git a/include/config_distro_bootcmd.h
> b/include/config_distro_bootcmd.h new file mode 100644
> index 0000000..0fe94be
> --- /dev/null
> +++ b/include/config_distro_bootcmd.h
> @@ -0,0 +1,208 @@
> +/*
> + * (C) Copyright 2014
> + * NVIDIA Corporation <www.nvidia.com>
> + *
> + * Copyright 2014 Red Hat, Inc.
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#ifndef _CONFIG_CMD_DISTRO_BOOTCMD_H
> +#define _CONFIG_CMD_DISTRO_BOOTCMD_H
> +
> +
> +#ifdef CONFIG_CMD_MMC
> +#define BOOTCMDS_MMC \
> + "mmc_boot=" \
> + "setenv devtype mmc; " \

Please use 'env set ...'

> + "if mmc dev ${devnum}; then " \
> + "run scan_boot; " \
> + "fi\0" \
> + "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \
> + "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0"
> +#define BOOT_TARGETS_MMC "mmc1 mmc0"

This will not work on a boot with three MMC cards ... this does not scale and
needs re-thinking.

> +#else
> +#define BOOTCMDS_MMC ""
> +#define BOOT_TARGETS_MMC ""

You need to #undef those after you assembled the env, otherwise you will
propagate those throughout the rest of the U-Boot at build time, which is not
nice. …