From patchwork Thu Jul 23 14:32:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_Zieth=C3=A9n?= X-Patchwork-Id: 51397 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 44BEA22A9E for ; Thu, 23 Jul 2015 14:33:04 +0000 (UTC) Received: by lbcjf8 with SMTP id jf8sf67656406lbc.0 for ; Thu, 23 Jul 2015 07:33:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:mime-version:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=HFe6ltj+WzeboHK4Z2eiPzGE8iTwlncRMBdjJgI5+W4=; b=EBQm3N0uspquzDS1VYR1ILNxSxdj75fr9+JsVvEiJJ/9ur0UocYCGquhwY4Du66GYC hboQzGdExvsKggYiRrYZHqNSSLqDDWagVkQVY5877m/tydpBlbjEoWrKT5LEM1omGZMw 21Q7cUV0i4sC4nxKfzAnbjmtYhzYTZjvtvsSv7ri9bXIfCAHEmTkSCP9pqSqAmX3jP2M Pq9miaLCm53pGmgPUlQrbSY3OUcwx/FImRjpla3njIMMeiDUedO6nNPNcZhJ8iwB1o/v nkvcBwBS/HsIR7ZTtQiSzbMNLD0a5yu/ItGpVLwCWZUqteljcKPcDai6FKmUfKGQhTUT wq2A== X-Gm-Message-State: ALoCoQnWls8mmikfFSSkB5nPkMNenLup+qWVBJLWu+rEKp3kZv7G8JNR2Bqg77dHe4YS0WMQ3NKv X-Received: by 10.152.28.100 with SMTP id a4mr3888291lah.4.1437661983236; Thu, 23 Jul 2015 07:33:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.105 with SMTP id i9ls230658laa.96.gmail; Thu, 23 Jul 2015 07:33:03 -0700 (PDT) X-Received: by 10.152.87.205 with SMTP id ba13mr8133266lab.37.1437661983091; Thu, 23 Jul 2015 07:33:03 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id nx8si4434830lbb.161.2015.07.23.07.33.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jul 2015 07:33:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by laah7 with SMTP id h7so27404584laa.0 for ; Thu, 23 Jul 2015 07:33:03 -0700 (PDT) X-Received: by 10.112.126.101 with SMTP id mx5mr8501818lbb.35.1437661982934; Thu, 23 Jul 2015 07:33:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp591643lba; Thu, 23 Jul 2015 07:33:01 -0700 (PDT) X-Received: by 10.50.13.10 with SMTP id d10mr45154072igc.20.1437661981094; Thu, 23 Jul 2015 07:33:01 -0700 (PDT) Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id y3si4964783iod.109.2015.07.23.07.33.00; Thu, 23 Jul 2015 07:33:01 -0700 (PDT) Received-SPF: pass (google.com: domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Received: from mail.openembedded.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id D9B63761D6; Thu, 23 Jul 2015 14:32:55 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mail.openembedded.org (Postfix) with ESMTP id 605AF734B8 for ; Thu, 23 Jul 2015 14:32:52 +0000 (UTC) Received: by lbbzr7 with SMTP id zr7so159059059lbb.1 for ; Thu, 23 Jul 2015 07:32:51 -0700 (PDT) X-Received: by 10.112.224.4 with SMTP id qy4mr8364399lbc.20.1437661971107; Thu, 23 Jul 2015 07:32:51 -0700 (PDT) Received: from chzi-linux.enea.se (sestofw01.enea.se. [192.36.1.252]) by smtp.googlemail.com with ESMTPSA id z1sm1060444lbj.11.2015.07.23.07.32.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Jul 2015 07:32:49 -0700 (PDT) From: =?UTF-8?q?Christian=20Zieth=C3=A9n?= To: openembedded-core@lists.openembedded.org Date: Thu, 23 Jul 2015 16:32:28 +0200 Message-Id: <1437661949-9295-1-git-send-email-christian.ziethen@linaro.org> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Subject: [OE-core] [PATCH 1/2] image: Support for qcow2 X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christian.ziethen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 --- 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'):