From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6655521619015892992 X-Received: by 2002:a1c:96d2:: with SMTP id y201mr1089393wmd.3.1549636311117; Fri, 08 Feb 2019 06:31:51 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:8b85:: with SMTP id o5ls1204879wra.4.gmail; Fri, 08 Feb 2019 06:31:50 -0800 (PST) X-Google-Smtp-Source: AHgI3IYtvzaARaA67YZlgpUCBCsh5QoI/jDPJW6u9sJ+uohLS8G5wA4I6KfTSV9WUjxsE9+6mbMP X-Received: by 2002:adf:9b12:: with SMTP id b18mr613588wrc.15.1549636310552; Fri, 08 Feb 2019 06:31:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549636310; cv=none; d=google.com; s=arc-20160816; b=I3HX0dylJ5vqWIs8kcaF7WC0S+gkC6ZqpPSeGEVsjRr7+4ZnbNahHXgoL/vwyez7LB 9AcySnZ6rctcjAiRkfj/QGodoz0HDQONvlVPK2GGoCPJMCc7+PX4FvvfMEEIZYZY/mDS JccFKljF4qGEHL9/nD/LDDDJ7pc7t11FAH03zZ8PRojQIfeKbJ/FWEfq8pGaXU/s55kn 8AxI33CCM0pctKvCBIC2AKkLb9hRBlj5TwxblTIHPGCXP9iabMkCNVoGxk/tPdCdhccj SnrpoHcbA5oXTgE31iMgNWup73MSVBGQNL3blzV2nyEeMwfR6ZHIkFyLDKaTWedeSCHQ 3IOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject; bh=ZON537i/XyRrJPAHRlJODXYKg1/ghRgvpS1GRT6/i4I=; b=0kxHEUNAYYI536llm+mjmq3HKXG6aKcdWohgWQVcl6iA9YhVBM/yAhRG5+ucpQSH8Q 27rJ88V01squZ6TjYfoBQ7insteq3rGg+LaJ+8BpVTv0Sn0UHaY2DeO6SUfbSfttRwng srHvbCssdHqYmieCZrwLRPZsW4HdgdCY0kWsIS/v+MCbF4cYM4mHjXIipK1e1NyU8yb0 UXtiJKr32Ko1cnk9h6mXd53olQaEkq3z5RdyLzP8kkYDh7RtyP0U5HxEKL9kjcSk8H6Z t0Z1M14cMWaxtkm8j4PFOiYZUs3TeY61bgHCWGPrxGexSmoE8iunI8frZlJeOqV7jngQ V2Hg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id 64si118736wma.1.2019.02.08.06.31.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Feb 2019 06:31:50 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id x18EVoTY023579 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Feb 2019 15:31:50 +0100 Received: from [139.25.68.37] (md1q0hnc.ad001.siemens.net [139.25.68.37] (may be forged)) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x18EVnad022446; Fri, 8 Feb 2019 15:31:49 +0100 Subject: Re: [PATCH] wic-img: handle variables in .wks files To: "[ext] Henning Schild" , Cedric Hombourger Cc: isar-users@googlegroups.com References: <1549609367-1025-1-git-send-email-Cedric_Hombourger@mentor.com> <20190208152832.4a1a88b2@md1za8fc.ad001.siemens.net> From: Jan Kiszka Message-ID: <723aeb7d-85be-0907-fa22-f41fd02e7daa@siemens.com> Date: Fri, 8 Feb 2019 15:31:48 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <20190208152832.4a1a88b2@md1za8fc.ad001.siemens.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: Ois8RuR1yMuH On 08.02.19 15:28, [ext] Henning Schild wrote: > Not sure i get all the context right ... But if you are introducing a > template mechanism to generate .wks files, have a look at the patches > from Claudius that are currently pending. > He introduces a generic templating mechanism which may be useful for > generating .wks files as well. That is a different mechanism, not intended for patching recipe files (which wks files are). We align with OE here as far as I can see. Jan > > [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 > mechanism. 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 >> variables such as $ROOTFS_TYPE or $ROOTFS_SIZE replaced with their >> values. Custom variables may be substituted by adding them to WKSVARS >> (WKSVAR += FOO) >> >> Signed-off-by: Cedric Hombourger >> --- >> doc/user_manual.md | 2 ++ >> meta/classes/wic-img.bbclass | 31 ++++++++++++++++++++++++++++++- >> 2 files changed, 32 insertions(+), 1 deletion(-) >> >> diff --git a/doc/user_manual.md b/doc/user_manual.md >> index 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 >> IMAGE_TYPE to 'wic-img'. Behind th $ bitbake >> multiconfig:qemuamd64-stretch:isar-image-base ``` >> >> +Note: `.wks` files may use the ROOTFS_SIZE and ROOTFS_TYPE variables >> (as well as any other bitbake variables added to WKSVARS). + >> In order to run the EFI images with `qemu`, an EFI firmware is >> required and available at the following address: >> https://github.com/tianocore/edk2/tree/3858b4a1ff09d3243fea8d07bd135478237cb8f7 >> diff --git a/meta/classes/wic-img.bbclass >> 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 >> before do_wic_image do_rootfs_wicenv[vardeps] += "${WICVARS}" >> do_rootfs_wicenv[prefuncs] = 'set_image_size' >> >> +WKSVARS += "ROOTFS_SIZE ROOTFS_TYPE" >> + >> +python do_rootfs_wksenv () { >> + wksvars = d.getVar('WKSVARS', True) >> + if not wksvars: >> + return >> + >> + stdir = d.getVar('STAGING_DIR', True) >> + outdir = os.path.join(stdir, d.getVar('MACHINE', True), >> 'imgdata') >> + bb.utils.mkdirhier(outdir) >> + basename = d.getVar('IMAGE_BASENAME', True) >> + with open(os.path.join(outdir, basename) + '-wks.sh', 'w') as >> envf: >> + for var in wksvars.split(): >> + value = d.getVar(var, True) >> + if value: >> + envf.write('%s="%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 >> +do_rootfs_wksenv[vardeps] += "${WKSVARS}" >> +do_rootfs_wksenv[prefuncs] = 'set_image_size' >> + >> WIC_IMAGE_FILE ="${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.wic.img" >> >> do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" >> @@ -99,8 +125,11 @@ do_wic_image() { >> export BUILDDIR=${BUILDDIR} >> export MTOOLS_SKIP_CHECK=1 >> >> + /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} > -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux