From d4f4b40abd2791fd5a9b357dcf44cffbd108d2c2 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Fri, 12 Aug 2022 11:45:02 +0200 Subject: [PATCH] kernel-module-qualcomm: remove wlan kernel module load script The qualcomm.sh script has been losing functionality over time, to the point that now is just loading the kernel module using 'modprobe'. Instead, run modprobe directly from the udev rule and get rid of the qualcomm script. Signed-off-by: Javier Viguera --- .../kernel-module-qualcomm.bb | 4 - .../kernel-module-qualcomm/81-qcom-wifi.rules | 4 +- .../kernel-module-qualcomm/qualcomm.sh | 73 ------------------- 3 files changed, 2 insertions(+), 79 deletions(-) delete mode 100644 meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb index 224eabed3..5c679c474 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm.bb @@ -50,7 +50,6 @@ WLAN_CONFIG_INI = "${@oe.utils.conditional('QUALCOMM_WIFI_INTERFACE', 'sdio' , \ SRC_URI:append = " \ file://81-qcom-wifi.rules \ - file://qualcomm.sh \ " FILES_SDIO = " \ @@ -105,9 +104,6 @@ do_install:append() { # Disable 802.11d support sed -i -e "s/g11dSupportEnabled=1/g11dSupportEnabled=0/g" ${D}${base_libdir}/firmware/wlan/qcom_cfg.ini - install -d ${D}${sysconfdir}/udev/scripts - install -m 0755 ${WORKDIR}/qualcomm.sh ${D}${sysconfdir}/udev/scripts/ - install -d ${D}${sysconfdir}/udev/rules.d install -m 0644 ${WORKDIR}/81-qcom-wifi.rules ${D}${sysconfdir}/udev/rules.d/ } diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-qcom-wifi.rules b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-qcom-wifi.rules index b717ebf0b..92706c426 100644 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-qcom-wifi.rules +++ b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/81-qcom-wifi.rules @@ -1,4 +1,4 @@ # Load Qualcomm wireless module (sdio) -SUBSYSTEM=="sdio", ACTION=="add", ENV{MODALIAS}=="sdio:c00v0271d050A", RUN="/etc/udev/scripts/qualcomm.sh" +SUBSYSTEM=="sdio", ACTION=="add", ENV{MODALIAS}=="sdio:c00v0271d050A", RUN="/sbin/modprobe wlan" # Load Qualcomm wireless module (pci) -SUBSYSTEM=="pci", ACTION=="add", ENV{MODALIAS}=="pci:v0000168Cd0000003Esv*sd*bc*sc*i*", RUN="/etc/udev/scripts/qualcomm.sh" +SUBSYSTEM=="pci", ACTION=="add", ENV{MODALIAS}=="pci:v0000168Cd0000003Esv*sd*bc*sc*i*", RUN="/sbin/modprobe wlan" diff --git a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh b/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh deleted file mode 100644 index 813f9bd61..000000000 --- a/meta-digi-arm/recipes-kernel/kernel-module-qualcomm/kernel-module-qualcomm/qualcomm.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2017,2018 Digi International Inc. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, you can obtain one at http://mozilla.org/MPL/2.0/. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# - -# At this point of the boot (udev script), the system log (syslog) is not -# available yet, so use the kernel log buffer from userspace. -log() { - printf "<$1>qca65x4: $2\n" >/dev/kmsg -} - -# Get the permissions of the filesystem containing the given path -get_filesystem_access() { - [ -z "${1}" ] && return - - fs_device="$(df ${1} | awk 'NR==2 { print $1 }')" - fs_access="$(awk -v dev="${fs_device}" '$0 ~ dev { print substr($4,1,2) }' < /proc/mounts)" - echo ${fs_access} -} - -# Get the mount point of the filesystem containing the given path -get_filesystem_mount_point() { - [ -z "${1}" ] && return - - fs_device="$(df ${1} | awk 'NR==2 { print $1 }')" - fs_mount_point="$(awk -v dev="${fs_device}" '$0 ~ dev { print $2 }' < /proc/mounts)" - echo ${fs_mount_point} -} - -# Remount the filesystem containing the given path as 'read-write' if it was -# mounted as 'read-only'. -set_filesystem_rw_access() { - [ -z "${1}" ] && return - - if [ "$(get_filesystem_access ${1})" = "ro" ]; then - mount -o remount,rw $(get_filesystem_mount_point ${1}) - fi -} - -# Do nothing if the wireless node does not exist on the device tree -[ -d "/proc/device-tree/wireless" ] || exit 0 - -# Do nothing if the module is already loaded -grep -qws 'wlan' /proc/modules && exit 0 - -FS_ORIGINAL_ACCESS="$(get_filesystem_access ${FIRMWARE_DIR})" - -# Load the wireless module with the params defined in modprobe.d/qualcomm.conf -# and reduce the console log level to avoid debug messages at boot time -LOGLEVEL="$(sed -ne 's,^kernel.printk[^=]*=[[:blank:]]*\(.*\)$,\1,g;T;p' /etc/sysctl.conf 2>/dev/null)" -[ -n "${LOGLEVEL}" ] && sysctl -q -w kernel.printk="${LOGLEVEL}" -modprobe wlan - -# Verify the interface is present -[ -d "/sys/class/net/wlan0" ] || log "3" "[ERROR] Loading wlan module" - -# Restore the filesystem with the original access permissions if it has been -# changed inside the script. -if [ "$(get_filesystem_access ${FIRMWARE_DIR})" != "${FS_ORIGINAL_ACCESS}" ]; then - mount -o remount,${FS_ORIGINAL_ACCESS} $(get_filesystem_mount_point ${FIRMWARE_DIR}) -fi