Commit 3483b75d94716191b354d046b4ed3f322500a3ee

Authored by Stephen Warren
Committed by Simon Glass
1 parent e578b92cdb

distro bootcmd: make net boot only optionally start USB

Currently, the distro boot commands always enumerate USB devices before
performing network operations. However, depending on the board and end-
user configuration, network devices may not be attached to USB, and so
enumerating USB may not be necessary. Enhance the scripts to make this
step optional, so that the user can decrease boot time if they don't
need USB.

This change is performed by moving the "usb start" invocation into a
standalone variable. If the user desires, they can replace that
variable's value with some no-op command such as "true" instead.

Booting from a USB storage device always needs to enumerate USB devices,
so this action is still hard-coded.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

Showing 2 changed files with 13 additions and 5 deletions Side-by-side Diff

... ... @@ -341,6 +341,13 @@
341 341 If you want to disable boot.scr on all disks, set the value to something
342 342 innocuous, e.g. setenv scan_dev_for_scripts true.
343 343  
  344 +boot_net_usb_start:
  345 +
  346 + If you want to prevent USB enumeration by distro boot commands which execute
  347 + network operations, set the value to something innocuous, e.g. setenv
  348 + boot_net_usb_start true. This would be useful if you know your Ethernet
  349 + device is not attached to USB, and you wish to increase boot speed by
  350 + avoiding unnecessary actions.
344 351  
345 352 Interactively booting from a specific device at the u-boot prompt
346 353 =================================================================
include/config_distro_bootcmd.h
... ... @@ -140,15 +140,16 @@
140 140 #endif
141 141  
142 142 #ifdef CONFIG_CMD_USB
143   -#define BOOTENV_RUN_USB_INIT "usb start; "
  143 +#define BOOTENV_RUN_NET_USB_START "run boot_net_usb_start; "
144 144 #define BOOTENV_SHARED_USB \
  145 + "boot_net_usb_start=usb start\0" \
145 146 "usb_boot=" \
146   - BOOTENV_RUN_USB_INIT \
  147 + "usb start; " \
147 148 BOOTENV_SHARED_BLKDEV_BODY(usb)
148 149 #define BOOTENV_DEV_USB BOOTENV_DEV_BLKDEV
149 150 #define BOOTENV_DEV_NAME_USB BOOTENV_DEV_NAME_BLKDEV
150 151 #else
151   -#define BOOTENV_RUN_USB_INIT
  152 +#define BOOTENV_RUN_NET_USB_START
152 153 #define BOOTENV_SHARED_USB
153 154 #define BOOTENV_DEV_USB \
154 155 BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
... ... @@ -159,7 +160,7 @@
159 160 #if defined(CONFIG_CMD_DHCP)
160 161 #define BOOTENV_DEV_DHCP(devtypeu, devtypel, instance) \
161 162 "bootcmd_dhcp=" \
162   - BOOTENV_RUN_USB_INIT \
  163 + BOOTENV_RUN_NET_USB_START \
163 164 "if dhcp ${scriptaddr} ${boot_script_dhcp}; then " \
164 165 "source ${scriptaddr}; " \
165 166 "fi\0"
... ... @@ -175,7 +176,7 @@
175 176 #if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE)
176 177 #define BOOTENV_DEV_PXE(devtypeu, devtypel, instance) \
177 178 "bootcmd_pxe=" \
178   - BOOTENV_RUN_USB_INIT \
  179 + BOOTENV_RUN_NET_USB_START \
179 180 "dhcp; " \
180 181 "if pxe get; then " \
181 182 "pxe boot; " \