[U-Boot] [PATCH v4 01/14] fastboot: Move fastboot to drivers/fastboot

Alex Kiernan alex.kiernan at gmail.com
Tue May 15 14:48:40 UTC 2018


Separate CMD_FASTBOOT from FASTBOOT and move code and configuration to
drivers/fastboot.

Signed-off-by: Alex Kiernan <alex.kiernan at gmail.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
---

Changes in v4: None
Changes in v3:
- move imply ANDROID_BOOT_IMAGE, CMD_FASTBOOT to FASTBOOT from
  USB_FUNCTION_FASTBOOT
- add depend on USB_FUNCTION_FASTBOOT to FASTBOOT_USB_DEV
- leave images-sparse.c in common to acommodate 2f83f21

Changes in v2: None

 arch/arm/Kconfig                       |  2 --
 board/ti/common/Kconfig                |  1 -
 cmd/Kconfig                            | 14 ++++++++++++--
 common/Makefile                        | 15 +--------------
 drivers/Kconfig                        |  2 ++
 drivers/Makefile                       |  1 +
 {cmd => drivers}/fastboot/Kconfig      | 35 ++++++++++++----------------------
 drivers/fastboot/Makefile              |  8 ++++++++
 {common => drivers/fastboot}/fb_mmc.c  |  0
 {common => drivers/fastboot}/fb_nand.c |  0
 10 files changed, 36 insertions(+), 42 deletions(-)
 rename {cmd => drivers}/fastboot/Kconfig (88%)
 create mode 100644 drivers/fastboot/Makefile
 rename {common => drivers/fastboot}/fb_mmc.c (100%)
 rename {common => drivers/fastboot}/fb_nand.c (100%)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c9d6e0a..c4acd10 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1246,9 +1246,7 @@ config ARCH_ROCKCHIP
 	select DM_REGULATOR
 	select ENABLE_ARM_SOC_BOOT0_HOOK
 	select SPI
-	imply CMD_FASTBOOT
 	imply DISTRO_DEFAULTS
-	imply FASTBOOT
 	imply FAT_WRITE
 	imply USB_FUNCTION_FASTBOOT
 	imply SPL_SYSRESET
diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig
index c21eb8c..b1956b8 100644
--- a/board/ti/common/Kconfig
+++ b/board/ti/common/Kconfig
@@ -25,7 +25,6 @@ config TI_COMMON_CMD_OPTIONS
 	imply CMD_EXT2
 	imply CMD_EXT4
 	imply CMD_EXT4_WRITE
-	imply CMD_FASTBOOT if FASTBOOT
 	imply CMD_FAT
 	imply FAT_WRITE if CMD_FAT
 	imply CMD_FS_GENERIC
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 38406fc..df2194c 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -137,8 +137,6 @@ config AUTOBOOT_STOP_STR_SHA256
 
 endmenu
 
-source "cmd/fastboot/Kconfig"
-
 config BUILD_BIN2C
 	bool
 
@@ -650,6 +648,18 @@ config CMD_DM
 	  can be useful to see the state of driver model for debugging or
 	  interest.
 
+config CMD_FASTBOOT
+	bool "fastboot - Android fastboot support"
+	depends on USB_FUNCTION_FASTBOOT || UDP_FUNCTION_FASTBOOT
+	help
+	  This enables the command "fastboot" which enables the Android
+	  fastboot mode for the platform. Fastboot is a protocol for
+	  downloading images, flashing and device control used on
+	  Android devices. Fastboot requires either network stack
+	  enabled or support for acting as a USB device.
+
+	  See doc/README.android-fastboot for more information.
+
 config CMD_FDC
 	bool "fdcboot - Boot from floppy device"
 	help
diff --git a/common/Makefile b/common/Makefile
index d0681c7..9ec40b9 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -29,7 +29,7 @@ obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
 
 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
-
+obj-$(CONFIG_FASTBOOT_FLASH) += image-sparse.o
 obj-$(CONFIG_MII) += miiphyutil.o
 obj-$(CONFIG_CMD_MII) += miiphyutil.o
 obj-$(CONFIG_PHYLIB) += miiphyutil.o
@@ -109,19 +109,6 @@ obj-$(CONFIG_IO_TRACE) += iotrace.o
 obj-y += memsize.o
 obj-y += stdio.o
 
-ifndef CONFIG_SPL_BUILD
-# This option is not just y/n - it can have a numeric value
-ifdef CONFIG_FASTBOOT_FLASH
-obj-y += 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
-endif
-endif
-
 ifdef CONFIG_CMD_EEPROM_LAYOUT
 obj-y += eeprom/eeprom_field.o eeprom/eeprom_layout.o
 endif
diff --git a/drivers/Kconfig b/drivers/Kconfig
index c2e813f..8424898 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -28,6 +28,8 @@ source "drivers/dfu/Kconfig"
 
 source "drivers/dma/Kconfig"
 
+source "drivers/fastboot/Kconfig"
+
 source "drivers/firmware/Kconfig"
 
 source "drivers/fpga/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index b3f1b60..d29a6e4 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -71,6 +71,7 @@ obj-y += block/
 obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/
 obj-$(CONFIG_CPU) += cpu/
 obj-y += crypto/
+obj-$(CONFIG_FASTBOOT) += fastboot/
 obj-y += firmware/
 obj-$(CONFIG_FPGA) += fpga/
 obj-y += misc/
diff --git a/cmd/fastboot/Kconfig b/drivers/fastboot/Kconfig
similarity index 88%
rename from cmd/fastboot/Kconfig
rename to drivers/fastboot/Kconfig
index 0d2c2f1..93a8ac6 100644
--- a/cmd/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -1,32 +1,20 @@
-comment "FASTBOOT"
+menu "Fastboot support"
 
-menuconfig FASTBOOT
-	bool "Fastboot support"
-	depends on USB_GADGET
-	default y if ARCH_SUNXI && USB_MUSB_GADGET
-
-if FASTBOOT
+config FASTBOOT
+	bool
+	imply ANDROID_BOOT_IMAGE
+	imply CMD_FASTBOOT
 
 config USB_FUNCTION_FASTBOOT
 	bool "Enable USB fastboot gadget"
-	default y
+	depends on USB_GADGET
+	default y if ARCH_SUNXI && USB_MUSB_GADGET
+	select FASTBOOT
 	select USB_GADGET_DOWNLOAD
-	imply ANDROID_BOOT_IMAGE
-	imply CMD_FASTBOOT
 	help
 	  This enables the USB part of the fastboot gadget.
 
-config CMD_FASTBOOT
-	bool "Enable FASTBOOT command"
-	help
-	  This enables the command "fastboot" which enables the Android
-	  fastboot mode for the platform's USB device. Fastboot is a USB
-	  protocol for downloading images, flashing and device control
-	  used on Android devices.
-
-	  See doc/README.android-fastboot for more information.
-
-if USB_FUNCTION_FASTBOOT
+if FASTBOOT
 
 config FASTBOOT_BUF_ADDR
 	hex "Define FASTBOOT buffer address"
@@ -58,6 +46,7 @@ config FASTBOOT_BUF_SIZE
 
 config FASTBOOT_USB_DEV
 	int "USB controller number"
+	depends on USB_FUNCTION_FASTBOOT
 	default 0
 	help
 	  Some boards have USB OTG controller other than 0. Define this
@@ -129,6 +118,6 @@ config FASTBOOT_MBR_NAME
 	  specified on the "fastboot flash" command line matches the value
 	  defined here. The default target name for updating MBR is "mbr".
 
-endif # USB_FUNCTION_FASTBOOT
-
 endif # FASTBOOT
+
+endmenu
diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
new file mode 100644
index 0000000..651fbf0
--- /dev/null
+++ b/drivers/fastboot/Makefile
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier:      GPL-2.0+
+
+ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+obj-y += fb_mmc.o
+endif
+ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+obj-y += fb_nand.o
+endif
diff --git a/common/fb_mmc.c b/drivers/fastboot/fb_mmc.c
similarity index 100%
rename from common/fb_mmc.c
rename to drivers/fastboot/fb_mmc.c
diff --git a/common/fb_nand.c b/drivers/fastboot/fb_nand.c
similarity index 100%
rename from common/fb_nand.c
rename to drivers/fastboot/fb_nand.c
-- 
2.7.4



More information about the U-Boot mailing list