From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6613620343774904320 X-Received: by 2002:a65:62cd:: with SMTP id m13-v6mr911838pgv.44.1540478830801; Thu, 25 Oct 2018 07:47:10 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:902:aa09:: with SMTP id be9-v6ls4038723plb.2.gmail; Thu, 25 Oct 2018 07:47:10 -0700 (PDT) X-Google-Smtp-Source: AJdET5d0o2TNlRLYyVDqudoN1RIS6z13vrGKQdmfNqU5hYOF9EbXiOQQm756i+YG1KDktWk9gVPM X-Received: by 2002:a17:902:48c8:: with SMTP id u8-v6mr318793plh.12.1540478830440; Thu, 25 Oct 2018 07:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540478830; cv=none; d=google.com; s=arc-20160816; b=WM2i8BCZfNjWfVgFCsib0h4QcEhNp7fCaWEMkPhXnlIbeEuG1a/xbwjmjxxsxyP7Tp IzzM0gDyOWTffgdR2b0Axa1Qb0aQ/jUid2cRHOimRE0Q32IcpsXiFtI69t056M3M6NX2 tgr4P5KXNiyDAMKnyRkf/6Lo2qFi236ecdEWMYS3vDl4WOwm/himm8wuLKUZgN9zFmUM aFcVNx6FoxA2xoQBXPQOs+/n4QFu7o8rYQFP3aL8n2KO5Gy1ifvyxTyXOw9Ehpi8ZkJJ 9bbPRJm/BjXRLJLxH13mlSUJoT1qI7iudiXi2hAz/R2BnBui/hRBmxx8uUjUQGQxbzef PTDQ== 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=sjfk5w6Zd/WmFdgt663hWN7HiNETQEHphDQm33SVBeE=; b=hSr9DYh1FfA1v0S7XVkRUbxQw6W6x7snE4XoWcfQyDXwMHrlkmbVTedlVaoV0f0rbr bymI7tje8T/k8tWTTvYlEPX6DBpdWx9KSVxRWDEswHoBmLzIMdnjvVaEo6zBocfJo+B6 J0ht9N3+1TfrtPcOVyz+kvuDWPQVQp/DBCYgfVcBCWTiTgPEPt2pdCHr6xfF9GcNFJC8 FA306rXFw56Y7XoAhKnoaeIdbKuBzlSFnXEEJAG95tzyXGu7us5QEkQM7o2+7bC+oJc2 kp/rnHvXl254XD0jvaev9hHNzigv894wwy/xHHy/M79nAIdKVloZeAzBRcX1cDzH2RIe WRew== 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 t12-v6si160602plr.4.2018.10.25.07.47.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Oct 2018 07:47:10 -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 1gFguk-00032O-2e from Cedric_Hombourger@mentor.com for isar-users@googlegroups.com; Thu, 25 Oct 2018 07:47:10 -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, 25 Oct 2018 15:47:06 +0100 From: Cedric Hombourger To: CC: Cedric Hombourger Subject: [PATCH v3] image: include image name in the kernel/initrd image copies Date: Thu, 25 Oct 2018 16:46:58 +0200 Message-ID: <1540478818-257-1-git-send-email-Cedric_Hombourger@mentor.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20181025162204.7d823466@md1pvb1c.ad001.siemens.net> References: <20181025162204.7d823466@md1pvb1c.ad001.siemens.net> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) To svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) X-TUID: fDGareon6tfI 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 --- RECIPE-API-CHANGELOG.md | 24 ++++++++++++++++++++++++ meta/classes/ext4-img.bbclass | 2 +- meta/classes/image.bbclass | 7 ++++--- meta/classes/wic-img.bbclass | 6 +++--- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md index 8d93ef4..c7b7552 100644 --- a/RECIPE-API-CHANGELOG.md +++ b/RECIPE-API-CHANGELOG.md @@ -3,6 +3,30 @@ Recipe API Changelog Baseline: Release v0.5 +Upcoming changes (v0.7) +----------------------- + +### more consistent artifact names + +multiconfig image artifacts are all placed in tmp/deploy/images. They include +kernel, initrd and ext4/wic images. A consistent naming scheme is now used: +`IMAGE-DISTRO-MACHINE.TYPE`. This scheme was already used for ext4/wic images +so no visible changes there. Kernel and initrd images are however affected; for +instance: + +``` +vmlinuz-4.9.0-8-armmp_debian-stretch-qemuarm +``` + +is now + +``` +isar-image-base-debian-stretch-qemuarm.vmlinuz-4.9.0-8-armmp +``` + +It should be noted that the `KERNEL_IMAGE` and `INITRD_IMAGE` variables were +updated hence recipes using them shouldn't be impacted per se. + Changes in v0.6 --------------- 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