busybox: remove mdev extensions

We use udev as device manager both for minimal and graphical images so
there is no need for these mdev extensions anymore.

https://jira.digi.com/browse/DEL-944

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2014-02-26 10:31:39 +01:00
parent 6fd93d7157
commit 6e3694565e
10 changed files with 2 additions and 390 deletions

View File

@ -1,58 +0,0 @@
From: Javier Viguera <javier.viguera@digi.com>
Date: Wed, 20 Apr 2011 11:13:10 +0200
Subject: [PATCH] del-mdev_regulatory
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
---
util-linux/mdev.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 3d4e135..3293b59 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -96,6 +96,7 @@
//usage: "\n"
//usage: "If /dev/mdev.log file exists, debug log will be appended to it."
+#include <syslog.h>
#include "libbb.h"
#include "xregex.h"
@@ -249,8 +250,8 @@
#endif
-static const char keywords[] ALIGN1 = "add\0remove\0"; // "change\0"
-enum { OP_add, OP_remove };
+static const char keywords[] ALIGN1 = "add\0remove\0change\0";
+enum { OP_add, OP_remove, OP_change };
struct envmatch {
struct envmatch *next;
@@ -1131,13 +1132,24 @@ int mdev_main(int argc UNUSED_PARAM, char **argv)
if (!fw)
make_device(env_devname, temp, op);
}
- else {
+ else if (op == OP_add) {
make_device(env_devname, temp, op);
if (ENABLE_FEATURE_MDEV_LOAD_FIRMWARE) {
if (op == OP_add && fw)
load_firmware(fw, temp);
}
}
+ /* DigiEL: Handle regulatory domain change events */
+ else if (op == OP_change) {
+ char *env_modalias;
+ env_modalias = getenv("MODALIAS");
+ if (strcmp(env_modalias, "platform:regulatory") == 0) {
+ char *crda = xasprintf("%s", "/sbin/crda");
+ system(crda);
+ free(crda);
+ syslog(LOG_INFO, "[mdev] change regulatory domain [%s]", getenv("COUNTRY"));
+ }
+ }
dbg1("%s exiting", curtime());
if (seq_fd >= 0) {

View File

@ -1,35 +0,0 @@
#!/bin/sh
#===============================================================================
#
# adc
#
# Copyright (C) 2009 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# !Description: handle ADC nodes
#
#===============================================================================
dev_table="
/dev/adc d 755 0 0
/dev/adc/ c 644 0 0 %s 0 0 1 %s
"
case "${ACTION}" in
add)
major="$(sed -ne 's,\([^[:blank:]\+]\)[[:blank:]].*adc.*,\1,g;T;p' /proc/devices)"
[ "${MDEV}" = "s3c2443-adc" ] && channels="10"
[ "${MDEV}" = "adc-ns9215" ] && channels="8"
if [ -n "${major}" -a -n "${channels}" ]; then
printf "${dev_table}" "${major}" "${channels}" | makedevs / >/dev/null 2>&1
fi
;;
remove)
[ -d "/dev/adc" ] && rm -rf /dev/adc
;;
esac

View File

@ -1,45 +0,0 @@
#!/bin/sh
#===============================================================================
#
# mdev
#
# Copyright (C) 2013 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# Description: Device nodes bootscript
#
#===============================================================================
set -e
if [ "${1}" != "start" ]; then
exit 0
fi
MDEV="/sbin/mdev"
# Create shared memory mount point
mkdir -p /dev/shm
# Register mdev as hotplug to create devices.
if [ -f /proc/sys/kernel/hotplug ]; then
echo > /dev/mdev.seq
echo "${MDEV}" > /proc/sys/kernel/hotplug
fi
# Create all device nodes scanning /sys.
${MDEV} -s
# mount storage devices
usbmount
mmc-mount
# fire *add* event for ADC so the nodes are created in case of built-in driver
for i in $(echo /sys/bus/platform/drivers/*adc*/uevent); do
[ "${i}" = "/sys/bus/platform/drivers/*adc*/uevent" ] && continue
echo add > $i
done

View File

@ -1,44 +0,0 @@
# storage drives
sd[a-z][0-9]+ 0:0 0660 */lib/mdev/sd
mmcblk[0-9]+p[0-9]+ 0:0 0660 */lib/mdev/mmc
# serial
ttyNS([0-9]) 0:0 0660 >ttyS%1
ttySAC([0-9]) 0:0 0660 >ttyS%1
ttymxc([0-9]) 0:0 0660 >ttyS%1
ttyAMA?0 0:0 0660 @ln -sf ${MDEV} ttyS0
tty(SP|APP)0 0:0 0660 @ln -sf ${MDEV} ttyBt
ttyAPP([1-9]) 0:0 0660 @ln -sf ${MDEV} ${MDEV/APP/S}
ttySP([1-9]) 0:0 0660 @ln -sf ${MDEV} ${MDEV/SP/S}
# old Samsung serial port name (for backwards compatibility)
s3c2410_serial([0-9]) 0:0 0660 >ttyS%1
# watchdog
ns9[[:alnum:]]+-wdt 0:0 0660 >watchdog
# rtc
rtc0 0:0 0660 >rtc
# alsa sound devices
pcm.* 0:0 0660 =snd/
control.* 0:0 0660 =snd/
midi.* 0:0 0660 =snd/
seq 0:0 0660 =snd/
timer 0:0 0660 =snd/
# adc
adc-ns9215 0:0 0660 */lib/mdev/adc
s3c2443-adc 0:0 0660 */lib/mdev/adc
# input devices
mice.* 0:0 0660 =input/
mouse.* 0:0 0660 =input/
event.* 0:0 0660 =input/ */lib/mdev/ts
# fix some permissions (default is 0660)
null 0:0 0666
zero 0:0 0666
# FSL settings
mxc_iim 0:0 0444 >mxc_mem

View File

@ -1,73 +0,0 @@
#!/bin/sh
#===============================================================================
#
# mmc
#
# Copyright (C) 2009 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# !Description: mount/umount mmc/sd cards
#
#===============================================================================
SCRIPTNAME="$(basename ${0})"
usage() {
[ "${SCRIPTNAME}" = "mmc-mount" ] && printf "\nMount mmc storage drives\n"
[ "${SCRIPTNAME}" = "mmc-umount" ] && printf "\nUmount mmc storage drives\n"
printf "\nUsage: ${SCRIPTNAME} [OPTIONS]\n\n"
}
while getopts "" c; do
case "${c}" in
*)
usage
exit
;;
esac
done
if [ "${SCRIPTNAME}" = "mmc" ]; then
# Script run via mdev
case "${ACTION}" in
add)
# Create mountpoint and mount the mmc device
if mkdir -p /media/${MDEV} && ! mountpoint -q /media/${MDEV}; then
mount /dev/${MDEV} /media/${MDEV}
fi
;;
remove)
# Umount and then remove mountpoint
if grep -q "/dev/${MDEV}[[:blank:]]" /proc/mounts; then
mdir=$(sed -ne "s,/dev/${MDEV}[[:blank:]]\+\([^[:blank:]]\+\)[[:blank:]].*,\1,g;T;p" /proc/mounts)
umount "${mdir}"
rmdir -- "${mdir}" 2>/dev/null
fi
;;
esac
elif [ "${SCRIPTNAME}" = "mmc-mount" ]; then
# Script run via command line [mmc-mount]
for i in /sys/block/mmcblk[0-9]/mmcblk[0-9]p[1-9]*; do
[ "${i}" = "/sys/block/mmcblk[0-9]/mmcblk[0-9]p[1-9]*" ] && continue
device="$(basename ${i})"
if mkdir -p /media/${device} && ! mountpoint -q /media/${device}; then
echo -n "Mounting /dev/${device} on /media/${device}: "
mount /dev/${device} /media/${device}
echo "done."
fi
done
elif [ "${SCRIPTNAME}" = "mmc-umount" ]; then
# Script run via command line [mmc-umount]
for i in /media/mmcblk*; do
[ "${i}" = "/media/mmcblk*" ] && continue
if mountpoint -q $i; then
umount "$i"
rmdir -- "$i" 2>/dev/null
fi
done
fi

View File

@ -1,73 +0,0 @@
#!/bin/sh
#===============================================================================
#
# sd
#
# Copyright (C) 2009 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# !Description: mount/umount SCSI disk devices
#
#===============================================================================
SCRIPTNAME="$(basename ${0})"
usage() {
[ "${SCRIPTNAME}" = "usbmount" ] && printf "\nMount usb storage drives\n"
[ "${SCRIPTNAME}" = "usbumount" ] && printf "\nUmount usb storage drives\n"
printf "\nUsage: ${SCRIPTNAME} [OPTIONS]\n\n"
}
while getopts "" c; do
case "${c}" in
*)
usage
exit
;;
esac
done
if [ "${SCRIPTNAME}" = "sd" ]; then
# Script run via mdev
case "${ACTION}" in
add)
# Create mountpoint and mount the sd device
if mkdir -p /media/${MDEV} && ! mountpoint -q /media/${MDEV}; then
mount /dev/${MDEV} /media/${MDEV}
fi
;;
remove)
# Umount and then remove mountpoint
if grep -q "/dev/${MDEV}[[:blank:]]" /proc/mounts; then
mdir=$(sed -ne "s,/dev/${MDEV}[[:blank:]]\+\([^[:blank:]]\+\)[[:blank:]].*,\1,g;T;p" /proc/mounts)
umount "${mdir}"
rmdir -- "${mdir}" 2>/dev/null
fi
;;
esac
elif [ "${SCRIPTNAME}" = "usbmount" ]; then
# Script run via command line [usbmount]
for i in /sys/block/sd[a-z]/sd[a-z][1-9]*; do
[ "${i}" = "/sys/block/sd[a-z]/sd[a-z][1-9]*" ] && continue
device="$(basename ${i})"
if mkdir -p /media/${device} && ! mountpoint -q /media/${device}; then
echo -n "Mounting /dev/${device} on /media/${device}: "
mount /dev/${device} /media/${device}
echo "done."
fi
done
elif [ "${SCRIPTNAME}" = "usbumount" ]; then
# Script run via command line [usbumount]
for i in /media/sd*; do
[ "${i}" = "/media/sd*" ] && continue
if mountpoint -q $i; then
umount "$i"
rmdir -- "$i" 2>/dev/null
fi
done
fi

View File

@ -1,30 +0,0 @@
#!/bin/sh
#===============================================================================
#
# ts
#
# Copyright (C) 2013 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# !Description: symlink known touchscreen devices
#
# Values of '/sys/class/input/eventX/device/name':
#
# i.MX5X: mxc_ts, da9052-tsi, ADS784x, fusion touch
# i.MX28: mxs-lradc
#
#===============================================================================
# ${ACTION} is empty on scanning mode (mdev -s), exit otherwise
[ -n "${ACTION}" ] && exit
mdev=$(basename ${MDEV})
if grep -qs '\(mxc_ts\|da9052-tsi\|ADS784x\|fusion\|mxs-lradc\|[Tt]ouch\)' \
/sys/class/input/${mdev}/device/name; then
ln -sf ${mdev} /dev/input/touchscreen0
fi

View File

@ -8,13 +8,8 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
DEPENDS += "libdigi"
SRC_URI += "file://0001-del-baudrates.patch \
file://0002-del-mdev_regulatory.patch \
file://0003-del-flash_eraseall.patch \
file://0004-ntpd-indefinitely-try-to-resolve-peer-addresses.patch \
file://adc \
file://mmc \
file://sd \
file://ts \
file://0002-del-flash_eraseall.patch \
file://0003-ntpd-indefinitely-try-to-resolve-peer-addresses.patch \
file://suspend \
file://busybox-ntpd \
file://index.html \
@ -26,18 +21,6 @@ SRC_URI += "file://0001-del-baudrates.patch \
file://busybox-static-nodes \
"
# Add device handlers to 'mdev' package
FILES_${PN}-mdev += " \
${base_bindir}/mmc-mount \
${base_bindir}/mmc-umount \
${base_bindir}/usbmount \
${base_bindir}/usbumount \
${base_libdir}/mdev/adc \
${base_libdir}/mdev/mmc \
${base_libdir}/mdev/sd \
${base_libdir}/mdev/ts \
"
# hwclock bootscript init parameters
INITSCRIPT_PARAMS_${PN}-hwclock = "start 20 S . stop 20 0 6 ."
@ -65,19 +48,6 @@ INITSCRIPT_NAME_${PN}-static-nodes = "busybox-static-nodes"
INITSCRIPT_PARAMS_${PN}-static-nodes = "start 07 S ."
do_install_append() {
if grep "CONFIG_MDEV=y" ${WORKDIR}/defconfig; then
if grep "CONFIG_FEATURE_MDEV_CONF=y" ${WORKDIR}/defconfig; then
install -d ${D}${base_libdir}/mdev
install -m 0755 ${WORKDIR}/adc ${D}${base_libdir}/mdev/adc
install -m 0755 ${WORKDIR}/mmc ${D}${base_libdir}/mdev/mmc
install -m 0755 ${WORKDIR}/sd ${D}${base_libdir}/mdev/sd
install -m 0755 ${WORKDIR}/ts ${D}${base_libdir}/mdev/ts
ln -s ../lib/mdev/mmc ${D}${base_bindir}/mmc-mount
ln -s ../lib/mdev/mmc ${D}${base_bindir}/mmc-umount
ln -s ../lib/mdev/sd ${D}${base_bindir}/usbmount
ln -s ../lib/mdev/sd ${D}${base_bindir}/usbumount
fi
fi
if grep "CONFIG_NTPD=y" ${WORKDIR}/defconfig; then
install -m 0755 ${WORKDIR}/busybox-ntpd ${D}${sysconfdir}/init.d/
fi