Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] image: Support for qcow2
@ 2015-07-23 14:32 Christian Ziethén
  2015-07-23 14:32 ` [PATCH 2/2] boot-directdisk: Make kernel image inclusion conditional Christian Ziethén
  2015-08-17 10:54 ` [PATCH 1/2] image: Support for qcow2 Christian Ziethén
  0 siblings, 2 replies; 4+ messages in thread
From: Christian Ziethén @ 2015-07-23 14:32 UTC (permalink / raw)
  To: openembedded-core

Add support for qcow2 image format. Implemented in the same way as
the previously existing vmdk and vdi solutions.

Signed-off-by: Christian Ziethén <christian.ziethen@linaro.org>
---
 meta/classes/boot-directdisk.bbclass |  2 +-
 meta/classes/image-vm.bbclass        | 12 ++++++++++--
 meta/classes/image.bbclass           |  2 +-
 meta/classes/image_types.bbclass     |  5 +++--
 meta/classes/sanity.bbclass          |  4 ++++
 5 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index c576523..d256fff 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -63,7 +63,7 @@ DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}"
 SYSLINUX_ROOT ?= "root=/dev/sda2"
 SYSLINUX_TIMEOUT ?= "10"
 
-IS_VM = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk" ,"vdi"], "true", "false", d)}'
+IS_VM = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi", "qcow2"], "true", "false", d)}'
 
 boot_direct_populate() {
 	dest=$1
diff --git a/meta/classes/image-vm.bbclass b/meta/classes/image-vm.bbclass
index fdfd14f..28519c8 100644
--- a/meta/classes/image-vm.bbclass
+++ b/meta/classes/image-vm.bbclass
@@ -14,7 +14,8 @@ inherit boot-directdisk
 
 IMAGE_TYPEDEP_vmdk = "ext3"
 IMAGE_TYPEDEP_vdi = "ext3"
-IMAGE_TYPES_MASKED += "vmdk vdi"
+IMAGE_TYPEDEP_qcow2 = "ext3"
+IMAGE_TYPES_MASKED += "vmdk vdi qcow2"
 
 create_vmdk_image () {
     qemu-img convert -O vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk
@@ -26,11 +27,18 @@ create_vdi_image () {
     ln -sf ${IMAGE_NAME}.vdi ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vdi
 }
 
+create_qcow2_image () {
+    qemu-img convert -O qcow2 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.qcow2
+    ln -sf ${IMAGE_NAME}.qcow2 ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.qcow2
+}
+
 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)        
+        bb.build.exec_func('create_vdi_image', d)
+    if 'qcow2' in d.getVar('IMAGE_FSTYPES', True):
+        bb.build.exec_func('create_qcow2_image', d)
 }
 
 addtask vmimg after do_bootdirectdisk before do_build
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index e2995e2..ff2ed0d 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -132,7 +132,7 @@ def build_live(d):
 IMAGE_TYPE_live = "${@build_live(d)}"
 inherit ${IMAGE_TYPE_live}
 
-IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi"], "image-vm", "", d)}'
+IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi", "qcow2"], "image-vm", "", d)}'
 inherit ${IMAGE_TYPE_vm}
 
 python () {
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 588a474..cc789fc 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", "vdi", "live", "iso", "hddimg"]:
+        if type in ["vmdk", "vdi", "qcow2", "live", "iso", "hddimg"]:
             type = "ext3"
         basetype = type
         for ctype in ctypes:
@@ -187,6 +187,7 @@ IMAGE_TYPES = " \
     cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \
     vmdk \
     vdi \
+    qcow2 \
     elf \
 "
 
@@ -213,5 +214,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, vdi, hddimg, iso, etc.
+# images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hddimg, iso, etc.
 IMAGE_TYPES_MASKED ?= ""
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 2855941..6ad620b 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -835,6 +835,10 @@ def check_sanity_everybuild(status, d):
     if 'vdi' in d.getVar('IMAGE_FSTYPES', True) and 'live' in d.getVar('IMAGE_FSTYPES', True):
         status.addresult("Error, IMAGE_FSTYPES vdi and live can't be built together\n")
 
+    # Check qcow2 and live can't be built together.
+    if 'qcow2' in d.getVar('IMAGE_FSTYPES', True) and 'live' in d.getVar('IMAGE_FSTYPES', True):
+        status.addresult("Error, IMAGE_FSTYPES qcow2 and live can't be built together\n")
+
     # Check /bin/sh links to dash or bash
     real_sh = os.path.realpath('/bin/sh')
     if not real_sh.endswith('/dash') and not real_sh.endswith('/bash'):
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] boot-directdisk: Make kernel image inclusion conditional.
  2015-07-23 14:32 [PATCH 1/2] image: Support for qcow2 Christian Ziethén
@ 2015-07-23 14:32 ` Christian Ziethén
  2015-08-17 10:55   ` Christian Ziethén
  2015-08-17 10:54 ` [PATCH 1/2] image: Support for qcow2 Christian Ziethén
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Ziethén @ 2015-07-23 14:32 UTC (permalink / raw)
  To: openembedded-core

When building for qcow2 and a dummy kernel, avoid installing
a non existing bzImage.

Signed-off-by: Christian Ziethén <christian.ziethen@linaro.org>
---
 meta/classes/boot-directdisk.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index d256fff..600e21a 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -70,7 +70,9 @@ boot_direct_populate() {
 	install -d $dest
 
 	# Install bzImage, initrd, and rootfs.img in DEST for all loaders to use.
-	install -m 0644 ${DEPLOY_DIR_IMAGE}/bzImage $dest/vmlinuz
+	if [ -e ${DEPLOY_DIR_IMAGE}/bzImage ]; then
+		install -m 0644 ${DEPLOY_DIR_IMAGE}/bzImage $dest/vmlinuz
+	fi
 
 	# initrd is made of concatenation of multiple filesystem images
 	if [ -n "${INITRD}" ]; then
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 1/2] image: Support for qcow2
  2015-07-23 14:32 [PATCH 1/2] image: Support for qcow2 Christian Ziethén
  2015-07-23 14:32 ` [PATCH 2/2] boot-directdisk: Make kernel image inclusion conditional Christian Ziethén
@ 2015-08-17 10:54 ` Christian Ziethén
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Ziethén @ 2015-08-17 10:54 UTC (permalink / raw)
  To: openembedded-core

ping

On 2015-07-23 16:32, Christian Ziethén wrote:
> Add support for qcow2 image format. Implemented in the same way as
> the previously existing vmdk and vdi solutions.
> 
> Signed-off-by: Christian Ziethén <christian.ziethen@linaro.org>
> ---
>  meta/classes/boot-directdisk.bbclass |  2 +-
>  meta/classes/image-vm.bbclass        | 12 ++++++++++--
>  meta/classes/image.bbclass           |  2 +-
>  meta/classes/image_types.bbclass     |  5 +++--
>  meta/classes/sanity.bbclass          |  4 ++++
>  5 files changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
> index c576523..d256fff 100644
> --- a/meta/classes/boot-directdisk.bbclass
> +++ b/meta/classes/boot-directdisk.bbclass
> @@ -63,7 +63,7 @@ DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}"
>  SYSLINUX_ROOT ?= "root=/dev/sda2"
>  SYSLINUX_TIMEOUT ?= "10"
>  
> -IS_VM = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk" ,"vdi"], "true", "false", d)}'
> +IS_VM = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi", "qcow2"], "true", "false", d)}'
>  
>  boot_direct_populate() {
>  	dest=$1
> diff --git a/meta/classes/image-vm.bbclass b/meta/classes/image-vm.bbclass
> index fdfd14f..28519c8 100644
> --- a/meta/classes/image-vm.bbclass
> +++ b/meta/classes/image-vm.bbclass
> @@ -14,7 +14,8 @@ inherit boot-directdisk
>  
>  IMAGE_TYPEDEP_vmdk = "ext3"
>  IMAGE_TYPEDEP_vdi = "ext3"
> -IMAGE_TYPES_MASKED += "vmdk vdi"
> +IMAGE_TYPEDEP_qcow2 = "ext3"
> +IMAGE_TYPES_MASKED += "vmdk vdi qcow2"
>  
>  create_vmdk_image () {
>      qemu-img convert -O vmdk ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk
> @@ -26,11 +27,18 @@ create_vdi_image () {
>      ln -sf ${IMAGE_NAME}.vdi ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.vdi
>  }
>  
> +create_qcow2_image () {
> +    qemu-img convert -O qcow2 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.qcow2
> +    ln -sf ${IMAGE_NAME}.qcow2 ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.qcow2
> +}
> +
>  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)        
> +        bb.build.exec_func('create_vdi_image', d)
> +    if 'qcow2' in d.getVar('IMAGE_FSTYPES', True):
> +        bb.build.exec_func('create_qcow2_image', d)
>  }
>  
>  addtask vmimg after do_bootdirectdisk before do_build
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index e2995e2..ff2ed0d 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -132,7 +132,7 @@ def build_live(d):
>  IMAGE_TYPE_live = "${@build_live(d)}"
>  inherit ${IMAGE_TYPE_live}
>  
> -IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi"], "image-vm", "", d)}'
> +IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi", "qcow2"], "image-vm", "", d)}'
>  inherit ${IMAGE_TYPE_vm}
>  
>  python () {
> diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
> index 588a474..cc789fc 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", "vdi", "live", "iso", "hddimg"]:
> +        if type in ["vmdk", "vdi", "qcow2", "live", "iso", "hddimg"]:
>              type = "ext3"
>          basetype = type
>          for ctype in ctypes:
> @@ -187,6 +187,7 @@ IMAGE_TYPES = " \
>      cpio cpio.gz cpio.xz cpio.lzma cpio.lz4 \
>      vmdk \
>      vdi \
> +    qcow2 \
>      elf \
>  "
>  
> @@ -213,5 +214,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, vdi, hddimg, iso, etc.
> +# images that will not be built at do_rootfs time: vmdk, vdi, qcow2, hddimg, iso, etc.
>  IMAGE_TYPES_MASKED ?= ""
> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index 2855941..6ad620b 100644
> --- a/meta/classes/sanity.bbclass
> +++ b/meta/classes/sanity.bbclass
> @@ -835,6 +835,10 @@ def check_sanity_everybuild(status, d):
>      if 'vdi' in d.getVar('IMAGE_FSTYPES', True) and 'live' in d.getVar('IMAGE_FSTYPES', True):
>          status.addresult("Error, IMAGE_FSTYPES vdi and live can't be built together\n")
>  
> +    # Check qcow2 and live can't be built together.
> +    if 'qcow2' in d.getVar('IMAGE_FSTYPES', True) and 'live' in d.getVar('IMAGE_FSTYPES', True):
> +        status.addresult("Error, IMAGE_FSTYPES qcow2 and live can't be built together\n")
> +
>      # Check /bin/sh links to dash or bash
>      real_sh = os.path.realpath('/bin/sh')
>      if not real_sh.endswith('/dash') and not real_sh.endswith('/bash'):
> -- 
> 2.1.4
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] boot-directdisk: Make kernel image inclusion conditional.
  2015-07-23 14:32 ` [PATCH 2/2] boot-directdisk: Make kernel image inclusion conditional Christian Ziethén
@ 2015-08-17 10:55   ` Christian Ziethén
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Ziethén @ 2015-08-17 10:55 UTC (permalink / raw)
  To: openembedded-core

ping

On 2015-07-23 16:32, Christian Ziethén wrote:
> When building for qcow2 and a dummy kernel, avoid installing
> a non existing bzImage.
> 
> Signed-off-by: Christian Ziethén <christian.ziethen@linaro.org>
> ---
>  meta/classes/boot-directdisk.bbclass | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
> index d256fff..600e21a 100644
> --- a/meta/classes/boot-directdisk.bbclass
> +++ b/meta/classes/boot-directdisk.bbclass
> @@ -70,7 +70,9 @@ boot_direct_populate() {
>  	install -d $dest
>  
>  	# Install bzImage, initrd, and rootfs.img in DEST for all loaders to use.
> -	install -m 0644 ${DEPLOY_DIR_IMAGE}/bzImage $dest/vmlinuz
> +	if [ -e ${DEPLOY_DIR_IMAGE}/bzImage ]; then
> +		install -m 0644 ${DEPLOY_DIR_IMAGE}/bzImage $dest/vmlinuz
> +	fi
>  
>  	# initrd is made of concatenation of multiple filesystem images
>  	if [ -n "${INITRD}" ]; then
> -- 
> 2.1.4
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-17 10:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-23 14:32 [PATCH 1/2] image: Support for qcow2 Christian Ziethén
2015-07-23 14:32 ` [PATCH 2/2] boot-directdisk: Make kernel image inclusion conditional Christian Ziethén
2015-08-17 10:55   ` Christian Ziethén
2015-08-17 10:54 ` [PATCH 1/2] image: Support for qcow2 Christian Ziethén

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox