From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: openembedded-core@lists.openembedded.org,
Quentin Schulz <quentin.schulz@cherry.de>
Cc: Marcus Folkesson <marcus.folkesson@gmail.com>
Subject: [PATCH v2 2/2] image-bootfiles.bbclass: new class, copy boot files to root filesystem
Date: Sat, 25 May 2024 10:50:23 +0200 [thread overview]
Message-ID: <20240525085023.6042-3-marcus.folkesson@gmail.com> (raw)
In-Reply-To: <20240525085023.6042-1-marcus.folkesson@gmail.com>
image-bootfiles class copy files listed in IMAGE_BOOT_FILES
to the IMAGE_BOOTFILES_DIR directory of the root filesystem.
This is useful when there is no explicit boot partition but all boot
files should instead reside inside the root filesystem.
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
meta/classes/image-bootfiles.bbclass | 38 ++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
create mode 100644 meta/classes/image-bootfiles.bbclass
diff --git a/meta/classes/image-bootfiles.bbclass b/meta/classes/image-bootfiles.bbclass
new file mode 100644
index 0000000000..29a38ac631
--- /dev/null
+++ b/meta/classes/image-bootfiles.bbclass
@@ -0,0 +1,38 @@
+#
+# SPDX-License-Identifier: MIT
+#
+# Copyright (C) 2024 Marcus Folkesson
+# Author: Marcus Folkesson <marcus.folkesson@gmail.com>
+#
+# Writes IMAGE_BOOT_FILES to the IMAGE_BOOTFILES_DIR directory
+#
+#
+# Usage: add INHERIT += "image-bootfiles" to your image
+#
+
+IMAGE_BOOTFILES_DIR ?= "/boot"
+
+def bootfiles_populate(d):
+ import shutil
+ from oe.bootfiles import get_boot_files
+
+ boot_files = d.getVar("IMAGE_BOOT_FILES")
+ deploy_image_dir = d.getVar("DEPLOY_DIR_IMAGE")
+ boot_dir = d.getVar("IMAGE_ROOTFS") + d.getVar("IMAGE_BOOTFILES_DIR")
+
+ install_files = get_boot_files(deploy_image_dir, boot_files)
+ if install_files is None:
+ return
+
+ os.makedirs(boot_dir, exist_ok=True)
+ for entry in install_files:
+ src, dst = entry
+ image_src = os.path.join(deploy_image_dir, src)
+ image_dst = os.path.join(boot_dir, dst)
+ shutil.copyfile(image_src, image_dst)
+
+python bootfiles () {
+ bootfiles_populate(d),
+}
+
+IMAGE_PREPROCESS_COMMAND += "bootfiles;"
--
2.44.0
next prev parent reply other threads:[~2024-05-25 8:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-25 8:50 [PATCH v2 0/2] image-bootfiles: new class Marcus Folkesson
2024-05-25 8:50 ` [PATCH v2 1/2] bootimg-partition: break out code to a common library Marcus Folkesson
2024-05-27 15:20 ` Quentin Schulz
2024-05-28 8:54 ` Marcus Folkesson
2024-05-25 8:50 ` Marcus Folkesson [this message]
2024-05-27 15:29 ` [PATCH v2 2/2] image-bootfiles.bbclass: new class, copy boot files to root filesystem Quentin Schulz
2024-05-28 8:51 ` Marcus Folkesson
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=20240525085023.6042-3-marcus.folkesson@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.