=== modified file 'lava_dispatcher/actions/boot_control.py'
@@ -71,10 +71,16 @@
"""
parameters_schema = _boot_schema
+ parameters_schema['properties']['interactive_boot_cmds'] = {
+ 'default': False, 'optional': True
+ }
- def run(self, options=[]):
+ def run(self, options=[], interactive_boot_cmds=False):
client = self.client
- client.target_device.boot_options = options
+ if interactive_boot_cmds:
+ client.config.boot_cmds = options
+ else:
+ client.target_device.boot_options = options
status = 'pass'
try:
client.boot_linaro_image()
=== modified file 'lava_dispatcher/client/lmc_utils.py'
@@ -60,7 +60,7 @@
def generate_fastmodel_image(context, hwpack, rootfs, odir, bootloader='u_boot', size="2000M"):
cmd = ("flock /var/lock/lava-lmc.lck sudo linaro-media-create "
- "--dev fastmodel --output-directory %s --image-size %s "
+ "--dev vexpress --output-directory %s --image-size %s "
"--hwpack %s --binary %s --hwpack-force-yes --bootloader %s" %
(odir, size, hwpack, rootfs, bootloader) )
logging.info("Generating fastmodel image with: %s" % cmd)
=== modified file 'lava_dispatcher/config.py'
@@ -89,6 +89,7 @@
simulator_initrd = schema.StringOption(default=None)
simulator_dtb = schema.StringOption(default=None)
simulator_uefi = schema.StringOption(default=None)
+ simulator_boot_wrapper = schema.StringOption(default=None)
android_disable_suspend = schema.BoolOption(default=True)
android_adb_over_usb = schema.BoolOption(default=False)
=== removed file 'lava_dispatcher/default-config/lava-dispatcher/device-types/fastmodel_A15x4-A7x4.conf'
@@ -1,74 +0,0 @@
-client_type=fastmodel
-
-# how long the disablesuspend script should take to complete
-# fm takes longer than other android images do
-disablesuspend_timeout = 500
-
-# how long ubuntu takes to boot to prompt
-boot_linaro_timeout = 500
-
-# if you do dhcp on boot, adb will not work (asac) on fastmodels
-enable_network_after_boot_android = 0
-
-# we do usermode networking over the loopback
-default_network_interface = lo
-
-simulator_axf_files =
- img.axf
- linux-system-ISW.axf
- rtsm/linux-system-semi.axf
-
-simulator_kernel = vmlinuz.*
-simulator_initrd = initrd.*
-simulator_dtb = rtsm_ve-ca15x4-ca7x4.dtb
-simulator_uefi = uefi_rtsm_ve-ca15.bin
-
-license_file = 8224@localhost
-sim_bin = /opt/arm/RTSM_A15-A7x14_VE/Linux64_RTSM_VE_Cortex-A15x4-A7x4/RTSM_VE_Cortex-A15x4-A7x4
-android_adb_port = 6555
-
-simulator_version_command = %(sim_bin)s --version | grep "Fast Models" | sed 's/Fast Models \[//' | sed 's/\]//'
-
-simulator_command = sudo -u www-data ARMLMD_LICENSE_FILE="%(license_file)s" %(sim_bin)s -a coretile.cluster0.*={AXF} -C motherboard.mmc.p_mmc_file={IMG}
-
-boot_options =
- motherboard.hostbridge.userNetPorts
- motherboard.smsc_91c111.enabled
- motherboard.hostbridge.userNetworking
- motherboard.flashloader0.fname
- motherboard.flashloader1.fname
- motherboard.flashloader1.fnameWrite
- coretile.cache_state_modelled
- coretile.cluster0.cpu0.semihosting-enable
- coretile.cluster0.cpu0.semihosting-cmd_line
-
-[motherboard.hostbridge.userNetPorts]
-default="%(android_adb_port)s=%(android_adb_port)s"
-
-[motherboard.smsc_91c111.enabled]
-default = 1
-allowed = 0,1
-
-[motherboard.hostbridge.userNetworking]
-default = 1
-allowed = 0,1
-
-[motherboard.flashloader0.fname]
-default = {UEFI}
-
-[motherboard.flashloader1.fname]
-default = "uefi-vars.fd"
-
-[motherboard.flashloader1.fnameWrite]
-default = uefi-vars.fd
-
-[coretile.cache_state_modelled]
-default = 0
-allowed = 0,1
-
-[coretile.cluster0.cpu0.semihosting-enable]
-default = 1
-allowed = 0,1
-
-[coretile.cluster0.cpu0.semihosting-cmd_line]
-default = "--kernel {KERNEL} --dtb {DTB} --initrd {INITRD} -- console=ttyAMA0,38400n8 root=/dev/mmcblk0p2 rootwait ro mem=1024M"
=== removed file 'lava_dispatcher/default-config/lava-dispatcher/device-types/fastmodel_v8.conf'
@@ -1,91 +0,0 @@
-client_type=fastmodel
-
-# how long the disablesuspend script should take to complete
-# fm takes longer than other android images do
-disablesuspend_timeout = 500
-
-# how long ubuntu takes to boot to prompt
-boot_linaro_timeout = 500
-
-# if you do dhcp on boot, adb will not work (asac) on fastmodels
-enable_network_after_boot_android = 0
-
-# we do usermode networking over the loopback
-default_network_interface = lo
-
-simulator_axf_files = linux-system.axf
-
-license_file = 8224@localhost
-sim_bin = /opt/arm/RTSMv8_VE/bin/model_shell64
-sim_model = /opt/arm/RTSMv8_VE/models/Linux64_GCC-4.1/RTSM_VE_AEMv8A.so
-android_adb_port = 5555
-
-simulator_version_command = %(sim_bin)s --version | grep "Model Shell" | sed 's/Model Shell //'
-
-simulator_command = sudo -u www-data ARMLMD_LICENSE_FILE="%(license_file)s" %(sim_bin)s -a {AXF} %(sim_model)s -C motherboard.mmc.p_mmc_file={IMG}
-
-boot_options =
- motherboard.hostbridge.userNetPorts
- motherboard.hostbridge.userNetworking
- motherboard.smsc_91c111.enabled
- cluster.NUM_CORES
- cluster.cpu0.unpredictable_WPMASKANDBAS
- cluster.cpu0.unpredictable_non-contigous_BAS
- cluster.cpu1.unpredictable_WPMASKANDBAS
- cluster.cpu1.unpredictable_non-contigous_BAS
- cluster.cpu2.unpredictable_WPMASKANDBAS
- cluster.cpu2.unpredictable_non-contigous_BAS
- cluster.cpu3.unpredictable_WPMASKANDBAS
- cluster.cpu3.unpredictable_non-contigous_BAS
- cluster.take_ccfail_undef
-
-[motherboard.hostbridge.userNetPorts]
-default="%(android_adb_port)s=%(android_adb_port)s"
-
-[motherboard.hostbridge.userNetworking]
-default = 1
-allowed = 0,1
-
-[motherboard.smsc_91c111.enabled]
-default = 1
-allowed = 0,1
-
-[cluster.NUM_CORES]
-default = 1
-allowed = 0,1
-
-[cluster.cpu0.unpredictable_WPMASKANDBAS]
-default = 0
-allowed = 0,1
-
-[cluster.cpu0.unpredictable_non-contigous_BAS]
-default = 0
-allowed = 0,1
-
-[cluster.cpu1.unpredictable_WPMASKANDBAS]
-default = 0
-allowed = 0,1
-
-[cluster.cpu1.unpredictable_non-contigous_BAS]
-default = 0
-allowed = 0,1
-
-[cluster.cpu2.unpredictable_WPMASKANDBAS]
-default = 0
-allowed = 0,1
-
-[cluster.cpu2.unpredictable_non-contigous_BAS]
-default = 0
-allowed = 0,1
-
-[cluster.cpu3.unpredictable_WPMASKANDBAS]
-default = 0
-allowed = 0,1
-
-[cluster.cpu3.unpredictable_non-contigous_BAS]
-default = 0
-allowed = 0,1
-
-[cluster.take_ccfail_undef]
-default = 0
-allowed = 0,1
=== removed file 'lava_dispatcher/default-config/lava-dispatcher/device-types/foundationsmodel.conf'
@@ -1,20 +0,0 @@
-client_type=fastmodel
-
-# how long the disablesuspend script should take to complete
-# fm takes longer than other android images do
-disablesuspend_timeout = 500
-
-# how long ubuntu takes to boot to prompt
-boot_linaro_timeout = 500
-
-# if you do dhcp on boot, adb will not work (asac) on fastmodels
-enable_network_after_boot_android = 0
-
-# we do usermode networking over the loopback
-default_network_interface = lo
-
-simulator_axf_files = img-foundation.axf
-
-simulator_version_command = /opt/arm/Foundation_v8pkg/Foundation_v8 --version | grep "ARM V8 Foundation Model" | sed 's/ARM V8 Foundation Model //'
-
-simulator_command = sudo -u www-data /opt/arm/Foundation_v8pkg/Foundation_v8 --image={AXF} --block-device={IMG} --network=nat
=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_foundation-armv8.conf'
@@ -0,0 +1,20 @@
+client_type=fastmodel
+
+# how long the disablesuspend script should take to complete
+# fm takes longer than other android images do
+disablesuspend_timeout = 500
+
+# how long ubuntu takes to boot to prompt
+boot_linaro_timeout = 500
+
+# if you do dhcp on boot, adb will not work (asac) on fastmodels
+enable_network_after_boot_android = 0
+
+# we do usermode networking over the loopback
+default_network_interface = lo
+
+simulator_axf_files = img-foundation.axf
+
+simulator_version_command = /opt/arm/Foundation_v8pkg/Foundation_v8 --version | grep "ARM V8 Foundation Model" | sed 's/ARM V8 Foundation Model //'
+
+simulator_command = sudo -u www-data /opt/arm/Foundation_v8pkg/Foundation_v8 --image={AXF} --block-device={IMG} --network=nat
=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x1-a7x1.conf'
@@ -0,0 +1,111 @@
+client_type=fastmodel
+
+# how long the disablesuspend script should take to complete
+# fm takes longer than other android images do
+disablesuspend_timeout = 500
+
+# how long ubuntu takes to boot to prompt
+boot_linaro_timeout = 800
+
+# if you do dhcp on boot, adb will not work (asac) on fastmodels
+enable_network_after_boot_android = 0
+
+# we do usermode networking over the loopback
+default_network_interface = lo
+
+bootloader_prompt = Start:
+
+interrupt_boot_prompt = The default boot selection will start in
+
+interrupt_boot_command = break
+
+# UEFI boot commands
+boot_cmds = sendline a,
+ expect Choice:,
+ sendline 1,
+ expect Select the Boot Device:,
+ sendline 2,
+ expect File path of the EFI Application or the kernel:,
+ sendline uImage,
+ expect [a/g/l],
+ sendline l,
+ expect Add an initrd: [y/n],
+ sendline y,
+ expect File path of the initrd:,
+ sendline uInitrd,
+ expect Arguments to pass to the binary:,
+ sendline 'console=ttyAMA0,38400n8 root=/dev/mmcblk0p2 rootwait ro mem=1024M',
+ expect File path of the local FDT:,
+ sendline rtsm\\rtsm_ve-ca15x1-ca7x1.dtb,
+ expect Description for this new Entry:,
+ sendline Test Image,
+ expect Choice:,
+ sendline 5,
+ expect Start:,
+ sendline 2
+
+simulator_axf_files =
+ img.axf
+ linux-system-ISW.axf
+ rtsm/linux-system-semi.axf
+
+simulator_kernel = vmlinuz.*
+simulator_initrd = initrd.*
+simulator_dtb = rtsm_ve-ca15x1-ca7x1.dtb
+simulator_uefi = uefi_rtsm_ve-ca15.bin
+
+license_file = 8224@localhost
+sim_bin = /opt/arm/RTSM_A15-A7x14_VE/Linux64_RTSM_VE_Cortex-A15x4-A7x4/RTSM_VE_Cortex-A15x4-A7x4
+android_adb_port = 6555
+
+simulator_version_command = %(sim_bin)s --version | grep "Fast Models" | sed 's/Fast Models \[//' | sed 's/\]//'
+
+simulator_boot_wrapper = -a coretile.cluster0.*={AXF}
+
+simulator_command = sudo -u www-data ARMLMD_LICENSE_FILE="%(license_file)s" %(sim_bin)s
+
+boot_options =
+ motherboard.mmc.p_mmc_file
+ motherboard.hostbridge.userNetPorts
+ motherboard.smsc_91c111.enabled
+ motherboard.hostbridge.userNetworking
+ motherboard.flashloader0.fname
+ motherboard.flashloader1.fname
+ motherboard.flashloader1.fnameWrite
+ coretile.cache_state_modelled
+ coretile.cluster0.cpu0.semihosting-enable
+ coretile.cluster0.cpu0.semihosting-cmd_line
+
+[motherboard.mmc.p_mmc_file]
+default = {IMG}
+
+[motherboard.hostbridge.userNetPorts]
+default="%(android_adb_port)s=%(android_adb_port)s"
+
+[motherboard.smsc_91c111.enabled]
+default = 1
+allowed = 0,1
+
+[motherboard.hostbridge.userNetworking]
+default = 1
+allowed = 0,1
+
+[motherboard.flashloader0.fname]
+default = {UEFI}
+
+[motherboard.flashloader1.fname]
+default = uefi-vars.fd
+
+[motherboard.flashloader1.fnameWrite]
+default = uefi-vars.fd
+
+[coretile.cache_state_modelled]
+default = 0
+allowed = 0,1
+
+[coretile.cluster0.cpu0.semihosting-enable]
+default = 1
+allowed = 0,1
+
+[coretile.cluster0.cpu0.semihosting-cmd_line]
+default = "--kernel {KERNEL} --dtb {DTB} --initrd {INITRD} -- console=ttyAMA0,38400n8 root=/dev/mmcblk0p2 rootwait ro mem=1024M"
=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x4-a7x4.conf'
@@ -0,0 +1,111 @@
+client_type=fastmodel
+
+# how long the disablesuspend script should take to complete
+# fm takes longer than other android images do
+disablesuspend_timeout = 500
+
+# how long ubuntu takes to boot to prompt
+boot_linaro_timeout = 800
+
+# if you do dhcp on boot, adb will not work (asac) on fastmodels
+enable_network_after_boot_android = 0
+
+# we do usermode networking over the loopback
+default_network_interface = lo
+
+bootloader_prompt = Start:
+
+interrupt_boot_prompt = The default boot selection will start in
+
+interrupt_boot_command = break
+
+# UEFI boot commands
+boot_cmds = sendline a,
+ expect Choice:,
+ sendline 1,
+ expect Select the Boot Device:,
+ sendline 2,
+ expect File path of the EFI Application or the kernel:,
+ sendline uImage,
+ expect [a/g/l],
+ sendline l,
+ expect Add an initrd: [y/n],
+ sendline y,
+ expect File path of the initrd:,
+ sendline uInitrd,
+ expect Arguments to pass to the binary:,
+ sendline 'console=ttyAMA0,38400n8 root=/dev/mmcblk0p2 rootwait ro mem=1024M',
+ expect File path of the local FDT:,
+ sendline rtsm\\rtsm_ve-ca15x4-ca7x4.dtb,
+ expect Description for this new Entry:,
+ sendline Test Image,
+ expect Choice:,
+ sendline 5,
+ expect Start:,
+ sendline 2
+
+simulator_axf_files =
+ img.axf
+ linux-system-ISW.axf
+ rtsm/linux-system-semi.axf
+
+simulator_kernel = vmlinuz.*
+simulator_initrd = initrd.*
+simulator_dtb = rtsm_ve-ca15x4-ca7x4.dtb
+simulator_uefi = uefi_rtsm_ve-ca15.bin
+
+license_file = 8224@localhost
+sim_bin = /opt/arm/RTSM_A15-A7x14_VE/Linux64_RTSM_VE_Cortex-A15x4-A7x4/RTSM_VE_Cortex-A15x4-A7x4
+android_adb_port = 6555
+
+simulator_version_command = %(sim_bin)s --version | grep "Fast Models" | sed 's/Fast Models \[//' | sed 's/\]//'
+
+simulator_boot_wrapper = -a coretile.cluster0.*={AXF}
+
+simulator_command = sudo -u www-data ARMLMD_LICENSE_FILE="%(license_file)s" %(sim_bin)s
+
+boot_options =
+ motherboard.mmc.p_mmc_file
+ motherboard.hostbridge.userNetPorts
+ motherboard.smsc_91c111.enabled
+ motherboard.hostbridge.userNetworking
+ motherboard.flashloader0.fname
+ motherboard.flashloader1.fname
+ motherboard.flashloader1.fnameWrite
+ coretile.cache_state_modelled
+ coretile.cluster0.cpu0.semihosting-enable
+ coretile.cluster0.cpu0.semihosting-cmd_line
+
+[motherboard.mmc.p_mmc_file]
+default = {IMG}
+
+[motherboard.hostbridge.userNetPorts]
+default="%(android_adb_port)s=%(android_adb_port)s"
+
+[motherboard.smsc_91c111.enabled]
+default = 1
+allowed = 0,1
+
+[motherboard.hostbridge.userNetworking]
+default = 1
+allowed = 0,1
+
+[motherboard.flashloader0.fname]
+default = {UEFI}
+
+[motherboard.flashloader1.fname]
+default = uefi-vars.fd
+
+[motherboard.flashloader1.fnameWrite]
+default = uefi-vars.fd
+
+[coretile.cache_state_modelled]
+default = 0
+allowed = 0,1
+
+[coretile.cluster0.cpu0.semihosting-enable]
+default = 1
+allowed = 0,1
+
+[coretile.cluster0.cpu0.semihosting-cmd_line]
+default = "--kernel {KERNEL} --dtb {DTB} --initrd {INITRD} -- console=ttyAMA0,38400n8 root=/dev/mmcblk0p2 rootwait ro mem=1024M"
=== added file 'lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-armv8.conf'
@@ -0,0 +1,128 @@
+client_type=fastmodel
+
+# how long the disablesuspend script should take to complete
+# fm takes longer than other android images do
+disablesuspend_timeout = 500
+
+# how long ubuntu takes to boot to prompt
+boot_linaro_timeout = 500
+
+# if you do dhcp on boot, adb will not work (asac) on fastmodels
+enable_network_after_boot_android = 0
+
+# we do usermode networking over the loopback
+default_network_interface = lo
+
+bootloader_prompt = Start:
+
+interrupt_boot_prompt = The default boot selection will start in
+
+interrupt_boot_command = break
+
+# UEFI boot commands
+boot_cmds = sendline a,
+ expect Choice:,
+ sendline 1,
+ expect Select the Boot Device:,
+ sendline 2,
+ expect File path of the EFI Application or the kernel:,
+ sendline uImage,
+ expect [a/g/l],
+ sendline l,
+ expect Add an initrd: [y/n],
+ sendline y,
+ expect File path of the initrd:,
+ sendline uInitrd,
+ expect Arguments to pass to the binary:,
+ sendline 'console=ttyAMA0,38400n8 root=/dev/mmcblk0p2 rootwait ro mem=1024M',
+ expect File path of the local FDT:,
+ sendline rtsm\\rtsm_ve-ca15x1-ca7x1.dtb,
+ expect Description for this new Entry:,
+ sendline Test Image,
+ expect Choice:,
+ sendline 5,
+ expect Start:,
+ sendline 2
+
+simulator_axf_files = linux-system.axf
+
+license_file = 8224@localhost
+sim_bin = /opt/arm/RTSMv8_VE/bin/model_shell64
+sim_model = /opt/arm/RTSMv8_VE/models/Linux64_GCC-4.1/RTSM_VE_AEMv8A.so
+android_adb_port = 5555
+
+simulator_version_command = %(sim_bin)s --version | grep "Model Shell" | sed 's/Model Shell //'
+
+simulator_boot_wrapper = -a {AXF}
+
+simulator_command = sudo -u www-data ARMLMD_LICENSE_FILE="%(license_file)s" %(sim_bin)s %(sim_model)s
+
+boot_options =
+ motherboard.mmc.p_mmc_file
+ motherboard.hostbridge.userNetPorts
+ motherboard.hostbridge.userNetworking
+ motherboard.smsc_91c111.enabled
+ cluster.NUM_CORES
+ cluster.cpu0.unpredictable_WPMASKANDBAS
+ cluster.cpu0.unpredictable_non-contigous_BAS
+ cluster.cpu1.unpredictable_WPMASKANDBAS
+ cluster.cpu1.unpredictable_non-contigous_BAS
+ cluster.cpu2.unpredictable_WPMASKANDBAS
+ cluster.cpu2.unpredictable_non-contigous_BAS
+ cluster.cpu3.unpredictable_WPMASKANDBAS
+ cluster.cpu3.unpredictable_non-contigous_BAS
+ cluster.take_ccfail_undef
+
+[motherboard.mmc.p_mmc_file]
+default = {IMG}
+
+[motherboard.hostbridge.userNetPorts]
+default="%(android_adb_port)s=%(android_adb_port)s"
+
+[motherboard.hostbridge.userNetworking]
+default = 1
+allowed = 0,1
+
+[motherboard.smsc_91c111.enabled]
+default = 1
+allowed = 0,1
+
+[cluster.NUM_CORES]
+default = 1
+allowed = 0,1
+
+[cluster.cpu0.unpredictable_WPMASKANDBAS]
+default = 0
+allowed = 0,1
+
+[cluster.cpu0.unpredictable_non-contigous_BAS]
+default = 0
+allowed = 0,1
+
+[cluster.cpu1.unpredictable_WPMASKANDBAS]
+default = 0
+allowed = 0,1
+
+[cluster.cpu1.unpredictable_non-contigous_BAS]
+default = 0
+allowed = 0,1
+
+[cluster.cpu2.unpredictable_WPMASKANDBAS]
+default = 0
+allowed = 0,1
+
+[cluster.cpu2.unpredictable_non-contigous_BAS]
+default = 0
+allowed = 0,1
+
+[cluster.cpu3.unpredictable_WPMASKANDBAS]
+default = 0
+allowed = 0,1
+
+[cluster.cpu3.unpredictable_non-contigous_BAS]
+default = 0
+allowed = 0,1
+
+[cluster.take_ccfail_undef]
+default = 0
+allowed = 0,1
=== modified file 'lava_dispatcher/device/fastmodel.py'
@@ -48,6 +48,7 @@
ensure_directory,
extract_targz,
DrainConsoleOutput,
+ string_to_list,
)
@@ -68,6 +69,7 @@
self._dtb = None
self._initrd = None
self._uefi = None
+ self._bootloader = 'u_boot'
def _customize_android(self):
with image_partition_mounted(self._sd_image, self.DATA_PARTITION) as d:
@@ -92,61 +94,55 @@
def _copy_needed_files_from_directory(self, subdir):
odir = os.path.dirname(self._sd_image)
-
- if self._axf is None:
+ if self._bootloader == 'u_boot':
+ # Extract the bootwrapper from the image
for fname in self.config.simulator_axf_files:
- src = os.path.join(subdir, fname)
- if os.path.exists(src):
- self._axf = '%s/%s' % (odir, os.path.split(src)[1])
- if src != self._axf:
- shutil.copyfile(src, self._axf)
+ if self._axf is None:
+ self._axf = self._find_and_copy(
+ subdir, odir, fname)
+ else:
break
-
- if self.config.simulator_kernel:
- self._copy_boot_files_from_directory(odir, subdir)
-
- def _copy_boot_files_from_directory(self, odir, subdir):
- # TODO: Optimize this loop
- for root, dirs, files in os.walk(subdir):
- for file in files:
- if re.match(self.config.simulator_kernel, file) and self._kernel is None:
- self._kernel = os.path.join(odir, file)
- if odir != subdir:
- kernel = os.path.join(subdir, file)
- shutil.copyfile(kernel, self._kernel)
- elif re.match(self.config.simulator_initrd, file) and self._initrd is None:
- self._initrd = os.path.join(odir, file)
- if odir != subdir:
- initrd = os.path.join(subdir, file)
- shutil.copyfile(initrd, self._initrd)
- elif re.match(self.config.simulator_dtb, file) and self._dtb is None:
- self._dtb = os.path.join(odir, file)
- if odir != subdir:
- dtb = os.path.join(subdir, file)
- shutil.copyfile(dtb, self._dtb)
- elif re.match(self.config.simulator_uefi, file) and self._uefi is None:
- self._uefi = os.path.join(odir, file)
- if odir != subdir:
- uefi = os.path.join(subdir, file)
- shutil.copyfile(uefi, self._uefi)
+ # Extract the kernel from the image
+ if self.config.simulator_kernel and self._kernel is None:
+ self._kernel = self._find_and_copy(
+ subdir, odir, self.config.simulator_kernel)
+ # Extract the initrd from the image
+ if self.config.simulator_initrd and self._initrd is None:
+ self._initrd = self._find_and_copy(
+ subdir, odir, self.config.simulator_initrd)
+ # Extract the dtb from the image
+ if self.config.simulator_dtb and self._dtb is None:
+ self._dtb = self._find_and_copy(
+ subdir, odir, self.config.simulator_dtb)
+ elif self._bootloader == 'uefi':
+ # Extract the uefi binary from the image
+ if self.config.simulator_uefi and self._uefi is None:
+ self._uefi = self._find_and_copy(
+ subdir, odir, self.config.simulator_uefi)
def _check_needed_files(self):
- # AXF is needed in all cases
- if not self._axf:
- raise RuntimeError('No AXF found, %r' %
- self.config.simulator_axf_files)
- # Kernel is needed only for b.L models
- if self._kernel is None and self.config.simulator_kernel:
- raise RuntimeError('No kernel found, %r' %
- self.config.simulator_kernel)
- # Initrd is needed only for b.L models
- if self._initrd is None and self.config.simulator_initrd:
- raise RuntimeError('No initrd found, %r' %
- self.config.simulator_initrd)
- # DTB is needed only for b.L models
- if self._dtb is None and self.config.simulator_dtb:
- raise RuntimeError('No initrd found, %r' %
- self.config.simulator_dtb)
+ if self._bootloader == 'u_boot':
+ # AXF is needed when we are not using UEFI
+ if self._axf is None and self.config.simulator_axf_files:
+ raise RuntimeError('No AXF found, %r' %
+ self.config.simulator_axf_files)
+ # Kernel is needed only for b.L models
+ if self._kernel is None and self.config.simulator_kernel:
+ raise RuntimeError('No KERNEL found, %r' %
+ self.config.simulator_kernel)
+ # Initrd is needed only for b.L models
+ if self._initrd is None and self.config.simulator_initrd:
+ raise RuntimeError('No INITRD found, %r' %
+ self.config.simulator_initrd)
+ # DTB is needed only for b.L models
+ if self._dtb is None and self.config.simulator_dtb:
+ raise RuntimeError('No DTB found, %r' %
+ self.config.simulator_dtb)
+ elif self._bootloader == 'uefi':
+ # UEFI binary is needed when specified
+ if self._uefi is None and self.config.simulator_uefi:
+ raise RuntimeError('No UEFI binary found, %r' %
+ self.config.simulator_uefi)
def deploy_android(self, boot, system, data):
logging.info("Deploying Android on %s" % self.config.hostname)
@@ -170,6 +166,8 @@
rootfs = download_image(rootfs, self.context, decompress=False)
odir = os.path.dirname(rootfs)
+ self._bootloader = bootloader
+
generate_fastmodel_image(self.context, hwpack, rootfs, odir, bootloader)
self._sd_image = '%s/sd.img' % odir
@@ -210,29 +208,36 @@
d = os.path.dirname(self._sd_image)
os.chmod(d, stat.S_IRWXG | stat.S_IRWXU)
os.chmod(self._sd_image, stat.S_IRWXG | stat.S_IRWXU)
- os.chmod(self._axf, stat.S_IRWXG | stat.S_IRWXU)
+ if self._axf:
+ os.chmod(self._axf, stat.S_IRWXG | stat.S_IRWXU)
if self._kernel:
os.chmod(self._kernel, stat.S_IRWXG | stat.S_IRWXU)
+ if self._initrd:
+ os.chmod(self._initrd, stat.S_IRWXG | stat.S_IRWXU)
if self._dtb:
os.chmod(self._dtb, stat.S_IRWXG | stat.S_IRWXU)
- if self._initrd:
- os.chmod(self._initrd, stat.S_IRWXG | stat.S_IRWXU)
if self._uefi:
os.chmod(self._uefi, stat.S_IRWXG | stat.S_IRWXU)
#lmc ignores the parent directories group owner
st = os.stat(d)
- os.chown(self._axf, st.st_uid, st.st_gid)
os.chown(self._sd_image, st.st_uid, st.st_gid)
+ if self._axf:
+ os.chown(self._axf, st.st_uid, st.st_gid)
if self._kernel:
os.chown(self._kernel, st.st_uid, st.st_gid)
+ if self._initrd:
+ os.chown(self._initrd, st.st_uid, st.st_gid)
if self._dtb:
os.chown(self._dtb, st.st_uid, st.st_gid)
- if self._initrd:
- os.chown(self._initrd, st.st_uid, st.st_gid)
if self._uefi:
os.chown(self._uefi, st.st_uid, st.st_gid)
+ def _enter_bootloader(self):
+ if self.proc.expect(self.config.interrupt_boot_prompt) != 0:
+ raise Exception("Failed to enter bootloader")
+ self.proc.sendline(self.config.interrupt_boot_command)
+
def power_off(self, proc):
super(FastModelTarget, self).power_off(proc)
if self._sim_proc is not None:
@@ -263,6 +268,10 @@
self._fix_perms()
options = boot_options.as_string(self, join_pattern=' -C %s=%s')
+
+ if self.config.simulator_boot_wrapper and self._uefi is None:
+ options = '%s %s' % (self.config.simulator_boot_wrapper, options)
+
sim_cmd = '%s %s' % (self.config.simulator_command, options)
sim_cmd = sim_cmd.format(
AXF=self._axf, IMG=self._sd_image, KERNEL=self._kernel,
@@ -289,6 +298,11 @@
timeout=1200)
self.proc.logfile_read = self._create_rtsm_ostream(
self.proc.logfile_read)
+
+ if self._uefi:
+ self._enter_bootloader()
+ self._customize_bootloader()
+
return self.proc
def get_test_data_attachments(self):
=== modified file 'lava_dispatcher/device/target.py'
@@ -20,6 +20,8 @@
import contextlib
import os
+import shutil
+import re
from lava_dispatcher.client.lmc_utils import (
image_partition_mounted,
@@ -67,7 +69,6 @@
def __init__(self, context, device_config):
self.context = context
self.config = device_config
-
self.boot_options = []
self._scratch_dir = None
self.deployment_data = {}
@@ -154,6 +155,46 @@
"""
return 'unknown'
+ def _find_and_copy(self, rootdir, odir, pattern, name=None):
+ dest = None
+ for root, dirs, files in os.walk(rootdir):
+ for file in files:
+ if re.match(pattern, file):
+ if name:
+ dest = os.path.join(odir, name)
+ else:
+ dest = os.path.join(odir, file)
+ if rootdir != odir:
+ src = os.path.join(rootdir, file)
+ shutil.copyfile(src, dest)
+ return dest
+ else:
+ return dest
+ return dest
+
+ def _customize_bootloader(self):
+ self.proc.expect(self.config.bootloader_prompt, timeout=300)
+ if isinstance(self.config.boot_cmds, basestring):
+ boot_cmds = utils.string_to_list(self.config.boot_cmds.encode('ascii'))
+ else:
+ boot_cmds = self.config.boot_cmds
+ for line in boot_cmds:
+ parts = re.match('^(?P<action>sendline|expect)\s*(?P<command>.*)', line)
+ if parts:
+ try:
+ action = parts.group('action')
+ command = parts.group('command')
+ except AttributeError as e:
+ raise Exception("Badly formatted command in boot_cmds %s" % e)
+ if action == "sendline":
+ self.proc.send(command)
+ self.proc.sendline('')
+ elif action == "expect":
+ command = re.escape(command)
+ self.proc.expect(command, timeout=300)
+ else:
+ self.proc.sendline(line)
+
def _customize_ubuntu(self, rootdir):
self.deployment_data = Target.ubuntu_deployment_data
with open('%s/root/.bashrc' % rootdir, 'a') as f: