From f3d914cfdd5ac611d99f04096497f4cd13dd6aaa Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Fri, 16 Dec 2022 13:20:16 -0500 Subject: fastboot: Add OEM run command This adds the UUU UCmd functionality as an OEM command. While the fastboot tool allows sending arbitrary commands as long as they are prefixed with "oem". This allows running generic U-Boot commands over fastboot without UUU, which is especially useful when not using USB. This is really the route we should have gone in the first place when adding these commands. While we're here, clean up the UUU Kconfig a bit. Signed-off-by: Sean Anderson Reviewed-by: Heiko Schocher --- drivers/fastboot/Kconfig | 19 ++++++++++++++----- drivers/fastboot/fb_command.c | 4 ++++ 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index b97c67bf609..eefa34779c4 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -80,12 +80,13 @@ config FASTBOOT_FLASH this to enable the "fastboot flash" command. config FASTBOOT_UUU_SUPPORT - bool "Enable FASTBOOT i.MX UUU special command" + bool "Enable UUU support" help - The fastboot protocol includes "UCmd" and "ACmd" command. - Be aware that you provide full access to any U-Boot command, - including working with memory and may open a huge backdoor, - when enabling this option. + This extends the fastboot protocol with the "UCmd" and "ACmd" + commands, which are used by NXP's "universal update utility" (UUU). + These commands allow running any shell command. Do not enable this + feature if you are using verified boot, as it will allow an attacker + to bypass any restrictions you have in place. choice prompt "Flash provider for FASTBOOT" @@ -218,6 +219,14 @@ config FASTBOOT_CMD_OEM_BOOTBUS Add support for the "oem bootbus" command from a client. This set the mmc boot configuration for the selecting eMMC device. +config FASTBOOT_OEM_RUN + bool "Enable the 'oem run' command" + help + This extends the fastboot protocol with an "oem run" command. This + command allows running arbitrary U-Boot shell commands. Do not enable + this feature if you are using verified boot, as it will allow an + attacker to bypass any restrictions you have in place. + endif # FASTBOOT endmenu diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c index f0fd605854d..67a94798287 100644 --- a/drivers/fastboot/fb_command.c +++ b/drivers/fastboot/fb_command.c @@ -102,6 +102,10 @@ static const struct { .command = "oem bootbus", .dispatch = CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS, (oem_bootbus), (NULL)) }, + [FASTBOOT_COMMAND_OEM_RUN] = { + .command = "oem run", + .dispatch = CONFIG_IS_ENABLED(FASTBOOT_OEM_RUN, (run_ucmd), (NULL)) + }, [FASTBOOT_COMMAND_UCMD] = { .command = "UCmd", .dispatch = CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT, (run_ucmd), (NULL)) -- cgit v1.3.1