All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dennis Gilmore <dennis@ausil.us>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/6] add header with a generic set of boot commands defined.
Date: Thu, 20 Mar 2014 17:12:57 -0500	[thread overview]
Message-ID: <1395353581-5839-3-git-send-email-dennis@ausil.us> (raw)
In-Reply-To: <1395353581-5839-1-git-send-email-dennis@ausil.us>

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; " \
+		"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"
+#else
+#define BOOTCMDS_MMC ""
+#define BOOT_TARGETS_MMC ""
+#endif
+
+#ifdef CONFIG_CMD_USB
+#define BOOTCMD_INIT_USB "run usb_init; "
+#define BOOTCMDS_USB \
+	"usb_init=" \
+		"if ${usb_need_init}; then " \
+			"set usb_need_init false; " \
+			"usb start 0; " \
+		"fi\0" \
+	\
+	"usb_boot=" \
+		"setenv devtype usb; " \
+		BOOTCMD_INIT_USB \
+		"if usb dev ${devnum}; then " \
+			"run scan_boot; " \
+		"fi\0" \
+	\
+	"bootcmd_usb0=setenv devnum 0; run usb_boot;\0" \
+	"bootcmd_usb1=setenv devnum 1; run usb_boot;\0"
+#define BOOT_TARGETS_USB "usb0 usb1"
+#else
+#define BOOTCMD_INIT_USB ""
+#define BOOTCMDS_USB ""
+#define BOOT_TARGETS_USB ""
+#endif
+
+#ifdef CONFIG_CMD_SATA
+#define BOOTCMDS_SATA \
+	"sata_boot=" \
+		"setenv devtype sata; " \
+		"if sata dev ${devnum}; then " \
+			"run scan_boot; " \
+		"fi\0" \
+	\
+	"bootcmd_sata0=setenv devnum 0; run sata_boot;\0" \
+	"bootcmd_sata1=setenv devnum 1; run sata_boot;\0"
+#define BOOT_TARGETS_SATA "sata0 sata1"
+#else
+#define BOOTCMDS_SATA ""
+#define BOOT_TARGETS_SATA ""
+#endif
+
+#ifdef CONFIG_CMD_SCSI
+#define BOOTCMDS_SCSI \
+        "scsi_boot=" \
+                "setenv devtype scsi; " \
+                "if scsi dev ${devnum}; then " \
+                        "run scan_boot; " \
+                "fi\0" \
+        \
+        "bootcmd_scsi0=setenv devnum 0; run scsi_boot;\0" \
+        "bootcmd_scsi1=setenv devnum 1; run scsi_boot;\0"
+#define BOOT_TARGETS_SCSI "scsi0 scsi1"
+#else
+#define BOOTCMDS_SCSI ""
+#define BOOT_TARGETS_SCSI ""
+#endif
+
+#ifdef CONFIG_CMD_IDE
+#define BOOTCMDS_IDE \
+        "ide_boot=" \
+                "setenv devtype ide; " \
+                "if ide dev ${devnum}; then " \
+                        "run scan_boot; " \
+                "fi\0" \
+        \
+        "bootcmd_ide0=setenv devnum 0; run ide_boot;\0" \
+        "bootcmd_ide1=setenv devnum 1; run ide_boot;\0"
+#define BOOT_TARGETS_IDE "ide0 ide1"
+#else
+#define BOOTCMDS_IDE ""
+#define BOOT_TARGETS_IDE ""
+#endif
+
+#ifdef CONFIG_CMD_DHCP
+#define BOOTCMDS_DHCP \
+	"bootcmd_dhcp=" \
+		BOOTCMD_INIT_USB \
+		"if dhcp ${scriptaddr} boot.scr.uimg; then "\
+			"source ${scriptaddr}; " \
+		"fi\0"
+#define BOOT_TARGETS_DHCP "dhcp"
+#else
+#define BOOTCMDS_DHCP ""
+#define BOOT_TARGETS_DHCP ""
+#endif
+
+#if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE)
+#define BOOTCMDS_PXE \
+	"bootcmd_pxe=" \
+		BOOTCMD_INIT_USB \
+		"dhcp; " \
+		"if pxe get; then " \
+			"pxe boot; " \
+		"fi\0"
+#define BOOT_TARGETS_PXE "pxe"
+#else
+#define BOOTCMDS_PXE ""
+#define BOOT_TARGETS_PXE ""
+#endif
+
+#define BOOTCMDS_COMMON \
+	"rootpart=1\0" \
+	\
+	"do_envimport="                                                   \
+		"load ${devtype} ${devnum}:${rootpart} ${loadaddr} "      \
+			"${environment}\0"                                \
+		"env import -t ${loadaddr} $filesize\0"                   \
+	\
+	"envimport="                                                      \
+		"for environment in ${boot_envs}; do "                    \
+			"if test -e ${devtype} ${devnum}:${rootpart} "    \
+					"${prefix}${environment}; then "  \
+				"echo Found U-Boot environment "          \
+					"${prefix}${environment}; "       \
+				"run do_envimport;"                       \
+				"echo Import FAILED; continuing...; "     \
+			"fi; "                                            \
+		"done\0"                                                  \
+	\
+	"do_script_boot="                                                 \
+		"load ${devtype} ${devnum}:${rootpart} "                  \
+			"${scriptaddr} ${prefix}${script}; "              \
+		"source ${scriptaddr}\0"                                  \
+	\
+	"script_boot="                                                    \
+		"for script in ${boot_scripts}; do "                      \
+			"if test -e ${devtype} ${devnum}:${rootpart} "    \
+					"${prefix}${script}; then "       \
+				"echo Found U-Boot script "               \
+					"${prefix}${script}; "            \
+				"run do_script_boot;"                     \
+				"echo SCRIPT FAILED; continuing...; "     \
+			"fi; "                                            \
+		"done\0"                                                  \
+	\
+	"do_sysboot_boot="                                                \
+		"sysboot ${devtype} ${devnum}:${rootpart} any "           \
+			"${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
+	\
+	"sysboot_boot="                                                   \
+		"if test -e ${devtype} ${devnum}:${rootpart} "            \
+				"${prefix}extlinux/extlinux.conf; then "  \
+			"echo Found extlinux config "                     \
+				"${prefix}extlinux/extlinux.conf; "       \
+			"run do_sysboot_boot;"                            \
+			"echo SYSBOOT FAILED; continuing...; "            \
+		"fi\0"                                                    \
+	\
+	"scan_boot="                                                      \
+		"echo Scanning ${devtype} ${devnum}...; "                 \
+		"for prefix in ${boot_prefixes}; do "                     \
+			"run sysboot_boot; "                              \
+			"run script_boot; "                               \
+		"done\0"                                                  \
+	\
+	"boot_targets=" \
+		BOOT_TARGETS_MMC " "  \
+		BOOT_TARGETS_USB " "  \
+		BOOT_TARGETS_SATA " " \
+		BOOT_TARGETS_SCSI " " \
+		BOOT_TARGETS_IDE " "  \
+		BOOT_TARGETS_PXE " "  \
+		BOOT_TARGETS_DHCP " " \
+		"\0" \
+	\
+	"boot_prefixes=/ /boot/\0" \
+	\
+	"boot_scripts=boot.scr.uimg boot.scr\0" \
+	\
+	"boot_envs=uEnv.txt\0" \
+	\
+	BOOTCMDS_MMC \
+	BOOTCMDS_USB \
+	BOOTCMDS_SATA \
+	BOOTCMDS_SCSI \
+	BOOTCMDS_IDE \
+	BOOTCMDS_DHCP \
+	BOOTCMDS_PXE
+
+#endif  /* _CONFIG_CMD_DISTRO_BOOTCMD_H */
-- 
1.9.0

  parent reply	other threads:[~2014-03-20 22:12 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 17:56 [U-Boot] RFC unified boot environment Dennis Gilmore
2014-02-17 17:56 ` [U-Boot] [RFC PATCH 1/3] add file with a default boot environment based heavily on Stephen Warrens recent tegra work Dennis Gilmore
2014-02-19 13:42   ` Tom Rini
2014-02-19 13:57     ` Dennis Gilmore
2014-02-19 15:54   ` Marek Vasut
2014-02-19 17:28     ` Stephen Warren
2014-02-19 17:30       ` Marek Vasut
2014-02-19 17:41         ` Stephen Warren
2014-02-19 17:44           ` Marek Vasut
2014-02-19 17:40   ` Stephen Warren
2014-02-22  8:20     ` Dennis Gilmore
2014-02-24 18:40       ` Stephen Warren
2014-02-24 20:07         ` Tom Rini
2014-02-19 18:44   ` Dan Murphy
2014-02-19 18:48     ` Stephen Warren
2014-02-19 18:52       ` Dan Murphy
2014-02-19 18:57         ` Stephen Warren
2014-02-19 18:59           ` Dan Murphy
2014-02-19 19:04             ` Stephen Warren
2014-02-19 19:10               ` Tom Rini
2014-02-19 19:16                 ` Stephen Warren
2014-02-19 19:36                   ` Tom Rini
2014-02-19 19:43                     ` Stephen Warren
2014-02-19 19:57                       ` Tom Rini
2014-02-19 20:10                       ` Dennis Gilmore
2014-02-19 19:32               ` Dan Murphy
2014-02-19 19:38                 ` Stephen Warren
2014-02-19 20:03                   ` Dan Murphy
2014-02-19 19:02           ` Eric Nelson
2014-02-19 19:05             ` Dan Murphy
2014-02-19 19:16               ` Tom Rini
2014-02-19 19:24                 ` Dan Murphy
2014-02-19 19:29                   ` Stephen Warren
2014-02-19 19:37                     ` Dan Murphy
2014-02-19 19:43                       ` Tom Rini
2014-02-19 19:41                     ` Tom Rini
2014-02-19 21:20                       ` Denys Dmytriyenko
2014-02-20 12:31                       ` Otavio Salvador
2014-02-20 13:46                         ` Tom Rini
2014-02-22 12:56                           ` Otavio Salvador
2014-02-17 17:56 ` [U-Boot] [RFC PATCH 2/3] move the beaglebones over to the generic configs Dennis Gilmore
2014-02-19 13:52   ` Tom Rini
2014-02-19 17:46   ` Stephen Warren
2014-02-19 19:57   ` Dan Murphy
2014-02-19 19:58     ` Dan Murphy
2014-02-19 20:05     ` Stephen Warren
2014-02-19 20:20       ` Dan Murphy
2014-02-19 20:22         ` Stephen Warren
2014-02-19 20:31           ` Dan Murphy
2014-02-19 20:38             ` Stephen Warren
2014-02-19 20:58               ` Dan Murphy
2014-02-19 21:07             ` Dennis Gilmore
2014-02-17 17:56 ` [U-Boot] [RFC PATCH 3/3] move wandboard over to use the generic distro configuratin and environment Dennis Gilmore
2014-02-19 11:52   ` Otavio Salvador
2014-02-19 17:50   ` Stephen Warren
2014-02-18 10:18 ` [U-Boot] RFC unified boot environment Stefano Babic
2014-02-18 16:09   ` Dennis Gilmore
2014-02-19 13:33     ` Tom Rini
2014-03-20 22:12 ` [U-Boot] [PATCH 0/6] " Dennis Gilmore
2014-03-20 22:12   ` [U-Boot] [PATCH 1/6] add README.distro file Dennis Gilmore
2014-03-21 18:48     ` Tom Rini
2014-03-25 20:40       ` Stephen Warren
2014-03-25 20:24     ` Stephen Warren
2014-03-28 15:42       ` Tom Rini
2014-03-28 16:11         ` Stephen Warren
2014-03-28 16:25           ` Tom Rini
2014-03-20 22:12   ` Dennis Gilmore [this message]
2014-03-21 18:37     ` [U-Boot] [PATCH 2/6] add header with a generic set of boot commands defined Marek Vasut
2014-03-21 18:53       ` Tom Rini
2014-03-21 21:00         ` Marek Vasut
2014-03-21 18:48     ` Tom Rini
2014-03-25 20:38       ` Stephen Warren
2014-03-25 20:36     ` Stephen Warren
2014-03-20 22:12   ` [U-Boot] [PATCH 3/6] move wandboard over to use the generic distro configuation and environment Dennis Gilmore
2014-03-20 22:12   ` [U-Boot] [PATCH 4/6] move beagleboard " Dennis Gilmore
2014-03-21 18:48     ` Tom Rini
2014-03-20 22:13   ` [U-Boot] [PATCH 5/6] move pandaboard " Dennis Gilmore
2014-03-21 18:49     ` Tom Rini
2014-03-20 22:13   ` [U-Boot] [PATCH 6/6] pxe: additionaly check for fdt_file env variable Dennis Gilmore
2014-03-21 18:49     ` Tom Rini
2014-03-25 20:45     ` Stephen Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395353581-5839-3-git-send-email-dennis@ausil.us \
    --to=dennis@ausil.us \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.