From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6655521619015892992 X-Received: by 2002:a17:906:46ca:: with SMTP id k10mr2719705ejs.2.1549636293682; Fri, 08 Feb 2019 06:31:33 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a50:a4aa:: with SMTP id w39ls1447848edb.8.gmail; Fri, 08 Feb 2019 06:31:33 -0800 (PST) X-Google-Smtp-Source: AHgI3IZfzdZi0qxUxaZ0YBRnyJ5watTfkn1rfFMoishGVdKAmkVI4iewwkyVMUD65FgNeKq0xtDC X-Received: by 2002:a50:b781:: with SMTP id h1mr2038346ede.3.1549636293243; Fri, 08 Feb 2019 06:31:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549636293; cv=none; d=google.com; s=arc-20160816; b=SRGgPqqqiJ4GBgJ82TRGEYX472yfLj1PcZSP4aMMlsrAgyF6tCfyUOLN30/44Q+ZIw R77VqfdnVx8devshkJTFBnLSqJG9fQ8mF3VrAYoo2Nd9VnVhjpT3ofMJz/5aCJVoGpZV swU9RKVYRIs/QYKOUmDiBDCCZAK2/z4HgH8LCD3Ds1jhAh9hjgCNV/rM/VTvjuX+NXe9 tRBumRBglVsewbKc/xFPLyIXrwg711Lw61/ZxU7JKyuq7QNClWe/gbQGCkcJ+sfKQeKR QU7LqGs+BqmXP8rJIVe6tBK5sJKd7IwxankWLcMB5KsE4VswYGloYpMdPMiwJLfArmVo kRXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=ONnCXYLtnz6cFOPENqF92Z1iqqxqc0VmHviNouvJsvo=; b=ZHKMWyX5A4ouktm8PAdwBOSHBvbgSTu4x3zyNYUYjJwDCSgIXKjfYY1OdrC6syDJe/ I9QX+ppeqH9D0u+lb4OquZjk1MxFcDaL7zNvE7HXRyGmmxBydynOvb9sRWXE4awwsDBW YEiKL+z5+DIBZU9dRlR/pTO9PNDKFVRXLRJJoi59q+AMrNKQWw9O9bgMFoBJbqyz030Y A4sllI70nR/ECUZqmbYnbxwDgDs+K1I200vmL4snkTZe5WppbxbaMJQB4H8KVa5WUXJC NPcW1YZ3vZSuwAyX4Aot5Syh3U+dUehKgQsqosooSys/l4V3E3RIMoftg1DdKEk6SrkK Ibsg== 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 l1si121530ejs.1.2019.02.08.06.31.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 06:31:33 -0800 (PST) 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-01.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gs7Bj-00057k-4x from Cedric_Hombourger@mentor.com ; Fri, 08 Feb 2019 06:31:31 -0800 Received: from svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 8 Feb 2019 14:31:27 +0000 Received: from svr-ies-mbx-02.mgc.mentorg.com ([fe80::a01f:51c9:5b6c:e0c]) by svr-ies-mbx-02.mgc.mentorg.com ([fe80::a01f:51c9:5b6c:e0c%22]) with mapi id 15.00.1320.000; Fri, 8 Feb 2019 14:31:27 +0000 From: "Hombourger, Cedric" To: Henning Schild CC: "isar-users@googlegroups.com" Subject: RE: [PATCH] wic-img: handle variables in .wks files Thread-Topic: [PATCH] wic-img: handle variables in .wks files Thread-Index: AQHUv3xT/zZZdQ0lQ0adzZT32+LN/6XV9ikAgAAAQ0A= Date: Fri, 8 Feb 2019 14:31:27 +0000 Message-ID: <611b761764b545ec8e8b69c15793fab9@svr-ies-mbx-02.mgc.mentorg.com> References: <1549609367-1025-1-git-send-email-Cedric_Hombourger@mentor.com> <20190208152832.4a1a88b2@md1za8fc.ad001.siemens.net> In-Reply-To: <20190208152832.4a1a88b2@md1za8fc.ad001.siemens.net> Accept-Language: en-US, en-IE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [137.202.0.90] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-TUID: W5S2l79QB/ob Hi Henning, Will surely take a look but we will have to decide whether we'd want our wi= c-img class to be closely aligned with oe or accept this divergence (note that I am not suggesting any options right now as I should take a loo= k at the framework proposed by Claudius) Cedric -----Original Message----- From: Henning Schild [mailto:henning.schild@siemens.com]=20 Sent: Friday, February 8, 2019 3:29 PM To: Hombourger, Cedric Cc: isar-users@googlegroups.com Subject: Re: [PATCH] wic-img: handle variables in .wks files Not sure i get all the context right ... But if you are introducing a templ= ate mechanism to generate .wks files, have a look at the patches from Claud= ius that are currently pending. He introduces a generic templating mechanism which may be useful for genera= ting .wks files as well. [PATCH v2 1/1] meta: added do_transform_template task as templating system = and switch You could give that a try and maybe still vote for or against that mechanis= m. At the moment i would say it is likely to go in, and consequently other/= future templating mechanism will we be questioned. Henning Am Fri, 8 Feb 2019 08:02:47 +0100 schrieb Cedric Hombourger : > Isar will now generate .wks from user-specified templates with=20 > variables such as $ROOTFS_TYPE or $ROOTFS_SIZE replaced with their=20 > values. Custom variables may be substituted by adding them to WKSVARS=20 > (WKSVAR +=3D FOO) >=20 > Signed-off-by: Cedric Hombourger > --- > doc/user_manual.md | 2 ++ > meta/classes/wic-img.bbclass | 31 ++++++++++++++++++++++++++++++- > 2 files changed, 32 insertions(+), 1 deletion(-) >=20 > diff --git a/doc/user_manual.md b/doc/user_manual.md index=20 > ebc31c6..ea3b4bd 100644 > --- a/doc/user_manual.md > +++ b/doc/user_manual.md > @@ -197,6 +197,8 @@ A bootable disk image is generated if you set=20 > IMAGE_TYPE to 'wic-img'. Behind th $ bitbake=20 > multiconfig:qemuamd64-stretch:isar-image-base ``` > =20 > +Note: `.wks` files may use the ROOTFS_SIZE and ROOTFS_TYPE variables > (as well as any other bitbake variables added to WKSVARS). + In order=20 > to run the EFI images with `qemu`, an EFI firmware is required and=20 > available at the following address: > https://github.com/tianocore/edk2/tree/3858b4a1ff09d3243fea8d07bd13547 > 8237cb8f7 diff --git a/meta/classes/wic-img.bbclass=20 > b/meta/classes/wic-img.bbclass index 76602d8..16bbc53 100644 > --- a/meta/classes/wic-img.bbclass > +++ b/meta/classes/wic-img.bbclass > @@ -81,6 +81,32 @@ addtask do_rootfs_wicenv after do_copy_boot_files=20 > before do_wic_image do_rootfs_wicenv[vardeps] +=3D "${WICVARS}" > do_rootfs_wicenv[prefuncs] =3D 'set_image_size' > =20 > +WKSVARS +=3D "ROOTFS_SIZE ROOTFS_TYPE" > + > +python do_rootfs_wksenv () { > + wksvars =3D d.getVar('WKSVARS', True) > + if not wksvars: > + return > + > + stdir =3D d.getVar('STAGING_DIR', True) > + outdir =3D os.path.join(stdir, d.getVar('MACHINE', True), > 'imgdata') > + bb.utils.mkdirhier(outdir) > + basename =3D d.getVar('IMAGE_BASENAME', True) > + with open(os.path.join(outdir, basename) + '-wks.sh', 'w') as > envf: > + for var in wksvars.split(): > + value =3D d.getVar(var, True) > + if value: > + envf.write('%s=3D"%s" \\\n' % (var, value.strip())) > + envf.write("envsubst '") > + for var in wksvars.split(): > + envf.write('$%s ' % var) > + envf.write("'\n") > +} > + > +addtask do_rootfs_wksenv after do_rootfs_wicenv before do_wic_image=20 > +do_rootfs_wksenv[vardeps] +=3D "${WKSVARS}" > +do_rootfs_wksenv[prefuncs] =3D 'set_image_size' > + > WIC_IMAGE_FILE =3D"${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic.img" > =20 > do_build[stamp-extra-info] =3D "${DISTRO}-${DISTRO_ARCH}" > @@ -99,8 +125,11 @@ do_wic_image() { > export BUILDDIR=3D${BUILDDIR} > export MTOOLS_SKIP_CHECK=3D1 > =20 > + /bin/sh > ${STAGING_DIR}/${MACHINE}/imgdata/${IMAGE_BASENAME}-wks.sh \ > + <${WKS_FULL_PATH} > >${BUILDCHROOT_DIR}/tmp/${IMAGE_FULLNAME}.wks + > sudo -E chroot ${BUILDCHROOT_DIR} \ > - ${ISARROOT}/scripts/wic create ${WKS_FULL_PATH} \ > + ${ISARROOT}/scripts/wic create /tmp/${IMAGE_FULLNAME}.wks \ > --vars "${STAGING_DIR}/${MACHINE}/imgdata/" \ > -o /tmp/${IMAGE_FULLNAME}.wic/ \ > -e ${IMAGE_BASENAME} ${WIC_CREATE_EXTRA_ARGS}