summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAlistair Francis <alistair.francis@wdc.com>2019-08-20 13:59:16 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-08-21 15:29:02 +0100
commit23662395e2e7f1ac2df9f2071ed2a1c38fecba77 (patch)
tree1806f628a10495c23ab6f1235792d94a869664ed /scripts
parent5a308c55a60282b475545f3c7346e5e8053aba3f (diff)
downloadpoky-23662395e2e7f1ac2df9f2071ed2a1c38fecba77.tar.gz
scripts/runqemu: Add support for the BIOS variable
Add support for specifying a BIOS the same way that the KERNEL variable is specified. This includes specifying a QB_DEFAULT_BIOS variable. (From OE-Core rev: fc2a2260aa22a81da6619b4affaf8ae0b5556a34) Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/runqemu53
1 files changed, 29 insertions, 24 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index df3c8aad08..e9b83737cb 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -59,6 +59,7 @@ def print_usage():
59Usage: you can run this script with any valid combination 59Usage: you can run this script with any valid combination
60of the following environment variables (in any order): 60of the following environment variables (in any order):
61 KERNEL - the kernel image file to use 61 KERNEL - the kernel image file to use
62 BIOS - the bios image file to use
62 ROOTFS - the rootfs image file or nfsroot directory to use 63 ROOTFS - the rootfs image file or nfsroot directory to use
63 DEVICE_TREE - the device tree blob to use 64 DEVICE_TREE - the device tree blob to use
64 MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified) 65 MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)
@@ -77,8 +78,6 @@ of the following environment variables (in any order):
77 audio - enable audio 78 audio - enable audio
78 [*/]ovmf* - OVMF firmware file or base name for booting with UEFI 79 [*/]ovmf* - OVMF firmware file or base name for booting with UEFI
79 tcpserial=<port> - specify tcp serial port number 80 tcpserial=<port> - specify tcp serial port number
80 biosdir=<dir> - specify custom bios dir
81 biosfilename=<filename> - specify bios filename
82 qemuparams=<xyz> - specify custom parameters to QEMU 81 qemuparams=<xyz> - specify custom parameters to QEMU
83 bootparams=<xyz> - specify custom kernel parameters during boot 82 bootparams=<xyz> - specify custom kernel parameters during boot
84 help, -h, --help: print this text 83 help, -h, --help: print this text
@@ -129,6 +128,7 @@ class BaseConfig(object):
129 self.env_vars = ('MACHINE', 128 self.env_vars = ('MACHINE',
130 'ROOTFS', 129 'ROOTFS',
131 'KERNEL', 130 'KERNEL',
131 'BIOS',
132 'DEVICE_TREE', 132 'DEVICE_TREE',
133 'DEPLOY_DIR_IMAGE', 133 'DEPLOY_DIR_IMAGE',
134 'OE_TMPDIR', 134 'OE_TMPDIR',
@@ -155,6 +155,7 @@ class BaseConfig(object):
155 self.qemuboot = '' 155 self.qemuboot = ''
156 self.qbconfload = False 156 self.qbconfload = False
157 self.kernel = '' 157 self.kernel = ''
158 self.bios = ''
158 self.kernel_cmdline = '' 159 self.kernel_cmdline = ''
159 self.kernel_cmdline_script = '' 160 self.kernel_cmdline_script = ''
160 self.bootparams = '' 161 self.bootparams = ''
@@ -171,7 +172,6 @@ class BaseConfig(object):
171 self.saved_stty = '' 172 self.saved_stty = ''
172 self.audio_enabled = False 173 self.audio_enabled = False
173 self.tcpserial_portnum = '' 174 self.tcpserial_portnum = ''
174 self.custombiosdir = ''
175 self.taplock = '' 175 self.taplock = ''
176 self.taplock_descriptor = None 176 self.taplock_descriptor = None
177 self.portlocks = {} 177 self.portlocks = {}
@@ -480,10 +480,6 @@ class BaseConfig(object):
480 self.qemu_opt_script += ' -vnc :0' 480 self.qemu_opt_script += ' -vnc :0'
481 elif arg.startswith('tcpserial='): 481 elif arg.startswith('tcpserial='):
482 self.tcpserial_portnum = '%s' % arg[len('tcpserial='):] 482 self.tcpserial_portnum = '%s' % arg[len('tcpserial='):]
483 elif arg.startswith('biosdir='):
484 self.custombiosdir = arg[len('biosdir='):]
485 elif arg.startswith('biosfilename='):
486 self.qemu_opt_script += ' -bios %s' % arg[len('biosfilename='):]
487 elif arg.startswith('qemuparams='): 483 elif arg.startswith('qemuparams='):
488 self.qemuparams = ' %s' % arg[len('qemuparams='):] 484 self.qemuparams = ' %s' % arg[len('qemuparams='):]
489 elif arg.startswith('bootparams='): 485 elif arg.startswith('bootparams='):
@@ -725,25 +721,30 @@ class BaseConfig(object):
725 if not os.path.exists(self.dtb): 721 if not os.path.exists(self.dtb):
726 raise RunQemuError('DTB not found: %s, %s or %s' % cmds) 722 raise RunQemuError('DTB not found: %s, %s or %s' % cmds)
727 723
728 def check_biosdir(self): 724 def check_bios(self):
729 """Check custombiosdir""" 725 """Check and set bios"""
730 if not self.custombiosdir: 726
727 # See if the user supplied a BIOS option
728 if self.get('BIOS'):
729 self.bios = self.get('BIOS')
730
731 # QB_DEFAULT_BIOS is always a full file path
732 bios_name = os.path.basename(self.get('QB_DEFAULT_BIOS'))
733
734 # The user didn't want a bios to be loaded
735 if (bios_name == "" or bios_name == "none") and not self.bios:
731 return 736 return
732 737
733 biosdir = "" 738 if not self.bios:
734 biosdir_native = "%s/%s" % (self.get('STAGING_DIR_NATIVE'), self.custombiosdir) 739 deploy_dir_image = self.get('DEPLOY_DIR_IMAGE')
735 biosdir_host = "%s/%s" % (self.get('STAGING_DIR_HOST'), self.custombiosdir) 740 self.bios = "%s/%s" % (deploy_dir_image, bios_name)
736 for i in (self.custombiosdir, biosdir_native, biosdir_host): 741
737 if os.path.isdir(i): 742 if not self.bios:
738 biosdir = i 743 raise RunQemuError('BIOS not found: %s' % bios_match_name)
739 break 744
745 if not os.path.exists(self.bios):
746 raise RunQemuError("KERNEL %s not found" % self.bios)
740 747
741 if biosdir:
742 logger.debug("Assuming biosdir is: %s" % biosdir)
743 self.qemu_opt_script += ' -L %s' % biosdir
744 else:
745 logger.error("Custom BIOS directory not found. Tried: %s, %s, and %s" % (self.custombiosdir, biosdir_native, biosdir_host))
746 raise RunQemuError("Invalid custombiosdir: %s" % self.custombiosdir)
747 748
748 def check_mem(self): 749 def check_mem(self):
749 """ 750 """
@@ -811,7 +812,7 @@ class BaseConfig(object):
811 self.check_ovmf() 812 self.check_ovmf()
812 self.check_kernel() 813 self.check_kernel()
813 self.check_dtb() 814 self.check_dtb()
814 self.check_biosdir() 815 self.check_bios()
815 self.check_mem() 816 self.check_mem()
816 self.check_tcpserial() 817 self.check_tcpserial()
817 818
@@ -923,6 +924,8 @@ class BaseConfig(object):
923 logger.info('Continuing with the following parameters:\n') 924 logger.info('Continuing with the following parameters:\n')
924 if not self.fstype in self.vmtypes: 925 if not self.fstype in self.vmtypes:
925 print('KERNEL: [%s]' % self.kernel) 926 print('KERNEL: [%s]' % self.kernel)
927 if self.bios:
928 print('BIOS: [%s]' % self.bios)
926 if self.dtb: 929 if self.dtb:
927 print('DTB: [%s]' % self.dtb) 930 print('DTB: [%s]' % self.dtb)
928 print('MACHINE: [%s]' % self.get('MACHINE')) 931 print('MACHINE: [%s]' % self.get('MACHINE'))
@@ -1339,6 +1342,8 @@ class BaseConfig(object):
1339 kernel_opts = "-kernel %s -append '%s %s %s %s'" % (self.kernel, self.kernel_cmdline, 1342 kernel_opts = "-kernel %s -append '%s %s %s %s'" % (self.kernel, self.kernel_cmdline,
1340 self.kernel_cmdline_script, self.get('QB_KERNEL_CMDLINE_APPEND'), 1343 self.kernel_cmdline_script, self.get('QB_KERNEL_CMDLINE_APPEND'),
1341 self.bootparams) 1344 self.bootparams)
1345 if self.bios:
1346 kernel_opts += " -bios %s" % self.bios
1342 if self.dtb: 1347 if self.dtb:
1343 kernel_opts += " -dtb %s" % self.dtb 1348 kernel_opts += " -dtb %s" % self.dtb
1344 else: 1349 else: