[OE-core] [meta-oe][PATCH 3/3] runqemu: support non-bootable wic images

Adrian Freihofer adrian.freihofer at gmail.com
Sun Apr 14 13:24:14 UTC 2019


wic images are treated as vmtype images including a bootloader. The new
image type wic-nb (non-bootable) is handled as fstype image.
In comparison to existing fstype images such as ext4 wic-nb images
support more than one partition.
This is particularly useful in combination with -machine virt where the
bootloader as well as the devicetree is provided by Qemu.

Example:
QB_DEFAULT_FSTYPE = "wic-nb"
QB_KERNEL_ROOT = "/dev/vda1"
QB_SYSTEM_NAME = "qemu-system-aarch64"
QB_MACHINE = "-machine virt"
QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0"
QB_SERIAL_OPT = ""
...

Signed-off-by: Adrian Freihofer <adrian.freihofer at gmail.com>
---
 scripts/runqemu | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index a4fc606e50..2cf68c834c 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -196,7 +196,8 @@ class BaseConfig(object):
         self.bitbake_e = ''
         self.snapshot = False
         self.fstypes = ('ext2', 'ext3', 'ext4', 'jffs2', 'nfs', 'btrfs',
-                        'cpio.gz', 'cpio', 'ramfs', 'tar.bz2', 'tar.gz')
+                        'cpio.gz', 'cpio', 'ramfs', 'tar.bz2', 'tar.gz',
+                        'wic-nb')
         self.vmtypes = ('hddimg', 'hdddirect', 'wic', 'wic.vmdk',
                         'wic.qcow2', 'wic.vdi', 'iso')
         self.network_device = "-device e1000,netdev=net0,mac=@MAC@"
@@ -560,14 +561,19 @@ class BaseConfig(object):
         if self.fstype == 'nfs':
             return
 
+        # Handle wic non-bootable images
+        rootfs_suffix = self.fstype
+        if rootfs_suffix == 'wic-nb':
+            rootfs_suffix = 'wic'
+
         if self.rootfs and not os.path.exists(self.rootfs):
             # Lazy rootfs
             self.rootfs = "%s/%s-%s.%s" % (self.get('DEPLOY_DIR_IMAGE'),
                     self.rootfs, self.get('MACHINE'),
-                    self.fstype)
+                    rootfs_suffix)
         elif not self.rootfs:
-            cmd_name = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_NAME'), self.fstype)
-            cmd_link = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_LINK_NAME'), self.fstype)
+            cmd_name = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_NAME'), rootfs_suffix)
+            cmd_link = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_LINK_NAME'), rootfs_suffix)
             cmds = (cmd_name, cmd_link)
             self.rootfs = get_first_file(cmds)
             if not self.rootfs:
-- 
2.20.1



More information about the Openembedded-core mailing list