From patchwork Sat Apr 18 22:14:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1272738 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=HSDuFyaM; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 494S1N0DM7z9sRN for ; Sun, 19 Apr 2020 08:14:30 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7296287B77; Sat, 18 Apr 2020 22:14:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Us-2uc8lJ7iP; Sat, 18 Apr 2020 22:14:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 600D687B5E; Sat, 18 Apr 2020 22:14:25 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 6B04E1BF577 for ; Sat, 18 Apr 2020 22:14:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 667F485CFF for ; Sat, 18 Apr 2020 22:14:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id li-MHjRhVJoQ for ; Sat, 18 Apr 2020 22:14:22 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 23FF185AE9 for ; Sat, 18 Apr 2020 22:14:22 +0000 (UTC) Received: by mail-qv1-f68.google.com with SMTP id w18so2397073qvs.3 for ; Sat, 18 Apr 2020 15:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TNXo+243M8qhsQGaQUuj1RBQ5Qe8r2XEVf+n5O0PFCU=; b=HSDuFyaMKnLAeaPYqmRt3zqkawinCNI3cWaKfx3anh2lv8A8SDN+WtEgfStr9v4nZJ y6DT+80VNYJGUNitm5biqx7oIk/etZ6+Sro5tFND9vuELfkLYwAGvBOqKImLWzzQK329 yi5w/EFsNHIkDOmnt6J6ae4RQLfkbEXT9dZD/XJ8ia+HtE/F7r+qMSD4U+kOybsc6YDe 0Lx5ge8trK3hO7ij+zRFZBgtWijAxNHG/p9KPsPuJ534BMM3ZIXu/VbaBmjz93os0hb6 x3rCgi3YyIq3gnwlhIA1TRfNnSu/bnRok5W7zCURefNM7vQ2KQtzewEqi6ftrxifB7b7 eajA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TNXo+243M8qhsQGaQUuj1RBQ5Qe8r2XEVf+n5O0PFCU=; b=jZwl8CeBLq7NM4rg3PegHKq3Qf0WYEBEdZWjQHpPuGUm7AAwzquJCtKKVv2eqpRRTX ZQYzpOWV8QbVEub6y/ORmyBJAwW1dqgWd/fDp1CLxuLkNC+xYUI+GBoGuUJ7eenpZbLo 8+9sMRlv1r339ASM3i/bR2sVrzGTCm3+zcVsqA0t86lc4Dht/MM1nukWfvRrKHul6CZi zPWOEZJsi0f5igbn2ZzRp8OSLb1lCrLuOrRiL3frHwPrGorNb+MD5gmb33k2yeGVeHx5 2nQJE8W8rcq+MA+HKgvxTpQRq1HMhoWiSJTkxYG3lEVXHEI9uaGQ3zN9oJ2XdllVoXSj Ar1g== X-Gm-Message-State: AGi0Pua8Gd50ZxNKwYkLe0NhWCjoFPI6HtWXvKBDDCB4dCD1IO3vHhbF hv/758ZMHL01SlmXn6PgxhJpsoLCT0U= X-Google-Smtp-Source: APiQypIa71NRidemX4o5sSJD08J5Q+ApfVTYm/nnhkWdZrxe5E2JXalMiyrFt5luz6IjsXU6UUOcwA== X-Received: by 2002:a0c:bd17:: with SMTP id m23mr7525002qvg.37.1587248060293; Sat, 18 Apr 2020 15:14:20 -0700 (PDT) Received: from casantos.remote.csb.com (189.27.141.225.dynamic.adsl.gvt.net.br. [189.27.141.225]) by smtp.gmail.com with ESMTPSA id h3sm5335252qkf.15.2020.04.18.15.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 15:14:19 -0700 (PDT) From: unixmania@gmail.com To: buildroot@buildroot.org Date: Sat, 18 Apr 2020 19:14:07 -0300 Message-Id: <20200418221411.1549783-2-unixmania@gmail.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20200418221411.1549783-1-unixmania@gmail.com> References: <20200418221411.1549783-1-unixmania@gmail.com> Subject: [Buildroot] [PATCH v2 1/5] package/kmod: add modules-load init script X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Santos , Lothar Felten , "Yann E. MORIN" , Adam Duskett MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Carlos Santos Use some scripting to mimic the systemd "modules-load" and the OpenRC "modules" services (load kernel modules based on static configuration). The configuration files should simply contain a list of kernel module names to load, separated by newlines. Empty lines and lines whose first non-whitespace character is # or ; are ignored. The configuration directory list and file format is the same as the one described in modules-load.d(5). Files are loaded in the following order: /etc/modules-load.d/*.conf /run/modules-load.d/*.conf /usr/lib/modules-load.d/*.conf This roughly mimics the logic used by systemd but the files are not sorted by their filename in lexicographic order as systemd does. Notice that OpenRC uses /etc/modules-load.d/*.conf, only, and does not ignore lines beginning with ';'. The file redirections do the following: - stdout is redirected to syslog with facility.level "kern.info" - stderr is redirected to syslog with facility.level "kern.err" - file dscriptor 4 is used to pass the result to the "start" function. Signed-off-by: Carlos Santos --- CC: "Yann E. MORIN" --- Changes v1->v2: - Redirect output to syslog only if /usr/bin/logger exists, as made in package/procps-ng/S02sysctl. - Use the MODULES_LOAD_ARGS variable, optionally set in /etc/default/modules-load. - Rename S02modules-load to S11modules-load to ensure that it runs after S10mdev and S10udev, which both are going to trigger cold-plug events that may in turn trigger module loading, as observed by Yann E. MORIN. - Prevent the installation of S11modules-load with openrc, which already provides the /etc/init.d/modules script. - Reorganize the comments in S11modules-load. --- package/kmod/S11modules-load | 115 +++++++++++++++++++++++++++++++++++ package/kmod/kmod.mk | 10 +++ 2 files changed, 125 insertions(+) create mode 100644 package/kmod/S11modules-load diff --git a/package/kmod/S11modules-load b/package/kmod/S11modules-load new file mode 100644 index 0000000000..9010230e23 --- /dev/null +++ b/package/kmod/S11modules-load @@ -0,0 +1,115 @@ +#!/bin/sh +# +# Use some scripting to mimic the systemd "modules-load" and the OpenRC +# "modules" services (load kernel modules based on static configuration). +# +# The configuration files should simply contain a list of kernel module +# names to load, separated by newlines. Empty lines and lines whose first +# non-whitespace character is # or ; are ignored. +# +# The configuration directory list and file format is the same as the one +# described in modules-load.d(5). Files are loaded in the following order: +# +# /etc/modules-load.d/*.conf +# /run/modules-load.d/*.conf +# /usr/lib/modules-load.d/*.conf +# +# This roughly mimics the logic used by systemd but the files are not sorted +# by their filename in lexicographic order as systemd does. +# +# Notice that OpenRC uses /etc/modules-load.d/*.conf, only, and does not +# ignore lines beginning with ';'. +# + +PROGRAM="modules-load" + +MODULES_LOAD_ARGS="" + +# Add "-q" to MODULES_LOAD_ARGS to disable error messages. +# shellcheck source=/dev/null +[ -r "/etc/default/$PROGRAM" ] && . "/etc/default/$PROGRAM" + +# Files are read from directories in the MODULES_SOURCES list, in the given +# order. A file may be used more than once, since there can be multiple +# symlinks to it. No attempt is made to prevent this. +MODULES_SOURCES="/etc/modules-load.d/ /run/modules-load.d/ /usr/lib/modules-load.d/" + +# If the logger utility is available all messages are sent to syslog, except +# for the final status. The file redirections do the following: +# +# - stdout is redirected to syslog with facility.level "kern.info" +# - stderr is redirected to syslog with facility.level "kern.err" +# - file dscriptor 4 is used to pass the result to the "start" function. +# +run_logger() { + # shellcheck disable=SC2086 # we need the word splitting + find $MODULES_SOURCES -maxdepth 1 -name '*.conf' -print0 2> /dev/null | \ + xargs -0 -r -n 1 readlink -f | { + prog_status="OK" + while :; do + read -r file || { + echo "$prog_status" >&4 + break + } + echo "* Applying $file ..." + while :; do + read -r mod || break + case "$mod" in + ''|'#'*|';'*) ;; + *) /sbin/modprobe $MODULES_LOAD_ARGS "$mod" || prog_status="FAIL" + esac + done < "$file" + done 2>&1 >&3 | /usr/bin/logger -t "$PROGRAM" -p kern.err + } 3>&1 | /usr/bin/logger -t "$PROGRAM" -p kern.info +} + +# If logger is not available all messages are sent to stdout/stderr. +run_std() { + # shellcheck disable=SC2086 # we need the word splitting + find $MODULES_SOURCES -maxdepth 1 -name '*.conf' -print0 2> /dev/null | \ + xargs -0 -r -n 1 readlink -f | { + prog_status="OK" + while :; do + read -r file || { + echo "$prog_status" >&4 + break + } + echo "* Applying $file ..." + while :; do + read -r mod || break + case "$mod" in + ''|'#'*|';'*) ;; + *) /sbin/modprobe $MODULES_LOAD_ARGS "$mod" || prog_status="FAIL" + esac + done < "$file" + done + } +} + +if [ -x /usr/bin/logger ]; then + run_program="run_logger" +else + run_program="run_std" +fi + +start() { + printf '%s %s: ' "$1" "$PROGRAM" + status=$("$run_program" 4>&1) + echo "$status" + if [ "$status" = "OK" ]; then + return 0 + fi + return 1 +} + +case "$1" in + start) + start "Running";; + restart|reload) + start "Rerunning";; + stop) + :;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 +esac diff --git a/package/kmod/kmod.mk b/package/kmod/kmod.mk index e2dfea5c7b..9b6735e2d0 100644 --- a/package/kmod/kmod.mk +++ b/package/kmod/kmod.mk @@ -60,6 +60,16 @@ else KMOD_BIN_PATH = ../usr/bin/kmod endif +# Avoid installing S11modules-load, since openrc provides /etc/init.d/modules. +define KMOD_INSTALL_INIT_OPENRC + @: +endef + +define KMOD_INSTALL_INIT_SYSV + $(INSTALL) -m 0755 -D package/kmod/S11modules-load \ + $(TARGET_DIR)/etc/init.d/S11modules-load +endef + define KMOD_INSTALL_TOOLS for i in depmod insmod lsmod modinfo modprobe rmmod; do \ ln -sf $(KMOD_BIN_PATH) $(TARGET_DIR)/sbin/$$i; \ From patchwork Sat Apr 18 22:14:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1272740 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=l14l70nE; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 494S1N5cGVz9sSG for ; Sun, 19 Apr 2020 08:14:32 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6532B87613; Sat, 18 Apr 2020 22:14:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sbuJ5Q8TcY0L; Sat, 18 Apr 2020 22:14:28 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 71C13875BA; Sat, 18 Apr 2020 22:14:28 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id E09D41BF577 for ; Sat, 18 Apr 2020 22:14:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id DCD9D87410 for ; Sat, 18 Apr 2020 22:14:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gUovtaMkDwpx for ; Sat, 18 Apr 2020 22:14:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by hemlock.osuosl.org (Postfix) with ESMTPS id 35EE687B5E for ; Sat, 18 Apr 2020 22:14:24 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id l13so5357633qtr.7 for ; Sat, 18 Apr 2020 15:14:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6ktryBLsDq5rSWzEOdQjG7rgRB7dI7miNRc9zyJnpw4=; b=l14l70nEwND8wO+Y0MzV5mRfbhkovxnYuiiPhugtzXWhQMbn9dR2NRAfSl0GmXRsH9 na5n5IpD9eduQzEio3+3dOOGp5dDquA9Ngh2OkSiT5mnJe7sBCFmoDHpOZsVqnBBKwHZ luVTo3o+7FgbHCQMN+qyl0vQkm5NeA6v6HEOdq/FeygACjA+Q29IOzNdIO9cBUC9MOPT v7d97+In9nodKkti5XQJtr8g+akC5eg+kvalS34qvSozLAlXLJpxHp5Rv8QDDBkLxbC8 GDW8lu90/5rLs70k7tWBzTFo2EOC6AAeaAc+/FI79sZLOgKvx5iGypT8eIZPUOGoodQC 8+MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6ktryBLsDq5rSWzEOdQjG7rgRB7dI7miNRc9zyJnpw4=; b=aC+a2CPjeh19A1Y3Bi7wrzUS5tR4LbFF2izIRLClIhYHPviNjRPtHoUzW8RIX19XhP j5yqqRSLF/fSnm5PooPHYiHvaa5Od1YrMF2EQ6f3AAGOz61lyPHA9Kn823ikhSjekdrQ x8qwKWxNZbr+DP/0zhUSVIzgZJzJ5f8E/lI5kWUM/BV1zvwTDhPlz0ICA9qtjgZ60vm0 aHMEf7hXNrV0MEo1DEJGV5zr9WWMfQiAZKnaFk+oYYhEsRtTFhug6o/E/yFt8qmcMbia 8+a/vkfMBsviLWO9ytb0onAhM4Bo4cmeDSlDmHXvMB17tJ6bXBydnyNqMiQUjhAmRjZN XBkw== X-Gm-Message-State: AGi0Pub6kmgTjHbd49XT8+t/inBxI1DrhJ8UC0ss9xR9c4u6p0uVfLOL HX7fDyLrtL1/nHkTPZce8eOFSyQMwlU= X-Google-Smtp-Source: APiQypJ5lcnKyB6kRPwaiHjul1RKy8rzV8BeV8LZV+4iOUJwEfyPLBxKpCIjL3cV/11rXojvZ5Tmbg== X-Received: by 2002:ac8:17c9:: with SMTP id r9mr9678031qtk.392.1587248062922; Sat, 18 Apr 2020 15:14:22 -0700 (PDT) Received: from casantos.remote.csb.com (189.27.141.225.dynamic.adsl.gvt.net.br. [189.27.141.225]) by smtp.gmail.com with ESMTPSA id h3sm5335252qkf.15.2020.04.18.15.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 15:14:22 -0700 (PDT) From: unixmania@gmail.com To: buildroot@buildroot.org Date: Sat, 18 Apr 2020 19:14:08 -0300 Message-Id: <20200418221411.1549783-3-unixmania@gmail.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20200418221411.1549783-1-unixmania@gmail.com> References: <20200418221411.1549783-1-unixmania@gmail.com> Subject: [Buildroot] [PATCH v2 2/5] package/busybox: add modules-load init script X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Santos , Lothar Felten , "Yann E. MORIN" , Adam Duskett MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Carlos Santos Use some scripting to mimic the systemd "modules-load" and the OpenRC "modules" services (load kernel modules based on static configuration). At the moment package/busybox/S02modules-load is a symlink to the kmod script, since it works with both versions of the "modprobe" utility. Signed-off-by: Carlos Santos package/busybox/ --- CC: "Yann E. MORIN" --- Changes v1->v2: - Rename S02modules-load to S11modules-load to ensure that it runs after S10mdev and S10udev, which both are going to trigger cold-plug events that may in turn trigger module loading, as observed by Yann E. MORIN. --- package/busybox/S11modules-load | 1 + package/busybox/busybox.mk | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 120000 package/busybox/S11modules-load diff --git a/package/busybox/S11modules-load b/package/busybox/S11modules-load new file mode 120000 index 0000000000..44623673ff --- /dev/null +++ b/package/busybox/S11modules-load @@ -0,0 +1 @@ +../kmod/S11modules-load \ No newline at end of file diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk index 5d5f3e92bd..3512bf77b5 100644 --- a/package/busybox/busybox.mk +++ b/package/busybox/busybox.mk @@ -264,6 +264,17 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT endef endif +# Only install our modules-load script if no other package does it. +ifeq ($(BR2_PACKAGE_KMOD_TOOLS),) +define BUSYBOX_INSTALL_MODULES_SCRIPT + if grep -q CONFIG_MODPROBE=y $(@D)/.config; \ + then \ + $(INSTALL) -m 0755 -D package/busybox/S11modules-load \ + $(TARGET_DIR)/etc/init.d/S11modules-load; \ + fi +endef +endif + # Only install our sysctl scripts if no other package does it. ifeq ($(BR2_PACKAGE_PROCPS_NG),) define BUSYBOX_INSTALL_SYSCTL_SCRIPT @@ -368,6 +379,7 @@ define BUSYBOX_INSTALL_INIT_SYSV $(BUSYBOX_INSTALL_MDEV_SCRIPT) $(BUSYBOX_INSTALL_LOGGING_SCRIPT) $(BUSYBOX_INSTALL_WATCHDOG_SCRIPT) + $(BUSYBOX_INSTALL_MODULES_SCRIPT) $(BUSYBOX_INSTALL_SYSCTL_SCRIPT) $(BUSYBOX_INSTALL_TELNET_SCRIPT) endef From patchwork Sat Apr 18 22:14:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1272741 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=fGYGAnUj; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 494S1S4qblz9sRN for ; Sun, 19 Apr 2020 08:14:36 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D5EFA87120; Sat, 18 Apr 2020 22:14:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5rKqKoLpIBKy; Sat, 18 Apr 2020 22:14:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 70D588762A; Sat, 18 Apr 2020 22:14:30 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 6588B1BF577 for ; Sat, 18 Apr 2020 22:14:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5E3F220108 for ; Sat, 18 Apr 2020 22:14:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r+NTLmJ8Q0bQ for ; Sat, 18 Apr 2020 22:14:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) by silver.osuosl.org (Postfix) with ESMTPS id A406F20035 for ; Sat, 18 Apr 2020 22:14:26 +0000 (UTC) Received: by mail-qt1-f196.google.com with SMTP id f13so5373397qti.5 for ; Sat, 18 Apr 2020 15:14:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xPkHLBk76154qMCVdQR1WJqsaorvL/JgfV7aQWabstE=; b=fGYGAnUjT/Oj5jE7AMtRNBOGZkdAVuoV8XuKydCEmxi94nJ5p2zC62+7NPxjb368cW cjAw3ZDdUQNLZ00cQvWeMG2npXOWl0/xDg2m6WPqL3xk0utv7KUEni8DK3XV5GHoeIr9 ehlu458EzBZGQ7JzklKwjT0HByO6UcNFp06Z3rJwitCDFsQ/wwybfJciOZCicVlQbaHk PQHoU4QbA3VJBYUBrNiDEFk5sWRbQV5/PAvOVx+zXFYgwvuVxqEI6DAhtiWVpH13StpX XGV+497vDAtP72SxOWGSGykQLRsjY9BODzh5jooux9fZJl396AMYfG4ETJcUOoZDfNwX WnmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xPkHLBk76154qMCVdQR1WJqsaorvL/JgfV7aQWabstE=; b=cOrUS2p/6gYKyOBzlXYpPAZ9VJgimgWSKPI/OP1/TmdmYIUeyuakUZQbj1ATHaLrrk A0+5xVbujUTlWagiaj8lYyI67cK+TvMQD4R08xe0y6UBKymz/hB5Qgx7nBk8mL6uDYjC C9bcXgNUrH9xGg8rbqUSGxPcCDaqRBIQThPoXPdJlA1HxkesdvdZ0ADxA9ydkpfL1aLK 1teGWfMRoKGSoxWWLmtwJ10g0RhNUTTHtJ6F5SqFIKgEBuR7kFgVLrRHnyN+PE866O0b OR048g9polxlFCl/17dbYqhyjQEc2pX/uXzJq9HQ6rGtUEyvEF2tt3nJDLYeYtsk1k1F kTAQ== X-Gm-Message-State: AGi0PuZCy4Jeain2YkNMCuRBiOGuP2M4Na6gOxgKM2GCC3f+1RFprHql y4QVZCS5i4PrikAZlIfvqqOCVCH2mj4= X-Google-Smtp-Source: APiQypLkAXFccg6bGnZ09Dr0glIUGKY4OZIE8nPYvLDe73bFvJSNPwxfRi1PnBGRreEvhfvgmKXjmA== X-Received: by 2002:ac8:46c9:: with SMTP id h9mr9663446qto.128.1587248065406; Sat, 18 Apr 2020 15:14:25 -0700 (PDT) Received: from casantos.remote.csb.com (189.27.141.225.dynamic.adsl.gvt.net.br. [189.27.141.225]) by smtp.gmail.com with ESMTPSA id h3sm5335252qkf.15.2020.04.18.15.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 15:14:24 -0700 (PDT) From: unixmania@gmail.com To: buildroot@buildroot.org Date: Sat, 18 Apr 2020 19:14:09 -0300 Message-Id: <20200418221411.1549783-4-unixmania@gmail.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20200418221411.1549783-1-unixmania@gmail.com> References: <20200418221411.1549783-1-unixmania@gmail.com> Subject: [Buildroot] [PATCH v2 3/5] package/dmraid: use modules-load to load the kernel module X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Santos , Adam Duskett , Lothar Felten MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Carlos Santos 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 --- Tested on QEMU with a kernel config with MD=y and DM_=m. Only the module loading was tested, since there is no RAID device. --- package/dmraid/S20dmraid | 3 --- package/dmraid/dmraid.mk | 12 ++++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/package/dmraid/S20dmraid b/package/dmraid/S20dmraid index b3bfdcc84b..ff325154c6 100644 --- a/package/dmraid/S20dmraid +++ b/package/dmraid/S20dmraid @@ -2,9 +2,6 @@ set -e -# try to load module in case that hasn't been done yet -modprobe dm-mod >/dev/null 2>&1 - case "$1" in start|"") echo "Setting up DMRAID devices..." diff --git a/package/dmraid/dmraid.mk b/package/dmraid/dmraid.mk index 0382cd4d99..c8facbdabd 100644 --- a/package/dmraid/dmraid.mk +++ b/package/dmraid/dmraid.mk @@ -21,4 +21,16 @@ define DMRAID_INSTALL_INIT_SYSV $(TARGET_DIR)/etc/init.d/S20dmraid endef +ifeq ($(BR2_LINUX_KERNEL),y) +define DMRAID_GEN_MODULES_CONF + $(INSTALL) -d -m 755 $(TARGET_DIR)/etc/modules-load.d + { \ + find $(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/kernel/drivers/md -name 'dm[_-]mod.ko*'; \ + } 2> /dev/null | { \ + sed 's:^.*/::; s:\.ko[^ ]*::'; \ + } > $(TARGET_DIR)/etc/modules-load.d/20-dmraid.conf +endef +DMRAID_TARGET_FINALIZE_HOOKS += DMRAID_GEN_MODULES_CONF +endif + $(eval $(autotools-package)) From patchwork Sat Apr 18 22:14:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1272743 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=M6u1Sn74; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 494S1X2Ngxz9sP7 for ; Sun, 19 Apr 2020 08:14:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7910E876EE; Sat, 18 Apr 2020 22:14:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yzzZxXL0OksS; Sat, 18 Apr 2020 22:14:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 50C4C8762A; Sat, 18 Apr 2020 22:14:33 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 716271BF577 for ; Sat, 18 Apr 2020 22:14:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6AEC587FCF for ; Sat, 18 Apr 2020 22:14:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qrq5Eb9p0jiv for ; Sat, 18 Apr 2020 22:14:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by hemlock.osuosl.org (Postfix) with ESMTPS id 0590A87B69 for ; Sat, 18 Apr 2020 22:14:29 +0000 (UTC) Received: by mail-qt1-f180.google.com with SMTP id f13so5373422qti.5 for ; Sat, 18 Apr 2020 15:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UD/esOlEzxqYMMR527xgf56vxPDxYhKageEl1pcOwJg=; b=M6u1Sn74nzPmOOD715DaPnhVduamaPJCZfmmgBoMZlDcfuev7DkcZYAG4iG44skdUm p+R8bkvNghbBsgNuu+1F7vuBqPbm+0YZC3ktw3lIpPyP+zasT9s50VW8LN3KxH56x4ap C0hva+jslZba3EJunpD4jo2t60/ApINMsnqjwcjkJWVziCn/5ljdvUNX8XpDB89aysZe ydSvQ/2g+sn7tIHvTkmB2xO84HYA4prSciYcJnI4wefXyDUjdpGBSdyZoqLIT6lUwCji NJMXiuPSMuTie6pTTChvZlbPYPI978Cyf6MwOThrykRx58688mKO4Mdz9xoEKdl72m9c ZVIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UD/esOlEzxqYMMR527xgf56vxPDxYhKageEl1pcOwJg=; b=MPq8aKHlFsbNftyjrNo/PfEtES7iH514/G+/kjS+xcmzPgl8EikOFX2fFyfiXVwAGG Zfr4UsO4IKj4yunGT9QAqsfCx4qtzE91LAbAtB66nFZvSfuWgqKK09VSUOLMjnj3WOSW ZHKp2+HXm6ewEv2xtCMnt4eaBZDwojCLP2NO3eJZJ8C+V3PR89JIGnLfpdw9oGBAfkAM Kby9jsS6hW+d+kUsLvNDbWt3L5XDEsOtW60SlVwekL3n/d37VnipkCeVVt/3DbZloU2j nVXwyjTiwqTioF8PfdHtowSRSju3D/dqfr/9A3VWSq5DWhmqHYOb7kuy0qGurZKpCKAb LbbQ== X-Gm-Message-State: AGi0PuaojBsLTv4nQ8t1UgAzqLQZl81ZcUNhO+e0p6mPhjzYe1hdmhdY 0gYEOiAUoCxU9BTfp8hyvRVCBbXDwi0= X-Google-Smtp-Source: APiQypIsSQUg1lP3cqcQsQpXFGoUXZh9rk8whuK89mENXReQHlZE3e6alxgO5TKg8rABKA8B1io7bw== X-Received: by 2002:aed:3f30:: with SMTP id p45mr9917448qtf.49.1587248067850; Sat, 18 Apr 2020 15:14:27 -0700 (PDT) Received: from casantos.remote.csb.com (189.27.141.225.dynamic.adsl.gvt.net.br. [189.27.141.225]) by smtp.gmail.com with ESMTPSA id h3sm5335252qkf.15.2020.04.18.15.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 15:14:27 -0700 (PDT) From: unixmania@gmail.com To: buildroot@buildroot.org Date: Sat, 18 Apr 2020 19:14:10 -0300 Message-Id: <20200418221411.1549783-5-unixmania@gmail.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20200418221411.1549783-1-unixmania@gmail.com> References: <20200418221411.1549783-1-unixmania@gmail.com> Subject: [Buildroot] [PATCH v2 4/5] package/owfs: use modules-load to load the kernel module X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Santos , Adam Duskett , Lothar Felten MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Carlos Santos 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 --- 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 From patchwork Sat Apr 18 22:14:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1272742 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=eY11W0nf; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 494S1V6hK4z9sP7 for ; Sun, 19 Apr 2020 08:14:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 02DC020385; Sat, 18 Apr 2020 22:14:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KN3osLiZYJIn; Sat, 18 Apr 2020 22:14:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id E6D5020108; Sat, 18 Apr 2020 22:14:34 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 9FD4D1BF577 for ; Sat, 18 Apr 2020 22:14:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 906BB20108 for ; Sat, 18 Apr 2020 22:14:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NOnmqPLvOb68 for ; Sat, 18 Apr 2020 22:14:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by silver.osuosl.org (Postfix) with ESMTPS id 97DB220035 for ; Sat, 18 Apr 2020 22:14:31 +0000 (UTC) Received: by mail-qv1-f54.google.com with SMTP id v18so2834270qvx.9 for ; Sat, 18 Apr 2020 15:14:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N17tKKsG7TiaBXeMsShfaD90PNb1zOZNceefkeBbecY=; b=eY11W0nf6LoKNHsDJp3Poz8obj6l1b6VH6v1usOejfHoy3XlqFaLopNnE4VRkyy7AF xq38azYNni2TfY6otaM2LbjqEmoGHLec/NVnv8GLdfSSzv5k16fNsYTUmuklVWKKa52o 0NDD1C57vX3aijjvriADB6U6R7/kxcmRFFXc2vteCxgclztCHn5OA1IVMBx0UfvhB3u8 VvOo2B3WiddQYKo+mNnvRVMY2oy3rqa5mS52kAomER8DwLH1q7dfvy70V4JPbaZZvdxD UpGizCyCY8662Qg62IpNRUrXoFR1l9JeA6UiPCSfdQLorEG6p6uvk7Hn5VWsMW7QPbOe 1JJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N17tKKsG7TiaBXeMsShfaD90PNb1zOZNceefkeBbecY=; b=scBulYZxYyxlaiX4Guym3yf+XfbznI8+YDffwdZl91f2cvsWCA4JhqRhLV9jW0mS7s WQyUmsrU2cJ7MFlEJTdwjEWZozimGP5PzaglETXQCQIJZPoTkdoeLiR6kCqbJ89faU6H kMTWjPb3ZmrYRakc39W0mbJ2pvjTykyEbVWf7YAVwmNFfs7sEhiHHOc2BVQ/Xm/FWY5w XDvt6Wj4Sak1k83xES1e3CrSUOE8Gbwu8J9OV1L+AylkN0Zg8GldQXrF7lJwlg+iI8bm OkZLGbZRRi2XvXRPbdwGZxtn7dpAcmwnhNEEef5hjfPTvPcKKHgfHQVWv1lr3rM5QTrv L3eA== X-Gm-Message-State: AGi0Pub5l5C9YYYI6TffJ4MKSFXQqzhqgsyovZMswEPjOtFxzJyEewep Ius/QOWeoGH2oHxdCQ1AOxPd6YqzsRw= X-Google-Smtp-Source: APiQypIeyojUZrMoN0q5+zXd1XoS8ArHRS2ubIH5rbe0A5h8wmrGCH0aWq008ARCWKheJ1Oz//FAAg== X-Received: by 2002:a0c:9b89:: with SMTP id o9mr8550939qve.131.1587248070315; Sat, 18 Apr 2020 15:14:30 -0700 (PDT) Received: from casantos.remote.csb.com (189.27.141.225.dynamic.adsl.gvt.net.br. [189.27.141.225]) by smtp.gmail.com with ESMTPSA id h3sm5335252qkf.15.2020.04.18.15.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 15:14:29 -0700 (PDT) From: unixmania@gmail.com To: buildroot@buildroot.org Date: Sat, 18 Apr 2020 19:14:11 -0300 Message-Id: <20200418221411.1549783-6-unixmania@gmail.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20200418221411.1549783-1-unixmania@gmail.com> References: <20200418221411.1549783-1-unixmania@gmail.com> Subject: [Buildroot] [PATCH v2 5/5] package/ti-sgx-km: use modules-load to load the kernel module X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Santos , Adam Duskett , Lothar Felten MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Carlos Santos 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 --- 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 '^\' -} - -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