All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Add support for VirtualBox VDI images
       [not found] <1431124779-28516-1-git-send-email-juro.bystricky@intel.com>
@ 2015-05-11 10:55 ` Burton, Ross
  2015-05-11 23:28   ` Bystricky, Juro
  2015-05-11 14:40 ` Saul Wold
  1 sibling, 1 reply; 3+ messages in thread
From: Burton, Ross @ 2015-05-11 10:55 UTC (permalink / raw)
  To: Juro Bystricky; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

Thanks Juro,

On 8 May 2015 at 23:39, Juro Bystricky <juro.bystricky@intel.com> wrote:

> Yocto does not support VirtualBox sparse image VDI file format.
> This could be achieved by the attached patch. The support mimics
> the VMDK support for VMware. The only subtle difference is that
> qemu-native has be be built with uuid enabled, as VDI images
> need a valid UUID in order to be recognized by VirtualBox.
>
> [YOCTO #7374]
>

This needs to be split up into logical patches.  For example one to enable
UUID into Qemu, one to add the new image type, another to update the checks.

Ross

[-- Attachment #2: Type: text/html, Size: 1054 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add support for VirtualBox VDI images
       [not found] <1431124779-28516-1-git-send-email-juro.bystricky@intel.com>
  2015-05-11 10:55 ` [PATCH] Add support for VirtualBox VDI images Burton, Ross
@ 2015-05-11 14:40 ` Saul Wold
  1 sibling, 0 replies; 3+ messages in thread
From: Saul Wold @ 2015-05-11 14:40 UTC (permalink / raw)
  To: Juro Bystricky, openembedded-core

On 05/08/2015 03:39 PM, Juro Bystricky wrote:
> Yocto does not support VirtualBox sparse image VDI file format.
> This could be achieved by the attached patch. The support mimics
> the VMDK support for VMware. The only subtle difference is that
> qemu-native has be be built with uuid enabled, as VDI images
> need a valid UUID in order to be recognized by VirtualBox.
>
> [YOCTO #7374]
>
> Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
> ---
>   meta/classes/boot-directdisk.bbclass |  3 ++-
>   meta/classes/image-vdi.bbclass       | 30 ++++++++++++++++++++++++++++++
>   meta/classes/image.bbclass           |  5 ++++-
>   meta/classes/image_types.bbclass     |  5 +++--
>   meta/classes/sanity.bbclass          |  4 ++++
>   meta/conf/documentation.conf         |  1 +
>   meta/lib/oe/image.py                 |  4 ++--
>   meta/recipes-devtools/qemu/qemu.inc  |  2 +-
>   8 files changed, 47 insertions(+), 7 deletions(-)
>   create mode 100644 meta/classes/image-vdi.bbclass
>
> diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
> index 44f738b..d2727c4 100644
> --- a/meta/classes/boot-directdisk.bbclass
> +++ b/meta/classes/boot-directdisk.bbclass
> @@ -64,6 +64,7 @@ SYSLINUX_ROOT ?= "root=/dev/sda2"
>   SYSLINUX_TIMEOUT ?= "10"
>
>   IS_VMDK = '${@bb.utils.contains("IMAGE_FSTYPES", "vmdk", "true", "false", d)}'
> +IS_VDI  = '${@bb.utils.contains("IMAGE_FSTYPES", "vdi",  "true", "false", d)}'
>
>   boot_direct_populate() {
>   	dest=$1
> @@ -101,7 +102,7 @@ build_boot_dd() {
>   		efi_hddimg_populate $HDDDIR
>   	fi
>
> -	if [ "${IS_VMDK}" = "true" ]; then
> +	if [ "${IS_VMDK}" = "true" ] || [ "${IS_VDI}" = "true" ]; then
>   		if [ "x${AUTO_SYSLINUXMENU}" = "x1" ] ; then
>   			install -m 0644 ${STAGING_DIR}/${MACHINE}/usr/share/syslinux/vesamenu.c32 $HDDDIR/${SYSLINUXDIR}/
>   			if [ "x${SYSLINUX_SPLASH}" != "x" ] ; then
> diff --git a/meta/classes/image-vdi.bbclass b/meta/classes/image-vdi.bbclass
> new file mode 100644
> index 0000000..5a145a9
> --- /dev/null
> +++ b/meta/classes/image-vdi.bbclass
> @@ -0,0 +1,30 @@
> +
> +SYSLINUX_ROOT ?= "root=/dev/sda2"
> +SYSLINUX_PROMPT ?= "0"
> +SYSLINUX_TIMEOUT ?= "10"
> +SYSLINUX_LABELS = "boot"
> +LABELS_append = " ${SYSLINUX_LABELS} "
> +
> +# need to define the dependency and the ROOTFS for directdisk
> +do_bootdirectdisk[depends] += "${PN}:do_rootfs"
> +ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.ext3"
> +
> +# creating VDI relies on having a hddimg so ensure we inherit it here.
> +inherit boot-directdisk
> +
> +IMAGE_TYPEDEP_vdi = "ext3"
> +IMAGE_TYPES_MASKED += "vdi"
> +
> +create_vdi_image () {
> +	qemu-img convert -O vdi ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vdi
> +	ln -sf ${IMAGE_NAME}.vdi ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vdi
> +}
> +
> +python do_vdiimg() {
> +        bb.build.exec_func('create_vdi_image', d)
> +}
> +
> +addtask vdiimg after do_bootdirectdisk before do_build
> +
> +do_vdiimg[depends] += "qemu-native:do_populate_sysroot"
> +

Is there any way that we can create a shared class for vmdk and vdi 
since the difference between the two classes is vmdk -> vdi?  Can this 
be a variable and/or parameter-ized some how?

I know it's a small class, but the code duplication could cause other 
problems down the line.

Sau!


> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index dc9bd80..578747f 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -127,11 +127,14 @@ def build_live(d):
>       return "image-live"
>
>   IMAGE_TYPE_live = "${@build_live(d)}"
> -
>   inherit ${IMAGE_TYPE_live}
> +
>   IMAGE_TYPE_vmdk = '${@bb.utils.contains("IMAGE_FSTYPES", "vmdk", "image-vmdk", "", d)}'
>   inherit ${IMAGE_TYPE_vmdk}
>
> +IMAGE_TYPE_vdi = '${@bb.utils.contains("IMAGE_FSTYPES", "vdi", "image-vdi", "", d)}'
> +inherit ${IMAGE_TYPE_vdi}
> +
>   python () {
>       deps = " " + imagetypes_getdepends(d)
>       d.appendVarFlag('do_rootfs', 'depends', deps)
> diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
> index 72c7337..d86d108 100644
> --- a/meta/classes/image_types.bbclass
> +++ b/meta/classes/image_types.bbclass
> @@ -13,7 +13,7 @@ def imagetypes_getdepends(d):
>       deps = []
>       ctypes = d.getVar('COMPRESSIONTYPES', True).split()
>       for type in (d.getVar('IMAGE_FSTYPES', True) or "").split():
> -        if type in ["vmdk", "live", "iso", "hddimg"]:
> +        if type in ["vmdk", "vdi", "live", "iso", "hddimg"]:
>               type = "ext3"
>           basetype = type
>           for ctype in ctypes:
> @@ -155,6 +155,7 @@ IMAGE_TYPES = " \
>       tar tar.gz tar.bz2 tar.xz tar.lz4 \
>       cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \
>       vmdk \
> +    vdi \
>       elf \
>   "
>
> @@ -181,5 +182,5 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
>   IMAGE_EXTENSION_live = "hddimg iso"
>
>   # The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
> -# images that will not be built at do_rootfs time: vmdk, hddimg, iso, etc.
> +# images that will not be built at do_rootfs time: vmdk, vdi, hddimg, iso, etc.
>   IMAGE_TYPES_MASKED ?= ""
> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index cca39c9..3d4bae5 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -822,6 +822,10 @@ def check_sanity_everybuild(status, d):
>       # Check vmdk and live can't be built together.
>       if 'vmdk' in d.getVar('IMAGE_FSTYPES', True) and 'live' in d.getVar('IMAGE_FSTYPES', True):
>           status.addresult("Error, IMAGE_FSTYPES vmdk and live can't be built together\n")
> +
> +    # Check vdi and live can't be built together.
> +    if 'vdi' in d.getVar('IMAGE_FSTYPES', True) and 'live' in d.getVar('IMAGE_FSTYPES', True):
> +        status.addresult("Error, IMAGE_FSTYPES vdi and live can't be built together\n")
>
>   def check_sanity(sanity_data):
>       import subprocess
> diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
> index 3a918e8..1305c32 100644
> --- a/meta/conf/documentation.conf
> +++ b/meta/conf/documentation.conf
> @@ -58,6 +58,7 @@ do_uboot_mkimage[doc] = "Creates a uImage file from the kernel for the U-Boot bo
>   do_unpack[doc] = "Unpacks the source code into a working directory"
>   do_validate_branches[doc] = "Ensures that the source/meta branches are on the locations specified by their SRCREV values for a linux-yocto style kernel"
>   do_vmdkimg[doc] = "Creates a .vmdk image for use with VMware and compatible virtual machine hosts"
> +do_vdiimg[doc] = "Creates a .vdi image for use with VirtualBox and compatible virtual machine hosts"
>
>   # DESCRIPTIONS FOR VARIABLES #
>
> diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py
> index 0ce303d..40f6151 100644
> --- a/meta/lib/oe/image.py
> +++ b/meta/lib/oe/image.py
> @@ -66,7 +66,7 @@ class ImageDepGraph(object):
>           return graph
>
>       def _clean_graph(self):
> -        # Live and VMDK images will be processed via inheriting
> +        # Live and VMDK/VDI images will be processed via inheriting
>           # bbclass and does not get processed here. Remove them from the fstypes
>           # graph. Their dependencies are already added, so no worries here.
>           remove_list = (self.d.getVar('IMAGE_TYPES_MASKED', True) or "").split()
> @@ -76,7 +76,7 @@ class ImageDepGraph(object):
>
>       def _image_base_type(self, type):
>           ctypes = self.d.getVar('COMPRESSIONTYPES', True).split()
> -        if type in ["vmdk", "live", "iso", "hddimg"]:
> +        if type in ["vmdk", "vdi", "live", "iso", "hddimg"]:
>               type = "ext3"
>           basetype = type
>           for ctype in ctypes:
> diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
> index 4225db7..cbe9425 100644
> --- a/meta/recipes-devtools/qemu/qemu.inc
> +++ b/meta/recipes-devtools/qemu/qemu.inc
> @@ -90,7 +90,7 @@ PACKAGECONFIG ??= " \
>   	fdt sdl alsa \
>   	${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'xen', '', d)} \
>   	"
> -PACKAGECONFIG_class-native ??= "fdt alsa"
> +PACKAGECONFIG_class-native ??= "fdt alsa uuid"
>   PACKAGECONFIG_class-nativesdk ??= "fdt sdl"
>   NATIVEDEPS = ""
>   NATIVEDEPS_class-native = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'libxext-native', '',d)}"
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add support for VirtualBox VDI images
  2015-05-11 10:55 ` [PATCH] Add support for VirtualBox VDI images Burton, Ross
@ 2015-05-11 23:28   ` Bystricky, Juro
  0 siblings, 0 replies; 3+ messages in thread
From: Bystricky, Juro @ 2015-05-11 23:28 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]

OK, no problem.
Saul also suggested merging image-vmdk and image-vdi classes into one class,
something like image-vm.bbclass. It is a bit more invasive (will modify the existing vmdk
bbclass) , but it should be a cleaner implementation overall.

Juro

From: Burton, Ross [mailto:ross.burton@intel.com]
Sent: Monday, May 11, 2015 3:55 AM
To: Bystricky, Juro
Cc: OE-core; Saul Wold
Subject: Re: [PATCH] Add support for VirtualBox VDI images

Thanks Juro,

On 8 May 2015 at 23:39, Juro Bystricky <juro.bystricky@intel.com<mailto:juro.bystricky@intel.com>> wrote:
Yocto does not support VirtualBox sparse image VDI file format.
This could be achieved by the attached patch. The support mimics
the VMDK support for VMware. The only subtle difference is that
qemu-native has be be built with uuid enabled, as VDI images
need a valid UUID in order to be recognized by VirtualBox.

[YOCTO #7374]

This needs to be split up into logical patches.  For example one to enable UUID into Qemu, one to add the new image type, another to update the checks.

Ross

[-- Attachment #2: Type: text/html, Size: 4740 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-11 23:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1431124779-28516-1-git-send-email-juro.bystricky@intel.com>
2015-05-11 10:55 ` [PATCH] Add support for VirtualBox VDI images Burton, Ross
2015-05-11 23:28   ` Bystricky, Juro
2015-05-11 14:40 ` Saul Wold

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.