From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6655521619015892992 X-Received: by 2002:a2e:4253:: with SMTP id p80-v6mr1346343lja.13.1549612120252; Thu, 07 Feb 2019 23:48:40 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:42c5:: with SMTP id h66-v6ls606086ljf.7.gmail; Thu, 07 Feb 2019 23:48:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IZT67EWZnu0Rr7QS2AXR1nVahAyqIDAlZ0eyomFIWlcZHqYKasxv1v3Ck3YQZ7xiagqQ0aU X-Received: by 2002:a2e:8112:: with SMTP id d18-v6mr1367413ljg.10.1549612119548; Thu, 07 Feb 2019 23:48:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549612119; cv=none; d=google.com; s=arc-20160816; b=d47cPkyeVcWia7wDumxB7LHR+PJCjLiPmqmhfCDXPqfnLy8Tm+u3OpIiitxMxFsdlO xNLydPMZe/F7cJ+gifTPTBIkqTedWYVPgl4NQ8YzCFrYsgWs5/gFjxwI1yM2CIgGWMJ4 0jV2wCarC7KlmIicCQdjGmCl39M7db/P5v9C/EP7yeog3WJanomzJJLgS5MqnEuUxLSo imFZY0aevqxaeVSn4A4qyJv2Lp7jQ45Q9+mf3IYbuROx7maewFUXX99zO7mn4cAHDhDu F5rUd8LegouyBKdcIbjzL6tkHeA94gmxKgH+7VM8JRFnu8BB5eyBDwyvWSFDjmQ/kQzZ KPVg== 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:to:subject; bh=LEHM8+Gj8xIo9uTN6gckNBDB4T5XxJTD4fVjtZoj4/4=; b=Rbqmws7Miu3x+VBRvPr+uA8hTxx9w1SmwECpQ5UsJcNZAPi6V4RPJhBJ5VoE+bWaop N3jSoz/qL5p+hE+cDT67UlGt25EokqgY4CGkgy1zu4jJd3Ao168/tO9WYH23wxoQHPVq 186DhLhxK16NNA2mT+dSy72oXEiPdLXd6UANd6HO2un9hKJlmx0SO3F7B90ryAgwm4kp PGz1femnzURQ0P90KYtl3WIlN72+BGBPn7rthf1AWXSuBDHQppFRngkVYvVWGow7+6T4 ZV7YkJtgQ601c7B1ZYmaw8ormuf949235i5XwhWH97bsvmDwxPawIBDQmujY5++L5XG/ yyVQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id q10-v6si71456lji.4.2019.02.07.23.48.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Feb 2019 23:48:39 -0800 (PST) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) client-ip=194.138.37.39; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id x187mcpQ019395 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Feb 2019 08:48:38 +0100 Received: from [167.87.49.100] ([167.87.49.100]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x187mb0A029531; Fri, 8 Feb 2019 08:48:38 +0100 Subject: Re: [PATCH] wic-img: handle variables in .wks files To: "Hombourger, Cedric" , "isar-users@googlegroups.com" References: <1549609367-1025-1-git-send-email-Cedric_Hombourger@mentor.com> <91d84a74-fdff-9833-1fd6-031ffebe88c2@siemens.com> <3da1e3e2de3b46679fcf8891541a5aed@svr-ies-mbx-02.mgc.mentorg.com> From: Jan Kiszka Message-ID: <6d544cd2-ec73-30d1-42a9-55a110146d62@siemens.com> Date: Fri, 8 Feb 2019 08:48:38 +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: <3da1e3e2de3b46679fcf8891541a5aed@svr-ies-mbx-02.mgc.mentorg.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: RnN731NmuGCQ On 08.02.19 08:44, Hombourger, Cedric wrote: > I will double check but WICVARS are for variables you wish to export to wic plugins > This interface is for variables we would to make available inside .wks files There is no WKSVARS in OE, while you can use variables, see e.g. scripts/lib/wic/canned-wks/directdisk.wks. Jan > > I realize I did not include any examples in reference .wks files we ship with Isar > I will add some > > Cedric > > -----Original Message----- > From: Jan Kiszka [mailto:jan.kiszka@siemens.com] > Sent: Friday, February 8, 2019 8:42 AM > To: Hombourger, Cedric ; isar-users@googlegroups.com > Subject: Re: [PATCH] wic-img: handle variables in .wks files > > On 08.02.19 08:02, Cedric Hombourger wrote: >> 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) > > Isn't that what WICVARS are for? That's at least what OE is doing. I don't see the reason to invent our own interface here. > > Jan > >> >> 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/3858b4a1ff09d3243fea8d07bd13547 >> 8237cb8f7 >> >> 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 > -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux