teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0089-kernel-install-add-new-variable-KERNEL_INSTALL_INITR.patch

594167
From 931ae9749924a396a78044f8b1536085ff574ae6 Mon Sep 17 00:00:00 2001
aa0848
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
aa0848
Date: Tue, 18 Jan 2022 17:40:13 +0100
aa0848
Subject: [PATCH] kernel-install: add new variable
aa0848
 $KERNEL_INSTALL_INITRD_GENERATOR
aa0848
aa0848
The idea is that when not set, we do whatever we did in the past. But
aa0848
with a new setting of initrd_generator=mkosi-initrd, mkosi-initrd will
aa0848
generate an initrd.
aa0848
aa0848
(cherry picked from commit 5c1b257faf87cb4f93aee8866f45a8cb98230af9)
aa0848
aa0848
Related: #2065061
aa0848
---
aa0848
 man/kernel-install.xml            | 6 +++++-
aa0848
 src/kernel-install/install.conf   | 1 +
aa0848
 src/kernel-install/kernel-install | 5 ++++-
aa0848
 3 files changed, 10 insertions(+), 2 deletions(-)
aa0848
aa0848
diff --git a/man/kernel-install.xml b/man/kernel-install.xml
aa0848
index 83255bb932..bb76074d2e 100644
aa0848
--- a/man/kernel-install.xml
aa0848
+++ b/man/kernel-install.xml
aa0848
@@ -171,11 +171,15 @@
aa0848
     <para><varname>KERNEL_INSTALL_BOOT_ROOT=</varname> is set for the plugins to the root directory (mount point, usually) of the hierarchy
aa0848
     where boot-loader entries, kernel images, and associated resources should be placed. Can be overridden by setting <varname>BOOT_ROOT=</varname>.</para>
aa0848
 
aa0848
-    <para><varname>KERNEL_INSTALL_LAYOUT=bls|other|...</varname> specifies the installation layout.
aa0848
+    <para><varname>KERNEL_INSTALL_LAYOUT=bls|other|...</varname> is set for the plugins to specify the installation layout.
aa0848
     Defaults to <option>bls</option> if <filename>$BOOT/<replaceable>MACHINE-ID</replaceable></filename> exists, or <option>other</option> otherwise.
aa0848
     Additional layout names may be defined by convention. If a plugin uses a special layout,
aa0848
     it's encouraged to declare its own layout name and configure <varname>layout=</varname> in <filename>install.conf</filename> upon initial installation.</para>
aa0848
 
aa0848
+    <para><varname>KERNEL_INSTALL_INITRD_GENERATOR=...</varname> is set for plugins to select the initrd generator.
aa0848
+    This should be configured as <varname>initrd_generator=</varname> in <filename>install.conf</filename>.
aa0848
+    </para>
aa0848
+
aa0848
     <variablelist>
aa0848
       <varlistentry>
aa0848
         <term>bls</term>
aa0848
diff --git a/src/kernel-install/install.conf b/src/kernel-install/install.conf
aa0848
index e4802e6fae..43b6e7d792 100644
aa0848
--- a/src/kernel-install/install.conf
aa0848
+++ b/src/kernel-install/install.conf
aa0848
@@ -8,3 +8,4 @@
aa0848
 # See kernel-install(8) for details.
aa0848
 
aa0848
 #layout=bls|other|...
aa0848
+#initrd_generator=dracut|...
aa0848
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
aa0848
index e56483ef96..fe457c1070 100755
aa0848
--- a/src/kernel-install/kernel-install
aa0848
+++ b/src/kernel-install/kernel-install
aa0848
@@ -80,6 +80,9 @@ fi
aa0848
 KERNEL_VERSION="$1"
aa0848
 shift
aa0848
 
aa0848
+layout=
aa0848
+initrd_generator=
aa0848
+
aa0848
 if [ -r "/etc/kernel/install.conf" ]; then
aa0848
     . /etc/kernel/install.conf
aa0848
 elif [ -r "/usr/lib/kernel/install.conf" ]; then
aa0848
@@ -123,12 +126,12 @@ if [ -z "$layout" ]; then
aa0848
     fi
aa0848
 fi
aa0848
 
aa0848
-
aa0848
 ENTRY_DIR_ABS="$BOOT_ROOT/$MACHINE_ID/$KERNEL_VERSION"
aa0848
 
aa0848
 export KERNEL_INSTALL_MACHINE_ID="$MACHINE_ID"
aa0848
 export KERNEL_INSTALL_BOOT_ROOT="$BOOT_ROOT"
aa0848
 export KERNEL_INSTALL_LAYOUT="$layout"
aa0848
+export KERNEL_INSTALL_INITRD_GENERATOR="$initrd_generator"
aa0848
 
aa0848
 [ "$layout" = "bls" ]
aa0848
 MAKE_ENTRY_DIR_ABS=$?