From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6874889650574458880 X-Received: by 2002:ac2:58e4:: with SMTP id v4mr11023815lfo.662.1610964527136; Mon, 18 Jan 2021 02:08:47 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a19:6145:: with SMTP id m5ls2435121lfk.2.gmail; Mon, 18 Jan 2021 02:08:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMWmb8LsJgDQAvtTMEP3IdpRdabrGT/lSKfKUPQ9Hky/ZhJ5S+wXNAwLtBTRfX/Jo+ahEe X-Received: by 2002:ac2:46e7:: with SMTP id q7mr10516397lfo.311.1610964526208; Mon, 18 Jan 2021 02:08:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610964526; cv=none; d=google.com; s=arc-20160816; b=wiixAjTYmkfsNzpAEhhERuRqiLOoZlPRJSin6PuGAFa4BNuf+LXXs2krsNlPxKbb+2 wNgECqECx8G2oA+TafjJuPIzo5RVv5oEkcIjDnv/SY/hNOfI9fgjtUnMtMXwSIfU9ITg 9HbSLa4BPsCD12PD3PvQSzNPLiTvJUp6x5wGJC3IqU/YLaqYMaSrzA4j9tuerx1gWE5e ZXwfHpTbJBvO7MnpK2dGlSZPUaxCHHKDqicxiwZw/0tUmSJ7vPn41V/5NGjq4r70eSIu U6CM5tLU1WI4LcVqGPnF2VvSxeteP/Q9tDuBr5Vfe5bWcB7vPMhSJqCbRqeOG5f4kzNg 8dqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=CDVew4gbAsnRTQ13Xl4RRpCV1PfelN0ZqX1Dg6Zz4SI=; b=fKYny9/gpMuhF/060sne0R3gUntq1mO54zvWsuu9U5Tz/54VpKV449uncG1TlrDEgg hwb1IY11VKm64ZJvz+y8ZTYpPf4FKgQhMUwxsgB6j9WYFGS+osaNmgz2edmPf1z6XUiH dSJVLjOhLDrsMYTcYUEVL/gkPJFEMpdnHWWAVq1bES1HlMu09tY9xyi+4wpc9JsWoKHN yLaYd1EfO3M1RIcIRklMFXXIt5/hb88yEwrJ2RrfNbqZXFnGbn25XDDvhhv9HN1swbDj VMuoj3hNHKjjFGVWMnrahRKE0wzhWEpkd6PBDPc+Kx7trioOtC+AIpCEgGWq/gUUP4z5 urMQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of hws@denx.de) smtp.mailfrom=hws@denx.de Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id r12si595531ljm.1.2021.01.18.02.08.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jan 2021 02:08:46 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of hws@denx.de) client-ip=212.18.0.9; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of hws@denx.de) smtp.mailfrom=hws@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4DK6v15mXzz1qs3n; Mon, 18 Jan 2021 11:08:45 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4DK6v15TMBz1tSQZ; Mon, 18 Jan 2021 11:08:45 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id UOggrWUeQgI1; Mon, 18 Jan 2021 11:08:44 +0100 (CET) X-Auth-Info: TDL5YHWqIAJcAWDT4PJkqqCapDXqC5c5CHWbtCOHsK8= Received: from maia.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 18 Jan 2021 11:08:44 +0100 (CET) From: Harald Seiler To: isar-users@googlegroups.com Cc: Harald Seiler , Jan Kiszka , "florian . bezdeka @ siemens . com" Subject: [PATCH v4 2/3] Add example initramfs module recipe Date: Mon, 18 Jan 2021 11:07:28 +0100 Message-Id: <20210118100729.138523-2-hws@denx.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118100729.138523-1-hws@denx.de> References: <20210118100729.138523-1-hws@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: EJ9nE+7S2h4i 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 --- Notes: Changes in v3: - None Changes in v4: - 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 " +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