* [RFC][PATCH 0/4] Kernel module autoload @ 2018-03-06 12:40 Alexander Smirnov 2018-03-06 12:40 ` [PATCH 1/4] kernel/module: Add AUTOLOAD option Alexander Smirnov ` (3 more replies) 0 siblings, 4 replies; 18+ messages in thread From: Alexander Smirnov @ 2018-03-06 12:40 UTC (permalink / raw) To: isar-users; +Cc: Alexander Smirnov Hi all, this series makes possible to set kernel module to be loaded automatically on boot. This feature is now used in automatic smoke test. With best regards, Alex Alexander Smirnov (4): kernel/module: Add AUTOLOAD option example-module: Do not return error on init example-module: Enable autoload vm_smoke_test: Add check for kernel module .../example-module/example-module.bb | 2 ++ .../example-module/files/src/example-module.c | 2 +- .../linux-module/files/debian/control | 2 +- meta/recipes-kernel/linux-module/module.inc | 7 ++++++ scripts/vm_smoke_test | 27 ++++++++++++++++++---- 5 files changed, 33 insertions(+), 7 deletions(-) -- 2.1.4 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/4] kernel/module: Add AUTOLOAD option 2018-03-06 12:40 [RFC][PATCH 0/4] Kernel module autoload Alexander Smirnov @ 2018-03-06 12:40 ` Alexander Smirnov 2018-03-06 12:59 ` Jan Kiszka ` (2 more replies) 2018-03-06 12:40 ` [PATCH 2/4] example-module: Do not return error on init Alexander Smirnov ` (2 subsequent siblings) 3 siblings, 3 replies; 18+ messages in thread From: Alexander Smirnov @ 2018-03-06 12:40 UTC (permalink / raw) To: isar-users; +Cc: Alexander Smirnov Add possibility to set kernel module to be autoloaded. Also add run dependency from 'systemd' because this package owns the content of '/etc/modules-load.d'. 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..0eae9a4 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@, systemd Description: @DESCRIPTION@ diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc index aa232f7..0684659 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-load.d/${PN}.conf" >> ${WORKDIR}/${S}/debian/postinst + chmod +x ${WORKDIR}/${S}/debian/postinst + fi } -- 2.1.4 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] kernel/module: Add AUTOLOAD option 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 10:46 ` [PATCH v3 " Alexander Smirnov 2 siblings, 0 replies; 18+ messages in thread From: Jan Kiszka @ 2018-03-06 12:59 UTC (permalink / raw) To: Alexander Smirnov, isar-users On 2018-03-06 13:40, Alexander Smirnov wrote: > Add possibility to set kernel module to be autoloaded. > Also add run dependency from 'systemd' because this package owns the > content of '/etc/modules-load.d'. > > 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..0eae9a4 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@, systemd > Description: @DESCRIPTION@ > diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc > index aa232f7..0684659 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-load.d/${PN}.conf" >> ${WORKDIR}/${S}/debian/postinst > + chmod +x ${WORKDIR}/${S}/debian/postinst > + fi > } > Useful! Also for jailhouse-images. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] kernel/module: Add AUTOLOAD option 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 10:46 ` [PATCH v3 " Alexander Smirnov 2 siblings, 1 reply; 18+ messages in thread From: Jan Kiszka @ 2018-03-07 7:19 UTC (permalink / raw) To: Alexander Smirnov, isar-users On 2018-03-06 13:40, Alexander Smirnov wrote: > Add possibility to set kernel module to be autoloaded. > Also add run dependency from 'systemd' because this package owns the > content of '/etc/modules-load.d'. > > 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..0eae9a4 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@, systemd Why this, BTW? Jan > Description: @DESCRIPTION@ > diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc > index aa232f7..0684659 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-load.d/${PN}.conf" >> ${WORKDIR}/${S}/debian/postinst > + chmod +x ${WORKDIR}/${S}/debian/postinst > + fi > } > -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] kernel/module: Add AUTOLOAD option 2018-03-07 7:19 ` Jan Kiszka @ 2018-03-07 7:36 ` Alexander Smirnov 2018-03-07 7:39 ` Jan Kiszka 0 siblings, 1 reply; 18+ messages in thread From: Alexander Smirnov @ 2018-03-07 7:36 UTC (permalink / raw) To: Jan Kiszka, isar-users On 03/07/2018 10:19 AM, Jan Kiszka wrote: > On 2018-03-06 13:40, Alexander Smirnov wrote: >> Add possibility to set kernel module to be autoloaded. >> Also add run dependency from 'systemd' because this package owns the >> content of '/etc/modules-load.d'. >> >> 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..0eae9a4 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@, systemd > > Why this, BTW? See comment to the patch: 8<-- Also add run dependency from 'systemd' because this package owns the content of '/etc/modules-load.d'. 8<-- So if this dependency is not set, the module.postinst script could be run *before* '/etc/modules*' infrastructure is created. Alex > > Jan > >> Description: @DESCRIPTION@ >> diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc >> index aa232f7..0684659 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-load.d/${PN}.conf" >> ${WORKDIR}/${S}/debian/postinst >> + chmod +x ${WORKDIR}/${S}/debian/postinst >> + fi >> } >> > -- With best regards, Alexander Smirnov ilbers GmbH Baierbrunner Str. 28c D-81379 Munich +49 (89) 122 67 24-0 http://ilbers.de/ Commercial register Munich, HRB 214197 General manager: Baurzhan Ismagulov ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] kernel/module: Add AUTOLOAD option 2018-03-07 7:36 ` Alexander Smirnov @ 2018-03-07 7:39 ` Jan Kiszka 2018-03-07 8:13 ` Alexander Smirnov 0 siblings, 1 reply; 18+ messages in thread From: Jan Kiszka @ 2018-03-07 7:39 UTC (permalink / raw) To: Alexander Smirnov, isar-users On 2018-03-07 08:36, Alexander Smirnov wrote: > > > On 03/07/2018 10:19 AM, Jan Kiszka wrote: >> On 2018-03-06 13:40, Alexander Smirnov wrote: >>> Add possibility to set kernel module to be autoloaded. >>> Also add run dependency from 'systemd' because this package owns the >>> content of '/etc/modules-load.d'. >>> >>> 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..0eae9a4 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@, systemd >> >> Why this, BTW? > > See comment to the patch: > > 8<-- > Also add run dependency from 'systemd' because this package owns the > content of '/etc/modules-load.d'. > 8<-- > > So if this dependency is not set, the module.postinst script could be > run *before* '/etc/modules*' infrastructure is created. ...and that means? Also, is systemd now the only provider of this infrastructure in Debian? Jan ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/4] kernel/module: Add AUTOLOAD option 2018-03-07 7:39 ` Jan Kiszka @ 2018-03-07 8:13 ` Alexander Smirnov 0 siblings, 0 replies; 18+ messages in thread From: Alexander Smirnov @ 2018-03-07 8:13 UTC (permalink / raw) To: Jan Kiszka, isar-users On 03/07/2018 10:39 AM, Jan Kiszka wrote: > On 2018-03-07 08:36, Alexander Smirnov wrote: >> >> >> On 03/07/2018 10:19 AM, Jan Kiszka wrote: >>> On 2018-03-06 13:40, Alexander Smirnov wrote: >>>> Add possibility to set kernel module to be autoloaded. >>>> Also add run dependency from 'systemd' because this package owns the >>>> content of '/etc/modules-load.d'. >>>> >>>> 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..0eae9a4 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@, systemd >>> >>> Why this, BTW? >> >> See comment to the patch: >> >> 8<-- >> Also add run dependency from 'systemd' because this package owns the >> content of '/etc/modules-load.d'. >> 8<-- >> >> So if this dependency is not set, the module.postinst script could be >> run *before* '/etc/modules*' infrastructure is created. > > ...and that means? > > Also, is systemd now the only provider of this infrastructure in Debian? > I have no 100% evidences. I see that there are mainly 2 ways to load kernel modules at boot time: 1. Add it to /etc/modules file. I've checked, this file is created by kmod package (kmod.postinst), so dependency from kmod should be added. 2. Create separate config file with module in /etc/modules-load.d. This folder is created by systemd. I've checked, this package is installed by default for all the distributions: wheezy, jessie and stretch. But in general I didn't find if that's the preferred way to load module. Some official Debian wiki (https://wiki.debian.org/Modules) mentioned: ... If you want to get a module to autoload when a device is accessed you can often add a file to /etc/modutils and run update-modules to generate /etc/modules.conf. ... But 'man update-modules' states: ... update-modules is an obsolete command which does nothing. Any program calling it should be fixed by not using it anymore. ... So, no idea what is the mainstream now. Alex ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 1/4] kernel/module: Add AUTOLOAD option 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 10:46 ` Alexander Smirnov 2018-09-12 13:15 ` Henning Schild 2 siblings, 1 reply; 18+ messages in thread From: Alexander Smirnov @ 2018-03-07 10:46 UTC (permalink / raw) To: isar-users; +Cc: Alexander Smirnov 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 } -- 2.1.4 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/4] kernel/module: Add AUTOLOAD option 2018-03-07 10:46 ` [PATCH v3 " Alexander Smirnov @ 2018-09-12 13:15 ` Henning Schild 0 siblings, 0 replies; 18+ messages in thread From: Henning Schild @ 2018-09-12 13:15 UTC (permalink / raw) To: Alexander Smirnov; +Cc: isar-users 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 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 2/4] example-module: Do not return error on init 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:40 ` Alexander Smirnov 2018-03-06 12:58 ` Jan Kiszka 2018-03-06 15:40 ` [PATCH v2 " 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 3 siblings, 2 replies; 18+ messages in thread From: Alexander Smirnov @ 2018-03-06 12:40 UTC (permalink / raw) To: isar-users; +Cc: Alexander Smirnov Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de> --- meta-isar/recipes-kernel/example-module/files/src/example-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta-isar/recipes-kernel/example-module/files/src/example-module.c b/meta-isar/recipes-kernel/example-module/files/src/example-module.c index 07cb214..ef25dd9 100644 --- a/meta-isar/recipes-kernel/example-module/files/src/example-module.c +++ b/meta-isar/recipes-kernel/example-module/files/src/example-module.c @@ -11,7 +11,7 @@ static int __init example_module_init(void) { printk("Just an example\n"); - return -ENOANO; + return 0; } module_init(example_module_init); -- 2.1.4 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/4] example-module: Do not return error on init 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 1 sibling, 0 replies; 18+ messages in thread From: Jan Kiszka @ 2018-03-06 12:58 UTC (permalink / raw) To: Alexander Smirnov, isar-users On 2018-03-06 13:40, Alexander Smirnov wrote: > Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de> > --- > meta-isar/recipes-kernel/example-module/files/src/example-module.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/meta-isar/recipes-kernel/example-module/files/src/example-module.c b/meta-isar/recipes-kernel/example-module/files/src/example-module.c > index 07cb214..ef25dd9 100644 > --- a/meta-isar/recipes-kernel/example-module/files/src/example-module.c > +++ b/meta-isar/recipes-kernel/example-module/files/src/example-module.c > @@ -11,7 +11,7 @@ > static int __init example_module_init(void) > { > printk("Just an example\n"); > - return -ENOANO; > + return 0; > } > > module_init(example_module_init); > IIRC, you then need to provide a module_exit handler, or that module cannot be unloaded again. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v2 2/4] example-module: Do not return error on init 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 ` Alexander Smirnov 2018-03-06 15:56 ` Jan Kiszka 1 sibling, 1 reply; 18+ messages in thread From: Alexander Smirnov @ 2018-03-06 15:40 UTC (permalink / raw) To: isar-users; +Cc: Alexander Smirnov Also make module re-loadable by adding exit hook. Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de> --- .../recipes-kernel/example-module/files/src/example-module.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/meta-isar/recipes-kernel/example-module/files/src/example-module.c b/meta-isar/recipes-kernel/example-module/files/src/example-module.c index 07cb214..4e74ee7 100644 --- a/meta-isar/recipes-kernel/example-module/files/src/example-module.c +++ b/meta-isar/recipes-kernel/example-module/files/src/example-module.c @@ -11,9 +11,15 @@ static int __init example_module_init(void) { printk("Just an example\n"); - return -ENOANO; + return 0; +} + +static void __exit example_module_exit(void) +{ + return; } module_init(example_module_init); +module_exit(example_module_exit); MODULE_LICENSE("GPL"); -- 2.1.4 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 2/4] example-module: Do not return error on init 2018-03-06 15:40 ` [PATCH v2 " Alexander Smirnov @ 2018-03-06 15:56 ` Jan Kiszka 2018-03-06 16:26 ` Alexander Smirnov 0 siblings, 1 reply; 18+ messages in thread From: Jan Kiszka @ 2018-03-06 15:56 UTC (permalink / raw) To: Alexander Smirnov, isar-users On 2018-03-06 16:40, Alexander Smirnov wrote: > Also make module re-loadable by adding exit hook. > > Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de> > --- > .../recipes-kernel/example-module/files/src/example-module.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/meta-isar/recipes-kernel/example-module/files/src/example-module.c b/meta-isar/recipes-kernel/example-module/files/src/example-module.c > index 07cb214..4e74ee7 100644 > --- a/meta-isar/recipes-kernel/example-module/files/src/example-module.c > +++ b/meta-isar/recipes-kernel/example-module/files/src/example-module.c > @@ -11,9 +11,15 @@ > static int __init example_module_init(void) > { > printk("Just an example\n"); > - return -ENOANO; > + return 0; > +} > + > +static void __exit example_module_exit(void) > +{ > + return; > } > > module_init(example_module_init); > +module_exit(example_module_exit); > > MODULE_LICENSE("GPL"); > Looks better :) Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 2/4] example-module: Do not return error on init 2018-03-06 15:56 ` Jan Kiszka @ 2018-03-06 16:26 ` Alexander Smirnov 0 siblings, 0 replies; 18+ messages in thread From: Alexander Smirnov @ 2018-03-06 16:26 UTC (permalink / raw) To: Jan Kiszka, isar-users On 03/06/2018 06:56 PM, Jan Kiszka wrote: > On 2018-03-06 16:40, Alexander Smirnov wrote: >> Also make module re-loadable by adding exit hook. >> >> Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de> >> --- >> .../recipes-kernel/example-module/files/src/example-module.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/meta-isar/recipes-kernel/example-module/files/src/example-module.c b/meta-isar/recipes-kernel/example-module/files/src/example-module.c >> index 07cb214..4e74ee7 100644 >> --- a/meta-isar/recipes-kernel/example-module/files/src/example-module.c >> +++ b/meta-isar/recipes-kernel/example-module/files/src/example-module.c >> @@ -11,9 +11,15 @@ >> static int __init example_module_init(void) >> { >> printk("Just an example\n"); >> - return -ENOANO; >> + return 0; >> +} >> + >> +static void __exit example_module_exit(void) >> +{ >> + return; >> } >> >> module_init(example_module_init); >> +module_exit(example_module_exit); >> >> MODULE_LICENSE("GPL"); >> > > Looks better :) Thanks for the hint, you were right regarding exit. :-) Alex ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 3/4] example-module: Enable autoload 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:40 ` [PATCH 2/4] example-module: Do not return error on init Alexander Smirnov @ 2018-03-06 12:40 ` Alexander Smirnov 2018-03-06 12:40 ` [PATCH 4/4] vm_smoke_test: Add check for kernel module Alexander Smirnov 3 siblings, 0 replies; 18+ messages in thread From: Alexander Smirnov @ 2018-03-06 12:40 UTC (permalink / raw) To: isar-users; +Cc: Alexander Smirnov Load module on boot. Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de> --- meta-isar/recipes-kernel/example-module/example-module.bb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta-isar/recipes-kernel/example-module/example-module.bb b/meta-isar/recipes-kernel/example-module/example-module.bb index c7042cf..dbaf5ac 100644 --- a/meta-isar/recipes-kernel/example-module/example-module.bb +++ b/meta-isar/recipes-kernel/example-module/example-module.bb @@ -10,3 +10,5 @@ include recipes-kernel/linux-module/module.inc SRC_URI += "file://src" S = "src" + +AUTOLOAD = "1" -- 2.1.4 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 4/4] vm_smoke_test: Add check for kernel module 2018-03-06 12:40 [RFC][PATCH 0/4] Kernel module autoload Alexander Smirnov ` (2 preceding siblings ...) 2018-03-06 12:40 ` [PATCH 3/4] example-module: Enable autoload Alexander Smirnov @ 2018-03-06 12:40 ` Alexander Smirnov 2018-03-07 10:47 ` [PATCH v2 " Alexander Smirnov 3 siblings, 1 reply; 18+ messages in thread From: Alexander Smirnov @ 2018-03-06 12:40 UTC (permalink / raw) To: isar-users; +Cc: Alexander Smirnov Check if example-module successfully loaded on boot. Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de> --- scripts/vm_smoke_test | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test index 7263cc4..c400d21 100755 --- a/scripts/vm_smoke_test +++ b/scripts/vm_smoke_test @@ -6,13 +6,27 @@ CONSOLE_OUTPUT=/tmp/isar_console PID_FILE=/tmp/qemu.pid -check_output() { +check_login_prompt() { + echo -n "Check login prompt: " + str=$(tail -1 $CONSOLE_OUTPUT) if [ "$str" = "isar login: " ]; then - echo "Test: PASSED" + echo "PASSED" + else + echo "FAIL" + fi +} + +check_example_module() { + echo -n "Check example module: " + + str=$(grep "Just an example" $CONSOLE_OUTPUT) + + if [ -n "$str" ]; then + echo "PASSED" else - echo "Test: FAIL" + echo "FAIL" fi } @@ -28,8 +42,11 @@ run_test () { sleep 30 kill `cat $PID_FILE` - # Check output - check_output + # Check login prompt + check_login_prompt + + # Check kernel module + check_example_module # Clean up test artifacts rm $CONSOLE_OUTPUT -- 2.1.4 ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v2 4/4] vm_smoke_test: Add check for kernel module 2018-03-06 12:40 ` [PATCH 4/4] vm_smoke_test: Add check for kernel module Alexander Smirnov @ 2018-03-07 10:47 ` Alexander Smirnov 2018-03-09 8:49 ` Henning Schild 0 siblings, 1 reply; 18+ messages in thread From: Alexander Smirnov @ 2018-03-07 10:47 UTC (permalink / raw) To: isar-users; +Cc: Alexander Smirnov Check if example-module successfully loaded on boot. Also return non-zero code if some test failed. Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de> --- scripts/vm_smoke_test | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test index 7263cc4..60c78da 100755 --- a/scripts/vm_smoke_test +++ b/scripts/vm_smoke_test @@ -6,13 +6,39 @@ CONSOLE_OUTPUT=/tmp/isar_console PID_FILE=/tmp/qemu.pid -check_output() { - str=$(tail -1 $CONSOLE_OUTPUT) +RET=0 - if [ "$str" = "isar login: " ]; then - echo "Test: PASSED" +dump_boot_log() { + echo "Boot log: 8<--" + cat $CONSOLE_OUTPUT + echo -e "\n8<--" +} + +check_login_prompt() { + echo -n "Check login prompt: " + + str=$(grep "isar login: " $CONSOLE_OUTPUT) + + if [ -n "$str" ]; then + echo "PASSED" + else + echo "FAIL" + dump_boot_log + RET=1 + fi +} + +check_example_module() { + echo -n "Check example module: " + + str=$(grep "Just an example" $CONSOLE_OUTPUT) + + if [ -n "$str" ]; then + echo "PASSED" else - echo "Test: FAIL" + echo "FAIL" + dump_boot_log + RET=1 fi } @@ -28,8 +54,11 @@ run_test () { sleep 30 kill `cat $PID_FILE` - # Check output - check_output + # Check login prompt + check_login_prompt + + # Check kernel module + check_example_module # Clean up test artifacts rm $CONSOLE_OUTPUT @@ -51,3 +80,5 @@ run_test i386 stretch # ARM64 machine run_test arm64 stretch + +exit $RET -- 2.1.4 ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 4/4] vm_smoke_test: Add check for kernel module 2018-03-07 10:47 ` [PATCH v2 " Alexander Smirnov @ 2018-03-09 8:49 ` Henning Schild 0 siblings, 0 replies; 18+ messages in thread From: Henning Schild @ 2018-03-09 8:49 UTC (permalink / raw) To: Alexander Smirnov; +Cc: isar-users I posted a patch that returns the sum of failures, might also be useful. Henning Am Wed, 7 Mar 2018 13:47:48 +0300 schrieb Alexander Smirnov <asmirnov@ilbers.de>: > Check if example-module successfully loaded on boot. Also return > non-zero code if some test failed. > > Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de> > --- > scripts/vm_smoke_test | 45 > ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 > insertions(+), 7 deletions(-) > > diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test > index 7263cc4..60c78da 100755 > --- a/scripts/vm_smoke_test > +++ b/scripts/vm_smoke_test > @@ -6,13 +6,39 @@ > CONSOLE_OUTPUT=/tmp/isar_console > PID_FILE=/tmp/qemu.pid > > -check_output() { > - str=$(tail -1 $CONSOLE_OUTPUT) > +RET=0 > > - if [ "$str" = "isar login: " ]; then > - echo "Test: PASSED" > +dump_boot_log() { > + echo "Boot log: 8<--" > + cat $CONSOLE_OUTPUT > + echo -e "\n8<--" > +} > + > +check_login_prompt() { > + echo -n "Check login prompt: " > + > + str=$(grep "isar login: " $CONSOLE_OUTPUT) > + > + if [ -n "$str" ]; then > + echo "PASSED" > + else > + echo "FAIL" > + dump_boot_log > + RET=1 > + fi > +} > + > +check_example_module() { > + echo -n "Check example module: " > + > + str=$(grep "Just an example" $CONSOLE_OUTPUT) > + > + if [ -n "$str" ]; then > + echo "PASSED" > else > - echo "Test: FAIL" > + echo "FAIL" > + dump_boot_log > + RET=1 > fi > } > > @@ -28,8 +54,11 @@ run_test () { > sleep 30 > kill `cat $PID_FILE` > > - # Check output > - check_output > + # Check login prompt > + check_login_prompt > + > + # Check kernel module > + check_example_module > > # Clean up test artifacts > rm $CONSOLE_OUTPUT > @@ -51,3 +80,5 @@ run_test i386 stretch > > # ARM64 machine > run_test arm64 stretch > + > +exit $RET ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2018-09-12 13:15 UTC | newest] Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox