[U-Boot] [PATCH] config_distro_bootcmd: Avoid scanning usb twice (under some circumstances)

Hans de Goede hdegoede at redhat.com
Thu Nov 20 19:59:57 CET 2014


When using usb-keyboard support, the preboot env variable must be set to a
command to scan usb, so that the keyboard is available to interrupt autoboot.

The logical command to add when using config_distro_bootcmd.h is
"run usb_init", as that does a "setenv usb_need_init false" which should avoid
a second scan when booting from usb.

However this does not work because config_distro_bootcmd sets
bootcmd to "setenv usb_need_init; ...".

This is not necessary "if ${usb_need_init}" will evaluate to true just as well
if usb_need_init is not set at all. So drop the BOOTENV_SET_USB_NEED_INIT
macro and calling of it, thereby fixing the double usb-scan.

While at it do the same for scsi_need_init which was modelled after the usb
code.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 include/config_distro_bootcmd.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index be616e8..2b515bc 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -54,7 +54,6 @@
 
 #ifdef CONFIG_CMD_SCSI
 #define BOOTENV_RUN_SCSI_INIT "run scsi_init; "
-#define BOOTENV_SET_SCSI_NEED_INIT "setenv scsi_need_init; "
 #define BOOTENV_SHARED_SCSI \
 	"scsi_init=" \
 		"if ${scsi_need_init}; then " \
@@ -69,7 +68,6 @@
 #define BOOTENV_DEV_NAME_SCSI	BOOTENV_DEV_NAME_BLKDEV
 #else
 #define BOOTENV_RUN_SCSI_INIT
-#define BOOTENV_SET_SCSI_NEED_INIT
 #define BOOTENV_SHARED_SCSI
 #define BOOTENV_DEV_SCSI \
 	BOOT_TARGET_DEVICES_references_SCSI_without_CONFIG_CMD_SCSI
@@ -91,7 +89,6 @@
 
 #ifdef CONFIG_CMD_USB
 #define BOOTENV_RUN_USB_INIT "run usb_init; "
-#define BOOTENV_SET_USB_NEED_INIT "setenv usb_need_init; "
 #define BOOTENV_SHARED_USB \
 	"usb_init=" \
 		"if ${usb_need_init}; then " \
@@ -106,7 +103,6 @@
 #define BOOTENV_DEV_NAME_USB	BOOTENV_DEV_NAME_BLKDEV
 #else
 #define BOOTENV_RUN_USB_INIT
-#define BOOTENV_SET_USB_NEED_INIT
 #define BOOTENV_SHARED_USB
 #define BOOTENV_DEV_USB \
 	BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
@@ -202,7 +198,7 @@
 	\
 	BOOT_TARGET_DEVICES(BOOTENV_DEV)                                  \
 	\
-	"bootcmd=" BOOTENV_SET_USB_NEED_INIT BOOTENV_SET_SCSI_NEED_INIT   \
+	"bootcmd="                                                        \
 		"for target in ${boot_targets}; do "                      \
 			"run bootcmd_${target}; "                         \
 		"done\0"
-- 
2.1.0



More information about the U-Boot mailing list