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 5/5] package/ti-sgx-km: use modules-load to load the kernel module
Date: Sat, 18 Apr 2020 19:14:11 -0300	[thread overview]
Message-ID: <20200418221411.1549783-6-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.

Remove the insmod command from the ti-sgx-um init script.

Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
Tested on a BeagleBone Black card using beaglebone_qt5_defconfig.
---
 package/ti-sgx-km/ti-sgx-km.mk | 10 ++++++++++
 package/ti-sgx-um/S80ti-sgx    | 19 ++-----------------
 2 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/package/ti-sgx-km/ti-sgx-km.mk b/package/ti-sgx-km/ti-sgx-km.mk
index ae294c300a..7f627f276b 100644
--- a/package/ti-sgx-km/ti-sgx-km.mk
+++ b/package/ti-sgx-km/ti-sgx-km.mk
@@ -33,4 +33,14 @@ define TI_SGX_KM_INSTALL_TARGET_CMDS
 		kbuild_install -C $(@D)/$(TI_SGX_KM_SUBDIR)
 endef
 
+define TI_SGX_KM_GEN_MODULES_CONF
+	$(INSTALL) -d -m 755 $(TARGET_DIR)/etc/modules-load.d
+	{ \
+		find $(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/extra -name 'pvrsrvkm.ko*'; \
+	} 2> /dev/null | { \
+		sed 's:^.*/::; s:\.ko[^ ]*::'; \
+	} > $(TARGET_DIR)/etc/modules-load.d/50-ti-sgx-km.conf
+endef
+TI_SGX_KM_TARGET_FINALIZE_HOOKS += TI_SGX_KM_GEN_MODULES_CONF
+
 $(eval $(generic-package))
diff --git a/package/ti-sgx-um/S80ti-sgx b/package/ti-sgx-um/S80ti-sgx
index 2630a0576a..0f183b6fc5 100644
--- a/package/ti-sgx-um/S80ti-sgx
+++ b/package/ti-sgx-um/S80ti-sgx
@@ -1,24 +1,9 @@
 #!/bin/sh
 
-pvrsrvkm_ko="/lib/modules/$(/bin/uname -r)/extra/pvrsrvkm.ko"
-
-pvr_loaded() {
-	/sbin/lsmod | /bin/grep -q '^\<pvrsrvkm\>'
-}
-
-pvr_load() {
-	/sbin/insmod "$pvrsrvkm_ko" > /dev/null 2>&1
-}
-
 start() {
-	printf 'Loading pvrsrvkm module: '
-	pvr_loaded || pvr_load
+	printf 'Starting PowerVR services: '
+	/usr/bin/pvrsrvctl --start --no-module > /dev/null 2>&1
 	status=$?
-	if [ "$status" -eq 0 ]; then
-		printf 'Starting PowerVR services: '
-		/usr/bin/pvrsrvctl --start --no-module > /dev/null 2>&1
-		status=$?
-	fi
 	if [ "$status" -eq 0 ]; then
 		echo "OK"
 	else
-- 
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 ` [Buildroot] [PATCH v2 4/5] package/owfs: " unixmania at gmail.com
2020-04-18 22:14 ` unixmania at gmail.com [this message]

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-6-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