runqemu: Add multiconfig support

Users may want to run qemu against a specific multiconfig instead of the
base configuration, so give them the ability to specify which config
should be used with the MULTICONFIG environment variable.

(From OE-Core rev: fda5d9b64fa310173ad949540c54fd693c4f7d3a)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Watt 2019-12-30 14:59:50 -06:00 committed by Richard Purdie
parent 4ceb3fcb4e
commit 714eb4532b

View File

@ -135,6 +135,7 @@ class BaseConfig(object):
'DEPLOY_DIR_IMAGE',
'OE_TMPDIR',
'OECORE_NATIVE_SYSROOT',
'MULTICONFIG',
)
self.qemu_opt = ''
@ -401,9 +402,7 @@ class BaseConfig(object):
self.set("MACHINE", arg)
return
cmd = 'MACHINE=%s bitbake -e' % arg
logger.info('Running %s...' % cmd)
self.bitbake_e = subprocess.check_output(cmd, shell=True).decode('utf-8')
self.bitbake_e = self.run_bitbake_env(arg)
# bitbake -e doesn't report invalid MACHINE as an error, so
# let's check DEPLOY_DIR_IMAGE to make sure that it is a valid
# MACHINE.
@ -1410,10 +1409,7 @@ class BaseConfig(object):
self.cleaned = True
def load_bitbake_env(self, mach=None):
if self.bitbake_e:
return
def run_bitbake_env(self, mach=None):
bitbake = shutil.which('bitbake')
if not bitbake:
return
@ -1421,14 +1417,24 @@ class BaseConfig(object):
if not mach:
mach = self.get('MACHINE')
multiconfig = self.get('MULTICONFIG')
if multiconfig:
multiconfig = "mc:%s" % multiconfig
if mach:
cmd = 'MACHINE=%s bitbake -e' % mach
cmd = 'MACHINE=%s bitbake -e %s' % (mach, multiconfig)
else:
cmd = 'bitbake -e'
cmd = 'bitbake -e %s' % multiconfig
logger.info('Running %s...' % cmd)
return subprocess.check_output(cmd, shell=True).decode('utf-8')
def load_bitbake_env(self, mach=None):
if self.bitbake_e:
return
try:
self.bitbake_e = subprocess.check_output(cmd, shell=True).decode('utf-8')
self.bitbake_e = self.run_bitbake_env(mach=mach)
except subprocess.CalledProcessError as err:
self.bitbake_e = ''
logger.warning("Couldn't run 'bitbake -e' to gather environment information:\n%s" % err.output.decode('utf-8'))
@ -1443,7 +1449,13 @@ class BaseConfig(object):
if result and os.path.exists(result):
return result
cmd = ('bitbake', 'qemu-helper-native', '-e')
cmd = ['bitbake', '-e']
multiconfig = self.get('MULTICONFIG')
if multiconfig:
cmd.append('mc:%s:qemu-helper-native' % multiconfig)
else:
cmd.append('qemu-helper-native')
logger.info('Running %s...' % str(cmd))
out = subprocess.check_output(cmd).decode('utf-8')