Skip to contentSkip to conversation

Add distro bootcommand to beagle bone and related boards

PATCH New Sjoerd Simons 3 participants 8 messages Aug 28, 2015 – Oct 22, 2015

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/3 config_distro_bootcmd.h: Use a private variable for bootpart

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}.

---

 include/config_distro_bootcmd.h | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
include/config_distro_bootcmd.h +11 -7
index 3a360ca4..d2f49a1 100644
@@ -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; "                                            \
Signature · 1 line
2.5.0
#2 lore raw

PATCH 1/3 config_distro_bootcmd.h: Use a private variable for bootpart

Quoted 8 lines · Sjoerd Simons

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,

#3 lore raw

PATCH 1/3 config_distro_bootcmd.h: Use a private variable for bootpart

In reply to Sjoerd Simons
Quoted 11 lines · Sjoerd Simons

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}.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151022/f723c9d8/attachment.sig>
#4 lore raw

PATCH 2/3 configs: ti_armv7_common.h: Add default addresses for pxe and scripts

In reply to Sjoerd Simons

Add mandatory address variables for loading scripts and pxe configuration as per README.distro

---

 include/configs/ti_armv7_common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/ti_armv7_common.h +2 -0
index 18fca02..bcce2d7 100644
@@ -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"
 
 /*
Signature · 1 line
2.5.0
#5 lore raw

PATCH 2/3 configs: ti_armv7_common.h: Add default addresses for pxe and scripts

Quoted 4 lines · Sjoerd Simons

Add mandatory address variables for loading scripts and pxe configuration as per README.distro

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151022/a16c656a/attachment.sig>
#6 lore raw

PATCH 3/3 configs: am335x_evm: Support distro bootcmds

In reply to Sjoerd Simons

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.

---

 include/configs/am335x_evm.h | 45 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 37 insertions(+), 8 deletions(-)
include/configs/am335x_evm.h +37 -8
index e89c49e..ca60486 100644
@@ -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 */
Signature · 1 line
2.5.0
#7 lore raw

PATCH 3/3 configs: am335x_evm: Support distro bootcmds

Quoted 12 lines · Sjoerd Simons

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)

Quoted 5 lines

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151022/92c3ef91/attachment.sig>