public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "Hombourger, Cedric" <Cedric_Hombourger@mentor.com>
To: Henning Schild <henning.schild@siemens.com>
Cc: "isar-users@googlegroups.com" <isar-users@googlegroups.com>
Subject: RE: [PATCH] wic-img: handle variables in .wks files
Date: Fri, 8 Feb 2019 14:31:27 +0000	[thread overview]
Message-ID: <611b761764b545ec8e8b69c15793fab9@svr-ies-mbx-02.mgc.mentorg.com> (raw)
In-Reply-To: <20190208152832.4a1a88b2@md1za8fc.ad001.siemens.net>

Hi Henning,

Will surely take a look but we will have to decide whether we'd want our wic-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 look at the framework proposed by Claudius)

Cedric

-----Original Message-----
From: Henning Schild [mailto:henning.schild@siemens.com] 
Sent: Friday, February 8, 2019 3:29 PM
To: Hombourger, Cedric <Cedric_Hombourger@mentor.com>
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 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.

[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 <Cedric_Hombourger@mentor.com>:

> 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 <Cedric_Hombourger@mentor.com>
> ---
>  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}


  reply	other threads:[~2019-02-08 14:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  7:02 Cedric Hombourger
2019-02-08  7:42 ` Jan Kiszka
2019-02-08  7:44   ` Hombourger, Cedric
2019-02-08  7:48     ` Jan Kiszka
2019-02-08  7:53       ` Jan Kiszka
2019-02-08  7:55         ` Hombourger, Cedric
2019-02-08 11:32         ` Hombourger, Cedric
2019-02-08 13:50         ` Hombourger, Cedric
2019-02-08 19:13           ` [PATCH v2] wic-img: import support for .wks.in files from oe-core Cedric Hombourger
2019-02-15 17:43             ` Maxim Yu. Osipov
2019-02-08 14:28 ` [PATCH] wic-img: handle variables in .wks files Henning Schild
2019-02-08 14:31   ` Hombourger, Cedric [this message]
2019-02-08 14:31   ` Jan Kiszka
2019-02-08 16:27     ` Henning Schild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=611b761764b545ec8e8b69c15793fab9@svr-ies-mbx-02.mgc.mentorg.com \
    --to=cedric_hombourger@mentor.com \
    --cc=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox