[U-Boot] [RFC PATCH v2 06/20] fastboot: Correct dependencies in FASTBOOT_FLASH
Alex Kiernan
alex.kiernan at gmail.com
Mon Apr 30 08:32:40 UTC 2018
Ensure that when selecting FASTBOOT_FLASH you end up with a buildable
configuration. Prior to this you could select NAND without MTDPARTS
and end up with an image which (surprisingly) excluded NAND.
Signed-off-by: Alex Kiernan <alex.kiernan at gmail.com>
---
Changes in v2: None
arch/arm/mach-omap2/utils.c | 4 ++--
drivers/fastboot/Kconfig | 8 ++++----
drivers/fastboot/Makefile | 8 ++------
drivers/usb/gadget/f_fastboot.c | 14 +++++++-------
4 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index 1d39625..28ca0e8 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -84,7 +84,7 @@ static void omap_set_fastboot_board_rev(void)
env_set("fastboot.board_rev", board_rev);
}
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
static u32 omap_mmc_get_part_size(const char *part)
{
int res;
@@ -127,7 +127,7 @@ static void omap_set_fastboot_userdata_size(void)
static inline void omap_set_fastboot_userdata_size(void)
{
}
-#endif /* CONFIG_FASTBOOT_FLASH_MMC_DEV */
+#endif /* CONFIG_FASTBOOT_FLASH_MMC */
void omap_set_fastboot_vars(void)
{
omap_set_fastboot_cpu();
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index eee866a..64b94f0 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -55,6 +55,7 @@ config FASTBOOT_USB_DEV
config FASTBOOT_FLASH
bool "Enable FASTBOOT FLASH command"
default y if ARCH_SUNXI
+ depends on MMC || (NAND && CMD_MTDPARTS)
help
The fastboot protocol includes a "flash" command for writing
the downloaded image to a non-volatile storage device. Define
@@ -70,7 +71,7 @@ config FASTBOOT_FLASH_MMC
config FASTBOOT_FLASH_NAND
bool "FASTBOOT on NAND"
- depends on NAND
+ depends on NAND && CMD_MTDPARTS
endchoice
@@ -87,7 +88,6 @@ config FASTBOOT_FLASH_MMC_DEV
config FASTBOOT_FLASH_NAND_DEV
int "Define FASTBOOT NAND FLASH default device"
depends on FASTBOOT_FLASH_NAND
- depends on CMD_MTDPARTS
default 0 if ARCH_SUNXI && NAND_SUNXI
help
The fastboot "flash" command requires additional information
@@ -96,7 +96,7 @@ config FASTBOOT_FLASH_NAND_DEV
config FASTBOOT_GPT_NAME
string "Target name for updating GPT"
- depends on FASTBOOT_FLASH
+ depends on FASTBOOT_FLASH_MMC
default "gpt"
help
The fastboot "flash" command supports writing the downloaded
@@ -109,7 +109,7 @@ config FASTBOOT_GPT_NAME
config FASTBOOT_MBR_NAME
string "Target name for updating MBR"
- depends on FASTBOOT_FLASH
+ depends on FASTBOOT_FLASH_MMC
default "mbr"
help
The fastboot "flash" command allows to write the downloaded image
diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
index 5b8337f..c12dfa8 100644
--- a/drivers/fastboot/Makefile
+++ b/drivers/fastboot/Makefile
@@ -3,9 +3,5 @@
obj-y += fb_common.o
obj-$(CONFIG_FASTBOOT_FLASH) += image-sparse.o
-ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
-obj-y += fb_mmc.o
-endif
-ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
-obj-y += fb_nand.o
-endif
+obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fb_mmc.o
+obj-$(CONFIG_FASTBOOT_FLASH_NAND) += fb_nand.o
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index fda4505..e757c3e 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -21,10 +21,10 @@
#include <linux/compiler.h>
#include <version.h>
#include <g_dnl.h>
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
#include <fb_mmc.h>
#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_NAND
#include <fb_nand.h>
#endif
@@ -584,11 +584,11 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
}
fastboot_fail("no flash device defined", response);
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
fb_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
download_bytes, response);
#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_NAND
fb_nand_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
download_bytes, response);
#endif
@@ -599,7 +599,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
static void cb_oem(struct usb_ep *ep, struct usb_request *req)
{
char *cmd = req->buf;
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
if (strncmp("format", cmd + 4, 6) == 0) {
char cmdbuf[32];
sprintf(cmdbuf, "gpt write mmc %x $partitions",
@@ -632,10 +632,10 @@ static void cb_erase(struct usb_ep *ep, struct usb_request *req)
}
fastboot_fail("no flash device defined", response);
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
fb_mmc_erase(cmd, response);
#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_NAND
fb_nand_erase(cmd, response);
#endif
fastboot_tx_write_str(response);
--
2.7.4
More information about the U-Boot
mailing list