blob: 11fc0fe1c800a847ccaa8fc7c3830ffe079f5580 [file] [log] [blame]
Alex Kiernan65de9552018-05-29 15:30:39 +00001menu "Fastboot support"
Tom Rinidff68172023-10-26 14:31:30 -04002 depends on CMDLINE
Steve Rae437689f2016-08-15 17:26:26 -07003
Alex Kiernan65de9552018-05-29 15:30:39 +00004config FASTBOOT
5 bool
6 imply ANDROID_BOOT_IMAGE
7 imply CMD_FASTBOOT
Dmitrii Merkurev308252d2023-04-12 19:49:30 +01008 help
9 Fastboot is a protocol used in Android devices for
10 communicating between the device and a computer during
11 the bootloader stage. It allows the user to flash the
12 device firmware and unlock the bootloader.
13 More information about the protocol and usecases:
14 https://android.googlesource.com/platform/system/core/+/refs/heads/master/fastboot/
Steve Rae437689f2016-08-15 17:26:26 -070015
16config USB_FUNCTION_FASTBOOT
17 bool "Enable USB fastboot gadget"
Alex Kiernan65de9552018-05-29 15:30:39 +000018 depends on USB_GADGET
19 default y if ARCH_SUNXI && USB_MUSB_GADGET
20 select FASTBOOT
Maxime Ripard6d7dfe22017-09-07 10:29:51 +020021 select USB_GADGET_DOWNLOAD
Steve Rae437689f2016-08-15 17:26:26 -070022 help
23 This enables the USB part of the fastboot gadget.
24
Alex Kiernand5aa57c2018-05-29 15:30:53 +000025config UDP_FUNCTION_FASTBOOT
26 depends on NET
27 select FASTBOOT
28 bool "Enable fastboot protocol over UDP"
29 help
30 This enables the fastboot protocol over UDP.
31
Christian Gmeiner7fd97aa2022-01-13 08:40:06 +010032config UDP_FUNCTION_FASTBOOT_PORT
33 depends on UDP_FUNCTION_FASTBOOT
34 int "Define FASTBOOT UDP port"
35 default 5554
36 help
37 The fastboot protocol requires a UDP port number.
38
Dmitrii Merkurev308252d2023-04-12 19:49:30 +010039config TCP_FUNCTION_FASTBOOT
40 depends on NET
41 select FASTBOOT
42 bool "Enable fastboot protocol over TCP"
43 help
44 This enables the fastboot protocol over TCP.
45
Alex Kiernan65de9552018-05-29 15:30:39 +000046if FASTBOOT
Steve Rae437689f2016-08-15 17:26:26 -070047
48config FASTBOOT_BUF_ADDR
49 hex "Define FASTBOOT buffer address"
Tom Rinib5bf5622017-08-25 17:50:27 -040050 default 0x82000000 if MX6SX || MX6SL || MX6UL || MX6SLL
51 default 0x81000000 if ARCH_OMAP2PLUS
52 default 0x42000000 if ARCH_SUNXI && !MACH_SUN9I
53 default 0x22000000 if ARCH_SUNXI && MACH_SUN9I
54 default 0x60800800 if ROCKCHIP_RK3036 || ROCKCHIP_RK3188 || \
55 ROCKCHIP_RK322X
56 default 0x800800 if ROCKCHIP_RK3288 || ROCKCHIP_RK3329 || \
57 ROCKCHIP_RK3399
58 default 0x280000 if ROCKCHIP_RK3368
59 default 0x100000 if ARCH_ZYNQMP
Tom Rinif18679c2023-08-02 11:09:43 -040060 default 0x0 if SANDBOX
Steve Rae437689f2016-08-15 17:26:26 -070061 help
62 The fastboot protocol requires a large memory buffer for
63 downloads. Define this to the starting RAM address to use for
64 downloaded images.
65
66config FASTBOOT_BUF_SIZE
67 hex "Define FASTBOOT buffer size"
Tom Rinib5bf5622017-08-25 17:50:27 -040068 default 0x8000000 if ARCH_ROCKCHIP
69 default 0x6000000 if ARCH_ZYNQMP
70 default 0x2000000 if ARCH_SUNXI
Jens Wiklanderf1edae92018-09-25 16:40:23 +020071 default 0x8192 if SANDBOX
Tom Rinib5bf5622017-08-25 17:50:27 -040072 default 0x7000000
Steve Rae437689f2016-08-15 17:26:26 -070073 help
74 The fastboot protocol requires a large memory buffer for
75 downloads. This buffer should be as large as possible for a
76 platform. Define this to the size available RAM for fastboot.
77
Semen Protsenko97bb3f82016-10-24 18:41:10 +030078config FASTBOOT_USB_DEV
79 int "USB controller number"
Alex Kiernan65de9552018-05-29 15:30:39 +000080 depends on USB_FUNCTION_FASTBOOT
Semen Protsenko97bb3f82016-10-24 18:41:10 +030081 default 0
82 help
83 Some boards have USB OTG controller other than 0. Define this
84 option so it can be used in compiled environment (e.g. in
85 CONFIG_BOOTCOMMAND).
86
Steve Rae437689f2016-08-15 17:26:26 -070087config FASTBOOT_FLASH
88 bool "Enable FASTBOOT FLASH command"
Jagan Teki04aae032019-11-19 13:56:18 +053089 default y if ARCH_SUNXI || ARCH_ROCKCHIP
Miquel Raynald0935362019-10-03 19:50:03 +020090 depends on MMC || (MTD_RAW_NAND && CMD_MTDPARTS)
Alex Kiernanc568bcb2018-05-29 15:30:52 +000091 select IMAGE_SPARSE
Steve Rae437689f2016-08-15 17:26:26 -070092 help
93 The fastboot protocol includes a "flash" command for writing
94 the downloaded image to a non-volatile storage device. Define
95 this to enable the "fastboot flash" command.
96
Heiko Schocher3a994482021-02-10 09:29:03 +010097config FASTBOOT_UUU_SUPPORT
Sean Anderson421bec02022-12-16 13:20:16 -050098 bool "Enable UUU support"
Heiko Schocher3a994482021-02-10 09:29:03 +010099 help
Sean Anderson421bec02022-12-16 13:20:16 -0500100 This extends the fastboot protocol with the "UCmd" and "ACmd"
101 commands, which are used by NXP's "universal update utility" (UUU).
102 These commands allow running any shell command. Do not enable this
103 feature if you are using verified boot, as it will allow an attacker
104 to bypass any restrictions you have in place.
Heiko Schocher3a994482021-02-10 09:29:03 +0100105
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100106choice
107 prompt "Flash provider for FASTBOOT"
108 depends on FASTBOOT_FLASH
109
110config FASTBOOT_FLASH_MMC
111 bool "FASTBOOT on MMC"
112 depends on MMC
113
114config FASTBOOT_FLASH_NAND
115 bool "FASTBOOT on NAND"
Miquel Raynald0935362019-10-03 19:50:03 +0200116 depends on MTD_RAW_NAND && CMD_MTDPARTS
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100117
118endchoice
119
Steve Rae437689f2016-08-15 17:26:26 -0700120config FASTBOOT_FLASH_MMC_DEV
121 int "Define FASTBOOT MMC FLASH default device"
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100122 depends on FASTBOOT_FLASH_MMC
Jagan Teki04aae032019-11-19 13:56:18 +0530123 default 0 if ARCH_ROCKCHIP
Maxime Ripard65cefba2017-08-23 10:12:22 +0200124 default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
125 default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
Steve Rae437689f2016-08-15 17:26:26 -0700126 help
127 The fastboot "flash" command requires additional information
128 regarding the non-volatile storage device. Define this to
129 the eMMC device that fastboot should use to store the image.
130
Alex Kiernandc405852018-05-29 15:30:51 +0000131config FASTBOOT_FLASH_NAND_TRIMFFS
132 bool "Skip empty pages when flashing NAND"
133 depends on FASTBOOT_FLASH_NAND
134 help
135 When flashing NAND enable the DROP_FFS flag to drop trailing all-0xff
136 pages.
137
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100138config FASTBOOT_MMC_BOOT_SUPPORT
139 bool "Enable EMMC_BOOT flash/erase"
140 depends on FASTBOOT_FLASH_MMC
developer6a105562020-01-16 16:11:42 +0800141 help
142 The fastboot "flash" and "erase" commands normally does operations
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100143 on eMMC userdata. Define this to enable the special commands to
144 flash/erase eMMC boot partition.
145 The default target name for updating eMMC boot partition 1/2 is
146 CONFIG_FASTBOOT_MMC_BOOT1_NAME/CONFIG_FASTBOOT_MMC_BOOT2_NAME.
developer6a105562020-01-16 16:11:42 +0800147
148config FASTBOOT_MMC_BOOT1_NAME
149 string "Target name for updating EMMC_BOOT1"
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100150 depends on FASTBOOT_MMC_BOOT_SUPPORT
developer6a105562020-01-16 16:11:42 +0800151 default "mmc0boot0"
152 help
153 The fastboot "flash" and "erase" commands support operations on
154 EMMC_BOOT1. This occurs when the specified "EMMC_BOOT1 name" on
155 the "fastboot flash" and "fastboot erase" commands match the value
156 defined here.
157 The default target name for updating EMMC_BOOT1 is "mmc0boot0".
158
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100159config FASTBOOT_MMC_BOOT2_NAME
160 string "Target name for updating EMMC_BOOT2"
161 depends on FASTBOOT_MMC_BOOT_SUPPORT
162 default "mmc0boot1"
163 help
164 The fastboot "flash" and "erase" commands support operations on
165 EMMC_BOOT2. This occurs when the specified "EMMC_BOOT2 name" on
166 the "fastboot flash" and "fastboot erase" commands match the value
167 defined here.
168 The default target name for updating EMMC_BOOT2 is "mmc0boot1".
169
Patrick Delaunay8b0a29a2021-01-27 14:46:46 +0100170config FASTBOOT_MMC_USER_SUPPORT
171 bool "Enable eMMC userdata partition flash/erase"
172 depends on FASTBOOT_FLASH_MMC
173 help
174 Define this to enable the support "flash" and "erase" command on
175 eMMC userdata. The "flash" command only update the MBR and GPT
176 header when CONFIG_EFI_PARTITION is supported.
177 The "erase" command erase all the userdata.
178 This occurs when the specified "partition name" on the
179 fastboot command line matches the value CONFIG_FASTBOOT_MMC_USER_NAME.
180
developer6a105562020-01-16 16:11:42 +0800181config FASTBOOT_MMC_USER_NAME
Patrick Delaunay8b0a29a2021-01-27 14:46:46 +0100182 string "Target name for updating EMMC_USER"
183 depends on FASTBOOT_MMC_USER_SUPPORT
developer6a105562020-01-16 16:11:42 +0800184 default "mmc0"
185 help
Patrick Delaunay8b0a29a2021-01-27 14:46:46 +0100186 The fastboot "flash" and "erase" command supports EMMC_USER.
187 This occurs when the specified "EMMC_USER name" on the
188 "fastboot flash" and the "fastboot erase" commands match the value
189 defined here.
developer6a105562020-01-16 16:11:42 +0800190 The default target name for erasing EMMC_USER is "mmc0".
191
Petr Kulhavy4ed1eca2016-09-09 10:27:18 +0200192config FASTBOOT_GPT_NAME
193 string "Target name for updating GPT"
Alex Kiernan8cb1eab2018-05-29 15:30:42 +0000194 depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
Petr Kulhavy4ed1eca2016-09-09 10:27:18 +0200195 default "gpt"
196 help
197 The fastboot "flash" command supports writing the downloaded
198 image to the Protective MBR and the Primary GUID Partition
199 Table. (Additionally, this downloaded image is post-processed
200 to generate and write the Backup GUID Partition Table.)
201 This occurs when the specified "partition name" on the
202 "fastboot flash" command line matches the value defined here.
203 The default target name for updating GPT is "gpt".
204
205config FASTBOOT_MBR_NAME
206 string "Target name for updating MBR"
Alex Kiernan8cb1eab2018-05-29 15:30:42 +0000207 depends on FASTBOOT_FLASH_MMC && DOS_PARTITION
Petr Kulhavy4ed1eca2016-09-09 10:27:18 +0200208 default "mbr"
209 help
210 The fastboot "flash" command allows to write the downloaded image
211 to the Master Boot Record. This occurs when the "partition name"
212 specified on the "fastboot flash" command line matches the value
213 defined here. The default target name for updating MBR is "mbr".
214
Alex Kiernanc86cde92018-05-29 15:30:54 +0000215config FASTBOOT_CMD_OEM_FORMAT
216 bool "Enable the 'oem format' command"
217 depends on FASTBOOT_FLASH_MMC && CMD_GPT
218 help
219 Add support for the "oem format" command from a client. This
220 relies on the env variable partitions to contain the list of
221 partitions as required by the gpt command.
222
Patrick Delaunay61687702021-01-27 14:46:48 +0100223config FASTBOOT_CMD_OEM_PARTCONF
224 bool "Enable the 'oem partconf' command"
225 depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT
226 help
227 Add support for the "oem partconf" command from a client. This set
228 the mmc boot-partition for the selecting eMMC device.
229
Patrick Delaunay67af29a2021-01-27 14:46:49 +0100230config FASTBOOT_CMD_OEM_BOOTBUS
231 bool "Enable the 'oem bootbus' command"
232 depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT
233 help
234 Add support for the "oem bootbus" command from a client. This set
235 the mmc boot configuration for the selecting eMMC device.
236
Sean Anderson421bec02022-12-16 13:20:16 -0500237config FASTBOOT_OEM_RUN
238 bool "Enable the 'oem run' command"
239 help
240 This extends the fastboot protocol with an "oem run" command. This
241 command allows running arbitrary U-Boot shell commands. Do not enable
242 this feature if you are using verified boot, as it will allow an
243 attacker to bypass any restrictions you have in place.
244
Yann E. MORIN3d2561f2016-11-13 22:26:13 +0100245endif # FASTBOOT
Alex Kiernan65de9552018-05-29 15:30:39 +0000246
247endmenu