diff options
author | Juro Bystricky <juro.bystricky@intel.com> | 2015-06-03 11:07:23 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-11 23:55:41 +0100 |
commit | 0a3e8eb9f592c3f1edd2c7521855f7406541651a (patch) | |
tree | 741b73d075c9b63166c424793ed1b5067f782f6a /meta | |
parent | b812d0f40423bc56394cc8b6fc92eb1f477dba1b (diff) | |
download | openembedded-core-contrib-0a3e8eb9f592c3f1edd2c7521855f7406541651a.tar.gz |
image: Support for VDI
Added support for VirtualBox VDI format. The support was
implemented by merging with the already existing VMDK support
for VM player by creating a new class image-vm.bbclass.
This class replaces the previous VMDK only image-vmdk.class.
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/image-vm.bbclass | 38 | ||||
-rw-r--r-- | meta/classes/image-vmdk.bbclass | 35 | ||||
-rw-r--r-- | meta/classes/image.bbclass | 6 | ||||
-rw-r--r-- | meta/classes/image_types.bbclass | 5 | ||||
-rw-r--r-- | meta/lib/oe/image.py | 4 |
5 files changed, 46 insertions, 42 deletions
diff --git a/meta/classes/image-vm.bbclass b/meta/classes/image-vm.bbclass new file mode 100644 index 00000000000..fdfd14f7801 --- /dev/null +++ b/meta/classes/image-vm.bbclass @@ -0,0 +1,38 @@ + +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 VM images relies on having a hddimg so ensure we inherit it here. +inherit boot-directdisk + +IMAGE_TYPEDEP_vmdk = "ext3" +IMAGE_TYPEDEP_vdi = "ext3" +IMAGE_TYPES_MASKED += "vmdk vdi" + +create_vmdk_image () { + qemu-img convert -O vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk + ln -sf ${IMAGE_NAME}.vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk +} + +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_vmimg() { + if 'vmdk' in d.getVar('IMAGE_FSTYPES', True): + bb.build.exec_func('create_vmdk_image', d) + if 'vdi' in d.getVar('IMAGE_FSTYPES', True): + bb.build.exec_func('create_vdi_image', d) +} + +addtask vmimg after do_bootdirectdisk before do_build +do_vmimg[depends] += "qemu-native:do_populate_sysroot" + diff --git a/meta/classes/image-vmdk.bbclass b/meta/classes/image-vmdk.bbclass deleted file mode 100644 index 77b7facd415..00000000000 --- a/meta/classes/image-vmdk.bbclass +++ /dev/null @@ -1,35 +0,0 @@ - -#NOISO = "1" - -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 VMDK relies on having a live hddimg so ensure we -# inherit it here. -#inherit image-live -inherit boot-directdisk - -IMAGE_TYPEDEP_vmdk = "ext3" -IMAGE_TYPES_MASKED += "vmdk" - -create_vmdk_image () { - qemu-img convert -O vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk - ln -sf ${IMAGE_NAME}.vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk -} - -python do_vmdkimg() { - bb.build.exec_func('create_vmdk_image', d) -} - -#addtask vmdkimg after do_bootimg before do_build -addtask vmdkimg after do_bootdirectdisk before do_build - -do_vmdkimg[depends] += "qemu-native:do_populate_sysroot" - diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 58b4add8fae..64ae2cb92b8 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -130,10 +130,10 @@ 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_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi"], "image-vm", "", d)}' +inherit ${IMAGE_TYPE_vm} python () { deps = " " + imagetypes_getdepends(d) diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 72c7337b6b4..d86d108c472 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/lib/oe/image.py b/meta/lib/oe/image.py index 0ce303d5701..40f61515eb5 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: |