mirror of
https://git.yoctoproject.org/poky
synced 2026-09-15 06:49:33 +02:00
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. (From OE-Core rev: 0a3e8eb9f592c3f1edd2c7521855f7406541651a) Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
d59d876f44
commit
a13c51e751
38
meta/classes/image-vm.bbclass
Normal file
38
meta/classes/image-vm.bbclass
Normal file
@@ -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"
|
||||||
|
|
||||||
@@ -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"
|
|
||||||
|
|
||||||
@@ -130,10 +130,10 @@ def build_live(d):
|
|||||||
return "image-live"
|
return "image-live"
|
||||||
|
|
||||||
IMAGE_TYPE_live = "${@build_live(d)}"
|
IMAGE_TYPE_live = "${@build_live(d)}"
|
||||||
|
|
||||||
inherit ${IMAGE_TYPE_live}
|
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 () {
|
python () {
|
||||||
deps = " " + imagetypes_getdepends(d)
|
deps = " " + imagetypes_getdepends(d)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ def imagetypes_getdepends(d):
|
|||||||
deps = []
|
deps = []
|
||||||
ctypes = d.getVar('COMPRESSIONTYPES', True).split()
|
ctypes = d.getVar('COMPRESSIONTYPES', True).split()
|
||||||
for type in (d.getVar('IMAGE_FSTYPES', True) or "").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"
|
type = "ext3"
|
||||||
basetype = type
|
basetype = type
|
||||||
for ctype in ctypes:
|
for ctype in ctypes:
|
||||||
@@ -155,6 +155,7 @@ IMAGE_TYPES = " \
|
|||||||
tar tar.gz tar.bz2 tar.xz tar.lz4 \
|
tar tar.gz tar.bz2 tar.xz tar.lz4 \
|
||||||
cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \
|
cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \
|
||||||
vmdk \
|
vmdk \
|
||||||
|
vdi \
|
||||||
elf \
|
elf \
|
||||||
"
|
"
|
||||||
|
|
||||||
@@ -181,5 +182,5 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
|
|||||||
IMAGE_EXTENSION_live = "hddimg iso"
|
IMAGE_EXTENSION_live = "hddimg iso"
|
||||||
|
|
||||||
# The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
|
# 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 ?= ""
|
IMAGE_TYPES_MASKED ?= ""
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class ImageDepGraph(object):
|
|||||||
return graph
|
return graph
|
||||||
|
|
||||||
def _clean_graph(self):
|
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
|
# bbclass and does not get processed here. Remove them from the fstypes
|
||||||
# graph. Their dependencies are already added, so no worries here.
|
# graph. Their dependencies are already added, so no worries here.
|
||||||
remove_list = (self.d.getVar('IMAGE_TYPES_MASKED', True) or "").split()
|
remove_list = (self.d.getVar('IMAGE_TYPES_MASKED', True) or "").split()
|
||||||
@@ -76,7 +76,7 @@ class ImageDepGraph(object):
|
|||||||
|
|
||||||
def _image_base_type(self, type):
|
def _image_base_type(self, type):
|
||||||
ctypes = self.d.getVar('COMPRESSIONTYPES', True).split()
|
ctypes = self.d.getVar('COMPRESSIONTYPES', True).split()
|
||||||
if type in ["vmdk", "live", "iso", "hddimg"]:
|
if type in ["vmdk", "vdi", "live", "iso", "hddimg"]:
|
||||||
type = "ext3"
|
type = "ext3"
|
||||||
basetype = type
|
basetype = type
|
||||||
for ctype in ctypes:
|
for ctype in ctypes:
|
||||||
|
|||||||
Reference in New Issue
Block a user