From patchwork Sat Nov 16 11:12:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 3940 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Sat, 16 Nov 2024 12:13:13 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-il1-f183.google.com (mail-il1-f183.google.com [209.85.166.183]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 4AGBDB9H014081 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 16 Nov 2024 12:13:12 +0100 Received: by mail-il1-f183.google.com with SMTP id e9e14a558f8ab-3a3da2d46b9sf32876855ab.0 for ; Sat, 16 Nov 2024 03:13:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1731755586; cv=pass; d=google.com; s=arc-20240605; b=RznDoX1rv5T7grDzXM9B8Yw+PUL2PalVOmuDLk7mEmPirm/D7goYqsgMqOrs5IVFRy gU5XH9lLrg7JODdMbJx5Rm1PIN9qPezCTQiMtrDtTLZxReVDJQnvflf1WaXIGR9/SwjR 9sfnVYU8Y9zP2gCXZW9Rh8HiNEqiMgmvGxtk0T12dZljFsWUm75PPGfp1M9Y7jlAC2T9 ebbs+nTbjV/JbLtBirgYBaJBroO2KM93YAbo35HIEczlQFFQaaX67fKH+DpVuMhbDFue /zsr2ZE3ko7QeX6EfdDEARQ+97rD8caRIjN+o09Ch8kINQ/Up9B1jLG0ju0OiEBv4qDs aM5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:feedback-id:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AyVUEsozNYUj6EHBx6BQpzJLJ54qXAhCFDmGDmDybqU=; fh=x6Nv7a90SOq+MolrJNLCrOvHe3eZ+yzlwFNxTKORlVI=; b=kE3ZxUbH3BBGMReuhnGxvbzDCNSx812/df6vNiHyC4hJPeqP2GTZeZXy7kbvyn4Jzk g76VSUm48kejDqkL9XtmzGWLWsdmeNeUELwHmIKLPDghkm2FWOQVznUKrxg/bGRDQBrX VTL9YwTfrJWoImEVbIGg3XO8nEm0YNdyRDHIh2nHXr6TZh09XgblqSBBTWkh0yqD9Ib7 +/kSLgQjFPqKjQ+ep8zbaOooDXkK3eMWihVnBgKAXDHbQI2DysPTkMBficeJpPq3CLA2 eX2plk31eoHHsNtZ6uaUjWgWMb9IKfHz4tTGsFHlEtUoqyDZrDhDJm0BBud+VEy99FNj LAfA==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=hZDl93dj; spf=pass (google.com: domain of fm-294854-202411161113022ce735cd6ec374d57d-t7n_51@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-294854-202411161113022ce735cd6ec374d57d-T7N_51@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1731755586; x=1732360386; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=AyVUEsozNYUj6EHBx6BQpzJLJ54qXAhCFDmGDmDybqU=; b=a7mkpusbC1tt35YkDMQDY7rJsAgkERTKhvhLgFQ7dGCI+R0eEiZaAK5higyMVjHU9s xIt1PiFH1Qbf9gFuaGXRo7T6J0c2Uq+Bf5gdfdSL4ylAxpw5G/+kYze3ucFQqgPodXPS a/mRGm0yd/5WSJmCc/3OR0YaLFHq3JgkKeqxFj5ATWMhovMgU4UQp0p/d3ngwbvZE37J QFKmCTwqVZRYo9xgCaDnm2sVFEx4rbiW/oPXlbcBINy54iRe11HgAhvhNH5m7/NJCYFM GDOZvY+RbsrmlIrNsHAPtkEjap1EDNKzbdDl+TAt8j56A5/9pw5FB2CyEkvNwdTQVPd6 62sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731755586; x=1732360386; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AyVUEsozNYUj6EHBx6BQpzJLJ54qXAhCFDmGDmDybqU=; b=rCBPnBp5ToobwnMF7qpx0hwqrRUdRgc+ZgvLlsExl/uAMlSP06OJgYTOs8tLQ5jVoZ arkUQgO+YdtVRfeXLHkEUtk7vy1bTWz5U3c8oXf5WzCWkxAHLz2089mSj3y3luFQXrFz btf53MxmWgAUon0zL5IrAydTDcgQzyBDKrgPXjk2vpGCGeVxWMlm4PCX8J9QjrY0C32U BynoOdHO6OPOJ7ZazX3+9K4ldWPasW2Iqdr8piVqwIULqu8JCPToiPcw55Sh0JYVIUgZ Kow6pTf9uBPEXuKBQe0rjifsnFL9K6ESoGIMpnEntiEZWWLDlG0qrOg68dSZx/OsGnmP cJJw== X-Forwarded-Encrypted: i=2; AJvYcCX1INK7q9vHO9IvRfRQK+N3XvWB9zgb31tYhPYycC2QHc+tmq1GyC40Wv56w6hqtil3CpqyITc=@isar-build.org X-Gm-Message-State: AOJu0YzRuW8FAtXZmq/rKSi4zlkbPIqATGwvmILZ5bTHiFsap/X8JFYN HYzBappBqX3F2EXdnt8LPDQYKhkJyLEGWP3OfSXbWJYMqkv3TIMF X-Google-Smtp-Source: AGHT+IFUb8o8UUju0TofnbmzS2epObbJ1JhnniSXW81ZsnulEK7zhFNwNkcA8HGsQredFy9Bev3JxA== X-Received: by 2002:a05:6e02:3203:b0:3a6:c023:7e35 with SMTP id e9e14a558f8ab-3a748012a1amr72177415ab.8.1731755585679; Sat, 16 Nov 2024 03:13:05 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a92:c5c2:0:b0:3a6:acdb:e3f8 with SMTP id e9e14a558f8ab-3a71e3755adls15074445ab.0.-pod-prod-07-us; Sat, 16 Nov 2024 03:13:04 -0800 (PST) X-Received: by 2002:a05:6602:1510:b0:83a:c858:dc3a with SMTP id ca18e2360f4ac-83e6c32ef20mr601195239f.14.1731755584660; Sat, 16 Nov 2024 03:13:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731755584; cv=none; d=google.com; s=arc-20240605; b=a+Z4ctXMaVRXLCZOZIF94njK6BDGXXMS+skzIHJnMYJrag6HnzvTI6nNXPvVXbYlLW NAsbq4IjKDUTmtqeXHhsxvUn8UtN0wBvYZ+PnerIAoS0Lt7eJJ6OjJ2PyRZ0jHQaLzGf otN3wFX4R+b5jvBvu091sfI1Fk9D45o1uXunB+IXKFRym+eOz9obg3rJfFBFVOk7ML0V XsjDkNvhdRNLeq3HgM8z/LBBEevHvbJKuFfOyodhrcmWPIgurzmtXM+auWxjDz/aFL+f ewTkPa3gevuf6/itiMoY2T9wZU00D4czlHVaEHiiII+x6CYmWtRGO/QYe+Qj6zIoOcje HqHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=feedback-id:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=MGtnwDmd0nGW5LYz9FhXkLLYF1RdsF2HYPn6RDVj7EA=; fh=TWGwN84gUgHIe5O4CbyH9KISyeWwGbvUX7cnJPxVD70=; b=WBe6if+m5m/CU1+AN48jGGIzRTJZvH0v0fB08kzzEHE5QIRhM63GMPy3lUCmqkxVZd P7f8McfyovSl3Mkh3w87TLTBst1QKJ1OwogmfRtTyrRpcY6SiMGrJShj5lEHCQs4QITk k2Q6+A1qZOisxvwhtRsVk5gF2Zgod3DhXtIc3Fjr95fuB8wnlAVurwwW7xARJRkSb0gm igTwXQO84wGzt1gN/m59H7FK+enZwNTch6qYINUx2VwVJ0qn/4xvyZmWoiO+CjWVCKXm NRLSiLmVB1l6o7aDznWsYpDeqMHtGHrI1DJdHOAR6e2khqfyfepQNntmp7niRtnnNnKw OPMg==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=hZDl93dj; spf=pass (google.com: domain of fm-294854-202411161113022ce735cd6ec374d57d-t7n_51@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-294854-202411161113022ce735cd6ec374d57d-T7N_51@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net. [185.136.64.225]) by gmr-mx.google.com with ESMTPS id 8926c6da1cb9f-4e056f37528si125930173.0.2024.11.16.03.13.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Nov 2024 03:13:04 -0800 (PST) Received-SPF: pass (google.com: domain of fm-294854-202411161113022ce735cd6ec374d57d-t7n_51@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) client-ip=185.136.64.225; Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 202411161113022ce735cd6ec374d57d for ; Sat, 16 Nov 2024 12:13:02 +0100 X-Patchwork-Original-From: "'Jan Kiszka' via isar-users" From: Jan Kiszka To: isar-users Cc: Quirin Gylstorff Subject: [PATCH v4 2/7] doc: Describe initramfs customizations Date: Sat, 16 Nov 2024 12:12:56 +0100 Message-ID: <3a94408e8cbbd169d6cdd70627338ac6ea201197.1731755581.git.jan.kiszka@siemens.com> In-Reply-To: References: MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-294854:519-21489:flowmailer X-Original-Sender: jan.kiszka@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=hZDl93dj; spf=pass (google.com: domain of fm-294854-202411161113022ce735cd6ec374d57d-t7n_51@rts-flowmailer.siemens.com designates 185.136.64.225 as permitted sender) smtp.mailfrom=fm-294854-202411161113022ce735cd6ec374d57d-T7N_51@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: Jan Kiszka Reply-To: Jan Kiszka Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED, RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: Jan Kiszka Document to new hook.inc as well as the preexisting initramfs class. Signed-off-by: Jan Kiszka --- doc/user_manual.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/doc/user_manual.md b/doc/user_manual.md index 4b07f903..c20ffd93 100644 --- a/doc/user_manual.md +++ b/doc/user_manual.md @@ -1602,3 +1602,57 @@ CONTAINER_DELETE_AFTER_LOAD = "1" SRC_URI += "docker://debian;digest=sha256:f528891ab1aa484bf7233dbcc84f3c806c3e427571d75510a9d74bb5ec535b33;tag=bookworm-20240701-slim" ``` + +## Customize the initramfs + +Isar supports the customization of initramfs images by providing an +infrastructure for quickly creating hooks and by allowing to replace the +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: + + - `HOOK_PREREQ` defines the prerequisites for running the hook script. + - `HOOK_ADD_MODULES` passes the provided modules names to the + `manual_add_modules` function during initramfs creation. + - `HOOK_COPY_EXECS` identifies the source of the passed executables on the + rootfs that runs mkinitramfs and passes that to `copy_exec`. If an + executable is not found, an error thrown, and the creation fails. + - `SCRIPT_PREREQ` defines the prerequisites for running the boot script. + +If the generated hook script is not sufficient, you can append an own +bottom-half script by providing a `hook` file in `${WORKDIR}`. It will be +appended to the `hook-header` that the helper generates. + +For running a custom script during boot-up, provide a bottom-half file in +`${WORKDIR}`. Its name defines where it is hooked up with the initramfs boot +process: `init-top`, `init-premount`, `local-top`, `nfs-top`, `local-block`, +`local-premount`, `nfs-premount`, `local-bottom`, `nfs-bottom`, `init-bottom` + +See https://manpages.debian.org/stable/initramfs-tools-core/initramfs-tools.7.en.html +for further details. + +The hook recipe should follow the naming convention `initramfs--hook` +so that its scripts will then be called `` in the generated +initramfs. + +See `initramfs-example` for an exemplary hook recipe. + +### Creating an initramfs image aside the rootfs + +To avoid shipping all tools and binaries needed to generate an initramfs, isar +provides the initramfs class. It creates a temporary Debian rootfs with all +those dependencies and generates the initramfs from there, rather than the +target's rootfs. + +This initramfs class should be pulled in by an image recipe. Said recipe +specifies all dependencies of the initramfs via `INITRAMFS_INSTALL` for +self-built packages and `INITRAMFS_PREINSTALL` for prebuilt ones, analogously +to the respective `IMAGE_*` variables. Note that the kernel is automatically +added to `INITRAMFS_INSTALL` if `KERNEL_NAME` is set. + +See `isar-initramfs` for an example recipe.