[U-Boot] [PATCH 0/3] Add distro bootcommand to beagle bone and related boards

Given the beagle bone and beagle bone black boards are quite popular devboards it seems rather convenient to have them using the distro boot commands. This patchset adds just that while staying compatible with the old scheme
Sjoerd Simons (3): config_distro_bootcmd.h: Use a private variable for bootpart configs: ti_armv7_common.h: Add default addresses for pxe and scripts configs: am335x_evm: Support distro bootcmds
include/config_distro_bootcmd.h | 18 ++++++++++------ include/configs/am335x_evm.h | 45 ++++++++++++++++++++++++++++++++------- include/configs/ti_armv7_common.h | 2 ++ 3 files changed, 50 insertions(+), 15 deletions(-)

Hush has an oddity where using ${var} causes var to resolved in the the global address space (iotw the environment) first and only afterwards will the local variable space be searched.
This causes odd side-effects when iterating over the boot partitions using ${bootpart} if the environment also has a bootpart variable (e.g. for the various TI boards). Fix this by using the hopefully more unique ${distro_bootpart} instead of ${bootpart}.
Signed-off-by: Sjoerd Simons sjoerd.simons@collabora.co.uk ---
include/config_distro_bootcmd.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 3a360ca4..d2f49a1 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -191,11 +191,12 @@ BOOTENV_BOOT_TARGETS \ \ "boot_extlinux=" \ - "sysboot ${devtype} ${devnum}:${bootpart} any " \ + "sysboot ${devtype} ${devnum}:${distro_bootpart} any " \ "${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \ \ "scan_dev_for_extlinux=" \ - "if test -e ${devtype} ${devnum}:${bootpart} " \ + "if test -e ${devtype} " \ + "${devnum}:${distro_bootpart} " \ "${prefix}extlinux/extlinux.conf; then " \ "echo Found ${prefix}extlinux/extlinux.conf; " \ "run boot_extlinux; " \ @@ -203,13 +204,14 @@ "fi\0" \ \ "boot_a_script=" \ - "load ${devtype} ${devnum}:${bootpart} " \ + "load ${devtype} ${devnum}:${distro_bootpart} " \ "${scriptaddr} ${prefix}${script}; " \ "source ${scriptaddr}\0" \ \ "scan_dev_for_scripts=" \ "for script in ${boot_scripts}; do " \ - "if test -e ${devtype} ${devnum}:${bootpart} " \ + "if test -e ${devtype} " \ + "${devnum}:${distro_bootpart} " \ "${prefix}${script}; then " \ "echo Found U-Boot script " \ "${prefix}${script}; " \ @@ -219,7 +221,8 @@ "done\0" \ \ "scan_dev_for_boot=" \ - "echo Scanning ${devtype} ${devnum}:${bootpart}...; " \ + "echo Scanning ${devtype} " \ + "${devnum}:${distro_bootpart}...; " \ "for prefix in ${boot_prefixes}; do " \ "run scan_dev_for_extlinux; " \ "run scan_dev_for_scripts; " \ @@ -228,8 +231,9 @@ "scan_dev_for_boot_part=" \ "part list ${devtype} ${devnum} -bootable devplist; " \ "env exists devplist || setenv devplist 1; " \ - "for bootpart in ${devplist}; do " \ - "if fstype ${devtype} ${devnum}:${bootpart} " \ + "for distro_bootpart in ${devplist}; do " \ + "if fstype ${devtype} " \ + "${devnum}:${distro_bootpart} " \ "bootfstype; then " \ "run scan_dev_for_boot; " \ "fi; " \

On 08/28/2015 06:01 AM, Sjoerd Simons wrote:
Hush has an oddity where using ${var} causes var to resolved in the the global address space (iotw the environment) first and only afterwards will the local variable space be searched.
This causes odd side-effects when iterating over the boot partitions using ${bootpart} if the environment also has a bootpart variable (e.g. for the various TI boards). Fix this by using the hopefully more unique ${distro_bootpart} instead of ${bootpart}.
The series, Acked-by: Stephen Warren swarren@wwwdotorg.org

On Fri, Aug 28, 2015 at 03:01:54PM +0200, Sjoerd Simons wrote:
Hush has an oddity where using ${var} causes var to resolved in the the global address space (iotw the environment) first and only afterwards will the local variable space be searched.
This causes odd side-effects when iterating over the boot partitions using ${bootpart} if the environment also has a bootpart variable (e.g. for the various TI boards). Fix this by using the hopefully more unique ${distro_bootpart} instead of ${bootpart}.
Signed-off-by: Sjoerd Simons sjoerd.simons@collabora.co.uk Acked-by: Stephen Warren swarren@wwwdotorg.org
Applied to u-boot/master, thanks!

Add mandatory address variables for loading scripts and pxe configuration as per README.distro
Signed-off-by: Sjoerd Simons sjoerd.simons@collabora.co.uk ---
include/configs/ti_armv7_common.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h index 18fca02..bcce2d7 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -56,6 +56,8 @@ "fdt_addr_r=0x88000000\0" \ "rdaddr=0x88080000\0" \ "ramdisk_addr_r=0x88080000\0" \ + "scriptaddr=0x80000000\0" \ + "pxefile_addr_r=0x80100000\0" \ "bootm_size=0x10000000\0"
/*

On Fri, Aug 28, 2015 at 03:01:55PM +0200, Sjoerd Simons wrote:
Add mandatory address variables for loading scripts and pxe configuration as per README.distro
Signed-off-by: Sjoerd Simons sjoerd.simons@collabora.co.uk
Applied to u-boot/master, thanks!

Add support for distro bootcmds and network booting while retaining backwards compatibility with the current "legacy" setup. With these changes the default boot sequence becomes:
* SD card (standard distro boot) * SD card (legacy boot) * EMMC (standard distro boot) * EMMC (legacy boot) * Nand (legacy boot) * PXE (standard distro boot) * DHCP (standard distro boot)
The older boot scripts have some overlap with what the distro bootcommands to however i've left them unchanged to prevent introduction of subtle bugs.
Signed-off-by: Sjoerd Simons sjoerd.simons@collabora.co.uk
---
include/configs/am335x_evm.h | 45 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index e89c49e..ca60486 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -18,6 +18,10 @@
#include <configs/ti_am335x_common.h>
+/* Don't override the distro default bootdelay */ +#undef CONFIG_BOOTDELAY +#include <config_distro_defaults.h> + #ifndef CONFIG_SPL_BUILD #ifndef CONFIG_FIT # define CONFIG_FIT @@ -67,6 +71,37 @@
#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+#define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \ + "bootcmd_" #devtypel #instance "=" \ + "setenv mmcdev " #instance"; "\ + "setenv bootpart " #instance":2 ; "\ + "run mmcboot\0" + +#define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \ + #devtypel #instance " " + +#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \ + "bootcmd_" #devtypel "=" \ + "run nandboot\0" + +#define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance) \ + #devtypel #instance " " + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + func(LEGACY_MMC, legacy_mmc, 0) \ + func(MMC, mmc, 1) \ + func(LEGACY_MMC, legacy_mmc, 1) \ + func(NAND, nand, 0) \ + func(PXE, pxe, na) \ + func(DHCP, dhcp, na) + +#define CONFIG_BOOTCOMMAND \ + "run findfdt; " \ + "run distro_bootcmd" + +#include <config_distro_bootcmd.h> + #ifndef CONFIG_SPL_BUILD #define CONFIG_EXTRA_ENV_SETTINGS \ DEFAULT_LINUX_BOOT_ENV \ @@ -166,16 +201,10 @@ "echo WARNING: Could not determine device tree to use; fi; \0" \ NANDARGS \ NETARGS \ - DFUARGS + DFUARGS \ + BOOTENV #endif
-#define CONFIG_BOOTCOMMAND \ - "run findfdt; " \ - "run mmcboot;" \ - "setenv mmcdev 1; " \ - "setenv bootpart 1:2; " \ - "run mmcboot;" \ - "run nandboot;"
/* NS16550 Configuration */ #define CONFIG_SYS_NS16550_COM1 0x44e09000 /* Base EVM has UART0 */

On Fri, Aug 28, 2015 at 03:01:56PM +0200, Sjoerd Simons wrote:
Add support for distro bootcmds and network booting while retaining backwards compatibility with the current "legacy" setup. With these changes the default boot sequence becomes:
- SD card (standard distro boot)
- SD card (legacy boot)
- EMMC (standard distro boot)
- EMMC (legacy boot)
- Nand (legacy boot)
- PXE (standard distro boot)
- DHCP (standard distro boot)
The older boot scripts have some overlap with what the distro bootcommands to however i've left them unchanged to prevent introduction of subtle bugs.
Signed-off-by: Sjoerd Simons sjoerd.simons@collabora.co.uk
Applied to u-boot/master, thanks!
participants (3)
-
Sjoerd Simons
-
Stephen Warren
-
Tom Rini