From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH v2 23/27] initramfs-hook: Migrate to a bbclass
Date: Mon, 10 Nov 2025 08:22:36 +0100 [thread overview]
Message-ID: <ebed617114508ba2563310fe92f3eebbf2b25325.1762759360.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1762759359.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
"inherit initramfs-hook" is shorter and a more common pattern compared
to OE/yocto. Keep the original .inc file as transitional helper, issuing
a warning when it's used with a migration suggestion.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
doc/user_manual.md | 5 +-
.../initramfs-hook.bbclass} | 5 +-
.../recipes-initramfs/initramfs-hook/hook.inc | 82 ++-----------------
3 files changed, 11 insertions(+), 81 deletions(-)
copy meta/{recipes-initramfs/initramfs-hook/hook.inc => classes-recipe/initramfs-hook.bbclass} (94%)
diff --git a/doc/user_manual.md b/doc/user_manual.md
index b577f76c..3064c17b 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -1691,9 +1691,8 @@ Debian-generated image with a separately built one.
### Creating initramfs hooks
To create an initramfs hook that adds tools or modules to the image and may
-also run custom scripts during boot, use the include file
-`recipes-initramfs/initramfs-hook/hook.inc`. It is controlled via a number of
-variables:
+also run custom scripts during boot, use the `initramfs-hook` class. It is
+controlled via a number of variables:
- `HOOK_PREREQ` defines the prerequisites for running the hook script.
- `HOOK_ADD_MODULES` passes the provided modules names to the
diff --git a/meta/recipes-initramfs/initramfs-hook/hook.inc b/meta/classes-recipe/initramfs-hook.bbclass
similarity index 94%
copy from meta/recipes-initramfs/initramfs-hook/hook.inc
copy to meta/classes-recipe/initramfs-hook.bbclass
index c80b781d..ef3ae06e 100644
--- a/meta/recipes-initramfs/initramfs-hook/hook.inc
+++ b/meta/classes-recipe/initramfs-hook.bbclass
@@ -1,5 +1,5 @@
#
-# Copyright (c) Siemens AG, 2024
+# Copyright (c) Siemens AG, 2024-2025
#
# Authors:
# Jan Kiszka <jan.kiszka@siemens.com>
@@ -7,10 +7,9 @@
# SPDX-License-Identifier: MIT
#
-FILESPATH:append := ":${FILE_DIRNAME}/files"
-
inherit dpkg-raw
+FILESPATH:append = ":${LAYERDIR_core}/recipes-initramfs/initramfs-hook/files"
SRC_URI = " \
file://hook-header.tmpl \
file://script-header.tmpl"
diff --git a/meta/recipes-initramfs/initramfs-hook/hook.inc b/meta/recipes-initramfs/initramfs-hook/hook.inc
index c80b781d..0ef89154 100644
--- a/meta/recipes-initramfs/initramfs-hook/hook.inc
+++ b/meta/recipes-initramfs/initramfs-hook/hook.inc
@@ -1,81 +1,13 @@
+# Transitional include for u-boot.bbclass
#
-# Copyright (c) Siemens AG, 2024
-#
-# Authors:
-# Jan Kiszka <jan.kiszka@siemens.com>
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2025
#
# SPDX-License-Identifier: MIT
-#
-
-FILESPATH:append := ":${FILE_DIRNAME}/files"
-
-inherit dpkg-raw
-
-SRC_URI = " \
- file://hook-header.tmpl \
- file://script-header.tmpl"
-
-TEMPLATE_FILES = " \
- hook-header.tmpl \
- script-header.tmpl"
-
-TEMPLATE_VARS:append = " \
- HOOK_PREREQ \
- HOOK_ADD_MODULES \
- HOOK_COPY_EXECS \
- SCRIPT_PREREQ"
-
-HOOK_PREREQ ?= ""
-HOOK_ADD_MODULES ?= ""
-HOOK_COPY_EXECS ?= ""
-SCRIPT_PREREQ ?= ""
-
-DEBIAN_DEPENDS = "initramfs-tools"
-
-def get_initramfs_hook_name(d):
- name = d.getVar('BPN')
- if name.startswith("initramfs-"):
- name = name[10:]
- if name.endswith("-hook"):
- name = name[:-5]
- return name
-
-INITRAMFS_HOOK_NAME ?= "${@get_initramfs_hook_name(d)}"
-
-do_install() {
- if [ -f "${WORKDIR}/hook" ] || [ -n "${HOOK_COPY_EXECS}" ] || \
- [ -n "${HOOK_ADD_MODULES}" ]; then
- rm -rf "${D}/usr/share/initramfs-tools/hooks"
- install -d -m 0755 "${D}/usr/share/initramfs-tools/hooks"
-
- install -m 0755 "${WORKDIR}/hook-header" \
- "${D}/usr/share/initramfs-tools/hooks/${INITRAMFS_HOOK_NAME}"
- if [ -f "${WORKDIR}/hook" ]; then
- cat "${WORKDIR}/hook" >> \
- "${D}/usr/share/initramfs-tools/hooks/${INITRAMFS_HOOK_NAME}"
- else
- echo "exit 0" >> \
- "${D}/usr/share/initramfs-tools/hooks/${INITRAMFS_HOOK_NAME}"
- fi
- fi
- for script in init-top init-premount local-top nfs-top local-block \
- local-premount nfs-premount local-bottom nfs-bottom \
- init-bottom; do
- if [ ! -f "${WORKDIR}/$script" ] && [ ! -f "${WORKDIR}/${script}-complete" ]; then
- continue
- fi
+inherit initramfs-hook
- rm -rf "${D}/usr/share/initramfs-tools/scripts/$script"
- install -d -m 0755 "${D}/usr/share/initramfs-tools/scripts/$script"
- if [ -f "${WORKDIR}/${script}" ]; then
- install -m 0755 "${WORKDIR}/script-header" \
- "${D}/usr/share/initramfs-tools/scripts/$script/${INITRAMFS_HOOK_NAME}"
- cat "${WORKDIR}/$script" >> \
- "${D}/usr/share/initramfs-tools/scripts/$script/${INITRAMFS_HOOK_NAME}"
- else
- install -m 0755 "${WORKDIR}/${script}-complete" \
- "${D}/usr/share/initramfs-tools/scripts/$script/${INITRAMFS_HOOK_NAME}"
- fi
- done
+do_warn_custom_inc() {
+ bbwarn "Please migrate from \"require recipes-initramfs/initramfs-hook/hook.inc\" to \"inherit initramfs-hook\""
}
+addtask warn_custom_inc before do_unpack
--
2.51.0
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/ebed617114508ba2563310fe92f3eebbf2b25325.1762759360.git.jan.kiszka%40siemens.com.
next prev parent reply other threads:[~2025-11-10 7:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 7:22 [PATCH v2 00/27] Use more classes! 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 01/27] linux-custom: Drop redundant template inheritance 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 02/27] meta: Move INHERIT'ed classes into classes-global 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 03/27] meta: Move recipe-pulled classes into classes-recipe 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 04/27] meta-isar: " 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 05/27] linux-custom: Migrate to a bbclass 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 06/27] meta-isar: Switch to linux-kernel class 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 07/27] linux-module: Migrate to a bbclasss 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 08/27] meta-isar: Switch to linux-module class 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 09/27] kselftest: Migrate to a bbclass 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 10/27] meta-isar: Switch to kselftest class 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 11/27] u-boot-custom: Migrate to a bbclass 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 12/27] meta-isar: Switch to u-boot class 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 13/27] optee-os[-tadevkit]-custom: Migrate to bbclass'es 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 14/27] meta-isar: Switch to optee-os[-tadevkit] classes 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 15/27] optee-client: Migrate to a bbclass 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 16/27] meta-isar: Switch to optee-client class 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 17/27] trusted-firmware-a: Migrate to a bbclass 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 18/27] meta-isar: Switch to trusted-firmware-a class 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 19/27] barebox: Add SPDX license identifiers 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 20/27] barebox: Move inherit dpkg into common .inc 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 21/27] barebox: Migrate to a bbclass 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 22/27] meta-isar: Switch to barebox class 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` 'Jan Kiszka' via isar-users [this message]
2025-11-10 7:22 ` [PATCH v2 24/27] meta[-isar]: Switch to initramfs-hook class 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 25/27] container-loader: Migrate to bbclass'es 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 26/27] meta-isar: Switch to {docker,podman}-loader classes 'Jan Kiszka' via isar-users
2025-11-10 7:22 ` [PATCH v2 27/27] RECIPES-API-CHANGELOG: Document include to class conversion 'Jan Kiszka' via isar-users
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=ebed617114508ba2563310fe92f3eebbf2b25325.1762759360.git.jan.kiszka@siemens.com \
--to=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.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