diff options
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 19 |
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 | |||
28 | import glob | 28 | import glob |
29 | import configparser | 29 | import configparser |
30 | 30 | ||
31 | class 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 \ | ||
35 | kernels or filesystem images, you either need bitbake in your PATH\n \ | ||
36 | or to source oe-init-build-env before running this script.\n\n \ | ||
37 | Dynamic path inference can be avoided by passing a *.qemuboot.conf to\n \ | ||
38 | runqemu, i.e. `runqemu /path/to/my-image-name.qemuboot.conf`\n\n %s" % message | ||
39 | |||
40 | |||
31 | def create_logger(): | 41 | def 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(): | |||
923 | if __name__ == "__main__": | 933 | if __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 |