All of lore.kernel.org
 help / color / mirror / Atom feed
* [cip-dev][isar-cip-core][PATCH] initramfs-config: Remove dependency to patch
@ 2021-07-08  8:32 Quirin Gylstorff
  2021-07-08  8:54 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Quirin Gylstorff @ 2021-07-08  8:32 UTC (permalink / raw)
  To: Jan.Kiszka, cip-dev; +Cc: Quirin Gylstorff

[-- Attachment #1: Type: text/plain, Size: 11332 bytes --]

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

The solution proposed by the patch[1] is not longer necessary.
Remove the patch and rework initramfs-config.

[1]: isar-patches/v7-0001-meta-support-Generate-a-custom-initramfs.patch

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 ...-support-Generate-a-custom-initramfs.patch | 207 ------------------
 kas-cip.yml                                   |   4 -
 .../initramfs-config/files/postinst           |   6 +
 .../initramfs-config/files/postinst.ext       |   3 -
 .../initramfs-abrootfs-secureboot_0.1.bb      |   9 +-
 5 files changed, 9 insertions(+), 220 deletions(-)
 delete mode 100644 isar-patches/v7-0001-meta-support-Generate-a-custom-initramfs.patch
 create mode 100644 recipes-support/initramfs-config/files/postinst
 delete mode 100644 recipes-support/initramfs-config/files/postinst.ext

diff --git a/isar-patches/v7-0001-meta-support-Generate-a-custom-initramfs.patch b/isar-patches/v7-0001-meta-support-Generate-a-custom-initramfs.patch
deleted file mode 100644
index f8fb28e..0000000
--- a/isar-patches/v7-0001-meta-support-Generate-a-custom-initramfs.patch
+++ /dev/null
@@ -1,207 +0,0 @@
-From 7c85e2e363fd39e60bf5041d02e14e8bd62c1a68 Mon Sep 17 00:00:00 2001
-From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
-Date: Tue, 24 Mar 2020 17:58:08 +0100
-Subject: [PATCH v7 1/3] meta/support: Generate a custom initramfs
-
-This package sets the Parameters for mkinitramfs/update-intramfs
-before it regenerates the initrd.img of debian with a modified version.
-
-Use cases are the remove unnecessary kernel modules to reduce the
-size of the initrd by using the parameters:
-```
-INITRAMFS_MODULES = "list"
-INITRAMFS_MODULE_LIST += "ext4"
-```
-
-Set the boot root during the initrd generation by setting `INITRAMFS_ROOT`.
-
-see also man pages of mkinitramfs and initramfs.conf.
-
-Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
----
- .../initramfs-config/initramfs-config_0.1.bb  |  6 +++
- .../initramfs-config/files/control.tmpl       | 12 +++++
- .../initramfs-config/files/postinst.tmpl      | 50 +++++++++++++++++++
- .../initramfs-config/files/postrm.tmpl        | 41 +++++++++++++++
- .../initramfs-config/initramfs-config.inc     | 32 ++++++++++++
- 5 files changed, 141 insertions(+)
- create mode 100644 meta-isar/recipes-support/initramfs-config/initramfs-config_0.1.bb
- create mode 100644 meta/recipes-support/initramfs-config/files/control.tmpl
- create mode 100644 meta/recipes-support/initramfs-config/files/postinst.tmpl
- create mode 100644 meta/recipes-support/initramfs-config/files/postrm.tmpl
- create mode 100644 meta/recipes-support/initramfs-config/initramfs-config.inc
-
-diff --git a/meta-isar/recipes-support/initramfs-config/initramfs-config_0.1.bb b/meta-isar/recipes-support/initramfs-config/initramfs-config_0.1.bb
-new file mode 100644
-index 0000000..c951e8a
---- /dev/null
-+++ b/meta-isar/recipes-support/initramfs-config/initramfs-config_0.1.bb
-@@ -0,0 +1,6 @@
-+#
-+# Copyright (C) Siemens AG, 2020
-+#
-+# SPDX-License-Identifier: MIT
-+
-+require recipes-support/initramfs-config/initramfs-config.inc
-diff --git a/meta/recipes-support/initramfs-config/files/control.tmpl b/meta/recipes-support/initramfs-config/files/control.tmpl
-new file mode 100644
-index 0000000..66984eb
---- /dev/null
-+++ b/meta/recipes-support/initramfs-config/files/control.tmpl
-@@ -0,0 +1,12 @@
-+Source: ${PN}
-+Section: misc
-+Priority: optional
-+Standards-Version: 3.9.6
-+Maintainer: isar-users <isar-users@googlegroups.com>
-+Build-Depends: debhelper (>= 9)
-+
-+
-+Package: ${PN}
-+Architecture: any
-+Depends: ${shlibs:Depends}, ${misc:Depends}, initramfs-tools-core, ${DEBIAN_DEPENDS}
-+Description: Configuration files for a custom initramfs
-diff --git a/meta/recipes-support/initramfs-config/files/postinst.tmpl b/meta/recipes-support/initramfs-config/files/postinst.tmpl
-new file mode 100644
-index 0000000..e523906
---- /dev/null
-+++ b/meta/recipes-support/initramfs-config/files/postinst.tmpl
-@@ -0,0 +1,50 @@
-+#!/bin/sh
-+# postinst script for initramfs-config
-+#
-+# see: dh_installdeb(1)
-+
-+set -e
-+
-+case "$1" in
-+    configure)
-+        INITRAMFS_CONF=/etc/initramfs-tools/initramfs.conf
-+        if [ -f ${INITRAMFS_CONF} ]; then
-+            sed -i -E 's/(^MODULES=).*/\1${INITRAMFS_MODULES}/' ${INITRAMFS_CONF}
-+            sed -i -E 's/(^BUSYBOX=).*/\1${INITRAMFS_BUSYBOX}/' ${INITRAMFS_CONF}
-+            sed -i -E 's/(^COMPRESS=).*/\1${INITRAMFS_COMPRESS}/' ${INITRAMFS_CONF}
-+            sed -i -E 's/(^KEYMAP=).*/\1${INITRAMFS_KEYMAP}/' ${INITRAMFS_CONF}
-+            sed -i -E 's/(^DEVICE=).*/\1${INITRAMFS_NET_DEVICE}/' ${INITRAMFS_CONF}
-+            sed -i -E 's/(^NFSROOT=).*/\1${INITRAMFS_NFSROOT}/' ${INITRAMFS_CONF}
-+            sed -i -E 's/(^RUNSIZE=).*/\1${INITRAMFS_RUNSIZE}/' ${INITRAMFS_CONF}
-+            if grep -Fxq "ROOT=" "${INITRAMFS_CONF}"; then
-+                sed -i -E 's/(^ROOT=).*/\1${INITRAMFS_ROOT}/' ${INITRAMFS_CONF}
-+            else
-+                sed -i -E "\$aROOT=${INITRAMFS_ROOT}" ${INITRAMFS_CONF}
-+            fi
-+        fi
-+
-+        MODULES_LIST_FILE=/etc/initramfs-tools/modules
-+        if [ -f ${MODULES_LIST_FILE} ]; then
-+            for modname in ${INITRAMFS_MODULE_LIST}; do
-+                if ! grep -Fxq "$modname" "${MODULES_LIST_FILE}"; then
-+                    echo "$modname" >> "${MODULES_LIST_FILE}"
-+                fi
-+            done
-+        fi
-+
-+        update-initramfs -v -u
-+
-+    ;;
-+    abort-upgrade|abort-remove|abort-deconfigure)
-+    ;;
-+
-+    *)
-+        echo "postinst called with unknown argument \`$1'" >&2
-+        exit 1
-+        ;;
-+esac
-+# dh_installdeb will replace this with shell code automatically
-+# generated by other debhelper scripts.
-+#DEBHELPER#
-+
-+exit 0
-diff --git a/meta/recipes-support/initramfs-config/files/postrm.tmpl b/meta/recipes-support/initramfs-config/files/postrm.tmpl
-new file mode 100644
-index 0000000..115d9b6
---- /dev/null
-+++ b/meta/recipes-support/initramfs-config/files/postrm.tmpl
-@@ -0,0 +1,41 @@
-+#!/bin/sh
-+# postrm script for initramfs-config
-+#
-+# see: dh_installdeb(1)
-+
-+set -e
-+
-+case "$1" in
-+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-+        # back to the debian defaults
-+        INITRAMFS_CONF=/etc/initramfs-tools/initramfs.conf
-+        sed -i -E 's/(^MODULES=).*/\1most/' ${INITRAMFS_CONF}
-+        sed -i -E 's/(^BUSYBOX=).*/\1auto/' ${INITRAMFS_CONF}
-+        sed -i -E 's/(^COMPRESS=).*/\1gzip/' ${INITRAMFS_CONF}
-+        sed -i -E 's/(^KEYMAP=).*/\1n/' ${INITRAMFS_CONF}
-+        sed -i -E 's/(^DEVICE=).*/\1/' ${INITRAMFS_CONF}
-+        sed -i -E 's/(^NFSROOT=).*/\1auto/' ${INITRAMFS_CONF}
-+        sed -i -E 's/(^RUNSIZE=).*/\110%/' ${INITRAMFS_CONF}
-+        sed -i -E 's/(^ROOT=).*//' ${INITRAMFS_CONF}
-+
-+        # remove the added modules
-+        MODULES_LIST_FILE=/etc/initramfs-tools/modules
-+        for modname in ${INITRAMFS_MODULE_LIST}; do
-+            sed -i -E 's/$modname//'
-+        done
-+
-+        update-initramfs -v -u
-+    ;;
-+
-+    *)
-+        echo "postrm called with unknown argument \`$1'" >&2
-+        exit 1
-+        ;;
-+esac
-+
-+# dh_installdeb will replace this with shell code automatically
-+# generated by other debhelper scripts.
-+
-+#DEBHELPER#
-+
-+exit 0
-diff --git a/meta/recipes-support/initramfs-config/initramfs-config.inc b/meta/recipes-support/initramfs-config/initramfs-config.inc
-new file mode 100644
-index 0000000..16049a9
---- /dev/null
-+++ b/meta/recipes-support/initramfs-config/initramfs-config.inc
-@@ -0,0 +1,32 @@
-+# This software is a part of ISAR.
-+# Copyright (C) 2020 Siemens AG
-+#
-+# SPDX-License-Identifier: MIT
-+inherit dpkg-raw
-+inherit template
-+DESCRIPTION = "Recipe to set the initramfs configuration and generate a new ramfs"
-+
-+FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/files:"
-+
-+SRC_URI = "file://postinst.tmpl \
-+           file://postrm.tmpl \
-+           file://control.tmpl \
-+          "
-+
-+INITRAMFS_MODULES ?= "most"
-+INITRAMFS_BUSYBOX ?= "auto"
-+INITRAMFS_COMPRESS ?= "gzip"
-+INITRAMFS_KEYMAP ?= "n"
-+INITRAMFS_NET_DEVICE ?= ""
-+INITRAMFS_NFSROOT ?= "auto"
-+INITRAMFS_RUNSIZE ?= "10%"
-+INITRAMFS_ROOT ?= ""
-+INITRAMFS_MODULE_LIST ?= ""
-+CREATE_NEW_INITRAMFS ?= "n"
-+KERNEL_PACKAGE = "${@ ("linux-image-" + d.getVar("KERNEL_NAME", True)) if d.getVar("KERNEL_NAME", True) else ""}"
-+DEBIAN_DEPENDS += ", ${KERNEL_PACKAGE}"
-+TEMPLATE_FILES = "postinst.tmpl control.tmpl postrm.tmpl"
-+TEMPLATE_VARS += "INITRAMFS_MODULES INITRAMFS_BUSYBOX INITRAMFS_COMPRESS \
-+                  INITRAMFS_KEYMAP INITRAMFS_NET_DEVICE INITRAMFS_NFSROOT \
-+                  INITRAMFS_RUNSIZE INITRAMFS_ROOT INITRAMFS_MODULE_LIST \
-+                  CREATE_NEW_INITRAMFS DEBIAN_DEPENDS PN"
--- 
-2.20.1
-
diff --git a/kas-cip.yml b/kas-cip.yml
index 8fb9004..8522957 100644
--- a/kas-cip.yml
+++ b/kas-cip.yml
@@ -25,10 +25,6 @@ repos:
     refspec: 03124cca669f50b682336a0bdf4ede5a4238e144
     layers:
       meta:
-    patches:
-      02-initramfs:
-        path: isar-patches/v7-0001-meta-support-Generate-a-custom-initramfs.patch
-        repo: cip-core
 
 bblayers_conf_header:
   standard: |
diff --git a/recipes-support/initramfs-config/files/postinst b/recipes-support/initramfs-config/files/postinst
new file mode 100644
index 0000000..2d4256d
--- /dev/null
+++ b/recipes-support/initramfs-config/files/postinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# patch local script
+patch -s -p0 /usr/share/initramfs-tools/scripts/local /usr/share/secureboot/secure-boot-debian-local.patch
+
+update-initramfs -v -u
diff --git a/recipes-support/initramfs-config/files/postinst.ext b/recipes-support/initramfs-config/files/postinst.ext
deleted file mode 100644
index cdafa74..0000000
--- a/recipes-support/initramfs-config/files/postinst.ext
+++ /dev/null
@@ -1,3 +0,0 @@
-if [ -d /usr/share/secureboot ]; then
-    patch -s -p0 /usr/share/initramfs-tools/scripts/local /usr/share/secureboot/secure-boot-debian-local.patch
-fi
diff --git a/recipes-support/initramfs-config/initramfs-abrootfs-secureboot_0.1.bb b/recipes-support/initramfs-config/initramfs-abrootfs-secureboot_0.1.bb
index f84f76f..4b257fa 100644
--- a/recipes-support/initramfs-config/initramfs-abrootfs-secureboot_0.1.bb
+++ b/recipes-support/initramfs-config/initramfs-abrootfs-secureboot_0.1.bb
@@ -8,24 +8,21 @@
 #
 # SPDX-License-Identifier: MIT
 
-require recipes-support/initramfs-config/initramfs-config.inc
+
+inherit dpkg-raw
 
 DEBIAN_DEPENDS += ", busybox, patch"
 
-SRC_URI += "file://postinst.ext \
+SRC_URI += "file://postinst \
             file://initramfs.lsblk.hook \
             file://initramfs.image_uuid.hook \
             file://secure-boot-debian-local-patch"
 
-INITRAMFS_BUSYBOX = "y"
-
 do_install() {
     # add patch for local to /usr/share/secure boot
     TARGET=${D}/usr/share/secureboot
     install -m 0755 -d ${TARGET}
     install -m 0644 ${WORKDIR}/secure-boot-debian-local-patch ${TARGET}/secure-boot-debian-local.patch
-    # patch postinst
-    sed -i -e '/configure)/r ${WORKDIR}/postinst.ext' ${WORKDIR}/postinst
 
     # add hooks for secure boot
     HOOKS=${D}/etc/initramfs-tools/hooks
-- 
2.20.1


[-- Attachment #2: Type: text/plain, Size: 428 bytes --]


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6609): https://lists.cip-project.org/g/cip-dev/message/6609
Mute This Topic: https://lists.cip-project.org/mt/84063674/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/4520388/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-08  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08  8:32 [cip-dev][isar-cip-core][PATCH] initramfs-config: Remove dependency to patch Quirin Gylstorff
2021-07-08  8:54 ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.