public inbox for buildroot@busybox.net
 help / color / mirror / Atom feed
From: unixmania at gmail.com <unixmania@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 4/5] package/owfs: use modules-load to load the kernel module
Date: Sat, 18 Apr 2020 19:14:10 -0300	[thread overview]
Message-ID: <20200418221411.1549783-5-unixmania@gmail.com> (raw)
In-Reply-To: <20200418221411.1549783-1-unixmania@gmail.com>

From: Carlos Santos <unixmania@gmail.com>

This is compatible with BusyBox/sysvinit (via S02modules-load), OpenRC
and systemd. It also prevents trying to load the module each time the
init script is executed.

Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
Tested on QEMU with a kernel config with FUSE_FS=m. Only the module
loading was tested, since there is no 1-wire device.
---
 package/owfs/S60owfs |  2 --
 package/owfs/owfs.mk | 11 +++++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/package/owfs/S60owfs b/package/owfs/S60owfs
index feed676f8a..46b7ec775d 100644
--- a/package/owfs/S60owfs
+++ b/package/owfs/S60owfs
@@ -10,8 +10,6 @@ OWFS_ARGS=""
 case "$1" in
 start)
 	printf "Starting ${NAME}: "
-	# Fuse may be in a module, so try to load it
-	modprobe -q fuse && printf "[fuse] "
 	mkdir -p ${OWFS_MOUNTPOINT}
 	start-stop-daemon -S -x ${DAEMON} -- \
 		--pid_file ${PID_F} -m ${OWFS_MOUNTPOINT} ${OWFS_DEVICES} \
diff --git a/package/owfs/owfs.mk b/package/owfs/owfs.mk
index ffc0b3098d..a09a4bb37b 100644
--- a/package/owfs/owfs.mk
+++ b/package/owfs/owfs.mk
@@ -35,6 +35,17 @@ define OWFS_CREATE_MOUNTPOINT
 	mkdir -p $(TARGET_DIR)/dev/1wire
 endef
 OWFS_POST_INSTALL_TARGET_HOOKS += OWFS_CREATE_MOUNTPOINT
+ifeq ($(BR2_LINUX_KERNEL),y)
+define OWFS_GEN_MODULES_CONF
+	$(INSTALL) -d -m 755 $(TARGET_DIR)/etc/modules-load.d
+	{ \
+		find $(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/kernel/fs/fuse -name 'fuse.ko*'; \
+	} 2> /dev/null | { \
+		sed 's:^.*/::; s:\.ko[^ ]*::'; \
+	} > $(TARGET_DIR)/etc/modules-load.d/60-owfs.conf
+endef
+OWFS_TARGET_FINALIZE_HOOKS += OWFS_GEN_MODULES_CONF
+endif
 else
 OWFS_CONF_OPTS += --disable-owfs
 endif
-- 
2.18.2

  parent reply	other threads:[~2020-04-18 22:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-18 22:14 [Buildroot] [PATCH v2 0/5] Add a kernel module loading mechanism unixmania at gmail.com
2020-04-18 22:14 ` [Buildroot] [PATCH v2 1/5] package/kmod: add modules-load init script unixmania at gmail.com
2020-04-19 10:31   ` Yann E. MORIN
2020-04-21 15:27   ` Matthew Weber
2020-04-18 22:14 ` [Buildroot] [PATCH v2 2/5] package/busybox: " unixmania at gmail.com
2020-04-19 10:37   ` Yann E. MORIN
2020-04-18 22:14 ` [Buildroot] [PATCH v2 3/5] package/dmraid: use modules-load to load the kernel module unixmania at gmail.com
2020-04-19 10:42   ` Yann E. MORIN
2020-04-19 12:49     ` Thomas Petazzoni
2020-04-19 13:24       ` Yann E. MORIN
2020-04-18 22:14 ` unixmania at gmail.com [this message]
2020-04-18 22:14 ` [Buildroot] [PATCH v2 5/5] package/ti-sgx-km: " unixmania at gmail.com

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=20200418221411.1549783-5-unixmania@gmail.com \
    --to=unixmania@gmail.com \
    --cc=buildroot@busybox.net \
    /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