Skip to contentSkip to conversation

arm: BeagleBone Black: enable fastboot support

PATCH Superseded Dileep Katta 2 participants 5 messages Aug 2, 2014 USB

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 arm: BeagleBone Black: enable fastboot support

Enable Android Fastboot support on am335x_evm board

---
 include/configs/am335x_evm.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/configs/am335x_evm.h +10 -0
index 35ae0e6..3999405 100644
@@ -291,6 +291,11 @@
 #define CONFIG_AM335X_USB0_MODE	MUSB_PERIPHERAL
 #define CONFIG_AM335X_USB1
 #define CONFIG_AM335X_USB1_MODE MUSB_HOST
+/* Fastboot */
+#define CONFIG_CMD_FASTBOOT
+#define CONFIG_ANDROID_BOOT_IMAGE
+#define CONFIG_USB_FASTBOOT_BUF_ADDR	CONFIG_SYS_LOAD_ADDR
+#define CONFIG_USB_FASTBOOT_BUF_SIZE	0x07000000
 
 #ifdef CONFIG_MUSB_HOST
 #define CONFIG_CMD_USB
@@ -303,8 +308,13 @@
 #define CONFIG_USBNET_HOST_ADDR	"de:ad:be:af:00:00"
 
 /* USB TI's IDs */
+#ifdef CONFIG_CMD_FASTBOOT
+#define CONFIG_G_DNL_VENDOR_NUM 0x0451
+#define CONFIG_G_DNL_PRODUCT_NUM 0xd022 /* TI fastboot PID */
+#else
 #define CONFIG_G_DNL_VENDOR_NUM 0x0403
 #define CONFIG_G_DNL_PRODUCT_NUM 0xBD00
+#endif
 #define CONFIG_G_DNL_MANUFACTURER "Texas Instruments"
 #endif /* CONFIG_MUSB_GADGET */
 
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 2/2 fastboot: Flash command support

Flash command uses DFU, and Fastboot command initialization is modified to add DFU and partition initialization Added oem format functionality for GPT table creation
partitioning code is added as disk/part_fastboot.c for better usability

Fastboot flash command code is enabled and being tested on BeagleBone Black.
OMAP3 Beagle configuration is modified to fix the build errors, but this configuration needs to be updated as per the flash functionality.

---
 common/cmd_fastboot.c           |   6 +
 common/cmd_mmc.c                |   2 +-
 common/cmd_nvedit.c             |   2 +-
 disk/Makefile                   |   1 +
 disk/part_fastboot.c            | 383 ++++++++++++++++++++++++++++++++++++++++
 doc/README.android-fastboot     |  26 +++
 drivers/usb/gadget/f_fastboot.c | 185 ++++++++++++++++++-
 include/configs/am335x_evm.h    |  23 ++-
 include/configs/omap3_beagle.h  |  12 ++
 include/usb/fastboot.h          | 175 ++++++++++++++++++
 10 files changed, 803 insertions(+), 12 deletions(-)
 create mode 100644 disk/part_fastboot.c
 create mode 100644 include/usb/fastboot.h
common/cmd_fastboot.c +6 -0
index 83fa7bd..7c91415 100644
@@ -10,11 +10,16 @@
 #include <common.h>
 #include <command.h>
 #include <g_dnl.h>
+extern int board_partition_init(void);
+extern int dfu_init_env_entities(char *interface, int dev);
+extern void dfu_free_entities(void);
 
 static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret;
 
+	board_partition_init();
+	dfu_init_env_entities("mmc", CONFIG_MMC_FASTBOOT_DEV);
 	ret = g_dnl_register("usb_dnl_fastboot");
 	if (ret)
 		return ret;
@@ -26,6 +31,7 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 	}
 
 	g_dnl_unregister();
+	dfu_free_entities();
 	return CMD_RET_SUCCESS;
 }
 
common/cmd_mmc.c +1 -1
index 1e40983..dd7170d 100644
@@ -612,7 +612,7 @@ static cmd_tbl_t cmd_mmc[] = {
 	U_BOOT_CMD_MKENT(setdsr, 2, 0, do_mmc_setdsr, "", ""),
 };
 
-static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	cmd_tbl_t *cp;
 
common/cmd_nvedit.c +1 -1
index 855808c..a100109 100644
@@ -686,7 +686,7 @@ ulong getenv_ulong(const char *name, int base, ulong default_val)
 
 #ifndef CONFIG_SPL_BUILD
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
+int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
 		       char * const argv[])
 {
 	printf("Saving Environment to %s...\n", env_name_spec);
disk/Makefile +1 -0
index 6970cec..4b7a9ef 100644
@@ -13,3 +13,4 @@ obj-$(CONFIG_DOS_PARTITION)   += part_dos.o
 obj-$(CONFIG_ISO_PARTITION)   += part_iso.o
 obj-$(CONFIG_AMIGA_PARTITION) += part_amiga.o
 obj-$(CONFIG_EFI_PARTITION)   += part_efi.o
+obj-$(CONFIG_CMD_FASTBOOT)    += part_fastboot.o
disk/part_fastboot.c new file +383 -0

383 lines not on this page · raw message

doc/README.android-fastboot +26 -0
index f1d128c..e2a330a 100644
@@ -46,6 +46,14 @@ buffer should be as large as possible for a platform. The location of the
 buffer and size are set with CONFIG_USB_FASTBOOT_BUF_ADDR and
 CONFIG_USB_FASTBOOT_BUF_SIZE.
 
+Fastboot flash command uses DFU and storage(NAND/MMC) specific
+functionality, and hence related definitions needs to be defined:
+
+DFU_ALT_INFO
+CONFIG_STORAGE_EMMC
+CONFIG_MMC_FASTBOOT_DEV
+
+
 In Action
 =========
 Enter into fastboot by executing the fastboot command in u-boot and you
@@ -89,3 +97,21 @@ and on the gadget side you should see:
 |OK
 |
 |Starting kernel ...
+
+Flash command in action, on the client side:
+
+|>fastboot flash bootloader u-boot.img
+|target reported max download size of 1835008 bytes
+|sending 'bootloader' (395 KB)...
+|OKAY [  0.144s]
+|writing 'bootloader'...
+|OKAY [  0.009s]
+|finished. total time: 0.153s
+
+and on the gadget side you should see:
+|Starting download of 405019 bytes
+|...
+|downloading of 405019 bytes finished
+|download_bytes: 0x62e1b
+|Writing 'bootloader'
+|Writing 'bootloader' DONE!
drivers/usb/gadget/f_fastboot.c +180 -5

260 lines not on this page · raw message

include/configs/am335x_evm.h +18 -5
index 3999405..8856276 100644
@@ -87,6 +87,7 @@
 		"uuid_disk=${uuid_gpt_disk};" \
 		"name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}\0" \
 	"optargs=\0" \
+	"dfu_alt_info=" DFU_ALT_INFO "\0" \
 	"mmcdev=0\0" \
 	"mmcroot=/dev/mmcblk0p2 ro\0" \
 	"mmcrootfstype=ext4 rootwait\0" \
@@ -303,6 +304,16 @@
 #endif
 
 #ifdef CONFIG_MUSB_GADGET
+
+#define CONFIG_MMC_FASTBOOT_DEV			1
+
+/*Uncomment this to enable NAND fastboot*/
+/*#define CONFIG_NAND */
+
+/*Uncomment this to support eMMC booting*/
+#define CONFIG_STORAGE_EMMC
+
+
 #define CONFIG_USB_ETHER
 #define CONFIG_USB_ETH_RNDIS
 #define CONFIG_USBNET_HOST_ADDR	"de:ad:be:af:00:00"
@@ -336,14 +347,13 @@
 #define CONFIG_DFU_MMC
 #define CONFIG_CMD_DFU
 #define DFU_ALT_INFO_MMC \
-	"dfu_alt_info_mmc=" \
 	"boot part 0 1;" \
 	"rootfs part 0 2;" \
 	"MLO fat 0 1;" \
-	"MLO.raw mmc 0x100 0x100;" \
-	"u-boot.img.raw mmc 0x300 0x400;" \
-	"spl-os-args.raw mmc 0x80 0x80;" \
-	"spl-os-image.raw mmc 0x900 0x2000;" \
+	"MLO.raw raw 0x100 0x100;" \
+	"u-boot.img.raw raw 0x300 0x400;" \
+	"spl-os-args.raw raw 0x80 0x80;" \
+	"spl-os-image.raw raw 0x900 0x2000;" \
 	"spl-os-args fat 0 1;" \
 	"spl-os-image fat 0 1;" \
 	"u-boot.img fat 0 1;" \
@@ -374,6 +384,9 @@
 	DFU_ALT_INFO_MMC \
 	DFU_ALT_INFO_RAM \
 	DFU_ALT_INFO_NAND
+#ifdef CONFIG_DFU_MMC
+#define DFU_ALT_INFO DFU_ALT_INFO_MMC
+#endif
 #endif
 
 /*
include/configs/omap3_beagle.h +12 -0
index 644e97f..2935208 100644
@@ -77,6 +77,18 @@
 #define CONFIG_USB_FASTBOOT_BUF_ADDR	CONFIG_SYS_LOAD_ADDR
 #define CONFIG_USB_FASTBOOT_BUF_SIZE	0x07000000
 
+#ifdef CONFIG_CMD_FASTBOOT
+#define CONFIG_MMC_FASTBOOT_DEV			1
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
+#define CONFIG_CMD_DFU
+#define DFU_ALT_INFO_MMC ""
+#endif
+
+#ifdef CONFIG_DFU_MMC
+#define DFU_ALT_INFO DFU_ALT_INFO_MMC
+#endif
+
 /* USB EHCI */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
include/usb/fastboot.h new file +175 -0

175 lines not on this page · raw message

Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 2/2 fastboot: Flash command support

Hello Dileep,

Quoted 20 lines · Dileep Katta

Flash command uses DFU, and Fastboot command initialization is modified to add DFU and partition initialization Added oem format functionality for GPT table creation
partitioning code is added as disk/part_fastboot.c for better usability

Fastboot flash command code is enabled and being tested on BeagleBone Black.
OMAP3 Beagle configuration is modified to fix the build errors, but this configuration needs to be updated as per the flash functionality.

---
  common/cmd_fastboot.c           |   6 +
  common/cmd_mmc.c                |   2 +-
  common/cmd_nvedit.c             |   2 +-
  disk/Makefile                   |   1 +
  disk/part_fastboot.c            | 383 ++++++++++++++++++++++++++++++++++++++++
  doc/README.android-fastboot     |  26 +++
  drivers/usb/gadget/f_fastboot.c | 185 ++++++++++++++++++-
  include/configs/am335x_evm.h    |  23 ++-
  include/configs/omap3_beagle.h  |  12 ++
  include/usb/fastboot.h          | 175 ++++++++++++++++++
  10 files changed, 803 insertions(+), 12 deletions(-)
Quoted 3 lines

create mode 100644 disk/part_fastboot.c
create mode 100644 include/usb/fastboot.h

I assume this is just a patch to be within the merge window and you send a cleaned up version later, right?

Regards,
Jeroen

#3 lore raw

PATCH 2/2 fastboot: Flash command support

Hello Dileep,

Quoted 31 lines · Jeroen Hofstee

Hello Dileep,

Quoted 24 lines · Dileep Katta

Flash command uses DFU, and Fastboot command initialization is modified to add DFU and partition initialization
Added oem format functionality for GPT table creation partitioning code is added as disk/part_fastboot.c for better usability

Fastboot flash command code is enabled and being tested on BeagleBone Black.
OMAP3 Beagle configuration is modified to fix the build errors, but this configuration needs to be updated as per the flash functionality.

---
  common/cmd_fastboot.c           |   6 +
  common/cmd_mmc.c                |   2 +-
  common/cmd_nvedit.c             |   2 +-
  disk/Makefile                   |   1 +
  disk/part_fastboot.c            | 383 
++++++++++++++++++++++++++++++++++++++++
  doc/README.android-fastboot     |  26 +++
  drivers/usb/gadget/f_fastboot.c | 185 ++++++++++++++++++-
  include/configs/am335x_evm.h    |  23 ++-
  include/configs/omap3_beagle.h  |  12 ++
  include/usb/fastboot.h          | 175 ++++++++++++++++++
  10 files changed, 803 insertions(+), 12 deletions(-)
Quoted 3 lines

create mode 100644 disk/part_fastboot.c
create mode 100644 include/usb/fastboot.h

Quoted 4 lines

I assume this is just a patch to be within the merge window and you send a cleaned up version later, right?

Just in case this is a serious submission, please check with checkpatch at least (which you are obligated to _before_ sending patches in the first place):

jeroen at yellow:~/software/u-boot$ ./scripts/checkpatch.pl U-Boot-2-2-fastboot-Flash-command-support.patch | wc

     912    3744   33293

Regards,
Jeroen

#4 lore raw

PATCH 2/2 fastboot: Flash command support

Hi Jeroen,

Quoted 45 lines · Jeroen Hofstee

Hello Dileep,

Quoted 32 lines · Jeroen Hofstee

Hello Dileep,

Quoted 24 lines · Dileep Katta

Flash command uses DFU, and Fastboot command initialization is modified to add DFU and partition initialization
Added oem format functionality for GPT table creation partitioning code is added as disk/part_fastboot.c for better usability

Fastboot flash command code is enabled and being tested on BeagleBone Black.
OMAP3 Beagle configuration is modified to fix the build errors, but this configuration needs to be updated as per the flash functionality.

---
  common/cmd_fastboot.c           |   6 +
  common/cmd_mmc.c                |   2 +-
  common/cmd_nvedit.c             |   2 +-
  disk/Makefile                   |   1 +
  disk/part_fastboot.c            | 383 ++++++++++++++++++++++++++++++
++++++++++
  doc/README.android-fastboot     |  26 +++
  drivers/usb/gadget/f_fastboot.c | 185 ++++++++++++++++++-
  include/configs/am335x_evm.h    |  23 ++-
  include/configs/omap3_beagle.h  |  12 ++
  include/usb/fastboot.h          | 175 ++++++++++++++++++
  10 files changed, 803 insertions(+), 12 deletions(-)
Quoted 4 lines

create mode 100644 disk/part_fastboot.c
create mode 100644 include/usb/fastboot.h

Quoted 5 lines

I assume this is just a patch to be within the merge window and you send a cleaned up version later, right?

Just in case this is a serious submission, please check with

checkpatch at least (which you are obligated to _before_ sending patches in the first place):

Quoted 7 lines

jeroen at yellow:~/software/u-boot$ ./scripts/checkpatch.pl U-Boot-2-2-fastboot-Flash-command-support.patch | wc

    912    3744   33293

Regards,
Jeroen

I will fix the errors and will send a cleaned up version. Please consider the patches for the merge.

Regards,
Dileep