@@ -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
similarity index 94%
copy from meta/recipes-initramfs/initramfs-hook/hook.inc
copy to 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"
@@ -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