summaryrefslogtreecommitdiffstats
path: root/meta/classes/image-vm.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/image-vm.bbclass')
-rw-r--r--meta/classes/image-vm.bbclass38
1 files changed, 38 insertions, 0 deletions
diff --git a/meta/classes/image-vm.bbclass b/meta/classes/image-vm.bbclass
new file mode 100644
index 0000000000..fdfd14f780
--- /dev/null
+++ b/meta/classes/image-vm.bbclass
@@ -0,0 +1,38 @@
1
2SYSLINUX_ROOT ?= "root=/dev/sda2"
3SYSLINUX_PROMPT ?= "0"
4SYSLINUX_TIMEOUT ?= "10"
5SYSLINUX_LABELS = "boot"
6LABELS_append = " ${SYSLINUX_LABELS} "
7
8# need to define the dependency and the ROOTFS for directdisk
9do_bootdirectdisk[depends] += "${PN}:do_rootfs"
10ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.ext3"
11
12# creating VM images relies on having a hddimg so ensure we inherit it here.
13inherit boot-directdisk
14
15IMAGE_TYPEDEP_vmdk = "ext3"
16IMAGE_TYPEDEP_vdi = "ext3"
17IMAGE_TYPES_MASKED += "vmdk vdi"
18
19create_vmdk_image () {
20 qemu-img convert -O vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk
21 ln -sf ${IMAGE_NAME}.vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vmdk
22}
23
24create_vdi_image () {
25 qemu-img convert -O vdi ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vdi
26 ln -sf ${IMAGE_NAME}.vdi ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vdi
27}
28
29python do_vmimg() {
30 if 'vmdk' in d.getVar('IMAGE_FSTYPES', True):
31 bb.build.exec_func('create_vmdk_image', d)
32 if 'vdi' in d.getVar('IMAGE_FSTYPES', True):
33 bb.build.exec_func('create_vdi_image', d)
34}
35
36addtask vmimg after do_bootdirectdisk before do_build
37do_vmimg[depends] += "qemu-native:do_populate_sysroot"
38