From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6874889650574458880 X-Received: by 2002:a19:f114:: with SMTP id p20mr3060843lfh.292.1610619140605; Thu, 14 Jan 2021 02:12:20 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:a58c:: with SMTP id m12ls849102ljp.2.gmail; Thu, 14 Jan 2021 02:12:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxs+gxD1LwFDoXmA4myn1ksSnVchiTnj4WkovLff3Qs0KTzQ1NAOByqmOetCn0f8dRDNCRI X-Received: by 2002:a2e:8e63:: with SMTP id t3mr2796657ljk.88.1610619139499; Thu, 14 Jan 2021 02:12:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610619139; cv=none; d=google.com; s=arc-20160816; b=Ph/dTXeiRw9T8HjIdq5RSwXwlFM34Mru/DGYGzoW88ebm5K2m6JfeMmY+nz9YsrhyH 3w7qZIMIjTmb+TrmyXiugwSJhrafmpKmHNuXikYZOqlJ6jMWYdsVN4qX5HcZUo1Tm4G/ x76qvOVJeXCLQY+7M7qN9ii/rZuaeUgofl6zhWMuS9McCcdx8nqug3lvfNifxc8XV45c YVdRnJ7tdov5zeQ4pB/IiOiDAZxB5THbhDVu14i7nWiwPie+X1McBPDQi/2RNuw6bvgO oGAIr+RiqB+YM0ZB6JJPAMIkqQyuEa0M8MvlfhbZlenqMvfXrx1PvlWJk863XnOuyIpt /QGA== 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=6oryJtUDsrqKtS3EWv8DbrZWNJcCNvdVsBMYLXx1xFo=; b=amKcemnQsuovQgVHdXJZo2pqWcydIA2UjhJVZkEvLX6BYN7Txr978MOv9T17UXuzXd A8IzrX6OCVPt8UBhTyFzQ4ZpbYbdG+Kw8gHBxJ40mH+0ic2lpRDu2NCP3X8lKtyn1YNm E86lvL+AI3/e4846aRMWk5/DFiSacR9w2yiZJcvsuY3ilXsQ106uocEEoM5RJJT8FwuI VQDc7GmwpTqi0pF9FucasvqEnNjnL2fOf9FtFr4Wv1zObRtdRk98PHumwWdd58ivTt7y rlrGeRKFFRgPPJYpmeTj4KRtM33yYTxJPONBhPEtT0P09kr10Xm9lmdHBuwg14ShKw+E bhhw== 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 d3si246952ljj.4.2021.01.14.02.12.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jan 2021 02:12:19 -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 4DGg8z06J3z1qs3l; Thu, 14 Jan 2021 11:12:19 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4DGg8y71WNz1tSQP; Thu, 14 Jan 2021 11:12:18 +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 xgrqFtfL9ATX; Thu, 14 Jan 2021 11:12:17 +0100 (CET) X-Auth-Info: YK5cfL7bnWD1/xHK6U9g8iEfuDvwKosMhN5eeJyLVH8= 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; Thu, 14 Jan 2021 11:12:17 +0100 (CET) From: Harald Seiler To: isar-users@googlegroups.com Cc: Harald Seiler , Jan Kiszka Subject: [PATCH v3 2/3] Add example initramfs module recipe Date: Thu, 14 Jan 2021 11:11:55 +0100 Message-Id: <20210114101156.243184-2-hws@denx.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210114101156.243184-1-hws@denx.de> References: <20210114101156.243184-1-hws@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: HnskBZ3ti+id 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 .../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