summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2017-04-11 02:21:28 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-11 18:10:49 +0100
commita99deb30a0138594147ae28aab016fe4b74b8959 (patch)
tree4009cda8006d0110552d36688d03b6feba40b6b1 /scripts/runqemu
parent9ebcb2b6f41420ae3686afad03bb26a68cfacf95 (diff)
downloadopenembedded-core-a99deb30a0138594147ae28aab016fe4b74b8959.tar.gz
runqemu: do not rely on grepping images
Fixed when the image is large and not enough memory: grep: memory exhausted Aborted [YOCTO #11073] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu19
1 files changed, 11 insertions, 8 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 51ed9de22c..803b205690 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -980,23 +980,26 @@ class BaseConfig(object):
self.kernel_cmdline = 'root=/dev/ram0 rw debugshell'
self.rootfs_options = '-initrd %s' % self.rootfs
else:
+ vm_drive = ''
if self.fstype in self.vmtypes:
if self.fstype == 'iso':
vm_drive = '-cdrom %s' % self.rootfs
- else:
- cmd1 = "grep -q 'root=/dev/sd' %s" % self.rootfs
- cmd2 = "grep -q 'root=/dev/hd' %s" % self.rootfs
- if subprocess.call(cmd1, shell=True) == 0:
+ elif self.get('QB_DRIVE_TYPE'):
+ drive_type = self.get('QB_DRIVE_TYPE')
+ if drive_type.startswith("/dev/sd"):
logger.info('Using scsi drive')
vm_drive = '-drive if=none,id=hd,file=%s,format=%s -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd' \
% (self.rootfs, rootfs_format)
- elif subprocess.call(cmd2, shell=True) == 0:
+ elif drive_type.startswith("/dev/hd"):
logger.info('Using ide drive')
vm_drive = "%s,format=%s" % (self.rootfs, rootfs_format)
else:
- logger.warn("Can't detect drive type %s" % self.rootfs)
- logger.warn('Trying to use virtio block drive')
- vm_drive = '-drive if=virtio,file=%s,format=%s' % (self.rootfs, rootfs_format)
+ logger.warn("Unknown QB_DRIVE_TYPE: %s" % drive_type)
+
+ if not vm_drive:
+ logger.warn("Failed to figure out drive type, consider define or fix QB_DRIVE_TYPE")
+ logger.warn('Trying to use virtio block drive')
+ vm_drive = '-drive if=virtio,file=%s,format=%s' % (self.rootfs, rootfs_format)
self.rootfs_options = '%s -no-reboot' % vm_drive
self.kernel_cmdline = 'root=%s rw highres=off' % (self.get('QB_KERNEL_ROOT'))