* [PATCH 1/4] runqemu: validate paths and attempt to infer unset paths
2016-09-21 19:35 [PATCH 0/4] runqemu fixes for toolchain and sdk uses Joshua Lock
@ 2016-09-21 19:35 ` Joshua Lock
2016-09-21 19:35 ` [PATCH 2/4] runqemu: try and guess qemu-system binary when MACHINE isn't set Joshua Lock
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Joshua Lock @ 2016-09-21 19:35 UTC (permalink / raw)
To: openembedded-core
We need to validate and ensure all paths are set regardless of
whether runqemu was invoked with a .qemuboot.conf file or
otherwise. Split this logic out into a separate method called
during check_and_set()
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
---
scripts/runqemu | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/runqemu b/scripts/runqemu
index 08dc306..5170d87 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -536,6 +536,7 @@ class BaseConfig(object):
def check_and_set(self):
"""Check configs sanity and set when needed"""
+ self.validate_paths()
check_tun()
# Check audio
if self.audio_enabled:
@@ -598,6 +599,8 @@ class BaseConfig(object):
k_upper = k.upper()
self.set(k_upper, v)
+ def validate_paths(self):
+ """Ensure all relevant path variables are set"""
# When we're started with a *.qemuboot.conf arg assume that image
# artefacts are relative to that file, rather than in whatever
# directory DEPLOY_DIR_IMAGE in the conf file points to.
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/4] runqemu: try and guess qemu-system binary when MACHINE isn't set
2016-09-21 19:35 [PATCH 0/4] runqemu fixes for toolchain and sdk uses Joshua Lock
2016-09-21 19:35 ` [PATCH 1/4] runqemu: validate paths and attempt to infer unset paths Joshua Lock
@ 2016-09-21 19:35 ` Joshua Lock
2016-09-21 19:35 ` [PATCH 3/4] runqemu: don't try and invoke bitbake when running in a toolchain env Joshua Lock
2016-09-21 19:35 ` [PATCH 4/4] runqemu: don't fail during check_arg_machine() Joshua Lock
3 siblings, 0 replies; 5+ messages in thread
From: Joshua Lock @ 2016-09-21 19:35 UTC (permalink / raw)
To: openembedded-core
Emulate some logic from the prior, shell based, version of runqemu
to try and infer the correct setting for MACHINE from the kernel
and rootfs filenames.
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
---
scripts/runqemu | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/scripts/runqemu b/scripts/runqemu
index 5170d87..591746f 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -846,9 +846,45 @@ class BaseConfig(object):
self.set('ROOTFS_OPTIONS', self.rootfs_options)
+ def guess_qb_system(self):
+ """attempt to determine the appropriate qemu-system binary"""
+ mach = self.get('MACHINE')
+ if not mach:
+ search = '.*(qemux86-64|qemux86|qemuarm64|qemuarm|qemumips64|qemumips|qemuppc).*'
+ if self.rootfs:
+ match = re.match(search, self.rootfs)
+ if match:
+ mach = match.group(1)
+ elif self.kernel:
+ match = re.match(search, self.kernel)
+ if match:
+ mach = match.group(1)
+
+ if not mach:
+ return None
+
+ if mach == 'qemuarm':
+ qbsys = 'arm'
+ elif mach == 'qemuarm64':
+ qbsys = 'aarch64'
+ elif mach == 'qemux86':
+ qbsys = 'i386'
+ elif mach == 'qemux86-64':
+ qbsys = 'x86_64'
+ elif mach == 'qemuppc':
+ qbsys = 'ppc'
+ elif mach == 'qemumips':
+ qbsys = 'mips'
+ elif mach == 'qemumips64':
+ qbsys = 'mips64'
+
+ return 'qemu-system-%s' % qbsys
+
def setup_final(self):
qemu_system = self.get('QB_SYSTEM_NAME')
if not qemu_system:
+ qemu_system = self.guess_qb_system()
+ if not qemu_system:
raise Exception("Failed to boot, QB_SYSTEM_NAME is NULL!")
qemu_bin = '%s/%s' % (self.get('STAGING_BINDIR_NATIVE'), qemu_system)
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/4] runqemu: don't try and invoke bitbake when running in a toolchain env
2016-09-21 19:35 [PATCH 0/4] runqemu fixes for toolchain and sdk uses Joshua Lock
2016-09-21 19:35 ` [PATCH 1/4] runqemu: validate paths and attempt to infer unset paths Joshua Lock
2016-09-21 19:35 ` [PATCH 2/4] runqemu: try and guess qemu-system binary when MACHINE isn't set Joshua Lock
@ 2016-09-21 19:35 ` Joshua Lock
2016-09-21 19:35 ` [PATCH 4/4] runqemu: don't fail during check_arg_machine() Joshua Lock
3 siblings, 0 replies; 5+ messages in thread
From: Joshua Lock @ 2016-09-21 19:35 UTC (permalink / raw)
To: openembedded-core
If a MACHINE value is passed we can't validate it by running bitbake
as the toolchain environment doesn't include the build system, we
must assume that the passed value for MACHINE is correct.
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
---
scripts/runqemu | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/runqemu b/scripts/runqemu
index 591746f..e8360c2 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -306,11 +306,16 @@ class BaseConfig(object):
# FIXME: testimage.bbclass exports these two variables into env,
# are there other scenarios in which we need to support being
# invoked by bitbake?
- deploy = os.environ.get('DEPLOY_DIR_IMAGE', None)
- bbchild = deploy and os.environ.get('OE_TMPDIR', None)
+ deploy = os.environ.get('DEPLOY_DIR_IMAGE')
+ bbchild = deploy and os.environ.get('OE_TMPDIR')
if bbchild:
self.set_machine_deploy_dir(arg, deploy)
return
+ # also check whether we're running under a sourced toolchain
+ # environment file
+ if os.environ.get('OECORE_NATIVE_SYSROOT'):
+ self.set("MACHINE", arg)
+ return
cmd = 'MACHINE=%s bitbake -e' % arg
logger.info('Running %s...' % cmd)
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/4] runqemu: don't fail during check_arg_machine()
2016-09-21 19:35 [PATCH 0/4] runqemu fixes for toolchain and sdk uses Joshua Lock
` (2 preceding siblings ...)
2016-09-21 19:35 ` [PATCH 3/4] runqemu: don't try and invoke bitbake when running in a toolchain env Joshua Lock
@ 2016-09-21 19:35 ` Joshua Lock
3 siblings, 0 replies; 5+ messages in thread
From: Joshua Lock @ 2016-09-21 19:35 UTC (permalink / raw)
To: openembedded-core
If DEPLOY_DIR_IMAGE doesn't exist during check_arg_machine() we
will attempt to guess a suitable value later when check_and_set()
calls validate_paths(), therefore this shouldn't raise an exception
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
---
scripts/runqemu | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/runqemu b/scripts/runqemu
index e8360c2..658f7c8 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -332,7 +332,7 @@ class BaseConfig(object):
self.set_machine_deploy_dir(arg, deploy_dir_image)
else:
logger.error("%s not a directory valid DEPLOY_DIR_IMAGE" % deploy_dir_image)
- raise Exception("Failed to set MACHINE to %s. Unknown arg: %s" % (arg, arg))
+ self.set("MACHINE", arg)
def check_args(self):
unknown_arg = ""
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread