Clean up fastboot help:
After:
usage: fastboot [OPTION...] COMMAND...
flashing:
update ZIP Flash all partitions from an update.zip package.
flashall Flash all partitions from $ANDROID_PRODUCT_OUT.
On A/B devices, flashed slot is set as active.
Secondary images may be flashed to inactive slot.
flash PARTITION [FILENAME]
Flash given partition only.
basics:
devices [-l] List devices in bootloader (-l: with device paths).
getvar NAME Display given bootloader variable.
reboot [bootloader] Reboot device.
locking/unlocking:
flashing lock|unlock Lock/unlock partitions for flashing
flashing lock_critical|unlock_critical
Lock/unlock 'critical' bootloader partitions.
flashing get_unlock_ability
Check whether unlocking is allowed (1) or not(0).
advanced:
erase PARTITION Erase a flash partition.
format[:FS_TYPE[:SIZE]] PARTITION
Format a flash partition.
set_active SLOT Set the active slot.
oem [COMMAND...] Execute OEM-specific command.
boot image:
boot KERNEL [RAMDISK [SECOND]]
Download and boot kernel from RAM.
flash:raw PARTITION KERNEL [RAMDISK [SECOND]]
Create boot image and flash it.
-c CMDLINE Override kernel command line.
--base ADDRESS Set kernel base address (default: 0x10000000).
--kernel-offset Set kernel offset (default: 0x00008000).
--ramdisk-offset Set ramdisk offset (default: 0x01000000).
--tags-offset Set tags offset (default: 0x00000100).
--page-size BYTES Set flash page size (default: 2048).
--header-version VERSION Set boot image header version.
Android Things:
stage IN_FILE Sends given file to stage for the next command.
get_staged OUT_FILE Writes data staged by the last command to a file.
options:
-w Wipe userdata.
-u Do not erase partition first when formatting.
-s SERIAL Specify a USB device.
-s tcp|udp:HOST[:PORT] Specify a network device.
-i VENDOR_ID Filter devices by USB vendor id.
-S SIZE[K|M|G] Use sparse files above this limit (0 to disable).
--slot SLOT Use SLOT; 'all' for both slots, 'other' for
non-current slot (default: current active slot).
--set-active[=SLOT] Sets the active slot before rebooting.
--skip-secondary Don't flash secondary slots in flashall/update.
--skip-reboot Don't reboot device after flashing.
--disable-verity Sets disable-verity when flashing vbmeta.
--disable-verification Sets disable-verification when flashing vbmeta.
--wipe-and-use-fbe Enable file-based encryption, wiping userdata.
--unbuffered Don't buffer input or output.
--verbose, -v Verbose output.
--version Display version.
--help, -h Show this message.
Bug: N/A
Test: `fastboot --help`
Change-Id: I3639fdee68de544f12e75004ccbb03b8386e64ed
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index c5b357c..091b117 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -326,118 +326,83 @@
// clang-format off
fprintf(stdout,
/* 1234567890123456789012345678901234567890123456789012345678901234567890123456 */
- "usage: fastboot [ <option> ] <command>\n"
+ "usage: fastboot [OPTION...] COMMAND...\n"
"\n"
- "commands:\n"
- " update <filename> Reflash device from update.zip.\n"
- " Sets the flashed slot as active.\n"
- " flashall Flash boot, system, vendor, and --\n"
- " if found -- recovery. If the device\n"
- " supports slots, the slot that has\n"
- " been flashed to is set as active.\n"
- " Secondary images may be flashed to\n"
- " an inactive slot.\n"
- " flash <partition> [ <filename> ] Write a file to a flash partition.\n"
- " flashing lock Locks the device. Prevents flashing.\n"
- " flashing unlock Unlocks the device. Allows flashing\n"
- " any partition except\n"
- " bootloader-related partitions.\n"
- " flashing lock_critical Prevents flashing bootloader-related\n"
- " partitions.\n"
- " flashing unlock_critical Enables flashing bootloader-related\n"
- " partitions.\n"
- " flashing get_unlock_ability Queries bootloader to see if the\n"
- " device is unlocked.\n"
- " flashing get_unlock_bootloader_nonce Queries the bootloader to get the\n"
- " unlock nonce.\n"
- " flashing unlock_bootloader <request> Issue unlock bootloader using request.\n"
- " flashing lock_bootloader Locks the bootloader to prevent\n"
- " bootloader version rollback.\n"
- " erase <partition> Erase a flash partition.\n"
- " format[:[<fs type>][:[<size>]] <partition>\n"
- " Format a flash partition. Can\n"
- " override the fs type and/or size\n"
- " the bootloader reports.\n"
- " getvar <variable> Display a bootloader variable.\n"
- " set_active <slot> Sets the active slot. If slots are\n"
- " not supported, this does nothing.\n"
- " boot <kernel> [ <ramdisk> [ <second> ] ] Download and boot kernel.\n"
- " flash:raw <bootable-partition> <kernel> [ <ramdisk> [ <second> ] ]\n"
- " Create bootimage and flash it.\n"
- " devices [-l] List all connected devices [with\n"
- " device paths].\n"
- " continue Continue with autoboot.\n"
- " reboot [bootloader|emergency] Reboot device [into bootloader or emergency mode].\n"
- " reboot-bootloader Reboot device into bootloader.\n"
- " oem <parameter1> ... <parameterN> Executes oem specific command.\n"
- " stage <infile> Sends contents of <infile> to stage for\n"
- " the next command. Supported only on\n"
- " Android Things devices.\n"
- " get_staged <outfile> Receives data to <outfile> staged by the\n"
- " last command. Supported only on Android\n"
- " Things devices.\n"
- " help Show this help message.\n"
+ "flashing:\n"
+ " update ZIP Flash all partitions from an update.zip package.\n"
+ " flashall Flash all partitions from $ANDROID_PRODUCT_OUT.\n"
+ " On A/B devices, flashed slot is set as active.\n"
+ " Secondary images may be flashed to inactive slot.\n"
+ " flash PARTITION [FILENAME]\n"
+ " Flash given partition only.\n"
+ "\n"
+ "basics:\n"
+ " devices [-l] List devices in bootloader (-l: with device paths).\n"
+ " getvar NAME Display given bootloader variable.\n"
+ " reboot [bootloader] Reboot device.\n"
+ "\n"
+ "locking/unlocking:\n"
+ " flashing lock|unlock Lock/unlock partitions for flashing\n"
+ " flashing lock_critical|unlock_critical\n"
+ " Lock/unlock 'critical' bootloader partitions.\n"
+ " flashing get_unlock_ability\n"
+ " Check whether unlocking is allowed (1) or not(0).\n"
+ "\n"
+ "advanced:\n"
+ " erase PARTITION Erase a flash partition.\n"
+ " format[:FS_TYPE[:SIZE]] PARTITION\n"
+ " Format a flash partition.\n"
+ " set_active SLOT Set the active slot.\n"
+ " oem [COMMAND...] Execute OEM-specific command.\n"
+ "\n"
+ "boot image:\n"
+ " boot KERNEL [RAMDISK [SECOND]]\n"
+ " Download and boot kernel from RAM.\n"
+ " flash:raw PARTITION KERNEL [RAMDISK [SECOND]]\n"
+ " Create boot image and flash it.\n"
+ // TODO: give -c a long option, and remove the short options for this group?
+ " -c CMDLINE Override kernel command line.\n"
+ " --base ADDRESS Set kernel base address (default: 0x10000000).\n"
+ " --kernel-offset Set kernel offset (default: 0x00008000).\n"
+ " --ramdisk-offset Set ramdisk offset (default: 0x01000000).\n"
+ " --tags-offset Set tags offset (default: 0x00000100).\n"
+ " --page-size BYTES Set flash page size (default: 2048).\n"
+ " --header-version VERSION Set boot image header version.\n"
+ "\n"
+ // TODO: what device(s) used these? is there any documentation?
+ //" flashing unlock_bootloader REQUEST\n"
+ //" unlock bootloader using request.\n"
+ //" flashing lock_bootloader\n"
+ //" lock bootloader to prevent bootloader version rollback.\n"
+ //" continue Continue with autoboot.\n"
+ //"\n"
+ "Android Things:\n"
+ " stage IN_FILE Sends given file to stage for the next command.\n"
+ " get_staged OUT_FILE Writes data staged by the last command to a file.\n"
"\n"
"options:\n"
- " -w Erase userdata and cache (and format\n"
- " if supported by partition type).\n"
- " -u Do not erase partition before\n"
- " formatting.\n"
- " -s <specific device> Specify a device. For USB, provide either\n"
- " a serial number or path to device port.\n"
- " For ethernet, provide an address in the\n"
- " form <protocol>:<hostname>[:port] where\n"
- " <protocol> is either tcp or udp.\n"
- " -c <cmdline> Override kernel commandline.\n"
- " -i <vendor id> Specify a custom USB vendor id.\n"
- " -b, --base <base_addr> Specify a custom kernel base\n"
- " address (default: 0x10000000).\n"
- " --kernel-offset Specify a custom kernel offset.\n"
- " (default: 0x00008000)\n"
- " --ramdisk-offset Specify a custom ramdisk offset.\n"
- " (default: 0x01000000)\n"
- " --tags-offset Specify a custom tags offset.\n"
- " (default: 0x00000100)\n"
- " -n, --page-size <page size> Specify the nand page size\n"
- " (default: 2048).\n"
- " -S <size>[K|M|G] Automatically sparse files greater\n"
- " than 'size'. 0 to disable.\n"
- " --slot <slot> Specify slot name to be used if the\n"
- " device supports slots. All operations\n"
- " on partitions that support slots will\n"
- " be done on the slot specified.\n"
- " 'all' can be given to refer to all slots.\n"
- " 'other' can be given to refer to a\n"
- " non-current slot. If this flag is not\n"
- " used, slotted partitions will default\n"
- " to the current active slot.\n"
- " -a, --set-active[=<slot>] Sets the active slot. If no slot is\n"
- " provided, this will default to the value\n"
- " given by --slot. If slots are not\n"
- " supported, this does nothing. This will\n"
- " run after all non-reboot commands.\n"
- " --skip-secondary Will not flash secondary slots when\n"
- " performing a flashall or update. This\n"
- " will preserve data on other slots.\n"
- " --skip-reboot Will not reboot the device when\n"
- " performing commands that normally\n"
- " trigger a reboot.\n"
- " --disable-verity Set the disable-verity flag in the\n"
- " the vbmeta image being flashed.\n"
- " --disable-verification Set the disable-verification flag in\n"
- " the vbmeta image being flashed.\n"
+ " -w Wipe userdata.\n"
+ " -u Do not erase partition first when formatting.\n"
+ " -s SERIAL Specify a USB device.\n"
+ " -s tcp|udp:HOST[:PORT] Specify a network device.\n"
+ // TODO: remove -i?
+ " -i VENDOR_ID Filter devices by USB vendor id.\n"
+ " -S SIZE[K|M|G] Use sparse files above this limit (0 to disable).\n"
+ " --slot SLOT Use SLOT; 'all' for both slots, 'other' for\n"
+ " non-current slot (default: current active slot).\n"
+ " --set-active[=SLOT] Sets the active slot before rebooting.\n"
+ " --skip-secondary Don't flash secondary slots in flashall/update.\n"
+ " --skip-reboot Don't reboot device after flashing.\n"
+ " --disable-verity Sets disable-verity when flashing vbmeta.\n"
+ " --disable-verification Sets disable-verification when flashing vbmeta.\n"
#if !defined(_WIN32)
- " --wipe-and-use-fbe On devices which support it,\n"
- " erase userdata and cache, and\n"
- " enable file-based encryption\n"
+ " --wipe-and-use-fbe Enable file-based encryption, wiping userdata.\n"
#endif
- " --unbuffered Do not buffer input or output.\n"
- " -v, --verbose Verbose output.\n"
- " --version Display version.\n"
- " --header-version Set boot image header version while\n"
- " using flash:raw and boot commands to \n"
- " to create a boot image.\n"
- " -h, --help show this message.\n"
+ // TODO: remove --unbuffered?
+ " --unbuffered Don't buffer input or output.\n"
+ " --verbose, -v Verbose output.\n"
+ " --version Display version.\n"
+ " --help, -h Show this message.\n"
);
// clang-format off
return 0;
@@ -1834,7 +1799,6 @@
args[0] == "unlock_critical" ||
args[0] == "lock_critical" ||
args[0] == "get_unlock_ability" ||
- args[0] == "get_unlock_bootloader_nonce" ||
args[0] == "lock_bootloader")) {
do_oem_command("flashing", &args);
} else if (args.size() == 2 && args[0] == "unlock_bootloader") {