From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6613620343774904320 X-Received: by 2002:a0c:9878:: with SMTP id e53mr14529772qvd.5.1539883452637; Thu, 18 Oct 2018 10:24:12 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:ac8:2b98:: with SMTP id m24-v6ls12321761qtm.9.gmail; Thu, 18 Oct 2018 10:24:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV620sm2//l4Ww9d1aZgnlACP79jCY4fhsd+6CDUiNqsrBGMzSJvQaetxZgC4CJQ2tWObn7K5 X-Received: by 2002:aed:35ef:: with SMTP id d44-v6mr1981842qte.62.1539883452406; Thu, 18 Oct 2018 10:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539883452; cv=none; d=google.com; s=arc-20160816; b=l9QW5PxYUGIZMLse8FSjIAcRYeUN6H1M9x45PFqFtM6lUWgMaH/ypDo2SjBrVj3bom BKDHqYBL0yKVNiRtGdUN2ZM16OPAuPmRbps8gPvnRkgGJj/xZxRdRXUzPAsUh3W7YI7w ULgeRE/q5TWTdkxJMl7EIhyAyWtjmtMWkwaWHxwWx1sd9Nfnymq4s1naOpIzr7HuWTCg 2DUnXAi86la8eGTi1pfIVe0GcLjm7SPLlb9Uj9eBJaVvUYuQojwvw6SMCpusn+NQeBTr 42oLlOEpb2DQGekvY20TWuYYWdXnyUafpyXrwNTkujt2QnTuDBdv0IR7wmks44FnUgb+ 1xgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=snOYbxs6N2pSenWp0w/RSLPpSF6bCVBs1gNvxtM5q8Q=; b=Htdng1SZg+TtjsPXEsI3aYesoyrWK+wnIpZCh781SFbrQ7akBnF1V6HUtbRAL2NX9/ J+JtINUcw6TwaX66wItvldqKeKf230MbF99CnYf9fI7yJW/2a8JIG7EVjW4Pazd9HZDZ AyRLqzSCkmvPZTDel42rub3IWmFKNvl36gWyM/GjCcHaBMcGzJc+WBcKGBtdty3uGp2V rDWNyg2genq3R/FFrntSQIGBl5pEEPk35TGrYmnVl9ai4KXMY2f72yPMDFe9uouJeTaA iKP1It0+F46eY1fJ7rwOwir8AZGJiR16gE9Pb2nMNoG44XI98vJCYuCnn5dkwU/3lT/j d2Zg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Return-Path: Received: from relay1.mentorg.com (relay1.mentorg.com. [192.94.38.131]) by gmr-mx.google.com with ESMTPS id k8-v6si1029821qkg.3.2018.10.18.10.24.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Oct 2018 10:24:12 -0700 (PDT) Received-SPF: pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) client-ip=192.94.38.131; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of cedric_hombourger@mentor.com designates 192.94.38.131 as permitted sender) smtp.mailfrom=Cedric_Hombourger@mentor.com Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-02.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gDC1r-0003wj-9c from Cedric_Hombourger@mentor.com for isar-users@googlegroups.com; Thu, 18 Oct 2018 10:24:11 -0700 Received: from FRG-W10-HOMBOUR.world.mentorg.com (137.202.0.90) by svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 18 Oct 2018 18:24:07 +0100 From: Cedric Hombourger To: CC: Cedric Hombourger Subject: [PATCH v2] image: include image name in the kernel/initrd image copies Date: Thu, 18 Oct 2018 19:23:56 +0200 Message-ID: <1539883436-305-1-git-send-email-Cedric_Hombourger@mentor.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <27912c86-2c53-4986-bf9c-2f9b9796bd50@siemens.com> References: <27912c86-2c53-4986-bf9c-2f9b9796bd50@siemens.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) X-TUID: FvRVz+ACDd+C The kernel and initrd images are really image-specific (especially the later as the initrd is created/updated as packages get installed into the root file-system). Make sure we retain a per-image copy of these images in the image deploy directory by inserting the name of the image (${PN}) into the full name of the artifacts (set in ${KERNEL_IMAGE} and ${INITRD_IMAGE}). In addition, an IMAGE_FULLNAME variable is introduced to combine the three components of the image name: the (base) name of the image, the name of the distribution and the name of the machine. This variable is now used in the start_vm script and the image classes (image, ext4-img and wic-img). Signed-off-by: Cedric Hombourger --- meta/classes/ext4-img.bbclass | 2 +- meta/classes/image.bbclass | 7 ++++--- meta/classes/wic-img.bbclass | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/meta/classes/ext4-img.bbclass b/meta/classes/ext4-img.bbclass index 78036a2..29e5f77 100644 --- a/meta/classes/ext4-img.bbclass +++ b/meta/classes/ext4-img.bbclass @@ -1,7 +1,7 @@ # This software is a part of ISAR. # Copyright (C) 2015-2017 ilbers GmbH -EXT4_IMAGE_FILE = "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${MACHINE}.ext4.img" +EXT4_IMAGE_FILE = "${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.ext4.img" do_ext4_image[stamp-extra-info] = "${DISTRO}-${MACHINE}" diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 05ff06f..ad19f3d 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -7,6 +7,9 @@ IMAGE_ROOTFS = "${WORKDIR}/rootfs" IMAGE_INSTALL += "${@ ("linux-image-" + d.getVar("KERNEL_NAME", True)) if d.getVar("KERNEL_NAME", True) else ""}" +# Name of the image including distro&machine names +IMAGE_FULLNAME = "${PN}-${DISTRO}-${MACHINE}" + # These variables are used by wic and start_vm KERNEL_IMAGE ?= "${@get_image_name(d, 'vmlinuz')[1]}" INITRD_IMAGE ?= "${@get_image_name(d, 'initrd.img')[1]}" @@ -21,9 +24,7 @@ def get_image_name(d, name_link): path_link = os.path.join(S, name_link) if os.path.exists(path_link): base = os.path.basename(os.path.realpath(path_link)) - full = base - full += "_" + d.getVar("DISTRO", True) - full += "-" + d.getVar("MACHINE", True) + full = d.getVar("IMAGE_FULLNAME", True) + "." + base return [base, full] if os.path.islink(path_link): return get_image_name(d, os.path.relpath(os.path.realpath(path_link), diff --git a/meta/classes/wic-img.bbclass b/meta/classes/wic-img.bbclass index d0747e2..e7527c8 100644 --- a/meta/classes/wic-img.bbclass +++ b/meta/classes/wic-img.bbclass @@ -63,7 +63,7 @@ addtask do_rootfs_wicenv after do_copy_boot_files before do_wic_image do_rootfs_wicenv[vardeps] += "${WICVARS}" do_rootfs_wicenv[prefuncs] = 'set_image_size' -WIC_IMAGE_FILE ="${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${MACHINE}.wic.img" +WIC_IMAGE_FILE ="${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic.img" do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" @@ -81,10 +81,10 @@ do_wic_image() { sudo -E chroot ${BUILDCHROOT_DIR} \ ${ISARROOT}/scripts/wic create ${WKS_FULL_PATH} \ --vars "${STAGING_DIR}/${MACHINE}/imgdata/" \ - -o /tmp/${PN}-${DISTRO}-${MACHINE}.wic/ \ + -o /tmp/${IMAGE_FULLNAME}.wic/ \ -e ${IMAGE_BASENAME} ${WIC_CREATE_EXTRA_ARGS} sudo chown -R $(stat -c "%U" ${ISARROOT}) ${ISARROOT}/meta ${ISARROOT}/meta-isar ${ISARROOT}/scripts || true - cp -f $(ls -t -1 ${BUILDCHROOT_DIR}/tmp/${PN}-${DISTRO}-${MACHINE}.wic/*.direct | head -1) ${WIC_IMAGE_FILE} + cp -f $(ls -t -1 ${BUILDCHROOT_DIR}/tmp/${IMAGE_FULLNAME}.wic/*.direct | head -1) ${WIC_IMAGE_FILE} } do_wic_image[file-checksums] += "${WKS_FULL_PATH}:True" -- 2.11.0