mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
modules/flash: Add a connect
parameter to the flash method
Adds a `connect` parameter to the flash method to specifiy whether devlib should attempt to connect to the target after flashing has completed.
This commit is contained in:
parent
6c9f80ff76
commit
745dc9499a
@ -91,7 +91,7 @@ class FlashModule(Module):
|
|||||||
|
|
||||||
kind = 'flash'
|
kind = 'flash'
|
||||||
|
|
||||||
def __call__(self, image_bundle=None, images=None, boot_config=None):
|
def __call__(self, image_bundle=None, images=None, boot_config=None, connect=True):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class FastbootFlashModule(FlashModule):
|
|||||||
def probe(target):
|
def probe(target):
|
||||||
return target.os == 'android'
|
return target.os == 'android'
|
||||||
|
|
||||||
def __call__(self, image_bundle=None, images=None, bootargs=None):
|
def __call__(self, image_bundle=None, images=None, bootargs=None, connect=True):
|
||||||
if bootargs:
|
if bootargs:
|
||||||
raise ValueError('{} does not support boot configuration'.format(self.name))
|
raise ValueError('{} does not support boot configuration'.format(self.name))
|
||||||
self.prelude_done = False
|
self.prelude_done = False
|
||||||
@ -67,6 +67,7 @@ class FastbootFlashModule(FlashModule):
|
|||||||
self.logger.debug('flashing {}'.format(partition))
|
self.logger.debug('flashing {}'.format(partition))
|
||||||
self._flash_image(self.target, partition, expand_path(image_path))
|
self._flash_image(self.target, partition, expand_path(image_path))
|
||||||
fastboot_command('reboot')
|
fastboot_command('reboot')
|
||||||
|
if connect:
|
||||||
self.target.connect(timeout=180)
|
self.target.connect(timeout=180)
|
||||||
|
|
||||||
def _validate_image_bundle(self, image_bundle):
|
def _validate_image_bundle(self, image_bundle):
|
||||||
|
@ -325,7 +325,7 @@ class VersatileExpressFlashModule(FlashModule):
|
|||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.short_delay = short_delay
|
self.short_delay = short_delay
|
||||||
|
|
||||||
def __call__(self, image_bundle=None, images=None, bootargs=None):
|
def __call__(self, image_bundle=None, images=None, bootargs=None, connect=True):
|
||||||
self.target.hard_reset()
|
self.target.hard_reset()
|
||||||
with open_serial_connection(port=self.target.platform.serial_port,
|
with open_serial_connection(port=self.target.platform.serial_port,
|
||||||
baudrate=self.target.platform.baudrate,
|
baudrate=self.target.platform.baudrate,
|
||||||
@ -346,6 +346,7 @@ class VersatileExpressFlashModule(FlashModule):
|
|||||||
msg = 'Could not deploy images to {}; got: {}'
|
msg = 'Could not deploy images to {}; got: {}'
|
||||||
raise TargetStableError(msg.format(self.vemsd_mount, e))
|
raise TargetStableError(msg.format(self.vemsd_mount, e))
|
||||||
self.target.boot()
|
self.target.boot()
|
||||||
|
if connect:
|
||||||
self.target.connect(timeout=30)
|
self.target.connect(timeout=30)
|
||||||
|
|
||||||
def _deploy_image_bundle(self, bundle):
|
def _deploy_image_bundle(self, bundle):
|
||||||
|
@ -322,7 +322,7 @@ FlashModule
|
|||||||
|
|
||||||
"flash"
|
"flash"
|
||||||
|
|
||||||
.. method:: __call__(image_bundle=None, images=None, boot_config=None)
|
.. method:: __call__(image_bundle=None, images=None, boot_config=None, connect=True)
|
||||||
|
|
||||||
Must be implemented by derived classes.
|
Must be implemented by derived classes.
|
||||||
|
|
||||||
@ -338,6 +338,7 @@ FlashModule
|
|||||||
:param boot_config: Some platforms require specifying boot arguments at the
|
:param boot_config: Some platforms require specifying boot arguments at the
|
||||||
time of flashing the images, rather than during each
|
time of flashing the images, rather than during each
|
||||||
reboot. For other platforms, this will be ignored.
|
reboot. For other platforms, this will be ignored.
|
||||||
|
:connect: Specifiy whether to try and connect to the target after flashing.
|
||||||
|
|
||||||
|
|
||||||
Module Registration
|
Module Registration
|
||||||
|
Loading…
x
Reference in New Issue
Block a user