From: Harald Seiler <hws@denx.de>
To: isar-users@googlegroups.com,
"Q. Gylstorff" <Quirin.Gylstorff@siemens.com>
Cc: jan.kiszka@siemens.com
Subject: Re: [PATCH v6 1/3] meta/support: Generate a custom initramfs
Date: Wed, 16 Sep 2020 14:24:16 +0200 [thread overview]
Message-ID: <3c3f04a8dd4545e3c7b6812b50924d4fb8ab9aa3.camel@denx.de> (raw)
In-Reply-To: <20200625125646.13365-2-Quirin.Gylstorff@siemens.com>
Hello,
On Thu, 2020-06-25 at 14:56 +0200, Q. Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>
> 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>
> ---
Are there any news on this patch?
One thing that just came to my mind: Maybe a mechanism should be added to
prevent multiple initramfs-config packages from being installed into the
same image? I fear that otherwise it could be easy to accidentally pull
in multiple such packages which would interfere with each other ...
--
Harald
> .../initramfs-config/initramfs-config_0.1.bb | 7 +++
> .../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, 142 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..0eb70d7
> --- /dev/null
> +++ b/meta-isar/recipes-support/initramfs-config/initramfs-config_0.1.bb
> @@ -0,0 +1,7 @@
> +#
> +# 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
>
next prev parent reply other threads:[~2020-09-16 12:24 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-27 13:27 [PATCH 0/3] some image classes Q. Gylstorff
2020-03-27 13:27 ` [PATCH 1/3] meta/classes: Generate a custom initramfs Q. Gylstorff
2020-03-30 7:25 ` Gylstorff Quirin
2020-03-30 8:08 ` Henning Schild
2020-03-27 13:28 ` [PATCH 2/3] meta/classes: Generate ova image for vmware or virtualbox Q. Gylstorff
2020-03-27 18:50 ` Henning Schild
2020-03-30 7:27 ` Gylstorff Quirin
2020-03-27 13:28 ` [PATCH 3/3] meta/classes: add cpiogz-img Q. Gylstorff
2020-03-27 19:01 ` Henning Schild
2020-03-30 7:29 ` Gylstorff Quirin
2020-03-27 14:51 ` [PATCH] Add ova configuration for testing Q. Gylstorff
2020-03-27 18:46 ` Henning Schild
2020-03-27 14:52 ` [PATCH] conf: Add multiconfig for cpiogz Q. Gylstorff
2020-04-03 14:55 ` [PATCH v2 0/3] some images classes Q. Gylstorff
2020-04-03 14:55 ` [PATCH v2 1/3] meta/support: Generate a custom initramfs Q. Gylstorff
2020-04-09 6:39 ` Henning Schild
2020-04-09 13:59 ` Gylstorff Quirin
2020-04-09 17:18 ` Henning Schild
2020-04-03 14:55 ` [PATCH v2 2/3] meta/classes: Generate ova image for vmware or virtualbox Q. Gylstorff
2020-04-09 6:48 ` Henning Schild
2020-04-09 14:28 ` Gylstorff Quirin
2020-04-03 14:55 ` [PATCH v2 3/3] meta/classes: add cpiogz-img Q. Gylstorff
2020-04-09 6:54 ` [PATCH v2 0/3] some images classes Henning Schild
2020-04-14 12:24 ` [PATCH v3 " Q. Gylstorff
2020-04-14 12:24 ` [PATCH v3 1/3] meta/support: Generate a custom initramfs Q. Gylstorff
2020-04-20 20:14 ` Henning Schild
2020-04-21 14:30 ` Gylstorff Quirin
2020-04-14 12:24 ` [PATCH v3 2/3] meta/classes: Generate ova image for vmware or virtualbox Q. Gylstorff
2020-04-14 12:24 ` [PATCH v3 3/3] meta/classes: add cpiogz-img Q. Gylstorff
2020-04-20 20:14 ` [PATCH v3 0/3] some images classes Henning Schild
2020-04-21 14:57 ` [PATCH v4 0/3] some images Q. Gylstorff
2020-04-21 14:57 ` [PATCH v4 1/3] meta/support: Generate a custom initramfs Q. Gylstorff
2020-04-21 14:57 ` [PATCH v4 2/3] meta/classes: Generate ova image for vmware or virtualbox Q. Gylstorff
2020-04-21 15:17 ` Jan Kiszka
2020-04-23 9:46 ` [PATCH v5 0/3] some images Q. Gylstorff
2020-04-23 9:46 ` [PATCH v5 1/3] meta/support: Generate a custom initramfs Q. Gylstorff
2020-06-18 15:54 ` Harald Seiler
2020-06-22 13:44 ` Gylstorff Quirin
2020-06-25 12:56 ` [PATCH v6 0/3] some images Q. Gylstorff
2020-06-25 12:56 ` [PATCH v6 1/3] meta/support: Generate a custom initramfs Q. Gylstorff
2020-09-16 12:24 ` Harald Seiler [this message]
2020-06-25 12:56 ` [PATCH v6 2/3] meta/classes: Generate ova image for vmware or virtualbox Q. Gylstorff
2020-06-25 12:56 ` [PATCH v6 3/3] meta/classes: add cpiogz-img Q. Gylstorff
2020-10-13 10:22 ` [PATCH v6 0/3] some images Jan Kiszka
2021-02-05 10:07 ` Gylstorff Quirin
2021-02-05 10:52 ` [PATCH v7 0/2] CPIO & OVA Images Q. Gylstorff
2021-02-05 10:52 ` [PATCH v7 1/2] meta/classes: Generate ova image for vmware or virtualbox Q. Gylstorff
2021-02-05 11:16 ` Jan Kiszka
2021-02-05 10:52 ` [PATCH v7 2/2] meta/classes: add cpiogz-img Q. Gylstorff
2021-02-05 11:09 ` Jan Kiszka
2021-02-05 15:57 ` [PATCH v8 0/2] CPIO & OVA Images Q. Gylstorff
2021-02-05 15:57 ` [PATCH v8 1/2] meta/classes: Generate ova image for VMWare or Virtualbox Q. Gylstorff
2021-03-26 11:47 ` Anton Mikanovich
2021-02-05 15:57 ` [PATCH v8 2/2] meta/classes: add cpiogz-img Q. Gylstorff
2021-03-26 11:51 ` Anton Mikanovich
2020-04-23 9:46 ` [PATCH v5 2/3] meta/classes: Generate ova image for vmware or virtualbox Q. Gylstorff
2020-04-23 9:46 ` [PATCH v5 3/3] meta/classes: add cpiogz-img Q. Gylstorff
2020-04-21 14:57 ` [PATCH v4 " Q. Gylstorff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3c3f04a8dd4545e3c7b6812b50924d4fb8ab9aa3.camel@denx.de \
--to=hws@denx.de \
--cc=Quirin.Gylstorff@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox