[oe-commits] org.oe.dev udev 118 simplify init script, closes #3886
mickeyl commit
openembedded-commits at lists.openembedded.org
Fri Feb 29 00:42:18 UTC 2008
udev 118 simplify init script, closes #3886
Author: mickeyl at openembedded.org
Branch: org.openembedded.dev
Revision: ac57dc4d0c5b9bb82d419b89a6ac80363bd3d42d
ViewMTN: http://monotone.openembedded.org/revision/info/ac57dc4d0c5b9bb82d419b89a6ac80363bd3d42d
Files:
1
packages/udev/udev-118/init
packages/udev/udev_118.bb
Diffs:
#
# mt diff -r0635cfb2a96634b5c0f72d6c1e3720dc647e8bfc -rac57dc4d0c5b9bb82d419b89a6ac80363bd3d42d
#
#
#
# patch "packages/udev/udev-118/init"
# from [39af5bc8230e6a5d1a8c29b715b06fd04ea3551d]
# to [35cae94119e36270fbd2b648a4dbe351ff714d55]
#
# patch "packages/udev/udev_118.bb"
# from [ea5479f679eae83985b0d677a1317948a47e3ac4]
# to [e9281fed9bc0fc17975cbcd7076778e89ce58196]
#
============================================================
--- packages/udev/udev-118/init 39af5bc8230e6a5d1a8c29b715b06fd04ea3551d
+++ packages/udev/udev-118/init 35cae94119e36270fbd2b648a4dbe351ff714d55
@@ -30,7 +30,7 @@ mount_tmpfs() {
# directory which is guaranteed to be available.
mount -n -o bind /dev /etc/udev
- if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs tmpfs /dev; then
+ if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs udev /dev; then
umount /etc/udev
echo "udev requires tmpfs support, not started."
exit 1
@@ -55,6 +55,7 @@ make_extra_nodes() {
# I hate this hack. -- Md
make_extra_nodes() {
+ mknod -m 666 /dev/null c 1 3
if [ "$(echo /lib/udev/devices/*)" != "/lib/udev/devices/*" ]; then
cp -a /lib/udev/devices/* /dev/
fi
@@ -75,18 +76,11 @@ supported_kernel() {
supported_kernel() {
case "$(uname -r)" in
2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;;
- 2.6.1[01]|2.6.1[01][!0-9]*) return 1 ;;
+ 2.6.1[0134]|2.6.1[01234][!0-9]*) return 1 ;;
esac
return 0
}
-set_hotplug_handler() {
- case "$(uname -r)" in
- 2.6.1[0-4]|2.6.1[0-4][!0-9]*) HANDLER='/sbin/udevsend' ;;
- esac
- echo $HANDLER > /proc/sys/kernel/hotplug
-}
-
# shell version of /usr/bin/tty
my_tty() {
[ -x /bin/readlink ] || return 0
@@ -94,24 +88,6 @@ my_tty() {
readlink --silent /proc/self/fd/0 || true
}
-warn_if_interactive() {
- if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then
- return
- fi
-
- TTY=$(my_tty)
- if [ -z "$TTY" -o "$TTY" = "/dev/console" ]; then
- return
- fi
-
- printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n"
- printf "has been run from an interactive shell.\n"
- printf "It will probably not do what you expect, so this script will wait\n"
- printf "60 seconds before continuing. Press ^C to stop it.\n"
- printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n"
- sleep 60
-}
-
##############################################################################
PATH="/sbin:/bin:/usr/bin"
@@ -120,13 +96,11 @@ tmpfs_size="2M"
# defaults
tmpfs_size="2M"
-udev_root="/dev"
-udevd_timeout=30
. /etc/udev/udev.conf
if ! supported_kernel; then
- echo "udev requires a kernel >= 2.6.12, not started."
+ echo "udev requires a kernel >= 2.6.15, not started."
exit 1
fi
@@ -145,61 +119,31 @@ fi
exit 1
fi
-if [ ! -e /proc/sys/kernel/hotplug ]; then
- echo "udev requires hotplug support, not started."
- exit 1
-fi
-
##############################################################################
# When modifying this script, do not forget that between the time that
# the new /dev has been mounted and udevsynthesize has been run there will be
# no /dev/null. This also means that you cannot use the "&" shell command.
-
case "$1" in
start)
- if [ -e "$udev_root/.udev/" ]; then
- if mountpoint -q /dev/; then
- TMPFS_MOUNTED=1
- else
- echo ".udev/ already exists on the static $udev_root!"
- fi
- else
- warn_if_interactive
- fi
+ unmount_devpts
+ mount_tmpfs
+ [ -d /proc/1 ] || mount -n /proc
- echo "Starting the hotplug events dispatcher" "udevd"
- udevd --daemon
+ # /dev/null must be created before udevd is started
+ make_extra_nodes
- set_hotplug_handler
-
- if [ -z "$TMPFS_MOUNTED" ]; then
- unmount_devpts
- mount_tmpfs
- [ -d /proc/1 ] || mount -n /proc
+ # It's all over netlink now
+ if [ -e /proc/sys/kernel/hotplug ]; then
+ echo "" > /proc/sys/kernel/hotplug
fi
- # if this directory is not present /dev will not be updated by udev
- mkdir -p /dev/.udev/ /dev/.udev/db/ /dev/.udev/queue/ /dev/.udevdb/
- # /dev/null must be created before udevd is started
- make_extra_nodes
+ echo "Starting the hotplug events dispatcher" "udevd"
+ udevd --daemon
echo "Synthesizing the initial hotplug events"
udevtrigger
-
- # wait for the udevd childs to finish
- echo "Waiting for /dev to be fully populated"
- while [ -d /dev/.udev/queue/ ]; do
- sleep 1
- udevd_timeout=$(($udevd_timeout - 1))
- if [ $udevd_timeout -eq 0 ]; then
- # ps axf
- break
- fi
- done
- if [ $udevd_timeout -eq 0 ]; then
- echo 'timeout'
- fi
+ udevsettle
;;
stop)
============================================================
--- packages/udev/udev_118.bb ea5479f679eae83985b0d677a1317948a47e3ac4
+++ packages/udev/udev_118.bb e9281fed9bc0fc17975cbcd7076778e89ce58196
@@ -1,11 +1,11 @@ RPROVIDES_${PN} = "hotplug"
DESCRIPTION = "udev is a daemon which dynamically creates and removes device nodes from \
/dev/, handles hotplug events and loads drivers at boot time. It replaces \
the hotplug package and requires a kernel not older than 2.6.12."
RPROVIDES_${PN} = "hotplug"
-PR = "r0"
+PR = "r2"
-DEFAULT_PREFERENCE = "-115"
+DEFAULT_PREFERENCE = "-118"
SRC_URI = "\
http://kernel.org/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
More information about the Openembedded-commits
mailing list