From: Claudius Heine <ch@denx.de>
To: openembedded-core@lists.openembedded.org
Cc: Claudius Heine <ch@denx.de>
Subject: [RFC PATCH 1/1] kernel: add kernel-image-fitimage-initramfs
Date: Wed, 30 Mar 2022 11:15:22 +0200 [thread overview]
Message-ID: <20220330091522.795083-2-ch@denx.de> (raw)
In-Reply-To: <20220330091522.795083-1-ch@denx.de>
When creating an initramfs bundled into a kernel fitimage, the resulting
fitimage will only be placed into the deploy directory and not packaged
by the kernel recipe/class.
Changing the kernel recipe/class to produce a package with the fitimage
containing the initramfs is not possible, because build dependencies
require the kernel packages to be already build before the initramfs can
be created.
The kernel-image-fitimage-initramfs recipe solves this dependency cycle
by packaging the fitimage with the embedded initramfs from the deploy
directory and replaces the `kernel-image` and `kernel-image-fitimage`
packages from the kernel recipe/class.
Signed-off-by: Claudius Heine <ch@denx.de>
---
.../kernel-image-fitimage-initramfs_0.1.0.bb | 50 +++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 meta/recipes-kernel/kernel-image-fitimage-initramfs/kernel-image-fitimage-initramfs_0.1.0.bb
diff --git a/meta/recipes-kernel/kernel-image-fitimage-initramfs/kernel-image-fitimage-initramfs_0.1.0.bb b/meta/recipes-kernel/kernel-image-fitimage-initramfs/kernel-image-fitimage-initramfs_0.1.0.bb
new file mode 100644
index 0000000000..c25168301b
--- /dev/null
+++ b/meta/recipes-kernel/kernel-image-fitimage-initramfs/kernel-image-fitimage-initramfs_0.1.0.bb
@@ -0,0 +1,50 @@
+# Copyright (C) 2022 Claudius Heine <ch@denx.de>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "Packages the fitimage with embedded initramfs"
+LICENSE = "GPL-2.0-only"
+DEPENDS = "virtual/kernel"
+
+SRC_URI = ""
+
+inherit kernel-artifact-names
+INITRAMFS_IMAGE_NAME ?= "${@['${INITRAMFS_IMAGE}-${MACHINE}', ''][d.getVar('INITRAMFS_IMAGE') == '']}"
+KERNEL_PACKAGE_NAME ?= "kernel"
+
+PN = "${KERNEL_PACKAGE_NAME}-image-fitimage-initramfs"
+
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+do_install[deptask] = "do_deploy"
+do_install() {
+ fitimage="$(readlink "${DEPLOY_DIR_IMAGE}/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}")"
+ install -d ${D}/boot
+ install -m 0644 \
+ ${DEPLOY_DIR_IMAGE}/${fitimage} \
+ ${D}/boot/
+ ln -snf \
+ ${fitimage} \
+ ${D}/boot/fitImage
+}
+
+PACKAGES += "${KERNEL_PACKAGE_NAME}-image-initramfs"
+
+FILES:${PN} = "/boot/fitImage /boot/fitImage-*"
+RPROVIDES:${PN} = "${KERNEL_PACKAGE_NAME}-image-fitimage"
+RCONFLICTS:${PN} = "${KERNEL_PACKAGE_NAME}-image-fitimage"
+RREPLACES:${PN} = "${KERNEL_PACKAGE_NAME}-image-fitimage"
+
+RDEPENDS:${KERNEL_PACKAGE_NAME}-image-initramfs = "${KERNEL_PACKAGE_NAME}-image-fitimage-initramfs (= ${EXTENDPGKV})"
+RPROVIDES:${KERNEL_PACKAGE_NAME}-image-initramfs = "${KERNEL_PACKAGE_NAME}-image"
+RCONFLICTS:${KERNEL_PACKAGE_NAME}-image-initramfs = "${KERNEL_PACKAGE_NAME}-image"
+RREPLACES:${KERNEL_PACKAGE_NAME}-image-initramfs = "${KERNEL_PACKAGE_NAME}-image"
+ALLOW_EMPTY:${KERNEL_PACKAGE_NAME}-image-initramfs = "1"
+
+python() {
+ if (not 'fitImage' in d.getVar('KERNEL_IMAGETYPES') or
+ bb.utils.to_boolean(d.getVar('INITRAMFS_IMAGE_BUNDLE'))):
+ raise bb.parse.SkipRecipe('Requires generation of fitImage and bundled initramfs.')
+ if not d.getVar('KERNEL_FIT_LINK_NAME'):
+ raise bb.parse.SkipRecipe('Requires generation of fitImage symlink in deploy dir.')
+}
--
2.33.1
next prev parent reply other threads:[~2022-03-30 9:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 9:15 [RFC PATCH 0/1] Packaging a fitimage with initramfs Claudius Heine
2022-03-30 9:15 ` Claudius Heine [this message]
2022-04-13 7:18 ` [RFC PATCH 1/1] kernel: add kernel-image-fitimage-initramfs Claudius Heine
2022-04-13 7:35 ` Richard Purdie
2022-04-13 7:50 ` Claudius Heine
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=20220330091522.795083-2-ch@denx.de \
--to=ch@denx.de \
--cc=openembedded-core@lists.openembedded.org \
/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