runqemu: do not rely on grepping images
Fixed when the image is large and not enough memory: grep: memory exhausted Aborted [YOCTO #11073] (From OE-Core rev: a99deb30a0138594147ae28aab016fe4b74b8959) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
f2c09f7867
commit
f57393b386
|
@ -64,6 +64,9 @@ QB_DEFAULT_FSTYPE ?= "ext4"
|
|||
QB_OPT_APPEND ?= "-show-cursor"
|
||||
QB_NETWORK_DEVICE ?= "-device virtio-net-pci,netdev=net0,mac=@MAC@"
|
||||
|
||||
# This should be kept align with ROOT_VM
|
||||
QB_DRIVE_TYPE ?= "/dev/sd"
|
||||
|
||||
# Create qemuboot.conf
|
||||
addtask do_write_qemuboot_conf after do_rootfs before do_image
|
||||
IMGDEPLOYDIR ?= "${WORKDIR}/deploy-${PN}-image-complete"
|
||||
|
|
|
@ -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'))
|
||||
|
||||
|
|
Loading…
Reference in New Issue