blob: 837c6f1180da6bb3a64ce0988572194b1f821456 [file] [log] [blame]
Alex Kiernan312a10f2018-05-29 15:30:39 +00001menu "Fastboot support"
Steve Raee016f0b2016-08-15 17:26:26 -07002
Alex Kiernan312a10f2018-05-29 15:30:39 +00003config FASTBOOT
4 bool
5 imply ANDROID_BOOT_IMAGE
6 imply CMD_FASTBOOT
Dmitrii Merkurev443d3192023-04-12 19:49:30 +01007 help
8 Fastboot is a protocol used in Android devices for
9 communicating between the device and a computer during
10 the bootloader stage. It allows the user to flash the
11 device firmware and unlock the bootloader.
12 More information about the protocol and usecases:
13 https://android.googlesource.com/platform/system/core/+/refs/heads/master/fastboot/
Steve Raee016f0b2016-08-15 17:26:26 -070014
15config USB_FUNCTION_FASTBOOT
16 bool "Enable USB fastboot gadget"
Alex Kiernan312a10f2018-05-29 15:30:39 +000017 depends on USB_GADGET
18 default y if ARCH_SUNXI && USB_MUSB_GADGET
19 select FASTBOOT
Maxime Ripardcfa34992017-09-07 10:29:51 +020020 select USB_GADGET_DOWNLOAD
Steve Raee016f0b2016-08-15 17:26:26 -070021 help
22 This enables the USB part of the fastboot gadget.
23
Alex Kiernanf73a7df2018-05-29 15:30:53 +000024config UDP_FUNCTION_FASTBOOT
25 depends on NET
26 select FASTBOOT
27 bool "Enable fastboot protocol over UDP"
28 help
29 This enables the fastboot protocol over UDP.
30
Christian Gmeiner046bf8d2022-01-13 08:40:06 +010031config UDP_FUNCTION_FASTBOOT_PORT
32 depends on UDP_FUNCTION_FASTBOOT
33 int "Define FASTBOOT UDP port"
34 default 5554
35 help
36 The fastboot protocol requires a UDP port number.
37
Dmitrii Merkurev443d3192023-04-12 19:49:30 +010038config TCP_FUNCTION_FASTBOOT
39 depends on NET
40 select FASTBOOT
41 bool "Enable fastboot protocol over TCP"
42 help
43 This enables the fastboot protocol over TCP.
44
Alex Kiernan312a10f2018-05-29 15:30:39 +000045if FASTBOOT
Steve Raee016f0b2016-08-15 17:26:26 -070046
47config FASTBOOT_BUF_ADDR
48 hex "Define FASTBOOT buffer address"
Tom Rini48f62322017-08-25 17:50:27 -040049 default 0x82000000 if MX6SX || MX6SL || MX6UL || MX6SLL
50 default 0x81000000 if ARCH_OMAP2PLUS
51 default 0x42000000 if ARCH_SUNXI && !MACH_SUN9I
52 default 0x22000000 if ARCH_SUNXI && MACH_SUN9I
53 default 0x60800800 if ROCKCHIP_RK3036 || ROCKCHIP_RK3188 || \
54 ROCKCHIP_RK322X
55 default 0x800800 if ROCKCHIP_RK3288 || ROCKCHIP_RK3329 || \
56 ROCKCHIP_RK3399
57 default 0x280000 if ROCKCHIP_RK3368
58 default 0x100000 if ARCH_ZYNQMP
Tom Rinia077ac12023-08-02 11:09:43 -040059 default 0x0 if SANDBOX
Steve Raee016f0b2016-08-15 17:26:26 -070060 help
61 The fastboot protocol requires a large memory buffer for
62 downloads. Define this to the starting RAM address to use for
63 downloaded images.
64
65config FASTBOOT_BUF_SIZE
66 hex "Define FASTBOOT buffer size"
Tom Rini48f62322017-08-25 17:50:27 -040067 default 0x8000000 if ARCH_ROCKCHIP
68 default 0x6000000 if ARCH_ZYNQMP
69 default 0x2000000 if ARCH_SUNXI
Jens Wiklander0a60a812018-09-25 16:40:23 +020070 default 0x8192 if SANDBOX
Tom Rini48f62322017-08-25 17:50:27 -040071 default 0x7000000
Steve Raee016f0b2016-08-15 17:26:26 -070072 help
73 The fastboot protocol requires a large memory buffer for
74 downloads. This buffer should be as large as possible for a
75 platform. Define this to the size available RAM for fastboot.
76
Semen Protsenko9af5ba82016-10-24 18:41:10 +030077config FASTBOOT_USB_DEV
78 int "USB controller number"
Alex Kiernan312a10f2018-05-29 15:30:39 +000079 depends on USB_FUNCTION_FASTBOOT
Semen Protsenko9af5ba82016-10-24 18:41:10 +030080 default 0
81 help
82 Some boards have USB OTG controller other than 0. Define this
83 option so it can be used in compiled environment (e.g. in
84 CONFIG_BOOTCOMMAND).
85
Steve Raee016f0b2016-08-15 17:26:26 -070086config FASTBOOT_FLASH
87 bool "Enable FASTBOOT FLASH command"
Jagan Tekia9af59a2019-11-19 13:56:18 +053088 default y if ARCH_SUNXI || ARCH_ROCKCHIP
Miquel Raynal88718be2019-10-03 19:50:03 +020089 depends on MMC || (MTD_RAW_NAND && CMD_MTDPARTS)
Alex Kiernanc232d142018-05-29 15:30:52 +000090 select IMAGE_SPARSE
Steve Raee016f0b2016-08-15 17:26:26 -070091 help
92 The fastboot protocol includes a "flash" command for writing
93 the downloaded image to a non-volatile storage device. Define
94 this to enable the "fastboot flash" command.
95
Heiko Schocherbc820d52021-02-10 09:29:03 +010096config FASTBOOT_UUU_SUPPORT
Sean Andersonf3d914c2022-12-16 13:20:16 -050097 bool "Enable UUU support"
Heiko Schocherbc820d52021-02-10 09:29:03 +010098 help
Sean Andersonf3d914c2022-12-16 13:20:16 -050099 This extends the fastboot protocol with the "UCmd" and "ACmd"
100 commands, which are used by NXP's "universal update utility" (UUU).
101 These commands allow running any shell command. Do not enable this
102 feature if you are using verified boot, as it will allow an attacker
103 to bypass any restrictions you have in place.
Heiko Schocherbc820d52021-02-10 09:29:03 +0100104
Patrick Delaunayb0cce3f2017-12-07 18:26:17 +0100105choice
106 prompt "Flash provider for FASTBOOT"
107 depends on FASTBOOT_FLASH
108
109config FASTBOOT_FLASH_MMC
110 bool "FASTBOOT on MMC"
111 depends on MMC
112
113config FASTBOOT_FLASH_NAND
114 bool "FASTBOOT on NAND"
Miquel Raynal88718be2019-10-03 19:50:03 +0200115 depends on MTD_RAW_NAND && CMD_MTDPARTS
Patrick Delaunayb0cce3f2017-12-07 18:26:17 +0100116
117endchoice
118
Steve Raee016f0b2016-08-15 17:26:26 -0700119config FASTBOOT_FLASH_MMC_DEV
120 int "Define FASTBOOT MMC FLASH default device"
Patrick Delaunayb0cce3f2017-12-07 18:26:17 +0100121 depends on FASTBOOT_FLASH_MMC
Jagan Tekia9af59a2019-11-19 13:56:18 +0530122 default 0 if ARCH_ROCKCHIP
Maxime Ripardde86fc32017-08-23 10:12:22 +0200123 default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
124 default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
Steve Raee016f0b2016-08-15 17:26:26 -0700125 help
126 The fastboot "flash" command requires additional information
127 regarding the non-volatile storage device. Define this to
128 the eMMC device that fastboot should use to store the image.
129
Alex Kiernan4085b902018-05-29 15:30:51 +0000130config FASTBOOT_FLASH_NAND_TRIMFFS
131 bool "Skip empty pages when flashing NAND"
132 depends on FASTBOOT_FLASH_NAND
133 help
134 When flashing NAND enable the DROP_FFS flag to drop trailing all-0xff
135 pages.
136
Patrick Delaunay3acbc7b2021-01-27 14:46:47 +0100137config FASTBOOT_MMC_BOOT_SUPPORT
138 bool "Enable EMMC_BOOT flash/erase"
139 depends on FASTBOOT_FLASH_MMC
mingming lee1fdbad02020-01-16 16:11:42 +0800140 help
141 The fastboot "flash" and "erase" commands normally does operations
Patrick Delaunay3acbc7b2021-01-27 14:46:47 +0100142 on eMMC userdata. Define this to enable the special commands to
143 flash/erase eMMC boot partition.
144 The default target name for updating eMMC boot partition 1/2 is
145 CONFIG_FASTBOOT_MMC_BOOT1_NAME/CONFIG_FASTBOOT_MMC_BOOT2_NAME.
mingming lee1fdbad02020-01-16 16:11:42 +0800146
147config FASTBOOT_MMC_BOOT1_NAME
148 string "Target name for updating EMMC_BOOT1"
Patrick Delaunay3acbc7b2021-01-27 14:46:47 +0100149 depends on FASTBOOT_MMC_BOOT_SUPPORT
mingming lee1fdbad02020-01-16 16:11:42 +0800150 default "mmc0boot0"
151 help
152 The fastboot "flash" and "erase" commands support operations on
153 EMMC_BOOT1. This occurs when the specified "EMMC_BOOT1 name" on
154 the "fastboot flash" and "fastboot erase" commands match the value
155 defined here.
156 The default target name for updating EMMC_BOOT1 is "mmc0boot0".
157
Patrick Delaunay3acbc7b2021-01-27 14:46:47 +0100158config FASTBOOT_MMC_BOOT2_NAME
159 string "Target name for updating EMMC_BOOT2"
160 depends on FASTBOOT_MMC_BOOT_SUPPORT
161 default "mmc0boot1"
162 help
163 The fastboot "flash" and "erase" commands support operations on
164 EMMC_BOOT2. This occurs when the specified "EMMC_BOOT2 name" on
165 the "fastboot flash" and "fastboot erase" commands match the value
166 defined here.
167 The default target name for updating EMMC_BOOT2 is "mmc0boot1".
168
Patrick Delaunay75966962021-01-27 14:46:46 +0100169config FASTBOOT_MMC_USER_SUPPORT
170 bool "Enable eMMC userdata partition flash/erase"
171 depends on FASTBOOT_FLASH_MMC
172 help
173 Define this to enable the support "flash" and "erase" command on
174 eMMC userdata. The "flash" command only update the MBR and GPT
175 header when CONFIG_EFI_PARTITION is supported.
176 The "erase" command erase all the userdata.
177 This occurs when the specified "partition name" on the
178 fastboot command line matches the value CONFIG_FASTBOOT_MMC_USER_NAME.
179
mingming lee1fdbad02020-01-16 16:11:42 +0800180config FASTBOOT_MMC_USER_NAME
Patrick Delaunay75966962021-01-27 14:46:46 +0100181 string "Target name for updating EMMC_USER"
182 depends on FASTBOOT_MMC_USER_SUPPORT
mingming lee1fdbad02020-01-16 16:11:42 +0800183 default "mmc0"
184 help
Patrick Delaunay75966962021-01-27 14:46:46 +0100185 The fastboot "flash" and "erase" command supports EMMC_USER.
186 This occurs when the specified "EMMC_USER name" on the
187 "fastboot flash" and the "fastboot erase" commands match the value
188 defined here.
mingming lee1fdbad02020-01-16 16:11:42 +0800189 The default target name for erasing EMMC_USER is "mmc0".
190
Petr Kulhavy6f6c8632016-09-09 10:27:18 +0200191config FASTBOOT_GPT_NAME
192 string "Target name for updating GPT"
Alex Kiernan42d8dd42018-05-29 15:30:42 +0000193 depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
Petr Kulhavy6f6c8632016-09-09 10:27:18 +0200194 default "gpt"
195 help
196 The fastboot "flash" command supports writing the downloaded
197 image to the Protective MBR and the Primary GUID Partition
198 Table. (Additionally, this downloaded image is post-processed
199 to generate and write the Backup GUID Partition Table.)
200 This occurs when the specified "partition name" on the
201 "fastboot flash" command line matches the value defined here.
202 The default target name for updating GPT is "gpt".
203
204config FASTBOOT_MBR_NAME
205 string "Target name for updating MBR"
Alex Kiernan42d8dd42018-05-29 15:30:42 +0000206 depends on FASTBOOT_FLASH_MMC && DOS_PARTITION
Petr Kulhavy6f6c8632016-09-09 10:27:18 +0200207 default "mbr"
208 help
209 The fastboot "flash" command allows to write the downloaded image
210 to the Master Boot Record. This occurs when the "partition name"
211 specified on the "fastboot flash" command line matches the value
212 defined here. The default target name for updating MBR is "mbr".
213
Alex Kiernan3845b902018-05-29 15:30:54 +0000214config FASTBOOT_CMD_OEM_FORMAT
215 bool "Enable the 'oem format' command"
216 depends on FASTBOOT_FLASH_MMC && CMD_GPT
217 help
218 Add support for the "oem format" command from a client. This
219 relies on the env variable partitions to contain the list of
220 partitions as required by the gpt command.
221
Patrick Delaunayb2f6b972021-01-27 14:46:48 +0100222config FASTBOOT_CMD_OEM_PARTCONF
223 bool "Enable the 'oem partconf' command"
224 depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT
225 help
226 Add support for the "oem partconf" command from a client. This set
227 the mmc boot-partition for the selecting eMMC device.
228
Patrick Delaunay0c0394b2021-01-27 14:46:49 +0100229config FASTBOOT_CMD_OEM_BOOTBUS
230 bool "Enable the 'oem bootbus' command"
231 depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT
232 help
233 Add support for the "oem bootbus" command from a client. This set
234 the mmc boot configuration for the selecting eMMC device.
235
Sean Andersonf3d914c2022-12-16 13:20:16 -0500236config FASTBOOT_OEM_RUN
237 bool "Enable the 'oem run' command"
238 help
239 This extends the fastboot protocol with an "oem run" command. This
240 command allows running arbitrary U-Boot shell commands. Do not enable
241 this feature if you are using verified boot, as it will allow an
242 attacker to bypass any restrictions you have in place.
243
Yann E. MORINc2948732016-11-13 22:26:13 +0100244endif # FASTBOOT
Alex Kiernan312a10f2018-05-29 15:30:39 +0000245
246endmenu