summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/boot-directdisk.bbclass2
-rw-r--r--meta/classes/image-vm.bbclass12
-rw-r--r--meta/classes/image.bbclass2
-rw-r--r--meta/classes/image_types.bbclass5
-rw-r--r--meta/classes/sanity.bbclass4
5 files changed, 19 insertions, 6 deletions
diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index e1ec1be534..600e21abcf 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -63,7 +63,7 @@ DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}"
63SYSLINUX_ROOT ?= "root=/dev/sda2" 63SYSLINUX_ROOT ?= "root=/dev/sda2"
64SYSLINUX_TIMEOUT ?= "10" 64SYSLINUX_TIMEOUT ?= "10"
65 65
66IS_VM = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk" ,"vdi"], "true", "false", d)}' 66IS_VM = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi", "qcow2"], "true", "false", d)}'
67 67
68boot_direct_populate() { 68boot_direct_populate() {
69 dest=$1 69 dest=$1
diff --git a/meta/classes/image-vm.bbclass b/meta/classes/image-vm.bbclass
index fdfd14f780..28519c8af1 100644
--- a/meta/classes/image-vm.bbclass
+++ b/meta/classes/image-vm.bbclass
@@ -14,7 +14,8 @@ inherit boot-directdisk
14 14
15IMAGE_TYPEDEP_vmdk = "ext3" 15IMAGE_TYPEDEP_vmdk = "ext3"
16IMAGE_TYPEDEP_vdi = "ext3" 16IMAGE_TYPEDEP_vdi = "ext3"
17IMAGE_TYPES_MASKED += "vmdk vdi" 17IMAGE_TYPEDEP_qcow2 = "ext3"
18IMAGE_TYPES_MASKED += "vmdk vdi qcow2"
18 19
19create_vmdk_image () { 20create_vmdk_image () {
20 qemu-img convert -O vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk 21 qemu-img convert -O vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk
@@ -26,11 +27,18 @@ create_vdi_image () {
26 ln -sf ${IMAGE_NAME}.vdi ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vdi 27 ln -sf ${IMAGE_NAME}.vdi ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vdi
27} 28}
28 29
30create_qcow2_image () {
31 qemu-img convert -O qcow2 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.qcow2
32 ln -sf ${IMAGE_NAME}.qcow2 ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.qcow2
33}
34
29python do_vmimg() { 35python do_vmimg() {
30 if 'vmdk' in d.getVar('IMAGE_FSTYPES', True): 36 if 'vmdk' in d.getVar('IMAGE_FSTYPES', True):
31 bb.build.exec_func('create_vmdk_image', d) 37 bb.build.exec_func('create_vmdk_image', d)
32 if 'vdi' in d.getVar('IMAGE_FSTYPES', True): 38 if 'vdi' in d.getVar('IMAGE_FSTYPES', True):
33 bb.build.exec_func('create_vdi_image', d) 39 bb.build.exec_func('create_vdi_image', d)
40 if 'qcow2' in d.getVar('IMAGE_FSTYPES', True):
41 bb.build.exec_func('create_qcow2_image', d)
34} 42}
35 43
36addtask vmimg after do_bootdirectdisk before do_build 44addtask vmimg after do_bootdirectdisk before do_build
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index e2995e2638..ff2ed0d09a 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -132,7 +132,7 @@ def build_live(d):
132IMAGE_TYPE_live = "${@build_live(d)}" 132IMAGE_TYPE_live = "${@build_live(d)}"
133inherit ${IMAGE_TYPE_live} 133inherit ${IMAGE_TYPE_live}
134 134
135IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi"], "image-vm", "", d)}' 135IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi", "qcow2"], "image-vm", "", d)}'
136inherit ${IMAGE_TYPE_vm} 136inherit ${IMAGE_TYPE_vm}
137 137
138python () { 138python () {
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 588a474620..cc789fc27f 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -13,7 +13,7 @@ def imagetypes_getdepends(d):
13 deps = [] 13 deps = []
14 ctypes = d.getVar('COMPRESSIONTYPES', True).split() 14 ctypes = d.getVar('COMPRESSIONTYPES', True).split()
15 for type in (d.getVar('IMAGE_FSTYPES', True) or "").split(): 15 for type in (d.getVar('IMAGE_FSTYPES', True) or "").split():
16 if type in ["vmdk", "vdi", "live", "iso", "hddimg"]: 16 if type in ["vmdk", "vdi", "qcow2", "live", "iso", "hddimg"]:
17 type = "ext3" 17 type = "ext3"
18 basetype = type 18 basetype = type
19 for ctype in ctypes: 19 for ctype in ctypes:
@@ -187,6 +187,7 @@ IMAGE_TYPES = " \
187 cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \ 187 cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \
188 vmdk \ 188 vmdk \
189 vdi \ 189 vdi \
190 qcow2 \
190 elf \ 191 elf \
191" 192"
192 193
@@ -213,5 +214,5 @@ DEPLOYABLE_IMAGE_TYPES ?= "hddimg iso"
213IMAGE_EXTENSION_live = "hddimg iso" 214IMAGE_EXTENSION_live = "hddimg iso"
214 215
215# The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES, 216# The IMAGE_TYPES_MASKED variable will be used to mask out from the IMAGE_FSTYPES,
216# images that will not be built at do_rootfs time: vmdk, vdi, hddimg, iso, etc. 217# images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hddimg, iso, etc.
217IMAGE_TYPES_MASKED ?= "" 218IMAGE_TYPES_MASKED ?= ""
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 2855941a7b..6ad620b0a4 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -835,6 +835,10 @@ def check_sanity_everybuild(status, d):
835 if 'vdi' in d.getVar('IMAGE_FSTYPES', True) and 'live' in d.getVar('IMAGE_FSTYPES', True): 835 if 'vdi' in d.getVar('IMAGE_FSTYPES', True) and 'live' in d.getVar('IMAGE_FSTYPES', True):
836 status.addresult("Error, IMAGE_FSTYPES vdi and live can't be built together\n") 836 status.addresult("Error, IMAGE_FSTYPES vdi and live can't be built together\n")
837 837
838 # Check qcow2 and live can't be built together.
839 if 'qcow2' in d.getVar('IMAGE_FSTYPES', True) and 'live' in d.getVar('IMAGE_FSTYPES', True):
840 status.addresult("Error, IMAGE_FSTYPES qcow2 and live can't be built together\n")
841
838 # Check /bin/sh links to dash or bash 842 # Check /bin/sh links to dash or bash
839 real_sh = os.path.realpath('/bin/sh') 843 real_sh = os.path.realpath('/bin/sh')
840 if not real_sh.endswith('/dash') and not real_sh.endswith('/bash'): 844 if not real_sh.endswith('/dash') and not real_sh.endswith('/bash'):