Is it possible to prevent the automatic reboot that follows

fastboot -w image.zip

? This would be quite useful for batch files. Thanks for any hint :-)

usage: fastboot [ <option> ] <command>

 update <filename>                        reflash device from update.zip
 flashall                                 'flash boot' + 'flash system'
 flash <partition> [ <filename> ]         write a file to a flash partition
 erase <partition>                        erase a flash partition
 getvar <variable>                        display a bootloader variable
 boot <kernel> [ <ramdisk> ]              download and boot kernel
 flash:raw boot <kernel> [ <ramdisk> ]    create bootimage and flash it
 devices                                  list all connected devices
 reboot                                   reboot device normally
 reboot-bootloader                        reboot device into bootloader

 -w                                       erase userdata and cache
 -s <serial number>                       specify device serial number
 -p <product>                             specify product name
 -c <cmdline>                             override kernel commandline

I think it's safe to assume that the options listed here are the options you have available to you when running the fastboot binary. Since there doesn't seem to be an override as a native function of fastboot, your only solution would be to access the source code of fastboot (if available) and remove or alter the part of the code where the device reboots.

Note that there might be very good reasons as to why the device reboots at that stage, so I'd be careful with messing around with it.

  • actually there are some hidden oem functions on fastboot, so I am not sure if there really is no option for it. for now, selected as correct answer, as it's the only one :P Oct 10 '12 at 9:05

I believe you're looking for the "--skip-reboot" switch, ex:

fastboot -w update image-marlin-opm1.171019.012.zip --skip-reboot

C:>fastboot --help

  update <filename>                        Reflash device from update.zip.
                                           Sets the flashed slot as active.
  flashall                                 Flash boot, system, vendor, and --
                                           if found -- recovery. If the device
                                           supports slots, the slot that has
                                           been flashed to is set as active.
                                           Secondary images may be flashed to
                                           an inactive slot.
  flash <partition> [ <filename> ]         Write a file to a flash partition.
  flashing lock                            Locks the device. Prevents flashing.
  flashing unlock                          Unlocks the device. Allows flashing
                                           any partition except
                                           bootloader-related partitions.
  flashing lock_critical                   Prevents flashing bootloader-related
  flashing unlock_critical                 Enables flashing bootloader-related
  flashing get_unlock_ability              Queries bootloader to see if the
                                           device is unlocked.
  flashing get_unlock_bootloader_nonce     Queries the bootloader to get the
                                           unlock nonce.
  flashing unlock_bootloader <request>     Issue unlock bootloader using request.
  flashing lock_bootloader                 Locks the bootloader to prevent
                                           bootloader version rollback.
  erase <partition>                        Erase a flash partition.
  format[:[<fs type>][:[<size>]] <partition>
                                           Format a flash partition. Can
                                           override the fs type and/or size
                                           the bootloader reports.
  getvar <variable>                        Display a bootloader variable.
  set_active <slot>                        Sets the active slot. If slots are
                                           not supported, this does nothing.
  boot <kernel> [ <ramdisk> [ <second> ] ] Download and boot kernel.
  flash:raw <bootable-partition> <kernel> [ <ramdisk> [ <second> ] ]
                                           Create bootimage and flash it.
  devices [-l]                             List all connected devices [with
                                           device paths].
  continue                                 Continue with autoboot.
  reboot [bootloader|emergency]            Reboot device [into bootloader or emergency mode].
  reboot-bootloader                        Reboot device into bootloader.
  oem <parameter1> ... <parameterN>        Executes oem specific command.
  stage <infile>                           Sends contents of <infile> to stage for
                                           the next command. Supported only on
                                           Android Things devices.
  get_staged <outfile>                     Receives data to <outfile> staged by the
                                           last command. Supported only on Android
                                           Things devices.
  help                                     Show this help message.

  -w                                       Erase userdata and cache (and format
                                           if supported by partition type).
  -u                                       Do not erase partition before
  -s <specific device>                     Specify a device. For USB, provide either
                                           a serial number or path to device port.
                                           For ethernet, provide an address in the
                                           form <protocol>:<hostname>[:port] where
                                           <protocol> is either tcp or udp.
  -c <cmdline>                             Override kernel commandline.
  -i <vendor id>                           Specify a custom USB vendor id.
  -b, --base <base_addr>                   Specify a custom kernel base
                                           address (default: 0x10000000).
  --kernel-offset                          Specify a custom kernel offset.
                                           (default: 0x00008000)
  --ramdisk-offset                         Specify a custom ramdisk offset.
                                           (default: 0x01000000)
  --tags-offset                            Specify a custom tags offset.
                                           (default: 0x00000100)
  -n, --page-size <page size>              Specify the nand page size
                                           (default: 2048).
  -S <size>[K|M|G]                         Automatically sparse files greater
                                           than 'size'. 0 to disable.
  --slot <slot>                            Specify slot name to be used if the
                                           device supports slots. All operations
                                           on partitions that support slots will
                                           be done on the slot specified.
                                           'all' can be given to refer to all slots.
                                           'other' can be given to refer to a
                                           non-current slot. If this flag is not
                                           used, slotted partitions will default
                                           to the current active slot.
  -a, --set-active[=<slot>]                Sets the active slot. If no slot is
                                           provided, this will default to the value
                                           given by --slot. If slots are not
                                           supported, this does nothing. This will
                                           run after all non-reboot commands.
  --skip-secondary                         Will not flash secondary slots when
                                           performing a flashall or update. This
                                           will preserve data on other slots.
  --skip-reboot                            Will not reboot the device when
                                           performing commands that normally
                                           trigger a reboot.
  --disable-verity                         Set the disable-verity flag in the
                                           the vbmeta image being flashed.
  --disable-verification                   Set the disable-verification flag in                                           the vbmeta image being flashed.
  --unbuffered                             Do not buffer input or output.
  --version                                Display version.
  -h, --help                               show this message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.