All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: Quentin Schulz <quentin.schulz@cherry.de>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH v3 2/2] image-bootfiles.bbclass: new class, copy boot files to root filesystem
Date: Tue, 28 May 2024 13:40:33 +0200	[thread overview]
Message-ID: <ZlXCsQkoqxoiwpXN@gmail.com> (raw)
In-Reply-To: <2261f556-6e25-4d18-9147-2f9d361bdaeb@cherry.de>

[-- Attachment #1: Type: text/plain, Size: 2459 bytes --]

Hi Quentin,

On Tue, May 28, 2024 at 01:23:20PM +0200, Quentin Schulz wrote:
> Hi Marcus,
> 

[...]

> > +#
> > +#
> > +# Usage: add inherit += "image-bootfiles" to your image
> > +#
> 
> Simply
> 
> inherit image-bootfiles

Noted

> 
> c.f. https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html#inherit-directive
> 
> since you put this class into meta/classes/ and not meta/classes-recipes/,
> it could be included both with
> 
> INHERIT += "image-bootfiles"
> 
> and
> 
> inherit image-bootfiles
> 
> The former is to be included from configuration files (e.g. a distro,
> local.conf, machine conf file, etc.). The latter inside the image recipe
> directly.
> 
> I am wondering if we shouldn't make this a recipes-only bbclass? so moving
> it to meta/classes-recipes/? This means that we won't be able to use the
> INHERIT += "image-bootfiles" anymore but.... should we? On one side, we have
> something that only applies to images, on the other hand, it's probably
> something close to a policy, so rather part of a distro. So just wondering,
> not asking for a change :)

I don't have a strong opinion, I let this be to what people think is
the best.
If I must choose, I think it is more of a distro thing.

> 
> Cheers,
> Quentin
> 
> > +
> > +IMAGE_BOOT_FILES_DIR ?= "boot"
> > +
> > +python bootfiles_populate() {
> > +    import shutil
> > +    from oe.bootfiles import get_boot_files
> > +
> > +    deploy_image_dir = d.getVar("DEPLOY_DIR_IMAGE")
> > +    boot_dir = os.path.join(d.getVar("IMAGE_ROOTFS"), d.getVar("IMAGE_BOOT_FILES_DIR"))
> > +
> > +    boot_files = d.getVar("IMAGE_BOOT_FILES")
> > +    if boot_files is None:
> > +        return
> > +
> > +    install_files = get_boot_files(deploy_image_dir, boot_files)
> > +    if install_files is None:
> > +        bb.warn("Could not find any boot files to install even though IMAGE_BOOT_FILES is not empty")
> > +        return
> > +
> > +    os.makedirs(boot_dir, exist_ok=True)
> > +    for src, dst  in install_files:
> > +        image_src = os.path.join(deploy_image_dir, src)
> > +        image_dst = os.path.join(boot_dir, dst)
> > +        shutil.copyfile(image_src, image_dst)
> 
> This won't work if the parent directory of image_dst doesn't exist yet.

Good catch, I will do as you suggest.

[...]
> 
> Cheers,
> Quentin


Best regards,
Marcus Folkesson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2024-05-28 11:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28  9:08 [PATCH v3 0/2] image-bootfiles: new class Marcus Folkesson
2024-05-28  9:08 ` [PATCH v3 1/2] bootimg-partition: break out code to a common library Marcus Folkesson
2024-05-28 11:01   ` Quentin Schulz
2024-05-28 11:48     ` Marcus Folkesson
2024-05-28  9:08 ` [PATCH v3 2/2] image-bootfiles.bbclass: new class, copy boot files to root filesystem Marcus Folkesson
2024-05-28 11:23   ` Quentin Schulz
2024-05-28 11:40     ` Marcus Folkesson [this message]

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=ZlXCsQkoqxoiwpXN@gmail.com \
    --to=marcus.folkesson@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=quentin.schulz@cherry.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.