mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-20 20:09:11 +00:00
Fixing UEFI entry creation for Juno
- UEFI config can be specified as a device_config parameter - The same config is used to create a missing UEFI entry, and to re-create the entry when flashing. UEFI config now wholy resides within the device and is not specified for vexpress flasher.
This commit is contained in:
parent
5c48b75375
commit
adb5ea9a30
@ -25,7 +25,7 @@ from wlauto import BigLittleDevice, Parameter
|
||||
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
|
||||
from wlauto.utils.uefi import UefiMenu, UefiConfig
|
||||
|
||||
|
||||
AUTOSTART_MESSAGE = 'Press Enter to stop auto boot...'
|
||||
@ -51,9 +51,6 @@ class Juno(BigLittleDevice):
|
||||
description="""Specifies the number of times the device will attempt to recover
|
||||
(normally, with a hard reset) if it detects that something went wrong."""),
|
||||
|
||||
# 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).'),
|
||||
Parameter('microsd_mount_point', default='/media/JUNO',
|
||||
description='Location at which the device\'s MicroSD card will be mounted.'),
|
||||
Parameter('port', default='/dev/ttyS0', description='Serial port on which the device is connected.'),
|
||||
@ -61,12 +58,28 @@ class Juno(BigLittleDevice):
|
||||
Parameter('timeout', kind=int, default=300, description='Serial connection timeout.'),
|
||||
Parameter('core_names', default=['a53', 'a53', 'a53', 'a53', 'a57', 'a57'], override=True),
|
||||
Parameter('core_clusters', default=[0, 0, 0, 0, 1, 1], override=True),
|
||||
|
||||
# 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).'),
|
||||
Parameter('uefi_config', kind=UefiConfig,
|
||||
description='''Specifies the configuration for the UEFI entry for his device. In an
|
||||
entry specified by ``uefi_entry`` parameter doesn't exist in UEFI menu,
|
||||
it will be created using this config. This configuration will also be
|
||||
used, when flashing new images.''',
|
||||
default={
|
||||
'image_name': 'Image',
|
||||
'image_args': 'console=ttyAMA0,115200 '
|
||||
'earlyprintk=pl011,0x7ff80000 '
|
||||
'verbose debug init=/init '
|
||||
'root=/dev/sda1 rw ip=dhcp rootwait',
|
||||
'fdt_support': True,
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
short_delay = 1
|
||||
firmware_prompt = 'Cmd>'
|
||||
# this is only used if there is no UEFI entry and one has to be created.
|
||||
kernel_arguments = 'console=ttyAMA0,115200 earlyprintk=pl011,0x7ff80000 verbose debug init=/init root=/dev/sda1 rw ip=dhcp rootwait'
|
||||
|
||||
def boot(self, **kwargs):
|
||||
self.logger.debug('Resetting the device.')
|
||||
@ -83,8 +96,7 @@ class Juno(BigLittleDevice):
|
||||
except LookupError:
|
||||
self.logger.debug('{} UEFI entry not found.'.format(self.uefi_entry))
|
||||
self.logger.debug('Attempting to create one using default flasher configuration.')
|
||||
self.flasher.image_args = self.kernel_arguments
|
||||
self.flasher.create_uefi_enty(self, menu)
|
||||
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)
|
||||
|
@ -20,12 +20,11 @@ import tarfile
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
from wlauto import Module, Parameter
|
||||
from wlauto import Module
|
||||
from wlauto.exceptions import ConfigError, DeviceError
|
||||
from wlauto.utils.android import fastboot_flash_partition, fastboot_command
|
||||
from wlauto.utils.serial_port import open_serial_connection
|
||||
from wlauto.utils.uefi import UefiMenu
|
||||
from wlauto.utils.types import boolean
|
||||
from wlauto.utils.misc import merge_dicts
|
||||
|
||||
|
||||
@ -140,19 +139,6 @@ class VersatileExpressFlasher(Flasher):
|
||||
|
||||
name = 'vexpress'
|
||||
|
||||
parameters = [
|
||||
Parameter('image_name', default='Image',
|
||||
description='The name of the kernel image to boot.'),
|
||||
Parameter('image_args', default=None,
|
||||
description='Kernel arguments with which the image will be booted.'),
|
||||
Parameter('fdt_support', kind=boolean, default=True,
|
||||
description='Specifies whether the image has device tree support.'),
|
||||
Parameter('initrd', default=None,
|
||||
description='If the kernel image uses an INITRD, this can be used to specify it.'),
|
||||
Parameter('fdt_path', default=None,
|
||||
description='If specified, this will be set as the FDT path.'),
|
||||
]
|
||||
|
||||
def flash(self, image_bundle=None, images=None):
|
||||
device = self.owner
|
||||
if not hasattr(device, 'port') or not hasattr(device, 'microsd_mount_point'):
|
||||
@ -178,18 +164,10 @@ class VersatileExpressFlasher(Flasher):
|
||||
if menu.has_option(device.uefi_entry):
|
||||
self.logger.debug('Deleting existing device entry.')
|
||||
menu.delete_entry(device.uefi_entry)
|
||||
self.create_uefi_enty(device, menu)
|
||||
menu.create_entry(device.uefi_entry, device.uefi_config)
|
||||
menu.select(device.uefi_entry)
|
||||
target.expect(device.android_prompt, timeout=device.timeout)
|
||||
|
||||
def create_uefi_enty(self, device, menu):
|
||||
menu.create_entry(device.uefi_entry,
|
||||
self.image_name,
|
||||
self.image_args,
|
||||
self.fdt_support,
|
||||
self.initrd,
|
||||
self.fdt_path)
|
||||
|
||||
def deploy_images(self, device, image_bundle=None, images=None):
|
||||
try:
|
||||
if image_bundle:
|
||||
|
@ -17,13 +17,34 @@
|
||||
import re
|
||||
import time
|
||||
import logging
|
||||
from copy import copy
|
||||
|
||||
from wlauto.exceptions import ConfigError
|
||||
from wlauto.utils.serial_port import TIMEOUT
|
||||
from wlauto.utils.types import boolean
|
||||
|
||||
|
||||
logger = logging.getLogger('UEFI')
|
||||
|
||||
|
||||
class UefiConfig(object):
|
||||
|
||||
def __init__(self, config_dict):
|
||||
if isinstance(config_dict, UefiConfig):
|
||||
self.__dict__ = copy(config_dict.__dict__)
|
||||
else:
|
||||
try:
|
||||
self.image_name = config_dict['image_name']
|
||||
self.image_args = config_dict['image_args']
|
||||
self.fdt_support = boolean(config_dict['fdt_support'])
|
||||
except KeyError as e:
|
||||
raise ConfigError('Missing mandatory parameter for UEFI entry config: "{}"'.format(e))
|
||||
self.initrd = config_dict.get('initrd')
|
||||
self.fdt_path = config_dict.get('fdt_path')
|
||||
if self.fdt_path and not self.fdt_support:
|
||||
raise ConfigError('FDT path has been specfied for UEFI entry, when FDT support is "False"')
|
||||
|
||||
|
||||
class UefiMenu(object):
|
||||
"""
|
||||
Allows navigating UEFI menu over serial (it relies on a pexpect connection).
|
||||
@ -58,7 +79,7 @@ class UefiMenu(object):
|
||||
self.conn.sendline('')
|
||||
time.sleep(self.load_delay)
|
||||
|
||||
def create_entry(self, name, image, args, fdt_support, initrd=None, fdt_path=None):
|
||||
def create_entry(self, name, config):
|
||||
"""Create a new UEFI entry using the parameters. The menu is assumed
|
||||
to be at the top level. Upon return, the menu will be at the top level."""
|
||||
logger.debug('Creating UEFI entry {}'.format(name))
|
||||
@ -66,19 +87,19 @@ class UefiMenu(object):
|
||||
self.select('Boot Manager')
|
||||
self.select('Add Boot Device Entry')
|
||||
self.select('NOR Flash')
|
||||
self.enter(image)
|
||||
self.enter('y' if fdt_support else 'n')
|
||||
if initrd:
|
||||
self.enter(config.image_name)
|
||||
self.enter('y' if config.fdt_support else 'n')
|
||||
if config.initrd:
|
||||
self.enter('y')
|
||||
self.enter(initrd)
|
||||
self.enter(config.initrd)
|
||||
else:
|
||||
self.enter('n')
|
||||
self.enter(args)
|
||||
self.enter(config.image_args)
|
||||
self.enter(name)
|
||||
|
||||
if fdt_path:
|
||||
if config.fdt_path:
|
||||
self.select('Update FDT path')
|
||||
self.enter(fdt_path)
|
||||
self.enter(config.fdt_path)
|
||||
|
||||
self.select('Return to main menu')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user