diff options
| author | Jerome Forissier <[email protected]> | 2025-04-18 16:09:42 +0200 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-04-23 13:19:44 -0600 |
| commit | ec89a4f7a3cbdfe601a45c110b375e925190f095 (patch) | |
| tree | 0cc58c3b91f33ddc658ab24a4b94b5ac375e6af7 /cmd/Makefile | |
| parent | 1c0f6999b5589315201ebb5aa659eb6658079b8e (diff) | |
cmd: add spawn and wait commands
Add a spawn command which runs another command in the background, as
well as a wait command to suspend the shell until one or more background
jobs have completed. The job_id environment variable is set by spawn and
wait accepts optional job ids, so that one can selectively wait on any
job.
Example:
=> date; spawn sleep 5; spawn sleep 3; date; echo "waiting..."; wait; date
Date: 2025-02-21 (Friday) Time: 17:04:52
Date: 2025-02-21 (Friday) Time: 17:04:52
waiting...
Date: 2025-02-21 (Friday) Time: 17:04:57
=>
Another example showing how background jobs can make initlizations
faster. The board is i.MX93 EVK, with one spinning HDD connected to
USB1 via a hub, and a network cable plugged into ENET1.
# From power up / reset
u-boot=> setenv autoload 0
u-boot=> setenv ud "usb start; dhcp"
u-boot=> time run ud
[...]
time: 8.058 seconds
# From power up / reset
u-boot=> setenv autoload 0
u-boot=> setenv ud "spawn usb start; spawn dhcp; wait"
u-boot=> time run ud
[...]
time: 4.475 seconds
Signed-off-by: Jerome Forissier <[email protected]>
Acked-by: Ilias Apalodimas <[email protected]>
Diffstat (limited to 'cmd/Makefile')
| -rw-r--r-- | cmd/Makefile | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cmd/Makefile b/cmd/Makefile index 8f0cee8d714..80cf70b7fe8 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -239,6 +239,8 @@ obj-$(CONFIG_CMD_SCP03) += scp03.o obj-$(CONFIG_HUSH_SELECTABLE) += cli.o +obj-$(CONFIG_CMD_SPAWN) += spawn.o + obj-$(CONFIG_ARM) += arm/ obj-$(CONFIG_RISCV) += riscv/ obj-$(CONFIG_SANDBOX) += sandbox/ |
