summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
authorJoshua Lock <joshua.g.lock@intel.com>2016-09-18 00:39:23 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-20 15:11:07 +0100
commit2952affc631def4bf0c239947f1b522ea42a4a02 (patch)
treeb3429fae33d23cbea58cfc7a050b896413f97683 /scripts/runqemu
parent383a4af0e9cf410961ee681f8a2f07b5818f3762 (diff)
downloadpoky-2952affc631def4bf0c239947f1b522ea42a4a02.tar.gz
runqemu: add guidance to resolve issues with missing files
When a required binary cannot be found print some guidance pointing to using a sourced OE build environment or a qemuboot.conf file, based on a similar message from the previous shell-based runqemu. (From OE-Core rev: 87cfb5165490cd4e7a8c2570ef5a62898db8395e) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu19
1 files changed, 16 insertions, 3 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 380568560b..6526536c25 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -28,6 +28,16 @@ import shutil
28import glob 28import glob
29import configparser 29import configparser
30 30
31class OEPathError(Exception):
32 """Custom Exception to give better guidance on missing binaries"""
33 def __init__(self, message):
34 self.message = "In order for this script to dynamically infer paths\n \
35kernels or filesystem images, you either need bitbake in your PATH\n \
36or to source oe-init-build-env before running this script.\n\n \
37Dynamic path inference can be avoided by passing a *.qemuboot.conf to\n \
38runqemu, i.e. `runqemu /path/to/my-image-name.qemuboot.conf`\n\n %s" % message
39
40
31def create_logger(): 41def create_logger():
32 logger = logging.getLogger('runqemu') 42 logger = logging.getLogger('runqemu')
33 logger.setLevel(logging.INFO) 43 logger.setLevel(logging.INFO)
@@ -537,7 +547,7 @@ class BaseConfig(object):
537 elif os.getenv('DEPLOY_DIR_IMAGE'): 547 elif os.getenv('DEPLOY_DIR_IMAGE'):
538 deploy_dir_image = os.getenv('DEPLOY_DIR_IMAGE') 548 deploy_dir_image = os.getenv('DEPLOY_DIR_IMAGE')
539 else: 549 else:
540 raise Exception("DEPLOY_DIR_IMAGE is NULL!") 550 raise OEPathError("DEPLOY_DIR_IMAGE is NULL!")
541 551
542 if self.rootfs and not os.path.exists(self.rootfs): 552 if self.rootfs and not os.path.exists(self.rootfs):
543 # Lazy rootfs 553 # Lazy rootfs
@@ -691,7 +701,7 @@ class BaseConfig(object):
691 lockdir = "/tmp/qemu-tap-locks" 701 lockdir = "/tmp/qemu-tap-locks"
692 702
693 if not (self.qemuifup and self.qemuifdown and ip): 703 if not (self.qemuifup and self.qemuifdown and ip):
694 raise Exception("runqemu-ifup, runqemu-ifdown or ip not found") 704 raise OEPathError("runqemu-ifup, runqemu-ifdown or ip not found")
695 705
696 if not os.path.exists(lockdir): 706 if not os.path.exists(lockdir):
697 # There might be a race issue when multi runqemu processess are 707 # There might be a race issue when multi runqemu processess are
@@ -808,7 +818,7 @@ class BaseConfig(object):
808 818
809 qemu_bin = '%s/%s' % (self.get('STAGING_BINDIR_NATIVE'), qemu_system) 819 qemu_bin = '%s/%s' % (self.get('STAGING_BINDIR_NATIVE'), qemu_system)
810 if not os.access(qemu_bin, os.X_OK): 820 if not os.access(qemu_bin, os.X_OK):
811 raise Exception("No QEMU binary '%s' could be found" % qemu_bin) 821 raise OEPathError("No QEMU binary '%s' could be found" % qemu_bin)
812 822
813 check_libgl(qemu_bin) 823 check_libgl(qemu_bin)
814 824
@@ -923,6 +933,9 @@ def main():
923if __name__ == "__main__": 933if __name__ == "__main__":
924 try: 934 try:
925 ret = main() 935 ret = main()
936 except OEPathError as err:
937 ret = 1
938 logger.error(err.message)
926 except Exception as esc: 939 except Exception as esc:
927 ret = 1 940 ret = 1
928 import traceback 941 import traceback