def reboot_target(self, disable_charge=True): """ Reboot the target if a "boot-image" has been specified If the user specify a boot-image as a command line parameter, this method will reboot the target with the specified kernel and wait for the target to be up and running. """ rebooted = False # Reboot the device, if a boot_image has been specified if self.args.boot_image: self._log.warning('=== Rebooting...') self._log.warning('Rebooting image to use: %s', self.args.boot_image) self._log.debug('Waiting 6[s] to enter bootloader...') self.target.adb_reboot_bootloader() sleep(6) # self._fastboot('boot {}'.format(self.args.boot_image)) cmd = 'boot {}'.format(self.args.boot_image) fastboot_command(cmd, device=self.target.adb_name) self._log.debug('Waiting {}[s] for boot to start...'\ .format(self.args.boot_timeout)) sleep(self.args.boot_timeout) rebooted = True else: self._log.warning('Device NOT rebooted, using current image') # Restart ADB in root mode self._log.warning('Restarting ADB in root mode...') self.target.adb_root(force=True) # TODO add check for kernel SHA1 self._log.warning('Skipping kernel SHA1 cross-check...') # Disable charge via USB if disable_charge: self._log.debug('Disabling charge over USB...') self.target.charging_enabled = False # Log current kernel version self._log.info('Running with kernel:') self._log.info(' %s', self.target.kernel_version) # Wait for the system to complete the boot self._wait_for_logcat_idle() return rebooted
def __call__(self, image_bundle=None, images=None, bootargs=None): if bootargs: raise ValueError('{} does not support boot configuration'.format(self.name)) self.prelude_done = False to_flash = {} if image_bundle: # pylint: disable=access-member-before-definition image_bundle = expand_path(image_bundle) to_flash = self._bundle_to_images(image_bundle) to_flash = merge_dicts(to_flash, images or {}, should_normalize=False) for partition, image_path in to_flash.items(): self.logger.debug('flashing {}'.format(partition)) self._flash_image(self.target, partition, expand_path(image_path)) fastboot_command('reboot') self.target.connect(timeout=180)
def __call__(self, image_bundle=None, images=None, bootargs=None): if bootargs: raise ValueError('{} does not support boot configuration'.format(self.name)) self.prelude_done = False to_flash = {} if image_bundle: # pylint: disable=access-member-before-definition image_bundle = expand_path(image_bundle) to_flash = self._bundle_to_images(image_bundle) to_flash = merge_dicts(to_flash, images or {}, should_normalize=False) for partition, image_path in to_flash.iteritems(): self.logger.debug('flashing {}'.format(partition)) self._flash_image(self.target, partition, expand_path(image_path)) fastboot_command('reboot') self.target.connect(timeout=180)