From 4badd48757f426f0f3fc7d04c7a202b92e5aedcc Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 11 Dec 2019 11:54:40 -0600 Subject: Add new package rs9113-rm to remove rs9113 packages from devices with no rs9113 part --- recipes-kernel/rs9113/files/rs9113/mts-rm-rs9113 | 51 ++++++++++++++++++++++++ recipes-kernel/rs9113/rs9113.inc | 14 ++++++- recipes-kernel/rs9113/rs9113_1.6.1.bb | 4 +- 3 files changed, 66 insertions(+), 3 deletions(-) create mode 100755 recipes-kernel/rs9113/files/rs9113/mts-rm-rs9113 diff --git a/recipes-kernel/rs9113/files/rs9113/mts-rm-rs9113 b/recipes-kernel/rs9113/files/rs9113/mts-rm-rs9113 new file mode 100755 index 0000000..b44aaf0 --- /dev/null +++ b/recipes-kernel/rs9113/files/rs9113/mts-rm-rs9113 @@ -0,0 +1,51 @@ +#!/bin/bash +### BEGIN INIT INFO +# Provides: mts-rm-rs9113 +# Default-Start: S +# Default-Stop: +# Short-Description: remove the rs9113 driver if no rs9113 present +# Description: If mts-io capability wifi exists, test it and remove +# the rs9113 related packages if present and no wifi +# capability. Must run after mts-io but before rs9113. +### END INIT INFO + +# update-rc.d mts-rm-rs9113 start 40 S . + +sysdir=/sys/devices/platform/mts-io +remount=0 + +function cleanup { + if ((remount == 1)) ; then + mount -o r0,remount / + fi +} + +trap cleanup EXIT + +if [[ -f ${sysdir}/capability/wifi ]] ; then + if [[ -f /opt/rs9113/onebox_wlan_nongpl.ko ]] && (( $(cat ${sysdir}/capability/wifi) == 0)) ; then + logger -sp daemon.info 'Attempting to remove rs9113 drivers from non-wifi device' + rmount=$(grep '^/dev/root' /proc/mounts) + remount=0 + if [[ $rmount =~ [[:space:],]ro[[:space:],] ]] ; then + remount=1 + mount -o rw,remount / + fi + plist="rs9113-autostart rs9113-misc rs9113-noarch rs9113-util rs9113-utils-extra kernel-module-rs9113" + for p in $plist ; do + opkg remove $p + done + + rlist=$(opkg list-installed | grep rs9113) + + for p in $plist ; do + # Hopefully the packages have been removed. + if [[ $rlist =~ (^|[[:space:]])${p}[[:space:]] ]] ; then + exit 1 + fi + done + + fi + + update-rc.d -f mts-rm-rs9113 remove +fi \ No newline at end of file diff --git a/recipes-kernel/rs9113/rs9113.inc b/recipes-kernel/rs9113/rs9113.inc index be7c994..1eb4629 100644 --- a/recipes-kernel/rs9113/rs9113.inc +++ b/recipes-kernel/rs9113/rs9113.inc @@ -8,8 +8,10 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" # noarch contains the init script and configuration for the driver and # the firmware file (firmware/*.rps). -PACKAGES = "${PN}-utils-extra ${PN}-misc kernel-module-${PN} ${PN}-util ${PN}-dbg ${PN}-noarch ${PN}-autostart ${PN}-btclonly" +PACKAGES = "${PN}-rm {PN}-utils-extra ${PN}-misc kernel-module-${PN} ${PN}-util ${PN}-dbg ${PN}-noarch ${PN}-autostart ${PN}-btclonly" ALLOW_EMPTY_${PN}-autostart = "1" + +PACKAGE_ARCH_${PN}-rm = "all" PACKAGE_ARCH_${PN}-noarch = "all" PACKAGE_ARCH_${PN}-misc = "all" PACKAGE_ARCH_${PN}-autostart = "all" @@ -26,9 +28,14 @@ ALLOW_EMPTY_${PN}-btclonly = "1" DR = "${DL_DIR}/rs9113-ipk" FILESEXTRAPATHS_append := "${DR}:" -INITSCRIPT_PACKAGES = "${PN}-autostart" +INITSCRIPT_PACKAGES = "${PN}-autostart ${PN}-rm" INITSCRIPT_NAME_${PN}-autostart = "rs9113" INITSCRIPT_PARAMS_${PN}-autostart = "start 50 S ." + +# ${PN}-rm must start after mts-io driver is loaded. +INITSCRIPT_NAME_${PN}-rm = "mts-rm-rs9113" +INITSCRIPT_PARAMS_${PN}-rm = "start 39 S ." + RDEPENDS_${PN}-autostart = "${PN}-noarch" BB_STRICT_CHECKSUM = "0" @@ -87,6 +94,8 @@ python do_fetch_prepend () { os.system(ex + ";" + gt + "|" + tar) } +FILES_${PN}-rm = "${sysconfdir}/init.d/mts-rm-rs9113" + # Required drivers for Bluetooth and WiFi FILES_kernel-module-${PN} = " \ /opt/rs9113/*.ko \ @@ -160,6 +169,7 @@ do_install () { install -m 0755 ${MR}/wpa_supplicant ${D}/opt/rs9113/init.d install -m 0755 ${MR}/rs9113.init ${D}${sysconfdir}/init.d/rs9113 install -m 0644 ${MR}/rs9113.default ${D}${sysconfdir}/default/rs9113 + install -m 0755 ${MR}/mts-rm-rs9113 ${D}${sysconfdir}/init.d/mts-rm-rs9113 } python do_cleanall_prepend () { diff --git a/recipes-kernel/rs9113/rs9113_1.6.1.bb b/recipes-kernel/rs9113/rs9113_1.6.1.bb index 147e205..f3333d5 100644 --- a/recipes-kernel/rs9113/rs9113_1.6.1.bb +++ b/recipes-kernel/rs9113/rs9113_1.6.1.bb @@ -4,7 +4,8 @@ LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Proprietary;md5=0557f9d92cf58f2ccdd50f62f8ac0b28" PROVIDES = "rs9113" FILES_${PN} = "/opt/rs9113 ${sbindir} ${sysconfdir}" -RDEPENDS_${PN} += "bash" +RDEPENDS_${PN}-noarch += "bash" +RDEPENDS_${PN}-rm += "bash" # This bitbake recipe requires SSH_AUTH_SOCK to be set if ssh key pass # phrases are used. SSH_AUTH_SOCK is set by a keyserver, @@ -18,6 +19,7 @@ PR = "r10.${MLINUX_KERNEL_VERSION}${MLINUX_KERNEL_EXTRA_VERSION}" SRC_URI = " \ file://rs9113/rs9113.init \ file://rs9113/rs9113.default \ + file://rs9113/mts-rm-rs9113 \ file://rs9113/wpa_supplicant \ file://rs9113-ipk/rs9113-from-src_${PV}-${PR}.0_${MACHINE}.ipk;name=binaries \ " -- cgit v1.2.3