Skip to content

Instantly share code, notes, and snippets.

@vonDubenshire
Forked from MrHallows/fastboot_help.md
Created June 20, 2023 01:27
Show Gist options
  • Save vonDubenshire/43aa510e29fd731f31303ed4366c1c02 to your computer and use it in GitHub Desktop.
Save vonDubenshire/43aa510e29fd731f31303ed4366c1c02 to your computer and use it in GitHub Desktop.
fastboot commands

Command:

$ fastboot help

Output:

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, using the image from
                            $ANDROID_PRODUCT_OUT if no filename is given.

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.
 gsi wipe|disable           Wipe or disable a GSI installation (fastbootd only).
 wipe-super [SUPER_EMPTY]   Wipe the super partition. This will reset it to
                            contain an empty set of default dynamic partitions.
 snapshot-update cancel     On devices that support snapshot-based updates, cancel
                            an in-progress update. This may make the device
                            unbootable until it is reflashed.
 snapshot-update merge      On devices that support snapshot-based updates, finish
                            an in-progress update if it is in the "merging"
                            phase.

boot image:
 boot KERNEL [RAMDISK [SECOND]]
                            Download and boot kernel from RAM.
 flash:raw PARTITION KERNEL [RAMDISK [SECOND]]
                            Create boot image and flash it.
 --dtb DTB                  Specify path to DTB for boot image header version 2.
 --cmdline 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).
 --dtb-offset               Set dtb offset (default: 0x01100000).
 --page-size BYTES          Set flash page size (default: 2048).
 --header-version VERSION   Set boot image header version.
 --os-version MAJOR[.MINOR[.PATCH]]
                            Set boot image OS version (default: 0.0.0).
 --os-patch-level YYYY-MM-DD
                            Set boot image OS security patch level.

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.
 -s SERIAL                  Specify a USB device.
 -s tcp|udp:HOST[:PORT]     Specify a network device.
 -S SIZE[K|M|G]             Break into sparse files no larger than SIZE.
 --force                    Force a flash operation that may be unsafe.
 --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.
 --unbuffered               Don't buffer input or output.
 --verbose, -v              Verbose output.
 --version                  Display version.
 --help, -h                 Show this message.

Command:

$ fastboot oem help

Output:

(bootloader) config...
(bootloader) hw...
(bootloader) partition...
(bootloader) fb_mode_set
(bootloader) fb_mode_clear
(bootloader) bp-tools-on
(bootloader) bp-tools-off
(bootloader) qcom-on
(bootloader) qcom-off
(bootloader) unlock
(bootloader) lock
(bootloader) get_unlock_data
(bootloader) cid_prov_req
(bootloader) read_sv
(bootloader) ab_reset
(bootloader) off-mode-charge
(bootloader) show_screen

Command:

$ fastboot oem hw help

Output:

(bootloader) usage: fastboot oem hw [options]
(bootloader)
(bootloader) options:
(bootloader)   (none given)      list all defined utags
(bootloader)   /                 list all existing utags
(bootloader)   +<name>           create empty utag
(bootloader)   -<name>           delete utag
(bootloader)      use "fastboot oem -- hw -<name>"
(bootloader)   @<name>           set current utag
(bootloader)   @                 show current utag
(bootloader)   @/                reset current utag
(bootloader)   <name> <value>    set a utag
(bootloader)   <name> +<value>   append value to current
(bootloader)                     utag value
(bootloader)   <name>            query a utag
(bootloader)   <name>/           query child utags
(bootloader)   clear             unset all utags
(bootloader)   lock              lock utags
(bootloader)   unlock            unlock utags
(bootloader)   status            check lock status
(bootloader)   help              show usage
(bootloader) special utags:
(bootloader)   .features         list of defined utags
(bootloader)   .attributes       list of attribute utags
(bootloader)                     defined for each utag
(bootloader)   attribute utags
(bootloader)   .range            comma separated list of
(bootloader)                     acceptable values
(bootloader)   following utags pass values to upper layers
(bootloader)   .chosen           add property to device tree
(bootloader)       <value of .chosen><parent utag name>=
(bootloader)                             <parent utag value>
(bootloader)   .cmdline          add value to cmdline
(bootloader)       <value of .cmdline><parent utag name>=
(bootloader)                             <parent utag value>
(bootloader)   .system           populate system property
(bootloader)       <value of .system><parent utag name>=
(bootloader)                             <parent utag value>
(bootloader)   .auto             autodetect utag value
(bootloader)       if utag is empty and .auto rule is set
(bootloader)       the rule is executed and result is saved
(bootloader)       to the utag. Format of the .auto rule:
(bootloader)       key=<key>;index=<index within key>;map=<mapping to
(bootloader) user friendly value>
(bootloader)       map is optional
(bootloader)
(bootloader)
(bootloader) Example of .chosen usage:
(bootloader)       utag nfc is set to "true"
(bootloader)       utag nfc/.chosen is set to "mmi,"
(bootloader)       device tree property under chosen is set to
(bootloader)           mmi,nfc=true
(bootloader)
(bootloader) Example of .cmdline usage:
(bootloader)       utag radio is set to "ROW"
(bootloader)       utag radio/.cmdline is set to "androidboot."
(bootloader)       option is added to kernel command line
(bootloader)           androidboot.radio=ROW
(bootloader)
(bootloader) Example of .system usage:
(bootloader)       utag fps is set to "false"
(bootloader)       utag fps/.system is set to "ro.hw."
(bootloader)       android system property is set to
(bootloader)           ro.vendor.hw.fps=false
(bootloader) Examples of .auto usage:
(bootloader)       utag radio/.auto is set to
(bootloader)           "key=hwid;index=2;map=1:US,2:China,3:EMEA"
(bootloader)           this rule takes value in column 2
(bootloader)           of current hwid line, e.g.:
(bootloader)           "B A 1 P1A athene_13mp"
(bootloader)           and maps it to US, China or EMEA
(bootloader)
(bootloader)       utag imager/.auto is set to
(bootloader)           "key=hwid;index=5;separator=_;
(bootloader)             map=13mp:13MP,16mp:16MP,power:13MP"
(bootloader)           this rule takes value in column 5
(bootloader)           of current hwid line, e.g.:
(bootloader)           "B A 1 P1A athene_13mp"
(bootloader)           considering default and '_' separators
(bootloader)           and maps it to 13MP or 16MP
(bootloader)
(bootloader)       utag ram/.auto is set to
(bootloader)           "key=hwprobe;index=__ram"
(bootloader)           utag ram is set to RAM size
(bootloader)
(bootloader)       utag frontcolor/.auto is set to
(bootloader)           "uspace=config;name=build_vars"
(bootloader)           HW utag frontcolor is set to value of
(bootloader)           CONFIG utag build_vars
(bootloader)
(bootloader)       utag nfc/.auto is set to
(bootloader)           "default=false"
(bootloader)           HW utag nfc is set to "false"
(bootloader)
(bootloader)       utag product/.auto is set to
(bootloader)           "uspace=config;name=fti;slice=53:10;
(bootloader)             map=VERTEX_VZW:addison"
(bootloader)           HW utag product is set to "addison"
(bootloader)           if field (offset:53, size:10) stored
(bootloader)           in config UTAG fti evaluates to
(bootloader)           "VERTEX_VZW"

Command:

$ fastboot oem partition

Output:

(bootloader) sbl1_a: offset=128KB, size=512KB
(bootloader) sbl1_b: offset=640KB, size=512KB
(bootloader) rpm_a: offset=1152KB, size=256KB
(bootloader) rpm_b: offset=1664KB, size=256KB
(bootloader) tz_a: offset=2176KB, size=1792KB
(bootloader) tz_b: offset=4224KB, size=1792KB
(bootloader) devcfg_a: offset=6272KB, size=64KB
(bootloader) devcfg_b: offset=6528KB, size=64KB
(bootloader) aboot_a: offset=6784KB, size=1536KB
(bootloader) aboot_b: offset=8320KB, size=1536KB
(bootloader) cmnlib_a: offset=9856KB, size=1024KB
(bootloader) cmnlib_b: offset=10880KB, size=1024KB
(bootloader) cmnlib64_a: offset=11904KB, size=1024KB
(bootloader) cmnlib64_b: offset=12928KB, size=1024KB
(bootloader) keymaster_a: offset=13952KB, size=1024KB
(bootloader) keymaster_b: offset=14976KB, size=1024KB
(bootloader) prov_a: offset=16000KB, size=192KB
(bootloader) prov_b: offset=16256KB, size=192KB
(bootloader) modem_a: offset=16512KB, size=102400KB
(bootloader) modem_b: offset=118912KB, size=102400KB
(bootloader) fsc: offset=221312KB, size=4KB
(bootloader) ssd: offset=221316KB, size=8KB
(bootloader) dsp_a: offset=221324KB, size=16384KB
(bootloader) dsp_b: offset=237708KB, size=16384KB
(bootloader) DDR: offset=254208KB, size=32KB
(bootloader) utags: offset=254336KB, size=512KB
(bootloader) utagsBackup: offset=254848KB, size=512KB
(bootloader) modemst1: offset=255360KB, size=2048KB
(bootloader) modemst2: offset=257408KB, size=2048KB
(bootloader) fsg_a: offset=259456KB, size=12288KB
(bootloader) fsg_b: offset=271744KB, size=12288KB
(bootloader) persist: offset=284032KB, size=32768KB
(bootloader) persist2: offset=316800KB, size=8192KB
(bootloader) frp: offset=324992KB, size=512KB
(bootloader) cid: offset=325504KB, size=128KB
(bootloader) logo_a: offset=325632KB, size=16384KB
(bootloader) logo_b: offset=342016KB, size=16384KB
(bootloader) carrier: offset=358400KB, size=16384KB
(bootloader) metadata: offset=374784KB, size=16384KB
(bootloader) kpan: offset=391168KB, size=8192KB
(bootloader) boot_a: offset=399360KB, size=32768KB
(bootloader) boot_b: offset=448512KB, size=32768KB
(bootloader) dtbo_a: offset=497664KB, size=8192KB
(bootloader) dtbo_b: offset=505856KB, size=8192KB
(bootloader) misc: offset=514048KB, size=1024KB
(bootloader) mota: offset=515072KB, size=512KB
(bootloader) syscfg: offset=515584KB, size=512KB
(bootloader) logs: offset=516096KB, size=2048KB
(bootloader) apdp: offset=518144KB, size=256KB
(bootloader) msadp: offset=518400KB, size=256KB
(bootloader) dpo: offset=518656KB, size=8KB
(bootloader) devinfo: offset=518664KB, size=512KB
(bootloader) vbmeta_a: offset=519176KB, size=64KB
(bootloader) vbmeta_b: offset=519240KB, size=64KB
(bootloader) padA: offset=519424KB, size=4864KB
(bootloader) hw: offset=524288KB, size=8192KB
(bootloader) sp: offset=532480KB, size=8192KB
(bootloader) oem_a: offset=540672KB, size=589824KB
(bootloader) oem_b: offset=1130496KB, size=589824KB
(bootloader) vendor_a: offset=1720320KB, size=589824KB
(bootloader) vendor_b: offset=2310144KB, size=589824KB
(bootloader) system_a: offset=2899968KB, size=2818048KB
(bootloader) system_b: offset=5718016KB, size=2818048KB
(bootloader) userdata: offset=8536064KB, size=21999599KB

Command:

$ fastboot oem partition help

Output:

(bootloader) usage: fastboot oem partition [options]
(bootloader)
(bootloader) options:
(bootloader)   (none given)                     list all partitions
(bootloader)   <name>                           list a partition
(bootloader)   dump <name> [<offset> [size]]    dump a partition
(bootloader)   md5 <name> [<offset> [size]]     md5 of a partition
(bootloader)   sha256 <name> [<offset> [size]]  sha256 of a partition
(bootloader)   help                             show usage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment