def flash(self, image_bundle=None, images=None): device = self.owner if not hasattr(device, 'port') or not hasattr(device, 'microsd_mount_point'): msg = 'Device {} does not appear to support VExpress flashing.' raise ConfigError(msg.format(device.name)) with open_serial_connection(port=device.port, baudrate=device.baudrate, timeout=device.timeout, init_dtr=0) as target: target.sendline('usb_on') # this will cause the MicroSD to be mounted on the host device.wait_for_microsd_mount_point(target) self.deploy_images(device, image_bundle, images) self.logger.debug('Resetting the device.') device.hard_reset(target) with open_serial_connection(port=device.port, baudrate=device.baudrate, timeout=device.timeout, init_dtr=0) as target: menu = UefiMenu(target) menu.open(timeout=120) if menu.has_option(device.uefi_entry): self.logger.debug('Deleting existing device entry.') menu.delete_entry(device.uefi_entry) menu.create_entry(device.uefi_entry, device.uefi_config) menu.select(device.uefi_entry) target.expect(device.android_prompt, timeout=device.timeout)
def _boot_via_uefi(self): with open_serial_connection(port=self.port, baudrate=self.baudrate, timeout=self.timeout, init_dtr=0) as target: menu = UefiMenu(target) self.logger.debug('Waiting for UEFI menu...') menu.open(timeout=120) try: menu.select(self.uefi_entry) except LookupError: self.logger.debug('{} UEFI entry not found.'.format( self.uefi_entry)) self.logger.debug( 'Attempting to create one using default flasher configuration.' ) menu.create_entry(self.uefi_entry, self.uefi_config) menu.select(self.uefi_entry) self.logger.debug('Waiting for the Android prompt.') target.expect(self.android_prompt, timeout=self.timeout)
def _boot_via_uefi(self): with open_serial_connection(port=self.port, baudrate=self.baudrate, timeout=self.timeout, init_dtr=0) as target: menu = UefiMenu(target) self.logger.debug('Waiting for UEFI menu...') menu.open(timeout=120) try: menu.select(self.uefi_entry) except LookupError: self.logger.debug('{} UEFI entry not found.'.format(self.uefi_entry)) self.logger.debug('Attempting to create one using default flasher configuration.') menu.create_entry(self.uefi_entry, self.uefi_config) menu.select(self.uefi_entry) self.logger.debug('Waiting for the Android prompt.') target.expect(self.android_prompt, timeout=self.timeout)
def flash(self, image_bundle=None, images=None, recreate_uefi_entry=True): # pylint: disable=arguments-differ device = self.owner if not hasattr(device, 'port') or not hasattr(device, 'microsd_mount_point'): msg = 'Device {} does not appear to support VExpress flashing.' raise ConfigError(msg.format(device.name)) with open_serial_connection(port=device.port, baudrate=device.baudrate, timeout=device.timeout, init_dtr=0) as target: target.sendline( 'usb_on' ) # this will cause the MicroSD to be mounted on the host device.wait_for_microsd_mount_point(target) self.deploy_images(device, image_bundle, images) self.logger.debug('Resetting the device.') device.hard_reset() with open_serial_connection(port=device.port, baudrate=device.baudrate, timeout=device.timeout, init_dtr=0) as target: menu = UefiMenu(target) menu.open(timeout=300) if recreate_uefi_entry and menu.has_option(device.uefi_entry): self.logger.debug('Deleting existing device entry.') menu.delete_entry(device.uefi_entry) menu.create_entry(device.uefi_entry, device.uefi_config) elif not menu.has_option(device.uefi_entry): menu.create_entry(device.uefi_entry, device.uefi_config) menu.select(device.uefi_entry) target.expect(device.android_prompt, timeout=device.timeout)