diff options
author | Joshua Lock <joshua.g.lock@intel.com> | 2016-09-18 00:39:27 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-20 15:11:08 +0100 |
commit | 239d1706b0588dc49a6a2dac9453c1c63781312d (patch) | |
tree | 4d665c4e4cf8a004ac347d9055acf41a369b7495 /scripts/runqemu | |
parent | 52e04cd88b043f2ce858426815f595acf1b8a713 (diff) | |
download | poky-239d1706b0588dc49a6a2dac9453c1c63781312d.tar.gz |
runqemu: try symlinks when kernel or rootfs can't be found
If the kernel or rootfs names written to the qemuboot.conf can't
be found, try and find the symlinked variant of the filename.
This will help usability of runqemu, for example where a user
downloads an image and associated files as the symlinked names
yet the qemuboot.conf variables point to the full, non-linked,
file names.
(From OE-Core rev: ca5a686c6e165a51f95cb6a834cd53f6f66d42d4)
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-x | scripts/runqemu | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 09fe7ceafd..3e4e3ff8e2 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -451,7 +451,12 @@ class BaseConfig(object): | |||
451 | if all_files: | 451 | if all_files: |
452 | self.rootfs = all_files[0] | 452 | self.rootfs = all_files[0] |
453 | else: | 453 | else: |
454 | raise Exception("Failed to find rootfs: %s" % cmd) | 454 | cmd = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_LINK_NAME'), self.fstype) |
455 | all_files = glob.glob(cmd) | ||
456 | if all_files: | ||
457 | self.rootfs = all_files[0] | ||
458 | else: | ||
459 | raise Exception("Failed to find rootfs: %s" % cmd) | ||
455 | 460 | ||
456 | if not os.path.exists(self.rootfs): | 461 | if not os.path.exists(self.rootfs): |
457 | raise Exception("Can't find rootfs: %s" % self.rootfs) | 462 | raise Exception("Can't find rootfs: %s" % self.rootfs) |
@@ -462,13 +467,18 @@ class BaseConfig(object): | |||
462 | if self.fstype in self.vmtypes: | 467 | if self.fstype in self.vmtypes: |
463 | return | 468 | return |
464 | kernel = self.kernel | 469 | kernel = self.kernel |
470 | deploy_dir_image = self.get('DEPLOY_DIR_IMAGE') | ||
465 | if not kernel: | 471 | if not kernel: |
466 | kernel = "%s/%s" % (self.get('DEPLOY_DIR_IMAGE'), self.get('QB_DEFAULT_KERNEL')) | 472 | kernel = "%s/%s" % (deploy_dir_image, self.get('QB_DEFAULT_KERNEL')) |
467 | 473 | ||
468 | if os.path.exists(kernel): | 474 | if os.path.exists(kernel): |
469 | self.kernel = kernel | 475 | self.kernel = kernel |
470 | else: | 476 | else: |
471 | raise Exception("KERNEL %s not found" % kernel) | 477 | kernel = "%s/%s" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE')) |
478 | if kernel != deploy_dir_image and os.path.exists(kernel): | ||
479 | self.kernel = kernel | ||
480 | else: | ||
481 | raise Exception("KERNEL %s not found" % kernel) | ||
472 | 482 | ||
473 | dtb = self.get('QB_DTB') | 483 | dtb = self.get('QB_DTB') |
474 | if dtb: | 484 | if dtb: |