1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 20:09:11 +00:00

Adding support for U-Boot booting in Juno.

This commit is contained in:
Sergei Trofimov 2015-06-25 10:59:19 +01:00
parent 642da319d4
commit 00561e0973
2 changed files with 50 additions and 20 deletions

View File

@ -26,6 +26,7 @@ from wlauto.exceptions import DeviceError
from wlauto.utils.serial_port import open_serial_connection, pulse_dtr
from wlauto.utils.android import adb_connect, adb_disconnect, adb_list_devices
from wlauto.utils.uefi import UefiMenu, UefiConfig
from wlauto.utils.uboot import UbootMenu
AUTOSTART_MESSAGE = 'Press Enter to stop auto boot...'
@ -59,6 +60,9 @@ class Juno(BigLittleDevice):
Parameter('core_names', default=['a53', 'a53', 'a53', 'a53', 'a57', 'a57'], override=True),
Parameter('core_clusters', default=[0, 0, 0, 0, 1, 1], override=True),
Parameter('bootloader', default='uefi', allowed_values=['uefi', 'u-boot'],
description="""Bootloader used on the device."""),
# VExpress flasher expects a device to have these:
Parameter('uefi_entry', default='WA',
description='The name of the entry to use (will be created if does not exist).'),
@ -84,6 +88,27 @@ class Juno(BigLittleDevice):
def boot(self, **kwargs):
self.logger.debug('Resetting the device.')
self.reset()
if self.bootloader == 'uefi':
self._boot_via_uefi()
else:
self._boot_via_uboot(**kwargs)
def _boot_via_uboot(self, **kwargs):
if not kwargs:
# Standard linaro configuration will proceed directly to the kernel
return
with open_serial_connection(port=self.port,
baudrate=self.baudrate,
timeout=self.timeout,
init_dtr=0) as target:
menu = UbootMenu(target)
self.logger.debug('Waiting for U-Boot prompt...')
menu.open(timeout=120)
for var, value in kwargs.iteritems():
menu.setenv(var, value)
menu.boot()
def _boot_via_uefi(self):
with open_serial_connection(port=self.port,
baudrate=self.baudrate,
timeout=self.timeout,
@ -109,7 +134,7 @@ class Juno(BigLittleDevice):
baudrate=self.baudrate,
init_dtr=0) as target:
target.sendline('')
self.logger.debug('Waiting for android prompt.')
self.logger.debug('Waiting for the Android prompt.')
target.expect(self.android_prompt)
self.logger.debug('Waiting for IP address...')

View File

@ -54,25 +54,7 @@ def pulse_dtr(conn, state=True, duration=0.1):
conn.setDTR(not state)
@contextmanager
def open_serial_connection(timeout, get_conn=False, init_dtr=None, *args, **kwargs):
"""
Opens a serial connection to a device.
:param timeout: timeout for the fdpexpect spawn object.
:param conn: ``bool`` that specfies whether the underlying connection
object should be yielded as well.
:param init_dtr: specifies the initial DTR state stat should be set.
All arguments are passed into the __init__ of serial.Serial. See
pyserial documentation for details:
http://pyserial.sourceforge.net/pyserial_api.html#serial.Serial
:returns: a pexpect spawn object connected to the device.
See: http://pexpect.sourceforge.net/pexpect.html
"""
def get_connection(timeout, init_dtr=None, *args, **kwargs):
if init_dtr is not None:
kwargs['dsrdtr'] = True
try:
@ -99,6 +81,29 @@ def open_serial_connection(timeout, get_conn=False, init_dtr=None, *args, **kwar
time.sleep(0.1)
target.sendline = sendline
return target, conn
@contextmanager
def open_serial_connection(timeout, get_conn=False, init_dtr=None, *args, **kwargs):
"""
Opens a serial connection to a device.
:param timeout: timeout for the fdpexpect spawn object.
:param conn: ``bool`` that specfies whether the underlying connection
object should be yielded as well.
:param init_dtr: specifies the initial DTR state stat should be set.
All arguments are passed into the __init__ of serial.Serial. See
pyserial documentation for details:
http://pyserial.sourceforge.net/pyserial_api.html#serial.Serial
:returns: a pexpect spawn object connected to the device.
See: http://pexpect.sourceforge.net/pexpect.html
"""
target, conn = get_connection(timeout, init_dtr=init_dtr, *args, **kwargs)
if get_conn:
yield target, conn