blob: a3df9aa3d0f858cf662924e463e7299db2730b3e [file] [log] [blame]
Alex Kiernan65de9552018-05-29 15:30:39 +00001menu "Fastboot support"
Steve Rae437689f2016-08-15 17:26:26 -07002
Alex Kiernan65de9552018-05-29 15:30:39 +00003config FASTBOOT
4 bool
5 imply ANDROID_BOOT_IMAGE
6 imply CMD_FASTBOOT
Dmitrii Merkurev308252d2023-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 Rae437689f2016-08-15 17:26:26 -070014
15config USB_FUNCTION_FASTBOOT
16 bool "Enable USB fastboot gadget"
Alex Kiernan65de9552018-05-29 15:30:39 +000017 depends on USB_GADGET
18 default y if ARCH_SUNXI && USB_MUSB_GADGET
19 select FASTBOOT
Maxime Ripard6d7dfe22017-09-07 10:29:51 +020020 select USB_GADGET_DOWNLOAD
Steve Rae437689f2016-08-15 17:26:26 -070021 help
22 This enables the USB part of the fastboot gadget.
23
Alex Kiernand5aa57c2018-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 Gmeiner7fd97aa2022-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 Merkurev308252d2023-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 Kiernan65de9552018-05-29 15:30:39 +000045if FASTBOOT
Steve Rae437689f2016-08-15 17:26:26 -070046
47config FASTBOOT_BUF_ADDR
48 hex "Define FASTBOOT buffer address"
Tom Rinib5bf5622017-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
Jens Wiklanderf1edae92018-09-25 16:40:23 +020059 default 0 if SANDBOX
Steve Rae437689f2016-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 Rinib5bf5622017-08-25 17:50:27 -040067 default 0x8000000 if ARCH_ROCKCHIP
68 default 0x6000000 if ARCH_ZYNQMP
69 default 0x2000000 if ARCH_SUNXI
Jens Wiklanderf1edae92018-09-25 16:40:23 +020070 default 0x8192 if SANDBOX
Tom Rinib5bf5622017-08-25 17:50:27 -040071 default 0x7000000
Steve Rae437689f2016-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 Protsenko97bb3f82016-10-24 18:41:10 +030077config FASTBOOT_USB_DEV
78 int "USB controller number"
Alex Kiernan65de9552018-05-29 15:30:39 +000079 depends on USB_FUNCTION_FASTBOOT
Semen Protsenko97bb3f82016-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 Rae437689f2016-08-15 17:26:26 -070086config FASTBOOT_FLASH
87 bool "Enable FASTBOOT FLASH command"
Jagan Teki04aae032019-11-19 13:56:18 +053088 default y if ARCH_SUNXI || ARCH_ROCKCHIP
Miquel Raynald0935362019-10-03 19:50:03 +020089 depends on MMC || (MTD_RAW_NAND && CMD_MTDPARTS)
Alex Kiernanc568bcb2018-05-29 15:30:52 +000090 select IMAGE_SPARSE
Steve Rae437689f2016-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 Schocher3a994482021-02-10 09:29:03 +010096config FASTBOOT_UUU_SUPPORT
Sean Anderson421bec02022-12-16 13:20:16 -050097 bool "Enable UUU support"
Heiko Schocher3a994482021-02-10 09:29:03 +010098 help
Sean Anderson421bec02022-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 Schocher3a994482021-02-10 09:29:03 +0100104
Patrick Delaunay99a8e032017-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 Raynald0935362019-10-03 19:50:03 +0200115 depends on MTD_RAW_NAND && CMD_MTDPARTS
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100116
117endchoice
118
Steve Rae437689f2016-08-15 17:26:26 -0700119config FASTBOOT_FLASH_MMC_DEV
120 int "Define FASTBOOT MMC FLASH default device"
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100121 depends on FASTBOOT_FLASH_MMC
Jagan Teki04aae032019-11-19 13:56:18 +0530122 default 0 if ARCH_ROCKCHIP
Maxime Ripard65cefba2017-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 Rae437689f2016-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 Kiernandc405852018-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 Delaunay2579b0e2021-01-27 14:46:47 +0100137config FASTBOOT_MMC_BOOT_SUPPORT
138 bool "Enable EMMC_BOOT flash/erase"
139 depends on FASTBOOT_FLASH_MMC
developer6a105562020-01-16 16:11:42 +0800140 help
141 The fastboot "flash" and "erase" commands normally does operations
Patrick Delaunay2579b0e2021-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.
developer6a105562020-01-16 16:11:42 +0800146
147config FASTBOOT_MMC_BOOT1_NAME
148 string "Target name for updating EMMC_BOOT1"
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100149 depends on FASTBOOT_MMC_BOOT_SUPPORT
developer6a105562020-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 Delaunay2579b0e2021-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 Delaunay8b0a29a2021-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
developer6a105562020-01-16 16:11:42 +0800180config FASTBOOT_MMC_USER_NAME
Patrick Delaunay8b0a29a2021-01-27 14:46:46 +0100181 string "Target name for updating EMMC_USER"
182 depends on FASTBOOT_MMC_USER_SUPPORT
developer6a105562020-01-16 16:11:42 +0800183 default "mmc0"
184 help
Patrick Delaunay8b0a29a2021-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.
developer6a105562020-01-16 16:11:42 +0800189 The default target name for erasing EMMC_USER is "mmc0".
190
Petr Kulhavy4ed1eca2016-09-09 10:27:18 +0200191config FASTBOOT_GPT_NAME
192 string "Target name for updating GPT"
Alex Kiernan8cb1eab2018-05-29 15:30:42 +0000193 depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
Petr Kulhavy4ed1eca2016-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 Kiernan8cb1eab2018-05-29 15:30:42 +0000206 depends on FASTBOOT_FLASH_MMC && DOS_PARTITION
Petr Kulhavy4ed1eca2016-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 Kiernanc86cde92018-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 Delaunay61687702021-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 Delaunay67af29a2021-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 Anderson421bec02022-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. MORIN3d2561f2016-11-13 22:26:13 +0100244endif # FASTBOOT
Alex Kiernan65de9552018-05-29 15:30:39 +0000245
246endmenu