summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu49
1 files changed, 44 insertions, 5 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index af90c010da..4079f2b17d 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -185,10 +185,11 @@ class BaseConfig(object):
185 self.lock_descriptor = None 185 self.lock_descriptor = None
186 self.bitbake_e = '' 186 self.bitbake_e = ''
187 self.snapshot = False 187 self.snapshot = False
188 self.wictypes = ('wic', 'wic.vmdk', 'wic.qcow2', 'wic.vdi')
188 self.fstypes = ('ext2', 'ext3', 'ext4', 'jffs2', 'nfs', 'btrfs', 189 self.fstypes = ('ext2', 'ext3', 'ext4', 'jffs2', 'nfs', 'btrfs',
189 'cpio.gz', 'cpio', 'ramfs', 'tar.bz2', 'tar.gz') 190 'cpio.gz', 'cpio', 'ramfs', 'tar.bz2', 'tar.gz')
190 self.vmtypes = ('hddimg', 'hdddirect', 'wic', 'wic.vmdk', 191 self.vmtypes = ('hddimg', 'hdddirect', 'iso')
191 'wic.qcow2', 'wic.vdi', 'iso') 192 self.fsinfo = {}
192 self.network_device = "-device e1000,netdev=net0,mac=@MAC@" 193 self.network_device = "-device e1000,netdev=net0,mac=@MAC@"
193 # Use different mac section for tap and slirp to avoid 194 # Use different mac section for tap and slirp to avoid
194 # conflicts, e.g., when one is running with tap, the other is 195 # conflicts, e.g., when one is running with tap, the other is
@@ -253,7 +254,7 @@ class BaseConfig(object):
253 254
254 def check_arg_fstype(self, fst): 255 def check_arg_fstype(self, fst):
255 """Check and set FSTYPE""" 256 """Check and set FSTYPE"""
256 if fst not in self.fstypes + self.vmtypes: 257 if fst not in self.fstypes + self.vmtypes + self.wictypes:
257 logger.warning("Maybe unsupported FSTYPE: %s" % fst) 258 logger.warning("Maybe unsupported FSTYPE: %s" % fst)
258 if not self.fstype or self.fstype == fst: 259 if not self.fstype or self.fstype == fst:
259 if fst == 'ramfs': 260 if fst == 'ramfs':
@@ -390,7 +391,7 @@ class BaseConfig(object):
390 391
391 unknown_arg = "" 392 unknown_arg = ""
392 for arg in sys.argv[1:]: 393 for arg in sys.argv[1:]:
393 if arg in self.fstypes + self.vmtypes: 394 if arg in self.fstypes + self.vmtypes + self.wictypes:
394 self.check_arg_fstype(arg) 395 self.check_arg_fstype(arg)
395 elif arg == 'nographic': 396 elif arg == 'nographic':
396 self.qemu_opt_script += ' -nographic' 397 self.qemu_opt_script += ' -nographic'
@@ -536,6 +537,40 @@ class BaseConfig(object):
536 else: 537 else:
537 raise RunQemuError("FSTYPE is NULL!") 538 raise RunQemuError("FSTYPE is NULL!")
538 539
540 # parse QB_FSINFO into dict, e.g. { 'wic': ['no-kernel-in-fs', 'a-flag'], 'ext4': ['another-flag']}
541 wic_fs = False
542 qb_fsinfo = self.get('QB_FSINFO')
543 if qb_fsinfo:
544 qb_fsinfo = qb_fsinfo.split()
545 for fsinfo in qb_fsinfo:
546 try:
547 fstype, fsflag = fsinfo.split(':')
548
549 if fstype == 'wic':
550 if fsflag == 'no-kernel-in-fs':
551 wic_fs = True
552 elif fsflag == 'kernel-in-fs':
553 wic_fs = False
554 else:
555 logger.warn('Unknown flag "%s:%s" in QB_FSINFO', fstype, fsflag)
556 continue
557 else:
558 logger.warn('QB_FSINFO is not supported for image type "%s"', fstype)
559 continue
560
561 if fstype in self.fsinfo:
562 self.fsinfo[fstype].append(fsflag)
563 else:
564 self.fsinfo[fstype] = [fsflag]
565 except Exception:
566 logger.error('Invalid parameter "%s" in QB_FSINFO', fsinfo)
567
568 # treat wic images as vmimages (with kernel) or as fsimages (rootfs only)
569 if wic_fs:
570 self.fstypes = self.fstypes + self.wictypes
571 else:
572 self.vmtypes = self.vmtypes + self.wictypes
573
539 def check_rootfs(self): 574 def check_rootfs(self):
540 """Check and set rootfs""" 575 """Check and set rootfs"""
541 576
@@ -832,7 +867,11 @@ class BaseConfig(object):
832 if self.dtb: 867 if self.dtb:
833 print('DTB: [%s]' % self.dtb) 868 print('DTB: [%s]' % self.dtb)
834 print('MACHINE: [%s]' % self.get('MACHINE')) 869 print('MACHINE: [%s]' % self.get('MACHINE'))
835 print('FSTYPE: [%s]' % self.fstype) 870 try:
871 fstype_flags = ' (' + ', '.join(self.fsinfo[self.fstype]) + ')'
872 except KeyError:
873 fstype_flags = ''
874 print('FSTYPE: [%s%s]' % (self.fstype, fstype_flags))
836 if self.fstype == 'nfs': 875 if self.fstype == 'nfs':
837 print('NFS_DIR: [%s]' % self.rootfs) 876 print('NFS_DIR: [%s]' % self.rootfs)
838 else: 877 else: