* [dunfell][PATCH 2/2] runqemu: add QB_ROOTFS_EXTRA_OPT parameter
[not found] <20200625201309.11441-1-kweihmann@outlook.com>
@ 2020-06-25 20:13 ` Konrad Weihmann
[not found] ` <161BE290B27F77BD.5977@lists.openembedded.org>
1 sibling, 0 replies; 2+ messages in thread
From: Konrad Weihmann @ 2020-06-25 20:13 UTC (permalink / raw
To: openembedded-core; +Cc: steve, Konrad Weihmann, Richard Purdie
Content of the optional parameter will be appended to the rootfs-device
in the qemu configuration, in case QB_ROOTFS_OPT is not specified.
By default this is empty.
Example use cases are:
Defining 'readonly' when using squashfs, so multiple instances of qemu
can share the same base image, something that cannot be done by just
specifying 'snapshot'.
Defining 'bootindex=0' which helps to get past the EFI shell in
ovmf-binary. This also enables the use case of running WIC images with
EFI bootloader through the testimage.bbclass.
Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 8361b47d7ff190f84e8bd81507cde01d74ca7c1c)
Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
---
meta/classes/qemuboot.bbclass | 5 +++++
scripts/runqemu | 11 ++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
index 54044c38da..99da543f9a 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -65,6 +65,10 @@
# " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
# Note, runqemu will replace "@PORT@" with the port number which is used.
#
+# QB_ROOTFS_EXTRA_OPT: extra options to be appended to the rootfs device in case there is none specified by QB_ROOTFS_OPT.
+# Can be used to automatically determine the image from the other variables
+# but define things link 'bootindex' when booting from EFI or 'readonly' when using squashfs
+# without the need to specify a dedicated qemu configuration
# Usage:
# IMAGE_CLASSES += "qemuboot"
# See "runqemu help" for more info
@@ -77,6 +81,7 @@ QB_OPT_APPEND ?= "-show-cursor"
QB_NETWORK_DEVICE ?= "-device virtio-net-pci,netdev=net0,mac=@MAC@"
QB_CMDLINE_IP_SLIRP ?= "ip=dhcp"
QB_CMDLINE_IP_TAP ?= "ip=192.168.7.@CLIENT@::192.168.7.@GATEWAY@:255.255.255.0"
+QB_ROOTFS_EXTRA_OPT ?= ""
# This should be kept align with ROOT_VM
QB_DRIVE_TYPE ?= "/dev/sd"
diff --git a/scripts/runqemu b/scripts/runqemu
index 6a77e3db9a..310d79fdc5 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1196,6 +1196,10 @@ class BaseConfig(object):
else:
self.rootfs_options = '-drive file=%s,if=virtio,format=%s' % (self.rootfs, rootfs_format)
+ qb_rootfs_extra_opt = self.get("QB_ROOTFS_EXTRA_OPT")
+ if qb_rootfs_extra_opt and not qb_rootfs_extra_opt.startswith(","):
+ qb_rootfs_extra_opt = "," + qb_rootfs_extra_opt
+
if self.fstype in ('cpio.gz', 'cpio'):
self.kernel_cmdline = 'root=/dev/ram0 rw debugshell'
self.rootfs_options = '-initrd %s' % self.rootfs
@@ -1208,14 +1212,15 @@ class BaseConfig(object):
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)
+ vm_drive = '-drive if=none,id=hd,file=%s,format=%s -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd%s' \
+ % (self.rootfs, rootfs_format, qb_rootfs_extra_opt)
elif drive_type.startswith("/dev/hd"):
logger.info('Using ide drive')
vm_drive = "-drive file=%s,format=%s" % (self.rootfs, rootfs_format)
elif drive_type.startswith("/dev/vdb"):
logger.info('Using block virtio drive');
- vm_drive = '-drive id=disk0,file=%s,if=none,format=%s -device virtio-blk-device,drive=disk0' % (self.rootfs, rootfs_format)
+ vm_drive = '-drive id=disk0,file=%s,if=none,format=%s -device virtio-blk-device,drive=disk0%s' \
+ % (self.rootfs, rootfs_format,qb_rootfs_extra_opt)
else:
# virtio might have been selected explicitly (just use it), or
# is used as fallback (then warn about that).
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [OE-core] [dunfell][PATCH 2/2] runqemu: add QB_ROOTFS_EXTRA_OPT parameter
[not found] ` <161BE290B27F77BD.5977@lists.openembedded.org>
@ 2020-06-25 20:17 ` Konrad Weihmann
0 siblings, 0 replies; 2+ messages in thread
From: Konrad Weihmann @ 2020-06-25 20:17 UTC (permalink / raw
To: openembedded-core, steve
Hi all,
I'd like this to be backported to dunfell, although it's something in
between a bugfix and a feature addition.
These both patches will unblock the usage of wic images in combination
with testimage class, which I otherwise would consider broken for this
use case.
So I really would appreciate if they could be merged to dunfell.
Thanks and regards
Konrad
On 25.06.20 22:13, Konrad Weihmann wrote:
> Content of the optional parameter will be appended to the rootfs-device
> in the qemu configuration, in case QB_ROOTFS_OPT is not specified.
> By default this is empty.
>
> Example use cases are:
>
> Defining 'readonly' when using squashfs, so multiple instances of qemu
> can share the same base image, something that cannot be done by just
> specifying 'snapshot'.
>
> Defining 'bootindex=0' which helps to get past the EFI shell in
> ovmf-binary. This also enables the use case of running WIC images with
> EFI bootloader through the testimage.bbclass.
>
> Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> (cherry picked from commit 8361b47d7ff190f84e8bd81507cde01d74ca7c1c)
> Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
> ---
> meta/classes/qemuboot.bbclass | 5 +++++
> scripts/runqemu | 11 ++++++++---
> 2 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
> index 54044c38da..99da543f9a 100644
> --- a/meta/classes/qemuboot.bbclass
> +++ b/meta/classes/qemuboot.bbclass
> @@ -65,6 +65,10 @@
> # " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
> # Note, runqemu will replace "@PORT@" with the port number which is used.
> #
> +# QB_ROOTFS_EXTRA_OPT: extra options to be appended to the rootfs device in case there is none specified by QB_ROOTFS_OPT.
> +# Can be used to automatically determine the image from the other variables
> +# but define things link 'bootindex' when booting from EFI or 'readonly' when using squashfs
> +# without the need to specify a dedicated qemu configuration
> # Usage:
> # IMAGE_CLASSES += "qemuboot"
> # See "runqemu help" for more info
> @@ -77,6 +81,7 @@ QB_OPT_APPEND ?= "-show-cursor"
> QB_NETWORK_DEVICE ?= "-device virtio-net-pci,netdev=net0,mac=@MAC@"
> QB_CMDLINE_IP_SLIRP ?= "ip=dhcp"
> QB_CMDLINE_IP_TAP ?= "ip=192.168.7.@CLIENT@::192.168.7.@GATEWAY@:255.255.255.0"
> +QB_ROOTFS_EXTRA_OPT ?= ""
>
> # This should be kept align with ROOT_VM
> QB_DRIVE_TYPE ?= "/dev/sd"
> diff --git a/scripts/runqemu b/scripts/runqemu
> index 6a77e3db9a..310d79fdc5 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -1196,6 +1196,10 @@ class BaseConfig(object):
> else:
> self.rootfs_options = '-drive file=%s,if=virtio,format=%s' % (self.rootfs, rootfs_format)
>
> + qb_rootfs_extra_opt = self.get("QB_ROOTFS_EXTRA_OPT")
> + if qb_rootfs_extra_opt and not qb_rootfs_extra_opt.startswith(","):
> + qb_rootfs_extra_opt = "," + qb_rootfs_extra_opt
> +
> if self.fstype in ('cpio.gz', 'cpio'):
> self.kernel_cmdline = 'root=/dev/ram0 rw debugshell'
> self.rootfs_options = '-initrd %s' % self.rootfs
> @@ -1208,14 +1212,15 @@ class BaseConfig(object):
> 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)
> + vm_drive = '-drive if=none,id=hd,file=%s,format=%s -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd%s' \
> + % (self.rootfs, rootfs_format, qb_rootfs_extra_opt)
> elif drive_type.startswith("/dev/hd"):
> logger.info('Using ide drive')
> vm_drive = "-drive file=%s,format=%s" % (self.rootfs, rootfs_format)
> elif drive_type.startswith("/dev/vdb"):
> logger.info('Using block virtio drive');
> - vm_drive = '-drive id=disk0,file=%s,if=none,format=%s -device virtio-blk-device,drive=disk0' % (self.rootfs, rootfs_format)
> + vm_drive = '-drive id=disk0,file=%s,if=none,format=%s -device virtio-blk-device,drive=disk0%s' \
> + % (self.rootfs, rootfs_format,qb_rootfs_extra_opt)
> else:
> # virtio might have been selected explicitly (just use it), or
> # is used as fallback (then warn about that).
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-25 20:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200625201309.11441-1-kweihmann@outlook.com>
2020-06-25 20:13 ` [dunfell][PATCH 2/2] runqemu: add QB_ROOTFS_EXTRA_OPT parameter Konrad Weihmann
[not found] ` <161BE290B27F77BD.5977@lists.openembedded.org>
2020-06-25 20:17 ` [OE-core] " Konrad Weihmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.