summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-04-12 23:40:58 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-13 10:54:10 +0100
commit4d3bececf617dca82b5043781d63229427c734db (patch)
treedf8bc0de17b950c670acf1f2d806c4a6ee4c3967
parent7ffcdd0a07d70d9322c68dd4caebcaebfc3a2c96 (diff)
downloadpoky-4d3bececf617dca82b5043781d63229427c734db.tar.gz
runqemu: add bindir_native property
Isolated logic of getting path to native bin directory in new bindir_native property method. This property is going to be used to obtain location of qemu-sytem and tunctl. (From OE-Core rev: 26e97f7ebb7e3302e3d3c6646fb58baf395d62be) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/runqemu37
1 files changed, 24 insertions, 13 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index a8bb9ebbda..6cdedd8d7e 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -721,7 +721,7 @@ class BaseConfig(object):
721 self.load_bitbake_env() 721 self.load_bitbake_env()
722 722
723 if self.bitbake_e: 723 if self.bitbake_e:
724 native_vars = ['STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE'] 724 native_vars = ['STAGING_DIR_NATIVE']
725 for nv in native_vars: 725 for nv in native_vars:
726 s = re.search('^%s="(.*)"' % nv, self.bitbake_e, re.M) 726 s = re.search('^%s="(.*)"' % nv, self.bitbake_e, re.M)
727 if s and s.group(1) != self.get(nv): 727 if s and s.group(1) != self.get(nv):
@@ -1056,18 +1056,7 @@ class BaseConfig(object):
1056 if not qemu_system: 1056 if not qemu_system:
1057 raise Exception("Failed to boot, QB_SYSTEM_NAME is NULL!") 1057 raise Exception("Failed to boot, QB_SYSTEM_NAME is NULL!")
1058 1058
1059 cmd = 'bitbake qemu-helper-native -e' 1059 qemu_bin = '%s/%s' % (self.bindir_native, qemu_system)
1060 logger.info('Running %s...' % cmd)
1061 out = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
1062 out = out.stdout.read().decode('utf-8')
1063
1064 match = re.search('^STAGING_BINDIR_NATIVE="(.*)"', out, re.M)
1065 if match:
1066 bindir_native = match.group(1)
1067 else:
1068 raise Exception("Can't find STAGING_BINDIR_NATIVE in '%s' output" % cmd)
1069
1070 qemu_bin = '%s/%s' % (bindir_native, qemu_system)
1071 1060
1072 # It is possible to have qemu-native in ASSUME_PROVIDED, and it won't 1061 # It is possible to have qemu-native in ASSUME_PROVIDED, and it won't
1073 # find QEMU in sysroot, it needs to use host's qemu. 1062 # find QEMU in sysroot, it needs to use host's qemu.
@@ -1196,6 +1185,28 @@ class BaseConfig(object):
1196 self.bitbake_e = '' 1185 self.bitbake_e = ''
1197 logger.warn("Couldn't run 'bitbake -e' to gather environment information:\n%s" % err.output.decode('utf-8')) 1186 logger.warn("Couldn't run 'bitbake -e' to gather environment information:\n%s" % err.output.decode('utf-8'))
1198 1187
1188 @property
1189 def bindir_native(self):
1190 result = self.get('STAGING_BINDIR_NATIVE')
1191 if result and os.path.exists(result):
1192 return result
1193
1194 cmd = 'bitbake qemu-helper-native -e'
1195 logger.info('Running %s...' % cmd)
1196 out = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
1197 out = out.stdout.read().decode('utf-8')
1198
1199 match = re.search('^STAGING_BINDIR_NATIVE="(.*)"', out, re.M)
1200 if match:
1201 result = match.group(1)
1202 if os.path.exists(result):
1203 self.set('STAGING_BINDIR_NATIVE', result)
1204 return result
1205 raise Exception("Native sysroot directory %s doesn't exist" % result)
1206 else:
1207 raise Exception("Can't find STAGING_BINDIR_NATIVE in '%s' output" % cmd)
1208
1209
1199def main(): 1210def main():
1200 if "help" in sys.argv or '-h' in sys.argv or '--help' in sys.argv: 1211 if "help" in sys.argv or '-h' in sys.argv or '--help' in sys.argv:
1201 print_usage() 1212 print_usage()