blob: 1eb460f5a02a87089d85b252375202d9acaec9fa [file] [log] [blame]
Alex Kiernan65de9552018-05-29 15:30:39 +00001menu "Fastboot support"
Tom Rini793921e2024-04-18 08:29:35 -06002 depends on CMDLINE
Jerome Forissiere0f95512024-10-16 12:03:59 +02003 depends on !NET_LWIP
Steve Rae437689f2016-08-15 17:26:26 -07004
Alex Kiernan65de9552018-05-29 15:30:39 +00005config FASTBOOT
6 bool
7 imply ANDROID_BOOT_IMAGE
8 imply CMD_FASTBOOT
Dmitrii Merkurev308252d2023-04-12 19:49:30 +01009 help
10 Fastboot is a protocol used in Android devices for
11 communicating between the device and a computer during
12 the bootloader stage. It allows the user to flash the
13 device firmware and unlock the bootloader.
14 More information about the protocol and usecases:
15 https://android.googlesource.com/platform/system/core/+/refs/heads/master/fastboot/
Steve Rae437689f2016-08-15 17:26:26 -070016
Tom Rini5e384862024-04-10 20:00:32 -060017 Note that enabling CMDLINE is recommended since fastboot allows U-Boot
18 commands to be executed on request. The CMDLINE option is required
19 for anything other than simply booting the OS.
20
Steve Rae437689f2016-08-15 17:26:26 -070021config USB_FUNCTION_FASTBOOT
22 bool "Enable USB fastboot gadget"
Alex Kiernan65de9552018-05-29 15:30:39 +000023 depends on USB_GADGET
24 default y if ARCH_SUNXI && USB_MUSB_GADGET
25 select FASTBOOT
Maxime Ripard6d7dfe22017-09-07 10:29:51 +020026 select USB_GADGET_DOWNLOAD
Steve Rae437689f2016-08-15 17:26:26 -070027 help
28 This enables the USB part of the fastboot gadget.
29
Alex Kiernand5aa57c2018-05-29 15:30:53 +000030config UDP_FUNCTION_FASTBOOT
31 depends on NET
32 select FASTBOOT
33 bool "Enable fastboot protocol over UDP"
34 help
35 This enables the fastboot protocol over UDP.
36
Christian Gmeiner7fd97aa2022-01-13 08:40:06 +010037config UDP_FUNCTION_FASTBOOT_PORT
38 depends on UDP_FUNCTION_FASTBOOT
39 int "Define FASTBOOT UDP port"
40 default 5554
41 help
42 The fastboot protocol requires a UDP port number.
43
Dmitrii Merkurev308252d2023-04-12 19:49:30 +010044config TCP_FUNCTION_FASTBOOT
45 depends on NET
46 select FASTBOOT
47 bool "Enable fastboot protocol over TCP"
48 help
49 This enables the fastboot protocol over TCP.
50
Alex Kiernan65de9552018-05-29 15:30:39 +000051if FASTBOOT
Steve Rae437689f2016-08-15 17:26:26 -070052
53config FASTBOOT_BUF_ADDR
54 hex "Define FASTBOOT buffer address"
Tom Rinib5bf5622017-08-25 17:50:27 -040055 default 0x82000000 if MX6SX || MX6SL || MX6UL || MX6SLL
56 default 0x81000000 if ARCH_OMAP2PLUS
57 default 0x42000000 if ARCH_SUNXI && !MACH_SUN9I
58 default 0x22000000 if ARCH_SUNXI && MACH_SUN9I
59 default 0x60800800 if ROCKCHIP_RK3036 || ROCKCHIP_RK3188 || \
60 ROCKCHIP_RK322X
61 default 0x800800 if ROCKCHIP_RK3288 || ROCKCHIP_RK3329 || \
62 ROCKCHIP_RK3399
63 default 0x280000 if ROCKCHIP_RK3368
64 default 0x100000 if ARCH_ZYNQMP
Tom Rinif18679c2023-08-02 11:09:43 -040065 default 0x0 if SANDBOX
Steve Rae437689f2016-08-15 17:26:26 -070066 help
67 The fastboot protocol requires a large memory buffer for
68 downloads. Define this to the starting RAM address to use for
69 downloaded images.
70
71config FASTBOOT_BUF_SIZE
72 hex "Define FASTBOOT buffer size"
Tom Rinib5bf5622017-08-25 17:50:27 -040073 default 0x8000000 if ARCH_ROCKCHIP
74 default 0x6000000 if ARCH_ZYNQMP
75 default 0x2000000 if ARCH_SUNXI
Jens Wiklanderf1edae92018-09-25 16:40:23 +020076 default 0x8192 if SANDBOX
Tom Rinib5bf5622017-08-25 17:50:27 -040077 default 0x7000000
Steve Rae437689f2016-08-15 17:26:26 -070078 help
79 The fastboot protocol requires a large memory buffer for
80 downloads. This buffer should be as large as possible for a
81 platform. Define this to the size available RAM for fastboot.
82
Semen Protsenko97bb3f82016-10-24 18:41:10 +030083config FASTBOOT_USB_DEV
84 int "USB controller number"
Alex Kiernan65de9552018-05-29 15:30:39 +000085 depends on USB_FUNCTION_FASTBOOT
Semen Protsenko97bb3f82016-10-24 18:41:10 +030086 default 0
87 help
88 Some boards have USB OTG controller other than 0. Define this
89 option so it can be used in compiled environment (e.g. in
90 CONFIG_BOOTCOMMAND).
91
Steve Rae437689f2016-08-15 17:26:26 -070092config FASTBOOT_FLASH
93 bool "Enable FASTBOOT FLASH command"
Jagan Teki04aae032019-11-19 13:56:18 +053094 default y if ARCH_SUNXI || ARCH_ROCKCHIP
Miquel Raynald0935362019-10-03 19:50:03 +020095 depends on MMC || (MTD_RAW_NAND && CMD_MTDPARTS)
Alex Kiernanc568bcb2018-05-29 15:30:52 +000096 select IMAGE_SPARSE
Steve Rae437689f2016-08-15 17:26:26 -070097 help
98 The fastboot protocol includes a "flash" command for writing
99 the downloaded image to a non-volatile storage device. Define
100 this to enable the "fastboot flash" command.
101
Heiko Schocher3a994482021-02-10 09:29:03 +0100102config FASTBOOT_UUU_SUPPORT
Sean Anderson421bec02022-12-16 13:20:16 -0500103 bool "Enable UUU support"
Heiko Schocher3a994482021-02-10 09:29:03 +0100104 help
Sean Anderson421bec02022-12-16 13:20:16 -0500105 This extends the fastboot protocol with the "UCmd" and "ACmd"
106 commands, which are used by NXP's "universal update utility" (UUU).
107 These commands allow running any shell command. Do not enable this
108 feature if you are using verified boot, as it will allow an attacker
109 to bypass any restrictions you have in place.
Heiko Schocher3a994482021-02-10 09:29:03 +0100110
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100111choice
112 prompt "Flash provider for FASTBOOT"
113 depends on FASTBOOT_FLASH
114
115config FASTBOOT_FLASH_MMC
116 bool "FASTBOOT on MMC"
117 depends on MMC
118
119config FASTBOOT_FLASH_NAND
120 bool "FASTBOOT on NAND"
Miquel Raynald0935362019-10-03 19:50:03 +0200121 depends on MTD_RAW_NAND && CMD_MTDPARTS
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100122
123endchoice
124
Steve Rae437689f2016-08-15 17:26:26 -0700125config FASTBOOT_FLASH_MMC_DEV
126 int "Define FASTBOOT MMC FLASH default device"
Patrick Delaunay99a8e032017-12-07 18:26:17 +0100127 depends on FASTBOOT_FLASH_MMC
Jagan Teki04aae032019-11-19 13:56:18 +0530128 default 0 if ARCH_ROCKCHIP
Maxime Ripard65cefba2017-08-23 10:12:22 +0200129 default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
130 default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
Steve Rae437689f2016-08-15 17:26:26 -0700131 help
132 The fastboot "flash" command requires additional information
133 regarding the non-volatile storage device. Define this to
134 the eMMC device that fastboot should use to store the image.
135
Alex Kiernandc405852018-05-29 15:30:51 +0000136config FASTBOOT_FLASH_NAND_TRIMFFS
137 bool "Skip empty pages when flashing NAND"
138 depends on FASTBOOT_FLASH_NAND
139 help
140 When flashing NAND enable the DROP_FFS flag to drop trailing all-0xff
141 pages.
142
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100143config FASTBOOT_MMC_BOOT_SUPPORT
144 bool "Enable EMMC_BOOT flash/erase"
145 depends on FASTBOOT_FLASH_MMC
developer6a105562020-01-16 16:11:42 +0800146 help
147 The fastboot "flash" and "erase" commands normally does operations
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100148 on eMMC userdata. Define this to enable the special commands to
149 flash/erase eMMC boot partition.
150 The default target name for updating eMMC boot partition 1/2 is
151 CONFIG_FASTBOOT_MMC_BOOT1_NAME/CONFIG_FASTBOOT_MMC_BOOT2_NAME.
developer6a105562020-01-16 16:11:42 +0800152
153config FASTBOOT_MMC_BOOT1_NAME
154 string "Target name for updating EMMC_BOOT1"
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100155 depends on FASTBOOT_MMC_BOOT_SUPPORT
developer6a105562020-01-16 16:11:42 +0800156 default "mmc0boot0"
157 help
158 The fastboot "flash" and "erase" commands support operations on
159 EMMC_BOOT1. This occurs when the specified "EMMC_BOOT1 name" on
160 the "fastboot flash" and "fastboot erase" commands match the value
161 defined here.
162 The default target name for updating EMMC_BOOT1 is "mmc0boot0".
163
Patrick Delaunay2579b0e2021-01-27 14:46:47 +0100164config FASTBOOT_MMC_BOOT2_NAME
165 string "Target name for updating EMMC_BOOT2"
166 depends on FASTBOOT_MMC_BOOT_SUPPORT
167 default "mmc0boot1"
168 help
169 The fastboot "flash" and "erase" commands support operations on
170 EMMC_BOOT2. This occurs when the specified "EMMC_BOOT2 name" on
171 the "fastboot flash" and "fastboot erase" commands match the value
172 defined here.
173 The default target name for updating EMMC_BOOT2 is "mmc0boot1".
174
Patrick Delaunay8b0a29a2021-01-27 14:46:46 +0100175config FASTBOOT_MMC_USER_SUPPORT
176 bool "Enable eMMC userdata partition flash/erase"
177 depends on FASTBOOT_FLASH_MMC
178 help
179 Define this to enable the support "flash" and "erase" command on
180 eMMC userdata. The "flash" command only update the MBR and GPT
181 header when CONFIG_EFI_PARTITION is supported.
182 The "erase" command erase all the userdata.
183 This occurs when the specified "partition name" on the
184 fastboot command line matches the value CONFIG_FASTBOOT_MMC_USER_NAME.
185
developer6a105562020-01-16 16:11:42 +0800186config FASTBOOT_MMC_USER_NAME
Patrick Delaunay8b0a29a2021-01-27 14:46:46 +0100187 string "Target name for updating EMMC_USER"
188 depends on FASTBOOT_MMC_USER_SUPPORT
developer6a105562020-01-16 16:11:42 +0800189 default "mmc0"
190 help
Patrick Delaunay8b0a29a2021-01-27 14:46:46 +0100191 The fastboot "flash" and "erase" command supports EMMC_USER.
192 This occurs when the specified "EMMC_USER name" on the
193 "fastboot flash" and the "fastboot erase" commands match the value
194 defined here.
developer6a105562020-01-16 16:11:42 +0800195 The default target name for erasing EMMC_USER is "mmc0".
196
Petr Kulhavy4ed1eca2016-09-09 10:27:18 +0200197config FASTBOOT_GPT_NAME
198 string "Target name for updating GPT"
Alex Kiernan8cb1eab2018-05-29 15:30:42 +0000199 depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
Petr Kulhavy4ed1eca2016-09-09 10:27:18 +0200200 default "gpt"
201 help
202 The fastboot "flash" command supports writing the downloaded
203 image to the Protective MBR and the Primary GUID Partition
204 Table. (Additionally, this downloaded image is post-processed
205 to generate and write the Backup GUID Partition Table.)
206 This occurs when the specified "partition name" on the
207 "fastboot flash" command line matches the value defined here.
208 The default target name for updating GPT is "gpt".
209
210config FASTBOOT_MBR_NAME
211 string "Target name for updating MBR"
Alex Kiernan8cb1eab2018-05-29 15:30:42 +0000212 depends on FASTBOOT_FLASH_MMC && DOS_PARTITION
Petr Kulhavy4ed1eca2016-09-09 10:27:18 +0200213 default "mbr"
214 help
215 The fastboot "flash" command allows to write the downloaded image
216 to the Master Boot Record. This occurs when the "partition name"
217 specified on the "fastboot flash" command line matches the value
218 defined here. The default target name for updating MBR is "mbr".
219
Alex Kiernanc86cde92018-05-29 15:30:54 +0000220config FASTBOOT_CMD_OEM_FORMAT
221 bool "Enable the 'oem format' command"
222 depends on FASTBOOT_FLASH_MMC && CMD_GPT
223 help
224 Add support for the "oem format" command from a client. This
225 relies on the env variable partitions to contain the list of
226 partitions as required by the gpt command.
227
Patrick Delaunay61687702021-01-27 14:46:48 +0100228config FASTBOOT_CMD_OEM_PARTCONF
229 bool "Enable the 'oem partconf' command"
230 depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT
231 help
232 Add support for the "oem partconf" command from a client. This set
233 the mmc boot-partition for the selecting eMMC device.
234
Patrick Delaunay67af29a2021-01-27 14:46:49 +0100235config FASTBOOT_CMD_OEM_BOOTBUS
236 bool "Enable the 'oem bootbus' command"
237 depends on FASTBOOT_FLASH_MMC && SUPPORT_EMMC_BOOT
238 help
239 Add support for the "oem bootbus" command from a client. This set
240 the mmc boot configuration for the selecting eMMC device.
241
Sean Anderson421bec02022-12-16 13:20:16 -0500242config FASTBOOT_OEM_RUN
243 bool "Enable the 'oem run' command"
244 help
245 This extends the fastboot protocol with an "oem run" command. This
246 command allows running arbitrary U-Boot shell commands. Do not enable
247 this feature if you are using verified boot, as it will allow an
248 attacker to bypass any restrictions you have in place.
249
Ion Agorriae64262d2024-01-05 09:22:11 +0200250config FASTBOOT_CMD_OEM_CONSOLE
251 bool "Enable the 'oem console' command"
252 depends on CONSOLE_RECORD
253 help
254 Add support for the "oem console" command to input and read console
255 record buffer.
256
Alexey Romanova0ae7902024-04-18 13:01:29 +0300257config FASTBOOT_OEM_BOARD
258 bool "Enable the 'oem board' command"
259 help
260 This extends the fastboot protocol with an "oem board" command. This
261 command allows running vendor custom code defined in board/ files.
262 Otherwise, it will do nothing and send fastboot fail.
263
Yann E. MORIN3d2561f2016-11-13 22:26:13 +0100264endif # FASTBOOT
Alex Kiernan65de9552018-05-29 15:30:39 +0000265
266endmenu