upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:02:07 +0000 (17:02 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:02:07 +0000 (17:02 +0900)
14 files changed:
debian/changelog
debian/control
debian/rules
packaging/start_udev [new file with mode: 0644]
packaging/udev.init [new file with mode: 0644]
packaging/udev.spec [new file with mode: 0644]
packaging/udev.udev-mtab.init [new file with mode: 0644]
rules/debian/50-udev-default.rules
rules/debian/91-permissions.rules
rules/slp/95-permissions-slp.rules [deleted file]
udev/udev-event.c
udev/udev-node.c
udev/udev-rules.c
udev/udev.h

index 5eb4b35..6f4d059 100644 (file)
@@ -1,5 +1,58 @@
+udev (166-1slp2+s10) unstable; urgency=low
+
+  [ Kim Hyunhee ]
+  * Modify debian/rules to remove slp/*.rules file
+
+  [ Rafal Krypa ]
+  * Remove udev rules file with device node permissions.
+  * Tizen permissions: fix detection of camera device nodes
+
+  [ Jang Yeongil ]
+  * SLP: Modify invalid udev rules
+  * Git: slp/pkgs/u/udev
+  * Tag: udev_166-1slp2+s10
+
+ -- Hyunhee Kim <hyunhee.kim@samsung.com>  Thu, 22 Mar 2012 20:37:48 +0900
+
+udev (166-1slp2+s9) unstable; urgency=low
+
+  [ Lee Kangwon ]
+  * Add packaging/udev.spec
+
+  [ Rafal Krypa ]
+  * Add SMACK label support to rules.
+  * Add smack label length checking.
+  * Properly handle permissions and ownership of all Tizen device nodes.
+  * Git: slp/pkgs/u/udev
+  * Tag: udev_166-1slp2+s9
+
+ -- Rafal Krypa <r.krypa@samsung.com>  Thu, 15 Mar 2012 12:58:41 +0100
+
 udev (166-1slp2+s8) unstable; urgency=low
 
+  * Increase version up for rebuild
+   - build failed. reupload sources from xorg/miscs/udev
+  * Git: slp/pkgs/u/udev
+  * Tag: udev_166-1slp2+s8
+
+ -- Wonil Choi <wonil22.choi@samsung.com>  Wed, 11 Jan 2012 18:45:46 +0900
+
+udev (166-1slp2+s7) unstable; urgency=low
+
+  * Increase version up for rebuild
+  * Git: slp/pkgs/u/udev
+  * Tag: udev_166-1slp2+s7
+
+ -- Wonil Choi <wonil22.choi@samsung.com>  Wed, 11 Jan 2012 17:52:26 +0900
+
+udev (166-1slp2+s6) unstable; urgency=low
+
+  * increase version up for rebuild
+
+ -- Wonil Choi <wonil22.choi@samsung.com>  Mon, 09 Jan 2012 16:38:32 +0900
+
+udev (166-1slp2+s5) unstable; urgency=low
+
   * Fix symlink issue on upgrade of dev package
 
  -- Mike McCormack <mj.mccormack@samsung.com>  Wed, 23 Nov 2011 09:29:04 +0900
index bfd4783..420b5f6 100644 (file)
@@ -1,7 +1,8 @@
 Source: udev
 Section: admin
 Priority: important
-Maintainer: Karol Lewandowski <k.lewandowsk@samsung.com>, Mike McCormack <mj.mccormack@samsung.com>
+Maintainer: Hyunhee Kim <hyunhee.kim@samsung.com>
+Uploaders: Hyunhee Kim <hyunhee.kim@samsung.com>, Rafal Krypa <r.krypa@samsung.com>
 X-Original-Maintainer: Marco d'Itri <md@linux.it>
 Build-Depends: debhelper (>> 7), hardening-includes, quilt (>= 0.40), libglib2.0-dev (>= 2.12.0), libusb-dev (>= 1:0.1.12), libacl1-dev, usbutils (>= 0.86-2), pciutils, libc6-dev (>= 2.9) [!alpha !ia64], libc6.1-dev (>= 2.9) [alpha ia64], linux-libc-dev (>= 2.6.29), autoconf, automake, libtool (>= 2.2.2), gtk-doc-tools, xsltproc, docbook-xsl, gperf
 Standards-Version: 3.9.1
index 8d2910a..241e8f8 100755 (executable)
@@ -132,7 +132,6 @@ endif
        cd $D/lib/udev/rules.d/ && rm 60-cdrom_id.rules \
                61-persistent-storage-edd.rules
        cp rules/debian/*.rules $D/lib/udev/rules.d/
-       cp rules/slp/*.rules $D/lib/udev/rules.d/
        perl extra/subst_lib_name $D
        cp extra/links.conf $D/etc/udev/
 
diff --git a/packaging/start_udev b/packaging/start_udev
new file mode 100644 (file)
index 0000000..a0ea9ae
--- /dev/null
@@ -0,0 +1,187 @@
+#! /bin/sh
+#
+# Streamlined udev initialization
+#
+# Based on the start_udev script by Greg KH:
+#
+#    Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
+#   
+#    Released under the GPL v2 only.
+#   
+#    This needs to be run at the earliest possible point in the boot 
+#    process.
+#   
+#    Based on the udev init.d script
+#   
+#    Thanks go out to the Gentoo developers for proving 
+#    that this is possible to do.
+#   
+#    Yes, it's very verbose, feel free to turn off all of the echo calls,
+#    they were there to make me feel better that everything was working
+#
+# Copyright (C) 2008 Intel Corporation <inaky.perez-gonzalez@intel.com>
+#
+# Just do the same stuff, but make the folling assumptions: 
+#
+#  - called from system boot, /dev, /dev/pts, etc not mounted
+#  - kernel command line options named udev* all belong to us
+#  - udev is not running
+#  - /etc/udev/devices and /lib/udev/devices are deprecated and not allowed
+#  - needed binaries / stuff is where it should be
+#    + /sbin/udevd exists
+#    + /sbin/MAKEDEV
+#    + /proc, /sys are mounted
+#
+# As well, use the program mkdevnodes to create the nodes and
+# directories, instead of MAKEDEV.
+#
+
+set -eu
+
+sysconfdir=${sysconfdir:-/etc/udev}
+devdir=${devdir:-/dev}
+progname=${0/#*\//}
+
+on_exit() {
+    local code=${1:-$?}
+    if [ $code != 0 ]
+    then
+        echo "$progname: FAILED ($code)"
+    fi
+}
+
+# $1 code
+# $2 message
+die() {
+    local code=$1
+    shift 1
+    echo "$@" 1>&2
+    exit $code
+}
+
+if [ -f /dev/.in_sysinit ]; then
+    exec >/dev/console 2>/dev/console </dev/console
+fi
+
+trap on_exit EXIT
+trap "on_exit 1" SIGHUP SIGABRT SIGQUIT SIGINT SIGKILL
+
+# Options to start udev
+UDEV_OPTS=""
+# Options to run udevcontrol after starting udev
+udev_ctl_options=""
+# Options to udevsettle
+udevtimeout=""
+modprobedebug=0
+# Bring in udev* options from the kernel command line
+for option in $(cat /proc/cmdline)
+do
+    case $option in
+        udevtimeout=*)
+            udevtimeout="--timeout=${option/#*=/}"
+            ;;
+        udevdebug)
+            udev_ctl_options="$udev_ctl_options --log-priority=debug"
+            ;;
+        udevinfo)
+            udev_ctl_options="$udev_ctl_options --log-priority=info"
+            ;;
+        udevtrace)
+            UDEV_OPTS="$UDEV_OPTS --debug-trace"
+            ;;
+        udevnopersist)
+            udev_ctl_options="$udev_ctl_options --env UDEV_NO_PERSISTENT_STORAGE=1"
+            ;;
+        udevchilds=*)
+            udev_ctl_options="$udev_ctl_options --max-childs-running=${option/#*=/}"
+            ;;
+        modprobedebug|udevmodprobedebug)
+            modrobedebug=1
+            udev_ctl_options="$udev_ctl_options --env MODPROBE_OPTIONS=\"-s -v -q\""
+            ;;
+        udev*)
+            echo "$progname: ignoring unknown udev command option '$option' in kernel command line" 1>&2
+            ;;
+    esac
+done
+
+# Parse config coming from /etc
+[ -f $sysconfdir/udev.conf ] && . $sysconfdir/udev.conf
+[ -f /etc/sysconfig/udev ] && . /etc/sysconfig/udev
+
+if [ "$UDEV_PERSISTENT_STORAGE" == "no" ]
+then
+    udev_ctl_options="$udev_ctl_options --env UDEV_NO_PERSISTENT_STORAGE=1"
+fi
+
+# This will be needed for configuring base devices
+[ -x $sysconfdir/selinux.conf ] && . $sysconfdir/selinux.conf
+
+# make sure we have /dev/console always
+[ ! -e /dev/console ] && mknod /dev/console c 5 1
+
+# Mount the base directories we need
+mount -n -o mode=0755 -t tmpfs none $devdir
+
+# create /dev/pts
+
+mkdir /dev/pts
+mkdir /dev/shm
+
+# Create dirs|links|nodes with mkdevnodes
+/sbin/mkdevnodes
+
+# mount /dev/pts
+mount -n -o mode=0755 -t devpts none $devdir/pts
+
+# Create nodes with the MAKEDEV method (this is OBSOLETE,
+# and should be REMOVED)
+for i in $sysconfdir/makedev.d/*.nodes; do
+       if [ -f "$i" ]; then                       
+           ( sed -e 's,#.*,,g' "$i" | \
+               xargs -n 100 MAKEDEV -x )
+       fi
+done 
+
+# Now start udev proper
+[ -f "/sys/class/tty/console/uevent" ] \
+    || die 1 "$progname: can't find /sys/class/tty/console/uevent! can't start udev" 1>&2
+
+# trigger the sorted events
+echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
+
+rm -fr $devdir/.udev > "$devdir/null" 2>&1
+/sbin/udevd -d \
+    || die 1 "$progname: can't start udev" 1>&2
+
+# Now tweak udev's config according to the options
+/sbin/udevadm control $udev_ctl_options --env STARTUP=1
+
+findalias () {
+       local n
+       for n in "$1"/* ; do
+               [ -h "$n" ] && continue
+               [ -d "$n" ] && { findalias "$n" ; continue; }
+               [ "${n##*/}" == "modalias" ] && echo $(cat $n)
+       done
+}
+
+if [ $modprobedebug = 1 ]
+then
+    findalias /sys | while read modules ; do
+       if [ -n "$modules" ]; then
+           /sbin/modprobe -a -v -q $modules
+           wait_for_queue $udevtimeout
+       fi
+    done
+fi
+
+(
+/sbin/udevadm trigger \
+    || die 1 "$progname: udevtrigger failed to start" 1>&2
+    /sbin/udevadm settle $udevtimeout \
+        || echo "$progname: failed waiting for queue, backgrounding" 1>&2
+    /sbin/udevadm trigger --action=add --subsystem-match="rtc"
+    /sbin/udevadm control --env STARTUP=
+) &
+exit 0
diff --git a/packaging/udev.init b/packaging/udev.init
new file mode 100644 (file)
index 0000000..a9b8db2
--- /dev/null
@@ -0,0 +1,319 @@
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Provides:          udev
+# Required-Start:    mountkernfs 
+# Required-Stop:     
+# Default-Start:     S
+# Default-Stop:
+# X-Interactive:     true
+# Short-Description: Start udevd, populate /dev and load drivers.
+### END INIT INFO
+
+# we need to unmount /dev/pts/ and remount it later over the tmpfs
+unmount_devpts() {
+  if mountpoint -q /dev/pts/; then
+    umount -n -l /dev/pts/
+  fi
+
+  if mountpoint -q /dev/shm/; then
+    umount -n -l /dev/shm/
+  fi
+}
+
+# mount a tmpfs over /dev, if somebody did not already do it
+mount_tmpfs() {
+  if grep -E -q "^[^[:space:]]+ /dev (dev)?tmpfs" /proc/mounts; then
+    mount -n -o remount,${dev_mount_options} -t tmpfs tmpfs /dev
+    return
+  fi
+
+  if ! mount -n -o $dev_mount_options -t tmpfs tmpfs /dev; then
+    log_failure_msg "udev requires tmpfs support, not started."
+    log_end_msg 1
+  fi
+
+  return 0
+}
+
+create_dev_makedev() {
+  if [ -e /sbin/MAKEDEV ]; then
+    ln -sf /sbin/MAKEDEV /dev/MAKEDEV
+  else
+    ln -sf /bin/true /dev/MAKEDEV
+  fi
+}
+
+supported_kernel() {
+  case "$(uname -r)" in
+    2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;;
+    2.6.1[0-9]|2.6.1[0-9][!0-9]*) return 1 ;;
+    2.6.2[0-6]|2.6.2[0-6][!0-9]*) return 1 ;;
+  esac
+  return 0
+}
+
+# shell version of /usr/bin/tty
+my_tty() {
+  [ -x /bin/readlink ] || return 0
+  [ -e /proc/self/fd/0 ] || return 0
+  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" -o "$TTY" = "/dev/null" ]; 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
+}
+
+create_dev_root_rule() {
+  local udevroot="$1"
+  [ -e $udevroot/rules.d/61-dev-root-link.rules ] && return 0
+
+  eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ \
+    || true)
+  [ "$ROOT_MAJOR" -a "$ROOT_MINOR" ] || return 0
+
+  echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' \
+    > $udevroot/root-link-rule
+  mv $udevroot/root-link-rule $udevroot/rules.d/61-dev-root-link.rules
+}
+
+##############################################################################
+
+[ -x /sbin/udevd ] || exit 0
+
+PATH="/sbin:/bin"
+
+# defaults
+tmpfs_size="10M"
+udev_root="/dev"
+
+if [ -e /etc/udev/udev.conf ]; then
+  . /etc/udev/udev.conf
+fi
+
+. /lib/lsb/init-functions
+
+if ! supported_kernel; then
+  log_failure_msg "udev requires a kernel >= 2.6.27, not started."
+  log_end_msg 1
+fi
+
+if [ ! -e /proc/filesystems ]; then
+  log_failure_msg "udev requires a mounted procfs, not started."
+  log_end_msg 1
+fi
+
+if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then
+  log_failure_msg "udev requires tmpfs support, not started."
+  log_end_msg 1
+fi
+
+if [ ! -d /sys/class/ ]; then
+  log_failure_msg "udev requires a mounted sysfs, not started."
+  log_end_msg 1
+fi
+
+if [ ! -e /sys/kernel/uevent_helper ]; then
+  log_failure_msg "udev requires hotplug support, not started."
+  log_end_msg 1
+fi
+
+##############################################################################
+
+# this is experimental and may not work well
+if [ "$UDEV_DISABLED" = "yes" ]; then
+  udev_root=/etc/udev/.dev
+  export UDEV_ROOT=$udev_root
+fi
+
+udev_root=${udev_root%/}
+
+dev_mount_options='mode=0755'
+if [ "$tmpfs_size" ]; then
+  dev_mount_options="size=${tmpfs_size},${dev_mount_options}"
+fi
+
+if [ "$udev_root" != "/dev" ]; then
+  log_warning_msg "udev_root != /dev/"
+
+case "$1" in
+    start)
+    if [ -e "$udev_root/.udev/" ]; then
+       if mountpoint -q $udev_root/; then
+           log_failure_msg "udev is already active on $udev_root."
+           log_end_msg 1
+       else
+           log_warning_msg ".udev/ already exists on the static $udev_root!"
+       fi
+    fi
+
+    echo > /sys/kernel/uevent_helper
+
+    mount -n -o $dev_mount_options -t tmpfs tmpfs $udev_root
+
+    log_daemon_msg "Starting the hotplug events dispatcher" "udevd"
+    if udevd --daemon; then
+       log_end_msg $?
+    else
+       log_end_msg $?
+    fi
+
+    mkdir -p $udev_root/.udev/rules.d/
+    create_dev_root_rule $udev_root/.udev/
+
+    log_action_begin_msg "Synthesizing initial hotplug events"
+    if udevadm trigger --action=add; then
+       log_action_end_msg $?
+    else
+       log_action_end_msg $?
+    fi
+
+    ;;
+    stop)
+    log_daemon_msg "Stopping the hotplug events dispatcher" "udevd"
+    if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then
+       log_end_msg $?
+    else
+       log_end_msg $?
+    fi
+
+    log_action_begin_msg "Unmounting $udev_root"
+    # unmounting with -l should never fail
+    if umount -n -l $udev_root; then
+       log_action_end_msg $?
+    else
+       log_action_end_msg $?
+    fi
+    ;;
+
+    restart)
+    $0 stop
+    $0 start
+    ;;
+
+    reload|force-reload)
+    udevadm control --reload-rules
+    ;;
+
+    *)
+    echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload}"
+    exit 1
+    ;;
+esac
+
+  exit 0
+fi # udev_root != /dev
+
+##############################################################################
+
+# When modifying this script, do not forget that between the time that the
+# new /dev has been mounted and udevadm trigger 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 $udev_root/; then
+           TMPFS_MOUNTED=1
+       else
+           log_warning_msg ".udev/ already exists on the static $udev_root!"
+       fi
+    else
+       warn_if_interactive
+    fi
+
+    echo > /sys/kernel/uevent_helper
+
+    if [ -z "$TMPFS_MOUNTED" ]; then
+       unmount_devpts
+       mount_tmpfs
+       [ -d /proc/1 ] || mount -n /proc
+    else
+       # and clean up the database of the initramfs udev
+       rm -rf /dev/.udev/
+    fi
+
+    # set the SELinux context for devices created in the initramfs
+    [ -x /sbin/restorecon ] && /sbin/restorecon -R /dev
+
+    # /dev/null must be created before udevd is started
+    /lib/udev/create_static_nodes || true
+
+    log_daemon_msg "Starting the hotplug events dispatcher" "udevd"
+    if udevd --daemon; then
+       log_end_msg $?
+    else
+       log_end_msg $?
+    fi
+
+    mkdir -p /dev/.udev/rules.d/
+    create_dev_root_rule /dev/.udev/
+
+    log_action_begin_msg "Synthesizing the initial hotplug events"
+    if udevadm trigger --action=add; then
+       log_action_end_msg $?
+    else
+       log_action_end_msg $?
+    fi
+
+    create_dev_makedev
+
+    # wait for the udevd childs to finish
+    log_action_begin_msg "Waiting for /dev to be fully populated"
+    if udevadm settle; then
+       log_action_end_msg 0
+    else
+       log_action_end_msg 0 'timeout'
+    fi
+    ;;
+
+    stop)
+    log_daemon_msg "Stopping the hotplug events dispatcher" "udevd"
+    if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then
+       log_end_msg $?
+    else
+       log_end_msg $?
+    fi
+    ;;
+
+    restart)
+    log_daemon_msg "Stopping the hotplug events dispatcher" "udevd"
+    if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then
+       log_end_msg $?
+    else
+       log_end_msg $? || true
+    fi
+
+    log_daemon_msg "Starting the hotplug events dispatcher" "udevd"
+    if udevd --daemon; then
+       log_end_msg $?
+    else
+       log_end_msg $?
+    fi
+    ;;
+
+    reload|force-reload)
+    udevadm control --reload-rules
+    ;;
+
+    *)
+    echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload}"
+    exit 1
+    ;;
+esac
+
+exit 0
+
diff --git a/packaging/udev.spec b/packaging/udev.spec
new file mode 100644 (file)
index 0000000..1489920
--- /dev/null
@@ -0,0 +1,196 @@
+Name:           udev
+Version:        166
+Release:        1
+License:        GPLv2
+Summary:        A userspace implementation of devfs
+Group:          System/Base
+Source0:        http://www.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.gz
+#Source1:      start_udev
+Source2:       udev.spec
+Source3:       udev.udev-mtab.init
+
+%define udev_libdir /lib/udev
+%define firmwaredir /lib/firmware
+
+Url:            http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
+BuildRequires:  bison
+BuildRequires:  findutils
+BuildRequires:  flex
+BuildRequires:  gperf
+BuildRequires:  libacl-devel
+BuildRequires:  libtool
+BuildRequires:  sed
+BuildRequires:  pciutils
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(libusb)
+BuildRequires:  pkgconfig(usbutils)
+BuildRequires:  pkgconfig(blkid)
+Requires:       /bin/sed
+Requires(pre): /bin/sh 
+Requires(pre): /usr/bin/stat
+
+Obsoletes:      udev-extra
+
+%description
+The udev package contains an implementation of devfs in
+userspace using sysfs and netlink.
+
+%package -n libudev
+Summary:        Library for accessing udev functionality
+Group:          Development/Libraries
+Requires:       udev = %{version}
+
+%description -n libudev
+This package contains a shared library for accesing libudev functionality.
+
+%package -n libudev-devel
+Summary:        Headers for libudev
+Group:          Development/Libraries
+Requires:       libudev = %{version}
+Requires:       udev = %{version}
+
+%description -n libudev-devel
+This package contains libraries and include files,
+which needed to link against libudev.
+
+%package -n libgudev1
+Summary:        Libraries for adding libudev support to applications that use glib
+Group:          Development/Libraries
+Requires:       libudev >= 142
+# remove the following lines for libgudev so major 1
+Provides:       libgudev = 20090517
+Obsoletes:      libgudev <= 20090516
+
+%description -n libgudev1
+This package contains the libraries that make it easier to use libudev
+functionality from applications that use glib.
+
+%package -n libgudev1-devel
+Summary:        Header files for adding libudev support to applications that use glib
+Group:          Development/Libraries
+Requires:       libgudev1 = %{version}
+Requires:       pkgconfig(udev) >= 142
+Provides:       libgudev-devel = 20090517
+Obsoletes:      libgudev-devel <= 20090516
+
+
+%description -n libgudev1-devel
+This package contains the header and pkg-config files for developing
+glib-based applications using libudev functionality.
+
+%prep
+%setup -q
+
+
+%build
+libtoolize -f -c
+%configure  --prefix=/usr --sysconfdir=/etc --sbindir=/sbin \
+  --with-rootlibdir=/lib --libexecdir=/lib/udev \
+  --disable-gtk-doc \
+  --disable-introspection \
+  --with-systemdsystemunitdir=/lib/systemd/system \
+  --enable-static --disable-dependency-tracking
+        
+
+make %{?_smp_mflags}
+
+%install
+
+%make_install
+
+mkdir -p %{buildroot}/etc/udev/
+mkdir -p %{buildroot}/etc/modprobe.d/
+mkdir -p %{buildroot}/etc/init.d/
+
+#install -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/sbin/start_udev
+install -m 0755 ./udev/udevd $RPM_BUILD_ROOT/sbin/udevd
+install -m 644 extra/blacklist.conf extra/fbdev-blacklist.conf \
+       %{buildroot}/etc/modprobe.d/
+cp -a extra/links.conf %{buildroot}/etc/udev/links.conf
+cp -a %{SOURCE2} %{buildroot}/etc/init.d/udev
+cp -a %{SOURCE3} %{buildroot}/etc/init.d/udev-mtab
+
+
+%post
+
+%postun
+
+%post -n libudev -p /sbin/ldconfig
+%postun -n libudev -p /sbin/ldconfig
+
+%post -n libudev-devel -p /sbin/ldconfig
+
+%post -n libgudev1 -p /sbin/ldconfig
+%postun -n libgudev1 -p /sbin/ldconfig
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(0644, root, root, 0755)
+%attr(0755,root,root) /sbin/udevadm
+%attr(0755,root,root) /sbin/udevd
+%attr(0755,root,root) /%{_lib}/udev/keymaps/*
+%attr(0755,root,root) /%{_lib}/udev/*
+
+/lib/udev/rules.d/*
+/lib/systemd/system/udev.service
+/lib/systemd/system/udev-retry.service
+/lib/systemd/system/basic.target.wants/udev.service
+/lib/systemd/system/basic.target.wants/udev-retry.service
+/lib/systemd/system/basic.target.wants/udev-settle.service
+/lib/systemd/system/udev-settle.service
+/etc/udev/udev.conf
+/etc/udev/links.conf
+/etc/modprobe.d/fbdev-blacklist.conf
+/etc/modprobe.d/blacklist.conf
+/etc/init.d/udev
+/etc/init.d/udev-mtab
+
+#%files
+%attr(0755,root,root) %{udev_libdir}/rules.d/42-qemu-usb.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/50-firmware.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/50-udev-default.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/60-cdrom_id.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/60-persistent-alsa.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/60-persistent-input.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/60-persistent-storage.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/60-persistent-storage-tape.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/60-persistent-serial.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/60-persistent-v4l.rules
+#%attr(0755,root,root) %{udev_libdir}/rules.d/61-accelerometer.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/75-net-description.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/75-probe_mtd.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/75-tty-description.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/78-sound-card.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/80-drivers.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/95-keyboard-force-release.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/95-keymap.rules
+%attr(0755,root,root) %{udev_libdir}/rules.d/95-udev-late.rules
+
+%files -n libudev
+/%{_lib}/libudev.so.*
+
+%files -n libudev-devel
+%defattr(0644, root, root, 0755)
+%attr(0644,root,root) %{_mandir}/man8/udev*.8*
+%attr(0644,root,root) %{_mandir}/man7/udev*.7*
+%attr(0644,root,root) %{_mandir}/man8/scsi_id*.8*
+/usr/include/libudev.h
+/usr/lib/libudev.so
+/usr/lib/pkgconfig/libudev.pc
+/usr/share/pkgconfig/udev.pc
+/usr/share/gtk-doc/html/libudev/*
+/usr/share/doc/udev/*
+%exclude %{_libdir}/ConsoleKit/*
+
+%files -n libgudev1
+/%{_lib}/libgudev-1.0.so.*
+
+%files -n libgudev1-devel
+%{_libdir}/libgudev-1.0.so
+%{_includedir}/gudev-1.0/gudev/*.h
+%{_libdir}/pkgconfig/gudev-1.0*
+%{_datadir}/gtk-doc/html/gudev/*
diff --git a/packaging/udev.udev-mtab.init b/packaging/udev.udev-mtab.init
new file mode 100644 (file)
index 0000000..1496426
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Provides:          udev-mtab
+# Required-Start:    udev $local_fs
+# Required-Stop:     
+# Default-Start:     S
+# Default-Stop:
+# Short-Description: Add to mtab the entry for /dev.
+### END INIT INFO
+
+PATH="/sbin:/bin"
+
+case "$1" in
+  start) ;;
+  stop|restart|force-reload) exit 0 ;;
+  *) echo "Usage: $0 {start|stop|restart|force-reload}" >&2; exit 1 ;;
+esac
+
+# copy the rules generated before / was mounted read-write
+for file in /dev/.udev/tmp-rules--*; do
+  dest=${file##*tmp-rules--}
+  [ "$dest" = '*' ] && break
+  cat $file >> /etc/udev/rules.d/$dest
+  rm -f $file
+done
+
+
+# if it's not, it's probably a symlink to /proc/mounts
+[ -w /etc/mtab ] || exit 0
+
+# defaults
+tmpfs_size="10M"
+udev_root="/dev/"
+
+if [ -e /etc/udev/udev.conf ]; then
+  . /etc/udev/udev.conf
+fi
+
+# strip the trailing slash
+udev_root=${udev_root%/}
+
+if mountpoint -q $udev_root; then
+  if ! grep -E --quiet --no-messages "^[^ ]+ +$udev_root +" /etc/mtab; then
+    mtabline="$(grep -E --no-messages "^[^ ]+ +$udev_root +(dev)?tmpfs +" /proc/mounts || true)"
+    if [ "$mtabline" ]; then
+      echo "$mtabline" >> /etc/mtab
+    fi
+  fi
+fi
+
+exit 0
+
index 5eb0a40..451933f 100644 (file)
@@ -26,7 +26,7 @@ SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \
 SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device",  NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}"
 
 # serial devices
-KERNEL=="capi",                        NAME="capi20",
+KERNEL=="capi",                        NAME="capi20"
 KERNEL=="capi[0-9]*",          NAME="capi/%n"
 
 # video devices
index 8f77585..c75b108 100644 (file)
@@ -102,7 +102,7 @@ KERNEL=="dv1394-[0-9]*",                    GROUP="video"
 KERNEL=="video1394-[0-9]*",                    GROUP="video"
 
 # input devices
-KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \
+KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *", \
                                MODE="0664",    GROUP="video"
 KERNEL=="js[0-9]*",            MODE="0664"
 KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", \
diff --git a/rules/slp/95-permissions-slp.rules b/rules/slp/95-permissions-slp.rules
deleted file mode 100644 (file)
index 04525af..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-ACTION=="remove", GOTO="permissions_slp_end"
-
-KERNEL=="video1",              GROUP="camera"
-KERNEL=="s5p-jpeg",            GROUP="camera"
-KERNEL=="radio0",              GROUP="radio"
-KERNEL=="video[56]",           GROUP="hwcodec"
-KERNEL=="s5p-mfc",             GROUP="hwcodec"
-KERNEL=="log_main",            GROUP="logging"
-KERNEL=="log_events",          GROUP="logging"
-KERNEL=="log_radio",           GROUP="logging"
-KERNEL=="controlC0D[0-3]c",    GROUP="recording"
-KERNEL=="pcmC0D[0-3]c",                GROUP="recording"
-
-KERNEL=="pvrsrvkm",            MODE="0666"
-
-KERNEL=="ump",                 MODE="0666"
-KERNEL=="mali",                        MODE="0666"
-
-LABEL="permissions_slp_end"
index 100a79c..e87d703 100644 (file)
@@ -54,6 +54,7 @@ void udev_event_unref(struct udev_event *event)
        free(event->tmp_node);
        free(event->program_result);
        free(event->name);
+       free(event->smack);
        dbg(event->udev, "free event %p\n", event);
        free(event);
 }
@@ -380,7 +381,7 @@ subst:
                                 minor(udev_device_get_devnum(dev)));
                        if (event->tmp_node == NULL)
                                break;
-                       udev_node_mknod(dev, event->tmp_node, 0600, 0, 0);
+                       udev_node_mknod(dev, event->tmp_node, 0600, 0, 0, NULL);
                        l = util_strpcpy(&s, l, event->tmp_node);
                        break;
                }
@@ -640,7 +641,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                        if (event->mode == 0600 && event->gid > 0)
                                event->mode = 0660;
 
-                       err = udev_node_add(dev, event->mode, event->uid, event->gid);
+                       err = udev_node_add(dev, event->mode, event->uid, event->gid, event->smack);
                }
 
                /* preserve old, or get new initialization timestamp */
index 0ceb1d5..201c9ca 100644 (file)
 #include <sys/time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/xattr.h>
 
 #include "udev.h"
 
 #define TMP_FILE_EXT           ".udev-tmp"
 
-int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid)
+int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid, const char *smack)
 {
        struct udev *udev = udev_device_get_udev(dev);
        dev_t devnum = udev_device_get_devnum(dev);
@@ -111,6 +112,13 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_
                chmod(file, mode);
                chown(file, uid, gid);
        }
+
+       if (smack != NULL) {
+               err = lsetxattr(file, "security.SMACK64", smack, strlen(smack) + 1, 0);
+               if (err != 0)
+                       err = -errno;
+    }
+
 exit:
        return err;
 }
@@ -360,7 +368,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev
        }
 }
 
-int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid)
+int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, const char *smack)
 {
        struct udev *udev = udev_device_get_udev(dev);
        char filename[UTIL_PATH_SIZE];
@@ -372,7 +380,7 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid)
             major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)),
             mode, uid, gid);
 
-       if (udev_node_mknod(dev, NULL, mode, uid, gid) != 0) {
+       if (udev_node_mknod(dev, NULL, mode, uid, gid, smack) != 0) {
                err = -1;
                goto exit;
        }
index 6b473c4..9420d40 100644 (file)
@@ -36,6 +36,8 @@
 #define PREALLOC_STRBUF                        32 * 1024
 #define PREALLOC_TRIE                  256
 
+#define SMK_MAXLEN                     23
+
 struct uid_gid {
        unsigned int name_off;
        union {
@@ -167,6 +169,7 @@ enum token_type {
        TK_A_ATTR,                      /* val, attr */
        TK_A_RUN,                       /* val, bool */
        TK_A_GOTO,                      /* size_t */
+       TK_A_SMACK,                     /* val */
 
        TK_END,
 };
@@ -1023,6 +1026,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
        case TK_A_GOTO:
        case TK_M_TAG:
        case TK_A_TAG:
+       case TK_A_SMACK:
                token->key.value_off = add_string(rule_tmp->rules, value);
                break;
        case TK_M_ENV:
@@ -1549,6 +1553,24 @@ static int add_rule(struct udev_rules *rules, char *line,
                        continue;
                }
 
+               if (strncmp(key, "SMACK", sizeof("SMACK")-1) == 0) {
+                       if (value[0] == '\0') {
+                               info(rules->udev, "SMACK=\"\" is ignored, invalid label \"\" "
+                                    "please remove it from %s:%u\n", filename, lineno);
+                               continue;
+                       }
+
+                       if (strnlen(value, SMK_MAXLEN + 1) > SMK_MAXLEN) {
+                               info(rules->udev, "SMACK=\"%s\" is ignored, label \"%s\" exceeds %d characters "
+                                    "please remove it from %s:%u\n", value, value, SMK_MAXLEN, filename, lineno);
+                               continue;
+                       }
+
+                       rule_add_key(&rule_tmp, TK_A_SMACK, op, value, NULL);
+                       rule_tmp.rule.rule.can_set_name = true;
+                       continue;
+               }
+
                if (strcmp(key, "MODE") == 0) {
                        mode_t mode;
                        char *endptr;
@@ -2449,6 +2471,26 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
                                     rule->rule.filename_line);
                                break;
                        }
+               case TK_A_SMACK:
+               {
+                       const char *smack  = &rules->buf[cur->key.value_off];
+                       char smack_str[UTIL_PATH_SIZE];
+
+                       if (event->smack_final)
+                               break;
+                       if (cur->key.op == OP_ASSIGN_FINAL)
+                               event->smack_final = true;
+
+                       udev_event_apply_format(event, smack, smack_str, sizeof(smack_str));
+                       free(event->smack);
+                       event->smack = strdup(smack_str);
+
+                       info(event->udev, "SMACK '%s' %s:%u\n",
+                            event->smack,
+                            &rules->buf[rule->rule.filename_off],
+                            rule->rule.filename_line);
+                       break;
+               }
                case TK_A_MODE:
                        {
                                char mode[UTIL_NAME_SIZE];
index 6833e60..f20f370 100644 (file)
@@ -42,12 +42,14 @@ struct udev_event {
        mode_t mode;
        uid_t uid;
        gid_t gid;
+       char *smack;
        struct udev_list_node run_list;
        int exec_delay;
        bool inotify_watch;
        bool inotify_watch_final;
        bool group_final;
        bool owner_final;
+       bool smack_final;
        bool mode_final;
        bool name_final;
        bool devlink_final;
@@ -84,8 +86,8 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev);
 struct udev_device *udev_watch_lookup(struct udev *udev, int wd);
 
 /* udev-node.c */
-int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid);
-int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid);
+int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid, const char *smack);
+int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, const char *smack);
 int udev_node_remove(struct udev_device *dev);
 void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old);