public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Alexander Smirnov <asmirnov@ilbers.de>
Cc: <isar-users@googlegroups.com>
Subject: Re: [PATCH v3 1/4] kernel/module: Add AUTOLOAD option
Date: Wed, 12 Sep 2018 15:15:48 +0200	[thread overview]
Message-ID: <20180912151548.6357ab81@md1pvb1c.ad001.siemens.net> (raw)
In-Reply-To: <20180307104655.19315-1-asmirnov@ilbers.de>

Am Wed, 7 Mar 2018 13:46:55 +0300
schrieb Alexander Smirnov <asmirnov@ilbers.de>:

> Add possibility to set kernel module to be autoloaded.
> File '/etc/modules' is created by kmod package, which is dependency of
> kernel image, so there is no need to add explicit deps to kernel
> module.
> 
> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
> ---
>  meta/recipes-kernel/linux-module/files/debian/control | 2 +-
>  meta/recipes-kernel/linux-module/module.inc           | 7 +++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-kernel/linux-module/files/debian/control
> b/meta/recipes-kernel/linux-module/files/debian/control index
> 707f857..1ee634c 100644 ---
> a/meta/recipes-kernel/linux-module/files/debian/control +++
> b/meta/recipes-kernel/linux-module/files/debian/control @@ -7,5 +7,5
> @@ Maintainer: ISAR project <isar-users@googlegroups.com> 
>  Package: @PN@
>  Architecture: any
> -Depends: linux-image-@KERNEL_NAME@
> +Depends: linux-image-@KERNEL_NAME@, kmod
>  Description: @DESCRIPTION@
> diff --git a/meta/recipes-kernel/linux-module/module.inc
> b/meta/recipes-kernel/linux-module/module.inc index aa232f7..ec1c4b0
> 100644 --- a/meta/recipes-kernel/linux-module/module.inc
> +++ b/meta/recipes-kernel/linux-module/module.inc
> @@ -13,6 +13,8 @@ DEPENDS += "linux-headers-${KERNEL_NAME}"
>  
>  SRC_URI += "file://debian/"
>  
> +AUTOLOAD ?= "0"
> +
>  inherit dpkg
>  
>  dpkg_runbuild_prepend() {
> @@ -21,4 +23,9 @@ dpkg_runbuild_prepend() {
>             -e 's/@KERNEL_NAME@/${KERNEL_NAME}/g' \
>             -e 's/@DESCRIPTION@/${DESCRIPTION}/g' \
>          ${WORKDIR}/${S}/debian/changelog
> ${WORKDIR}/${S}/debian/control +
> +    if [ ${AUTOLOAD} = "1" ]; then
> +        echo "echo ${PN} >> /etc/modules" >>
> ${WORKDIR}/${S}/debian/postinst
> +        chmod +x ${WORKDIR}/${S}/debian/postinst
> +    fi
>  }

The current approach is broken because the script is not idempotent.
Uninstalling the package will not unpatch /etc/modules. And installing
a second time will result in a second entry.

So we do need an extra postrm to make the package idempotent. And if we
are on systemd, we should create /etc/modules-load.d/ instead. (detect
systemd at post(rm|inst) runtime).

Henning 

Henning

  reply	other threads:[~2018-09-12 13:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 12:40 [RFC][PATCH 0/4] Kernel module autoload Alexander Smirnov
2018-03-06 12:40 ` [PATCH 1/4] kernel/module: Add AUTOLOAD option Alexander Smirnov
2018-03-06 12:59   ` Jan Kiszka
2018-03-07  7:19   ` Jan Kiszka
2018-03-07  7:36     ` Alexander Smirnov
2018-03-07  7:39       ` Jan Kiszka
2018-03-07  8:13         ` Alexander Smirnov
2018-03-07 10:46   ` [PATCH v3 " Alexander Smirnov
2018-09-12 13:15     ` Henning Schild [this message]
2018-03-06 12:40 ` [PATCH 2/4] example-module: Do not return error on init Alexander Smirnov
2018-03-06 12:58   ` Jan Kiszka
2018-03-06 15:40   ` [PATCH v2 " Alexander Smirnov
2018-03-06 15:56     ` Jan Kiszka
2018-03-06 16:26       ` Alexander Smirnov
2018-03-06 12:40 ` [PATCH 3/4] example-module: Enable autoload Alexander Smirnov
2018-03-06 12:40 ` [PATCH 4/4] vm_smoke_test: Add check for kernel module Alexander Smirnov
2018-03-07 10:47   ` [PATCH v2 " Alexander Smirnov
2018-03-09  8:49     ` Henning Schild

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=20180912151548.6357ab81@md1pvb1c.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.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