diff options
| -rwxr-xr-x | scripts/runqemu | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index ef454d67ff..b6fca041ae 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
| @@ -135,6 +135,7 @@ class BaseConfig(object): | |||
| 135 | 'DEPLOY_DIR_IMAGE', | 135 | 'DEPLOY_DIR_IMAGE', |
| 136 | 'OE_TMPDIR', | 136 | 'OE_TMPDIR', |
| 137 | 'OECORE_NATIVE_SYSROOT', | 137 | 'OECORE_NATIVE_SYSROOT', |
| 138 | 'MULTICONFIG', | ||
| 138 | ) | 139 | ) |
| 139 | 140 | ||
| 140 | self.qemu_opt = '' | 141 | self.qemu_opt = '' |
| @@ -401,9 +402,7 @@ class BaseConfig(object): | |||
| 401 | self.set("MACHINE", arg) | 402 | self.set("MACHINE", arg) |
| 402 | return | 403 | return |
| 403 | 404 | ||
| 404 | cmd = 'MACHINE=%s bitbake -e' % arg | 405 | self.bitbake_e = self.run_bitbake_env(arg) |
| 405 | logger.info('Running %s...' % cmd) | ||
| 406 | self.bitbake_e = subprocess.check_output(cmd, shell=True).decode('utf-8') | ||
| 407 | # bitbake -e doesn't report invalid MACHINE as an error, so | 406 | # bitbake -e doesn't report invalid MACHINE as an error, so |
| 408 | # let's check DEPLOY_DIR_IMAGE to make sure that it is a valid | 407 | # let's check DEPLOY_DIR_IMAGE to make sure that it is a valid |
| 409 | # MACHINE. | 408 | # MACHINE. |
| @@ -1410,10 +1409,7 @@ class BaseConfig(object): | |||
| 1410 | 1409 | ||
| 1411 | self.cleaned = True | 1410 | self.cleaned = True |
| 1412 | 1411 | ||
| 1413 | def load_bitbake_env(self, mach=None): | 1412 | def run_bitbake_env(self, mach=None): |
| 1414 | if self.bitbake_e: | ||
| 1415 | return | ||
| 1416 | |||
| 1417 | bitbake = shutil.which('bitbake') | 1413 | bitbake = shutil.which('bitbake') |
| 1418 | if not bitbake: | 1414 | if not bitbake: |
| 1419 | return | 1415 | return |
| @@ -1421,14 +1417,24 @@ class BaseConfig(object): | |||
| 1421 | if not mach: | 1417 | if not mach: |
| 1422 | mach = self.get('MACHINE') | 1418 | mach = self.get('MACHINE') |
| 1423 | 1419 | ||
| 1420 | multiconfig = self.get('MULTICONFIG') | ||
| 1421 | if multiconfig: | ||
| 1422 | multiconfig = "mc:%s" % multiconfig | ||
| 1423 | |||
| 1424 | if mach: | 1424 | if mach: |
| 1425 | cmd = 'MACHINE=%s bitbake -e' % mach | 1425 | cmd = 'MACHINE=%s bitbake -e %s' % (mach, multiconfig) |
| 1426 | else: | 1426 | else: |
| 1427 | cmd = 'bitbake -e' | 1427 | cmd = 'bitbake -e %s' % multiconfig |
| 1428 | 1428 | ||
| 1429 | logger.info('Running %s...' % cmd) | 1429 | logger.info('Running %s...' % cmd) |
| 1430 | return subprocess.check_output(cmd, shell=True).decode('utf-8') | ||
| 1431 | |||
| 1432 | def load_bitbake_env(self, mach=None): | ||
| 1433 | if self.bitbake_e: | ||
| 1434 | return | ||
| 1435 | |||
| 1430 | try: | 1436 | try: |
| 1431 | self.bitbake_e = subprocess.check_output(cmd, shell=True).decode('utf-8') | 1437 | self.bitbake_e = self.run_bitbake_env(mach=mach) |
| 1432 | except subprocess.CalledProcessError as err: | 1438 | except subprocess.CalledProcessError as err: |
| 1433 | self.bitbake_e = '' | 1439 | self.bitbake_e = '' |
| 1434 | logger.warning("Couldn't run 'bitbake -e' to gather environment information:\n%s" % err.output.decode('utf-8')) | 1440 | 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): | |||
| 1443 | if result and os.path.exists(result): | 1449 | if result and os.path.exists(result): |
| 1444 | return result | 1450 | return result |
| 1445 | 1451 | ||
| 1446 | cmd = ('bitbake', 'qemu-helper-native', '-e') | 1452 | cmd = ['bitbake', '-e'] |
| 1453 | multiconfig = self.get('MULTICONFIG') | ||
| 1454 | if multiconfig: | ||
| 1455 | cmd.append('mc:%s:qemu-helper-native' % multiconfig) | ||
| 1456 | else: | ||
| 1457 | cmd.append('qemu-helper-native') | ||
| 1458 | |||
| 1447 | logger.info('Running %s...' % str(cmd)) | 1459 | logger.info('Running %s...' % str(cmd)) |
| 1448 | out = subprocess.check_output(cmd).decode('utf-8') | 1460 | out = subprocess.check_output(cmd).decode('utf-8') |
| 1449 | 1461 | ||
