From: Harald Seiler <hws@denx.de>
To: isar-users@googlegroups.com
Cc: Harald Seiler <hws@denx.de>, Jan Kiszka <jan.kiszka@siemens.com>
Subject: [PATCH v3 2/3] Add example initramfs module recipe
Date: Thu, 14 Jan 2021 11:11:55 +0100 [thread overview]
Message-ID: <20210114101156.243184-2-hws@denx.de> (raw)
In-Reply-To: <20210114101156.243184-1-hws@denx.de>
Add the initramfs-example recipe/package which demonstrates how to write
initramfs modules. It demonstrates how to add hook scripts, boot scripts,
and conf-hooks.
Signed-off-by: Harald Seiler <hws@denx.de>
---
Notes:
Changes in v3:
- None
.../initramfs-example/files/example.conf-hook | 7 ++++
.../initramfs-example/files/example.hook | 19 +++++++++
.../initramfs-example/files/example.script | 21 ++++++++++
.../initramfs-example/initramfs-example.bb | 40 +++++++++++++++++++
4 files changed, 87 insertions(+)
create mode 100644 meta-isar/recipes-initramfs/initramfs-example/files/example.conf-hook
create mode 100644 meta-isar/recipes-initramfs/initramfs-example/files/example.hook
create mode 100644 meta-isar/recipes-initramfs/initramfs-example/files/example.script
create mode 100644 meta-isar/recipes-initramfs/initramfs-example/initramfs-example.bb
diff --git a/meta-isar/recipes-initramfs/initramfs-example/files/example.conf-hook b/meta-isar/recipes-initramfs/initramfs-example/files/example.conf-hook
new file mode 100644
index 000000000000..2a3cf7a84040
--- /dev/null
+++ b/meta-isar/recipes-initramfs/initramfs-example/files/example.conf-hook
@@ -0,0 +1,7 @@
+# Example conf-hook.
+#
+# See "CONFIGURATION HOOK SCRIPTS" in initramfs-tools(7) for details.
+
+# Example: Use busybox instead of klibc-utils. The package must also add
+# `busybox` as a dependency when this is set.
+BUSYBOX=y
diff --git a/meta-isar/recipes-initramfs/initramfs-example/files/example.hook b/meta-isar/recipes-initramfs/initramfs-example/files/example.hook
new file mode 100644
index 000000000000..0d84e7a97efd
--- /dev/null
+++ b/meta-isar/recipes-initramfs/initramfs-example/files/example.hook
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Example hook script.
+#
+# See "HOOK SCRIPTS" in initramfs-tools(7) for details.
+
+PREREQ=""
+prereqs()
+{
+ echo "$PREREQ"
+}
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+# Begin real processing below this line
diff --git a/meta-isar/recipes-initramfs/initramfs-example/files/example.script b/meta-isar/recipes-initramfs/initramfs-example/files/example.script
new file mode 100644
index 000000000000..784fad9c99bb
--- /dev/null
+++ b/meta-isar/recipes-initramfs/initramfs-example/files/example.script
@@ -0,0 +1,21 @@
+#!/bin/sh
+# Example boot script.
+#
+# See "BOOT SCRIPTS" in initramfs-tools(7) for details.
+
+PREREQ=""
+prereqs()
+{
+ echo "$PREREQ"
+}
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /scripts/functions
+# Begin real processing below this line
+
+log_success_msg "Hello from ISAR!"
diff --git a/meta-isar/recipes-initramfs/initramfs-example/initramfs-example.bb b/meta-isar/recipes-initramfs/initramfs-example/initramfs-example.bb
new file mode 100644
index 000000000000..c336dda92b5d
--- /dev/null
+++ b/meta-isar/recipes-initramfs/initramfs-example/initramfs-example.bb
@@ -0,0 +1,40 @@
+# Example of a recipe containing an initramfs module. Packages like this can be
+# used with initramfs.bbclass or installed directly into a rootfs, depending on
+# the usecase.
+#
+# This software is a part of ISAR.
+
+DESCRIPTION = "Sample initramfs module for ISAR"
+MAINTAINER = "Your name here <you@domain.com>"
+DEBIAN_DEPENDS = "initramfs-tools"
+
+# If the conf-hook enables BUSYBOX=y, busybox is needed:
+DEBIAN_DEPENDS .= ", busybox"
+
+SRC_URI = " \
+ file://example.conf-hook \
+ file://example.hook \
+ file://example.script \
+ "
+
+inherit dpkg-raw
+
+do_install[cleandirs] += " \
+ ${D}/usr/share/initramfs-tools/conf-hooks.d \
+ ${D}/usr/share/initramfs-tools/hooks \
+ ${D}/usr/share/initramfs-tools/scripts/local-top \
+ "
+do_install() {
+ # See "CONFIGURATION HOOK SCRIPTS" in initramfs-tools(7) for details.
+ install "${WORKDIR}/example.conf-hook" \
+ "${D}/usr/share/initramfs-tools/conf-hooks.d/isar-example"
+
+ # See "HOOK SCRIPTS" in initramfs-tools(7) for details.
+ install "${WORKDIR}/example.hook" \
+ "${D}/usr/share/initramfs-tools/hooks/isar-example"
+
+ # Note that there are other places where a boot script might be deployed to,
+ # apart from local-top. See "BOOT SCRIPTS" in initramfs-tools(7) for details.
+ install "${WORKDIR}/example.script" \
+ "${D}/usr/share/initramfs-tools/scripts/local-top/example.script"
+}
--
2.29.2
next prev parent reply other threads:[~2021-01-14 10:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 10:42 [RFC PATCH] classes: Add initramfs class Harald Seiler
2020-09-21 19:25 ` Jan Kiszka
2020-09-22 10:34 ` Harald Seiler
2020-09-22 11:04 ` Jan Kiszka
2020-09-22 12:10 ` Gylstorff Quirin
2020-09-22 12:18 ` Harald Seiler
2020-09-23 16:20 ` [PATCH v2 1/3] " Harald Seiler
2020-09-25 13:16 ` Henning Schild
2020-10-06 12:24 ` Harald Seiler
2020-09-23 16:20 ` [PATCH v2 2/3] Add example initramfs module recipe Harald Seiler
2020-09-23 16:20 ` [PATCH v2 3/3] Add custom isar-initramfs example Harald Seiler
2020-09-25 9:13 ` Jan Kiszka
2020-09-25 11:28 ` Harald Seiler
2020-10-13 15:11 ` Jan Kiszka
2021-01-14 10:11 ` [PATCH v3 1/3] classes: Add initramfs class Harald Seiler
2021-01-14 10:11 ` Harald Seiler [this message]
2021-01-14 10:11 ` [PATCH v3 3/3] Add custom isar-initramfs example Harald Seiler
2021-01-18 9:11 ` [PATCH v3 1/3] classes: Add initramfs class florian.bezdeka
2021-01-18 10:00 ` Harald Seiler
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=20210114101156.243184-2-hws@denx.de \
--to=hws@denx.de \
--cc=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