diff options
Diffstat (limited to 'meta/classes/image-vm.bbclass')
-rw-r--r-- | meta/classes/image-vm.bbclass | 38 |
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 | |||
2 | SYSLINUX_ROOT ?= "root=/dev/sda2" | ||
3 | SYSLINUX_PROMPT ?= "0" | ||
4 | SYSLINUX_TIMEOUT ?= "10" | ||
5 | SYSLINUX_LABELS = "boot" | ||
6 | LABELS_append = " ${SYSLINUX_LABELS} " | ||
7 | |||
8 | # need to define the dependency and the ROOTFS for directdisk | ||
9 | do_bootdirectdisk[depends] += "${PN}:do_rootfs" | ||
10 | ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.ext3" | ||
11 | |||
12 | # creating VM images relies on having a hddimg so ensure we inherit it here. | ||
13 | inherit boot-directdisk | ||
14 | |||
15 | IMAGE_TYPEDEP_vmdk = "ext3" | ||
16 | IMAGE_TYPEDEP_vdi = "ext3" | ||
17 | IMAGE_TYPES_MASKED += "vmdk vdi" | ||
18 | |||
19 | create_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 | |||
24 | create_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 | |||
29 | python 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 | |||
36 | addtask vmimg after do_bootdirectdisk before do_build | ||
37 | do_vmimg[depends] += "qemu-native:do_populate_sysroot" | ||
38 | |||