Commit 4d445841 authored by Neil Williams's avatar Neil Williams 💬

Fixes for X15 fastboot_uboot

Change-Id: I3978768403c91952ab62ad1a0347bd5c7e798615
parent 84d78a08
......@@ -244,6 +244,8 @@ class AutoLoginAction(Action):
'kernel-start-message', self.job.device.get_constant('kernel-start-message'))
if kernel_start_message:
connection.prompt_str = [kernel_start_message]
else:
connection.prompt_str = self.parameters.get('prompts', [])
if self.params and self.params.get('boot_message', None):
self.logger.warning("boot_message is being deprecated in favour of kernel-start-message in constants")
connection.prompt_str = [self.params.get('boot_message')]
......@@ -253,7 +255,7 @@ class AutoLoginAction(Action):
connection.prompt_str = connection.prompt_str + error_messages
res = self.wait(connection)
if res != 0:
raise InfrastructureError('matched a bootloader error message')
raise InfrastructureError('matched a bootloader error message: %s', connection.prompt_str[res])
def check_prompt_characters(chk_prompt):
if not any([True for c in DISTINCTIVE_PROMPT_CHARACTERS if c in chk_prompt]):
......@@ -602,12 +604,16 @@ class BootloaderInterruptAction(Action):
self.name = "bootloader-interrupt"
self.description = "interrupt bootloader"
self.summary = "interrupt bootloader to get an interactive shell"
self.params = {}
self.method = None
self.needs_interrupt = False
def validate(self):
super(BootloaderInterruptAction, self).validate()
uboot_fastboot = True if self.parameters.get('to', "") == 'fastboot' and self.job.device.get('fastboot_via_uboot', False) else False
if uboot_fastboot:
self.method = 'u-boot'
# 'to' only exists in deploy, this action can be used in boot too.
if self.parameters.get('to', "") == 'fastboot' or self.parameters.get('method', "") == 'fastboot':
if self.job.device.get('fastboot_via_uboot', False):
self.method = 'u-boot'
else:
self.method = self.parameters['method']
self.params = self.job.device['actions']['boot']['methods'][self.method]['parameters']
......
commands:
connections:
uart0:
connect: telnet localhost 7020
tags:
- primary
hard_reset: ['/usr/local/lab-scripts/snmp_pdu_control --hostname pdu14 --command reboot --port 5 --delay 20', '/usr/local/lab-scripts/eth008_control -a 10.0.9.2 -r 3 -s onoff']
power_off: /usr/local/lab-scripts/snmp_pdu_control --hostname pdu14 --command off --port 5 --delay 20
power_on: ['/usr/local/lab-scripts/snmp_pdu_control --hostname pdu14 --command on --port 5 --delay 20', '/usr/local/lab-scripts/eth008_control -a 10.0.9.2 -r 3 -s onoff']
device_type: x15
constants:
shutdown-message: "The system is going down for reboot NOW"
kernel-start-message: 'Linux version [0-9]'
default-shell-prompt: "lava-test: # "
# bootloader specific
u-boot:
interrupt-prompt: "Hit any key to stop autoboot"
interrupt-character: " "
final-message: '{{ uboot_final_message | default("Starting kernel") }}'
interrupt-prompt: 'Hit any key to stop autoboot'
interrupt-character: ' '
final-message: 'Starting kernel'
error-messages:
- 'Resetting CPU'
- 'Must RESET board to recover'
- 'TIMEOUT'
- 'Retry count exceeded'
- 'ERROR: The remote end did not respond in time.'
grub:
interrupt-prompt: 'Press enter to boot the selected OS'
interrupt-character: 'c'
grub-efi:
interrupt-prompt: 'Press enter to boot the selected OS'
interrupt-character: 'c'
error-messages:
- 'Undefined OpCode Exception PC at'
- 'Synchronous Exception at'
ipxe:
interrupt-prompt: 'Press Ctrl-B for the iPXE command line'
interrupt_ctrl_list: ['b']
error-messages:
- 'No configuration methods succeeded'
- 'Connection timed out'
device_info: [{'board_id': 'R32D300FRYP'}]
# OS shutdown message
# Override: set as the shutdown-message parameter of an Action.
# SHUTDOWN_MESSAGE
shutdown-message: 'The system is going down for reboot NOW'
# Kernel starting message
kernel-start-message: 'Linux version [0-9]'
# Default shell prompt for AutoLogin
# DEFAULT_SHELL_PROMPT
default-shell-prompt: 'lava-test: # '
commands:
connections:
uart0:
connect: telnet localhost 7108
tags:
- primary
- telnet
hard_reset: ['/usr/local/lab-scripts/snmp_pdu_control --hostname pdu18 --command reboot --port 9 --delay 20', '/usr/local/lab-scripts/eth008_control -a 10.0.9.2 -r 3 -s onoff']
power_off: /usr/local/lab-scripts/snmp_pdu_control --hostname pdu18 --command off --port 9
power_on: ['/usr/local/lab-scripts/snmp_pdu_control --hostname pdu18 --command on --port 9', '/usr/local/lab-scripts/eth008_control -a 10.0.9.2 -r 3 -s onoff']
device_info: [{'board_id': '100040061d1e00e2'}]
flash_cmds_order: ['update', 'ptable', 'partition', 'hyp', 'modem', 'rpm', 'sbl1', 'sbl2', 'sec', 'tz', 'aboot', 'boot', 'rootfs', 'vendor', 'system', 'cache', 'userdata']
parameters:
# interfaces or device_ip or device_mac
......@@ -46,9 +72,10 @@ parameters:
kernel: '0x82000000'
ramdisk: '0x88080000'
dtb: '0x88000000'
device_type: x15
adb_serial_number: R32D300FRYP
fastboot_serial_number: R32D300FRYP
adb_serial_number: 100040061d1e00e2
fastboot_serial_number: 100040061d1e00e2
fastboot_options: []
# This attribute identifies whether a device should get into fastboot mode by
# interrupting uboot and issuing commands at the bootloader prompt.
......@@ -110,7 +137,7 @@ actions:
interrupt_prompt: Hit any key to stop autoboot
# character needed to interrupt u-boot, single whitespace by default
interrupt_char: ""
boot_message: Booting Linux
needs_interrupt: True
# method specific stanza
mmc:
......@@ -127,64 +154,61 @@ actions:
- setenv autoload no
- setenv initrd_high 0xffffffff
- setenv fdt_high 0xffffffff
- setenv loadkernel 'tftp {KERNEL_ADDR} {KERNEL}'
- setenv loadinitrd 'tftp {RAMDISK_ADDR} {RAMDISK}; setenv initrd_size ${filesize}'
- setenv loadfdt 'tftp {DTB_ADDR} {DTB}'
- dhcp
- setenv serverip {SERVER_IP}
- tftp {KERNEL_ADDR} {KERNEL}
- tftp {RAMDISK_ADDR} {RAMDISK}
- setenv initrd_size ${filesize}
- tftp {DTB_ADDR} {DTB}
# Always quote the entire string if the command includes a colon to support correct YAML.
- "setenv nfsargs 'setenv bootargs console=ttyS0,115200n8 root=/dev/nfs rw
nfsroot={NFS_SERVER_IP}:{NFSROOTFS},tcp,hard,intr ip=dhcp'"
- setenv bootcmd 'dhcp; setenv serverip {SERVER_IP}; run loadkernel; run loadinitrd; run nfsargs; run loadfdt; {BOOTX}'
- run bootcmd
- "setenv bootargs 'console=ttyS2,115200n8 root=/dev/nfs rw nfsroot={NFS_SERVER_IP}:{NFSROOTFS},tcp,hard,intr ip=dhcp'"
- '{BOOTX}'
nbd:
commands:
- setenv autoload no
- setenv initrd_high 0xffffffff
- setenv fdt_high 0xffffffff
- setenv loadkernel 'tftp {KERNEL_ADDR} {KERNEL}'
- setenv loadinitrd 'tftp {RAMDISK_ADDR} {RAMDISK}; setenv initrd_size ${filesize}'
- setenv loadfdt 'tftp {DTB_ADDR} {DTB}'
- dhcp
- setenv serverip {SERVER_IP}
- tftp {KERNEL_ADDR} {KERNEL}
- tftp {RAMDISK_ADDR} {RAMDISK}
- setenv initrd_size ${filesize}
- tftp {DTB_ADDR} {DTB}
# Always quote the entire string if the command includes a colon to support correct YAML.
- "setenv nbdbasekargs 'verbose earlyprintk systemd.log_color=false ${extraargs} rw'"
- setenv nbdkbootargs ' ip=dhcp nbd.server={NBDSERVERIP} nbd.port={NBDSERVERPORT} root=/dev/ram0 ramdisk_size=16384 rootdelay=7 ip=dhcp'
- setenv bootargs verbose console=ttyS0,115200n8 rw ${nbdbasekargs} ${nbdkbootargs}
- setenv loadnbd 'setenv serverip {SERVER_IP}; run loadkernel; run loadfdt; run loadinitrd';
- setenv verify no
- setenv bootcmd 'dhcp; run loadnbd; printenv; {BOOTX}'
- run bootcmd
- "setenv bootargs 'console=ttyS2,115200n8 rw nbd.server={NBDSERVERIP} nbd.port={NBDSERVERPORT} root=/dev/ram0 ramdisk_size=16384 rootdelay=7 ip=dhcp verbose earlyprintk systemd.log_color=false ${extraargs} rw'"
- '{BOOTX}'
ramdisk:
commands:
- setenv autoload no
- setenv initrd_high 0xffffffff
- setenv fdt_high 0xffffffff
- setenv loadkernel 'tftp {KERNEL_ADDR} {KERNEL}'
- setenv loadinitrd 'tftp {RAMDISK_ADDR} {RAMDISK}; setenv initrd_size ${filesize}'
- setenv loadfdt 'tftp {DTB_ADDR} {DTB}'
- "setenv bootargs 'console=ttyS0,115200n8 root=/dev/ram0 ip=dhcp'"
- setenv bootcmd 'dhcp; setenv serverip {SERVER_IP}; run loadkernel; run loadinitrd; run loadfdt; {BOOTX}'
- run bootcmd
- dhcp
- setenv serverip {SERVER_IP}
- tftp {KERNEL_ADDR} {KERNEL}
- tftp {RAMDISK_ADDR} {RAMDISK}
- setenv initrd_size ${filesize}
- tftp {DTB_ADDR} {DTB}
- "setenv bootargs 'console=ttyS2,115200n8 root=/dev/ram0 ip=dhcp'"
- '{BOOTX}'
usb:
commands:
- usb start
- setenv autoload no
- "setenv loadkernel 'load usb 0:{ROOT_PART} {KERNEL_ADDR} {KERNEL}'"
- "setenv loadinitrd 'load usb 0:{ROOT_PART} {RAMDISK_ADDR} {RAMDISK}; setenv initrd_size ${filesize}'"
- "setenv loadfdt 'load usb 0:{ROOT_PART} {DTB_ADDR} {DTB}'"
- "setenv bootargs 'console=ttyS0,115200n8 root={ROOT} ip=dhcp'"
- setenv bootcmd 'run loadkernel; run loadinitrd; run loadfdt; {BOOTX}'
- run bootcmd
- "load usb 0:{ROOT_PART} {KERNEL_ADDR} {KERNEL}"
- "load usb 0:{ROOT_PART} {RAMDISK_ADDR} {RAMDISK}"
- "setenv initrd_size ${filesize}"
- "load usb 0:{ROOT_PART} {DTB_ADDR} {DTB}"
- "console=ttyS2,115200n8 root={ROOT} ip=dhcp"
- '{BOOTX}'
sata:
commands:
- scsi scan
- setenv autoload no
- "setenv loadkernel 'load scsi {ROOT_PART} {KERNEL_ADDR} {KERNEL}'"
- "setenv loadinitrd 'load scsi {ROOT_PART} {RAMDISK_ADDR} {RAMDISK}; setenv initrd_size ${filesize}'"
- "setenv loadfdt 'load scsi {ROOT_PART} {DTB_ADDR} {DTB}'"
- "setenv bootargs 'console=ttyS0,115200n8 root={ROOT} ip=dhcp'"
- setenv bootcmd 'run loadkernel; run loadinitrd; run loadfdt; {BOOTX}'
- run bootcmd
- "load scsi {ROOT_PART} {KERNEL_ADDR} {KERNEL}"
- "load scsi {ROOT_PART} {RAMDISK_ADDR} {RAMDISK}; setenv initrd_size ${filesize}"
- "load scsi {ROOT_PART} {DTB_ADDR} {DTB}"
- "setenv bootargs 'console=ttyS2,115200n8 root={ROOT} ip=dhcp'"
- '{BOOTX}'
timeouts:
actions:
apply-overlay-image:
......
......@@ -61,6 +61,7 @@ class FastBootFactory(Factory): # pylint: disable=too-few-public-methods
parser = JobParser()
job = parser.parse(sample_job_data, device, 4212, None, "",
output_dir=output_dir)
job.logger = DummyLogger()
return job
def create_x15_job(self, filename, output_dir='/tmp/'): # pylint: disable=no-self-use
......@@ -70,6 +71,7 @@ class FastBootFactory(Factory): # pylint: disable=too-few-public-methods
parser = JobParser()
job = parser.parse(sample_job_data, device, 4212, None, "",
output_dir=output_dir)
job.logger = DummyLogger()
return job
def create_hikey_job(self, filename, output_dir='/tmp/'): # pylint: disable=no-self-use
......@@ -260,8 +262,29 @@ class TestFastbootDeploy(StdoutTestCase): # pylint: disable=too-many-public-met
def test_x15_job(self):
self.factory = FastBootFactory()
job = self.factory.create_x15_job('sample_jobs/x15.yaml', mkdtemp())
job.validate()
description_ref = self.pipeline_reference('x15.yaml', job=job)
self.assertEqual(description_ref, job.pipeline.describe(False))
deploy = [action for action in job.pipeline.actions if action.name == 'fastboot-deploy'][0]
enter = [action for action in deploy.internal_pipeline.actions if action.name == 'uboot-enter-fastboot'][0]
interrupt = [action for action in enter.internal_pipeline.actions if action.name == 'bootloader-interrupt'][0]
self.assertTrue(interrupt.needs_interrupt)
self.assertIsInstance(interrupt.params, dict)
self.assertNotEqual(interrupt.params, {})
self.assertIn('mkimage_arch', interrupt.params)
self.assertIn('interrupt_prompt', interrupt.params)
boot = [action for action in job.pipeline.actions if action.name == 'fastboot-boot'][0]
enter = [action for action in boot.internal_pipeline.actions if action.name == 'uboot-enter-fastboot'][0]
interrupt = [action for action in enter.internal_pipeline.actions if action.name == 'bootloader-interrupt'][0]
self.assertIsInstance(interrupt.params, dict)
self.assertNotEqual(interrupt.params, {})
self.assertIn('mkimage_arch', interrupt.params)
self.assertIn('interrupt_prompt', interrupt.params)
self.assertTrue(interrupt.needs_interrupt)
autologin = [action for action in boot.internal_pipeline.actions if action.name == 'auto-login-action'][0]
print(autologin.booting)
print(autologin.parameters.get('prompts', None))
self.assertIsNone(autologin.parameters.get('boot_message', None))
def test_nexus5x_job(self):
self.factory = FastBootFactory()
......
......@@ -164,6 +164,12 @@ class TestUbootAction(StdoutTestCase): # pylint: disable=too-many-public-method
job.validate()
description_ref = self.pipeline_reference('x15-uboot.yaml', job=job)
self.assertEqual(description_ref, job.pipeline.describe(False))
deploy = [action for action in job.pipeline.actions if action.name == 'fastboot-deploy'][0]
enter = [action for action in deploy.internal_pipeline.actions if action.name == 'uboot-enter-fastboot'][0]
interrupt = [action for action in enter.internal_pipeline.actions if action.name == 'bootloader-interrupt'][0]
self.assertIsNotNone(interrupt.params)
self.assertNotEqual(interrupt.params, {})
self.assertEqual('u-boot', interrupt.method)
def test_x15_uboot_nfs(self): # pylint: disable=too-many-locals
job = self.factory.create_x15_job('sample_jobs/x15-nfs.yaml')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment