blob: 70207573de2bd0d56b4b7fa6f7e17fdc5803ba15 [file] [log] [blame]
Alex Kiernan65de9552018-05-29 15:30:39 +00001menu "Fastboot support"
Tom Rini793921e2024-04-18 08:29:35 -06002 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
Tom Rini5e384862024-04-10 20:00:32 -060016 Note that enabling CMDLINE is recommended since fastboot allows U-Boot
17 commands to be executed on request. The CMDLINE option is required
18 for anything other than simply booting the OS.
19
Steve Rae437689f2016-08-15 17:26:26 -070020config USB_FUNCTION_FASTBOOT
21 bool "Enable USB fastboot gadget"
Alex Kiernan65de9552018-05-29 15:30:39 +000022 depends on USB_GADGET
23 default y if ARCH_SUNXI && USB_MUSB_GADGET
24 select FASTBOOT
Maxime Ripard6d7dfe22017-09-07 10:29:51 +020025 select USB_GADGET_DOWNLOAD
Steve Rae437689f2016-08-15 17:26:26 -070026 help
27 This enables the USB part of the fastboot gadget.
28
Alex Kiernand5aa57c2018-05-29 15:30:53 +000029config UDP_FUNCTION_FASTBOOT
30 depends on NET
31 select FASTBOOT
32 bool "Enable fastboot protocol over UDP"
33 help
34 This enables the fastboot protocol over UDP.
35
Christian Gmeiner7fd97aa2022-01-13 08:40:06 +010036config UDP_FUNCTION_FASTBOOT_PORT
37 depends on UDP_FUNCTION_FASTBOOT
38 int "Define FASTBOOT UDP port"
39 default 5554
40 help
41 The fastboot protocol requires a UDP port number.
42
Dmitrii Merkurev308252d2023-04-12 19:49:30 +010043config TCP_FUNCTION_FASTBOOT
44 depends on NET
45 select FASTBOOT
46 bool "Enable fastboot protocol over TCP"
47 help
48 This enables the fastboot protocol over TCP.
49
Alex Kiernan65de9552018-05-29 15:30:39 +000050if FASTBOOT
Steve Rae437689f2016-08-15 17:26:26 -070051
52config FASTBOOT_BUF_ADDR
53 hex "Define FASTBOOT buffer address"
Tom Rinib5bf5622017-08-25 17:50:27 -040054 default 0x82000000 if MX6SX || MX6SL || MX6UL || MX6SLL
55 default 0x81000000 if ARCH_OMAP2PLUS
56 default 0x42000000 if ARCH_SUNXI && !MACH_SUN9I
57 default 0x22000000 if ARCH_SUNXI && MACH_SUN9I
58 default 0x60800800 if ROCKCHIP_RK3036 || ROCKCHIP_RK3188 || \
59 ROCKCHIP_RK322X
60 default 0x800800 if ROCKCHIP_RK3288 || ROCKCHIP_RK3329 || \
61 ROCKCHIP_RK3399
62 default 0x280000 if ROCKCHIP_RK3368
63 default 0x100000 if ARCH_ZYNQMP
Tom Rinif18679c2023-08-02 11:09:43 -040064 default 0x0 if SANDBOX
Steve Rae437689f2016-08-15 17:26:26 -070065 help
66 The fastboot protocol requires a large memory buffer for
67 downloads. Define this to the starting RAM address to use for
68 downloaded images.
69
70config FASTBOOT_BUF_SIZE
71 hex "Define FASTBOOT buffer size"
Tom Rinib5bf5622017-08-25 17:50:27 -040072 default 0x8000000 if ARCH_ROCKCHIP
73 default 0x6000000 if ARCH_ZYNQMP
74 default 0x2000000 if ARCH_SUNXI
Jens Wiklanderf1edae92018-09-25 16:40:23 +020075 default 0x8192 if SANDBOX
Tom Rinib5bf5622017-08-25 17:50:27 -040076 default 0x7000000
Steve Rae437689f2016-08-15 17:26:26 -070077 help
78 The fastboot protocol requires a large memory buffer for
79 downloads. This buffer should be as large as possible for a
80 platform. Define this to the size available RAM for fastboot.
81
Semen Protsenko97bb3f82016-10-24 18:41:10 +030082config FASTBOOT_USB_DEV
83 int "USB controller number"
Alex Kiernan65de9552018-05-29 15:30:39 +000084 depends on USB_FUNCTION_FASTBOOT
Semen Protsenko97bb3f82016-10-24 18:41:10 +030085 default 0
86 help
87 Some boards have USB OTG controller other than 0. Define this
88 option so it can be used in compiled environment (e.g. in
89 CONFIG_BOOTCOMMAND).
90
Steve Rae437689f2016-08-15 17:26:26 -070091config FASTBOOT_FLASH
92 bool "Enable FASTBOOT FLASH command"
Jagan Teki04aae032019-11-19 13:56:18 +053093 default y if ARCH_SUNXI || ARCH_ROCKCHIP
Miquel Raynald0935362019-10-03 19:50:03 +020094 depends on MMC || (MTD_RAW_NAND && CMD_MTDPARTS)
Alex Kiernanc568bcb2018-05-29 15:30:52 +000095 select IMAGE_SPARSE
Steve Rae437689f2016-08-15 17:26:26 -070096 help
97 The fastboot protocol includes a "flash" command for writing
98 the downloaded image to a non-volatile storage device. Define
99 this to enable the "fastboot flash" command.
100
Heiko Schocher3a994482021-02-10 09:29:03 +0100101config FASTBOOT_UUU_SUPPORT
Sean Anderson421bec02022-12-16 13:20:16 -0500102 bool "Enable UUU support"
Heiko Schocher3a994482021-02-10 09:29:03 +0100103 help
Sean Anderson421bec02022-12-16 13:20:16 -0500104 This extends the fastboot protocol with the "UCmd" and "ACmd"
105 commands, which are used by NXP's "universal update utility" (UUU).
106 These commands allow running any shell command. Do not enable this
107 feature if you are using verified boot, as it will allow an attacker
108 to bypass any restrictions you have in place.
Heiko Schocher3a994482021-02-10 09:29:03 +0100109
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100110choice
111 prompt "Flash provider for FASTBOOT"
112 depends on FASTBOOT_FLASH
113
114config FASTBOOT_FLASH_MMC
115 bool "FASTBOOT on MMC"
116 depends on MMC
117
118config FASTBOOT_FLASH_NAND
119 bool "FASTBOOT on NAND"
Miquel Raynald0935362019-10-03 19:50:03 +0200120 depends on MTD_RAW_NAND && CMD_MTDPARTS
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100121
122endchoice
123
Steve Rae437689f2016-08-15 17:26:26 -0700124config FASTBOOT_FLASH_MMC_DEV
125 int "Define FASTBOOT MMC FLASH default device"
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100126 depends on FASTBOOT_FLASH_MMC
Jagan Teki04aae032019-11-19 13:56:18 +0530127 default 0 if ARCH_ROCKCHIP
Maxime Ripard65cefba2017-08-23 10:12:22 +0200128 default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
129 default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
Steve Rae437689f2016-08-15 17:26:26 -0700130 help
131 The fastboot "flash" command requires additional information
132 regarding the non-volatile storage device. Define this to
133 the eMMC device that fastboot should use to store the image.
134
Alex Kiernandc405852018-05-29 15:30:51 +0000135config FASTBOOT_FLASH_NAND_TRIMFFS
136 bool "Skip empty pages when flashing NAND"
137 depends on FASTBOOT_FLASH_NAND
138 help
139 When flashing NAND enable the DROP_FFS flag to drop trailing all-0xff
140 pages.
141
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100142config FASTBOOT_MMC_BOOT_SUPPORT
143 bool "Enable EMMC_BOOT flash/erase"
144 depends on FASTBOOT_FLASH_MMC
developer6a105562020-01-16 16:11:42 +0800145 help
146 The fastboot "flash" and "erase" commands normally does operations
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100147 on eMMC userdata. Define this to enable the special commands to
148 flash/erase eMMC boot partition.
149 The default target name for updating eMMC boot partition 1/2 is
150 CONFIG_FASTBOOT_MMC_BOOT1_NAME/CONFIG_FASTBOOT_MMC_BOOT2_NAME.
developer6a105562020-01-16 16:11:42 +0800151
152config FASTBOOT_MMC_BOOT1_NAME
153 string "Target name for updating EMMC_BOOT1"
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100154 depends on FASTBOOT_MMC_BOOT_SUPPORT
developer6a105562020-01-16 16:11:42 +0800155 default "mmc0boot0"
156 help
157 The fastboot "flash" and "erase" commands support operations on
158 EMMC_BOOT1. This occurs when the specified "EMMC_BOOT1 name" on
159 the "fastboot flash" and "fastboot erase" commands match the value
160 defined here.
161 The default target name for updating EMMC_BOOT1 is "mmc0boot0".
162
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100163config FASTBOOT_MMC_BOOT2_NAME
164 string "Target name for updating EMMC_BOOT2"
165 depends on FASTBOOT_MMC_BOOT_SUPPORT
166 default "mmc0boot1"
167 help
168 The fastboot "flash" and "erase" commands support operations on
169 EMMC_BOOT2. This occurs when the specified "EMMC_BOOT2 name" on
170 the "fastboot flash" and "fastboot erase" commands match the value
171 defined here.
172 The default target name for updating EMMC_BOOT2 is "mmc0boot1".
173
Patrick Delaunay8b0a29a2021-01-27 14:46:46 +0100174config FASTBOOT_MMC_USER_SUPPORT
175 bool "Enable eMMC userdata partition flash/erase"
176 depends on FASTBOOT_FLASH_MMC
177 help
178 Define this to enable the support "flash" and "erase" command on
179 eMMC userdata. The "flash" command only update the MBR and GPT
180 header when CONFIG_EFI_PARTITION is supported.
181 The "erase" command erase all the userdata.
182 This occurs when the specified "partition name" on the
183 fastboot command line matches the value CONFIG_FASTBOOT_MMC_USER_NAME.
184
developer6a105562020-01-16 16:11:42 +0800185config FASTBOOT_MMC_USER_NAME
Patrick Delaunay8b0a29a2021-01-27 14:46:46 +0100186 string "Target name for updating EMMC_USER"
187 depends on FASTBOOT_MMC_USER_SUPPORT
developer6a105562020-01-16 16:11:42 +0800188 default "mmc0"
189 help
Patrick Delaunay8b0a29a2021-01-27 14:46:46 +0100190 The fastboot "flash" and "erase" command supports EMMC_USER.
191 This occurs when the specified "EMMC_USER name" on the
192 "fastboot flash" and the "fastboot erase" commands match the value
193 defined here.
developer6a105562020-01-16 16:11:42 +0800194 The default target name for erasing EMMC_USER is "mmc0".
195
Petr Kulhavy4ed1eca2016-09-09 10:27:18 +0200196config FASTBOOT_GPT_NAME
197 string "Target name for updating GPT"
Alex Kiernan8cb1eab2018-05-29 15:30:42 +0000198 depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
Petr Kulhavy4ed1eca2016-09-09 10:27:18 +0200199 default "gpt"
200 help
201 The fastboot "flash" command supports writing the downloaded
202 image to the Protective MBR and the Primary GUID Partition
203 Table. (Additionally, this downloaded image is post-processed
204 to generate and write the Backup GUID Partition Table.)
205 This occurs when the specified "partition name" on the
206 "fastboot flash" command line matches the value defined here.
207 The default target name for updating GPT is "gpt".
208
209config FASTBOOT_MBR_NAME
210 string "Target name for updating MBR"
Alex Kiernan8cb1eab2018-05-29 15:30:42 +0000211 depends on FASTBOOT_FLASH_MMC && DOS_PARTITION
Petr Kulhavy4ed1eca2016-09-09 10:27:18 +0200212 default "mbr"
213 help
214 The fastboot "flash" command allows to write the downloaded image
215 to the Master Boot Record. This occurs when the "partition name"
216 specified on the "fastboot flash" command line matches the value
217 defined here. The default target name for updating MBR is "mbr".
218
Alex Kiernanc86cde92018-05-29 15:30:54 +0000219config FASTBOOT_CMD_OEM_FORMAT
220 bool "Enable the 'oem format' command"
221 depends on FASTBOOT_FLASH_MMC && CMD_GPT
222 help
223 Add support for the "oem format" command from a client. This
224 relies on the env variable partitions to contain the list of
225 partitions as required by the gpt command.
226
Patrick Delaunay61687702021-01-27 14:46:48 +0100227config FASTBOOT_CMD_OEM_PARTCONF
228 bool "Enable the 'oem partconf' command"
229 depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT
230 help
231 Add support for the "oem partconf" command from a client. This set
232 the mmc boot-partition for the selecting eMMC device.
233
Patrick Delaunay67af29a2021-01-27 14:46:49 +0100234config FASTBOOT_CMD_OEM_BOOTBUS
235 bool "Enable the 'oem bootbus' command"
236 depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT
237 help
238 Add support for the "oem bootbus" command from a client. This set
239 the mmc boot configuration for the selecting eMMC device.
240
Sean Anderson421bec02022-12-16 13:20:16 -0500241config FASTBOOT_OEM_RUN
242 bool "Enable the 'oem run' command"
243 help
244 This extends the fastboot protocol with an "oem run" command. This
245 command allows running arbitrary U-Boot shell commands. Do not enable
246 this feature if you are using verified boot, as it will allow an
247 attacker to bypass any restrictions you have in place.
248
Ion Agorriae64262d2024-01-05 09:22:11 +0200249config FASTBOOT_CMD_OEM_CONSOLE
250 bool "Enable the 'oem console' command"
251 depends on CONSOLE_RECORD
252 help
253 Add support for the "oem console" command to input and read console
254 record buffer.
255
Alexey Romanova0ae7902024-04-18 13:01:29 +0300256config FASTBOOT_OEM_BOARD
257 bool "Enable the 'oem board' command"
258 help
259 This extends the fastboot protocol with an "oem board" command. This
260 command allows running vendor custom code defined in board/ files.
261 Otherwise, it will do nothing and send fastboot fail.
262
Yann E. MORIN3d2561f2016-11-13 22:26:13 +0100263endif # FASTBOOT
Alex Kiernan65de9552018-05-29 15:30:39 +0000264
265endmenu