blob: 5e5855a76c2dcbc1c23420fd74253210c99f19bc [file] [log] [blame]
Alex Kiernan312a10f2018-05-29 15:30:39 +00001menu "Fastboot support"
Tom Rini31655652023-10-26 14:31:30 -04002 depends on CMDLINE
Steve Raee016f0b2016-08-15 17:26:26 -07003
Alex Kiernan312a10f2018-05-29 15:30:39 +00004config FASTBOOT
5 bool
6 imply ANDROID_BOOT_IMAGE
7 imply CMD_FASTBOOT
Dmitrii Merkurev443d3192023-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 Raee016f0b2016-08-15 17:26:26 -070015
16config USB_FUNCTION_FASTBOOT
17 bool "Enable USB fastboot gadget"
Alex Kiernan312a10f2018-05-29 15:30:39 +000018 depends on USB_GADGET
19 default y if ARCH_SUNXI && USB_MUSB_GADGET
20 select FASTBOOT
Maxime Ripardcfa34992017-09-07 10:29:51 +020021 select USB_GADGET_DOWNLOAD
Steve Raee016f0b2016-08-15 17:26:26 -070022 help
23 This enables the USB part of the fastboot gadget.
24
Alex Kiernanf73a7df2018-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 Gmeiner046bf8d2022-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 Merkurev443d3192023-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 Kiernan312a10f2018-05-29 15:30:39 +000046if FASTBOOT
Steve Raee016f0b2016-08-15 17:26:26 -070047
48config FASTBOOT_BUF_ADDR
49 hex "Define FASTBOOT buffer address"
Tom Rini48f62322017-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 Rinia077ac12023-08-02 11:09:43 -040060 default 0x0 if SANDBOX
Steve Raee016f0b2016-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 Rini48f62322017-08-25 17:50:27 -040068 default 0x8000000 if ARCH_ROCKCHIP
69 default 0x6000000 if ARCH_ZYNQMP
70 default 0x2000000 if ARCH_SUNXI
Jens Wiklander0a60a812018-09-25 16:40:23 +020071 default 0x8192 if SANDBOX
Tom Rini48f62322017-08-25 17:50:27 -040072 default 0x7000000
Steve Raee016f0b2016-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 Protsenko9af5ba82016-10-24 18:41:10 +030078config FASTBOOT_USB_DEV
79 int "USB controller number"
Alex Kiernan312a10f2018-05-29 15:30:39 +000080 depends on USB_FUNCTION_FASTBOOT
Semen Protsenko9af5ba82016-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 Raee016f0b2016-08-15 17:26:26 -070087config FASTBOOT_FLASH
88 bool "Enable FASTBOOT FLASH command"
Jagan Tekia9af59a2019-11-19 13:56:18 +053089 default y if ARCH_SUNXI || ARCH_ROCKCHIP
Miquel Raynal88718be2019-10-03 19:50:03 +020090 depends on MMC || (MTD_RAW_NAND && CMD_MTDPARTS)
Alex Kiernanc232d142018-05-29 15:30:52 +000091 select IMAGE_SPARSE
Steve Raee016f0b2016-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 Schocherbc820d52021-02-10 09:29:03 +010097config FASTBOOT_UUU_SUPPORT
Sean Andersonf3d914c2022-12-16 13:20:16 -050098 bool "Enable UUU support"
Heiko Schocherbc820d52021-02-10 09:29:03 +010099 help
Sean Andersonf3d914c2022-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 Schocherbc820d52021-02-10 09:29:03 +0100105
Patrick Delaunayb0cce3f2017-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 Raynal88718be2019-10-03 19:50:03 +0200116 depends on MTD_RAW_NAND && CMD_MTDPARTS
Patrick Delaunayb0cce3f2017-12-07 18:26:17 +0100117
118endchoice
119
Steve Raee016f0b2016-08-15 17:26:26 -0700120config FASTBOOT_FLASH_MMC_DEV
121 int "Define FASTBOOT MMC FLASH default device"
Patrick Delaunayb0cce3f2017-12-07 18:26:17 +0100122 depends on FASTBOOT_FLASH_MMC
Jagan Tekia9af59a2019-11-19 13:56:18 +0530123 default 0 if ARCH_ROCKCHIP
Maxime Ripardde86fc32017-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 Raee016f0b2016-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 Kiernan4085b902018-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 Delaunay3acbc7b2021-01-27 14:46:47 +0100138config FASTBOOT_MMC_BOOT_SUPPORT
139 bool "Enable EMMC_BOOT flash/erase"
140 depends on FASTBOOT_FLASH_MMC
mingming lee1fdbad02020-01-16 16:11:42 +0800141 help
142 The fastboot "flash" and "erase" commands normally does operations
Patrick Delaunay3acbc7b2021-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.
mingming lee1fdbad02020-01-16 16:11:42 +0800147
148config FASTBOOT_MMC_BOOT1_NAME
149 string "Target name for updating EMMC_BOOT1"
Patrick Delaunay3acbc7b2021-01-27 14:46:47 +0100150 depends on FASTBOOT_MMC_BOOT_SUPPORT
mingming lee1fdbad02020-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 Delaunay3acbc7b2021-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 Delaunay75966962021-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
mingming lee1fdbad02020-01-16 16:11:42 +0800181config FASTBOOT_MMC_USER_NAME
Patrick Delaunay75966962021-01-27 14:46:46 +0100182 string "Target name for updating EMMC_USER"
183 depends on FASTBOOT_MMC_USER_SUPPORT
mingming lee1fdbad02020-01-16 16:11:42 +0800184 default "mmc0"
185 help
Patrick Delaunay75966962021-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.
mingming lee1fdbad02020-01-16 16:11:42 +0800190 The default target name for erasing EMMC_USER is "mmc0".
191
Petr Kulhavy6f6c8632016-09-09 10:27:18 +0200192config FASTBOOT_GPT_NAME
193 string "Target name for updating GPT"
Alex Kiernan42d8dd42018-05-29 15:30:42 +0000194 depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
Petr Kulhavy6f6c8632016-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 Kiernan42d8dd42018-05-29 15:30:42 +0000207 depends on FASTBOOT_FLASH_MMC && DOS_PARTITION
Petr Kulhavy6f6c8632016-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 Kiernan3845b902018-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 Delaunayb2f6b972021-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 Delaunay0c0394b2021-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 Andersonf3d914c2022-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
Ion Agorria16f79dd2024-01-05 09:22:11 +0200245config FASTBOOT_CMD_OEM_CONSOLE
246 bool "Enable the 'oem console' command"
247 depends on CONSOLE_RECORD
248 help
249 Add support for the "oem console" command to input and read console
250 record buffer.
251
Yann E. MORINc2948732016-11-13 22:26:13 +0100252endif # FASTBOOT
Alex Kiernan312a10f2018-05-29 15:30:39 +0000253
254endmenu