summaryrefslogtreecommitdiffstats
path: root/openembedded/packages/udev
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2005-08-31 10:45:47 +0000
committerRichard Purdie <richard@openedhand.com>2005-08-31 10:45:47 +0000
commit4b46c1f6e891b1ddd5968536440b888661fade3e (patch)
treee0ba2c1f56f61b868bf746da5c4feabb25b800b2 /openembedded/packages/udev
downloadpoky-4b46c1f6e891b1ddd5968536440b888661fade3e.tar.gz
Initial population
git-svn-id: https://svn.o-hand.com/repos/poky@1 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'openembedded/packages/udev')
-rwxr-xr-xopenembedded/packages/udev/files/init178
-rw-r--r--openembedded/packages/udev/files/noasmlinkage.patch27
-rw-r--r--openembedded/packages/udev/files/tmpfs.patch16
-rw-r--r--openembedded/packages/udev/udev-065/fix-alignment.patch24
-rw-r--r--openembedded/packages/udev/udev-065/flags.patch66
-rw-r--r--openembedded/packages/udev/udev-065/noasmlinkage.patch38
-rw-r--r--openembedded/packages/udev/udev-065/tty-symlinks.patch11
-rw-r--r--openembedded/packages/udev/udev.inc42
-rw-r--r--openembedded/packages/udev/udev_065.bb22
9 files changed, 424 insertions, 0 deletions
diff --git a/openembedded/packages/udev/files/init b/openembedded/packages/udev/files/init
new file mode 100755
index 0000000000..16efb31542
--- /dev/null
+++ b/openembedded/packages/udev/files/init
@@ -0,0 +1,178 @@
1#!/bin/sh -e
2
3PATH="/usr/sbin:/usr/bin:/sbin:/bin"
4
5UDEVSTART=/sbin/udevstart
6
7# default maximum size of the /dev ramfs
8ramfs_size="1M"
9
10[ -x $UDEVSTART ] || exit 0
11
12. /etc/udev/udev.conf
13
14case "$(uname -r)" in
15 2.[012345].*)
16 echo "udev requires a kernel >= 2.6, not started."
17 exit 0
18 ;;
19esac
20
21if ! grep -q '[[:space:]]ramfs$' /proc/filesystems; then
22 echo "udev requires ramfs support, not started."
23 exit 0
24fi
25
26if [ ! -e /proc/sys/kernel/hotplug ]; then
27 echo "udev requires hotplug support, not started."
28 exit 0
29fi
30
31##############################################################################
32
33# we need to unmount /dev/pts/ and remount it later over the ramfs
34unmount_devpts() {
35 if mountpoint -q /dev/pts/; then
36 umount -l /dev/pts/
37 fi
38
39 if mountpoint -q /dev/shm/; then
40 umount -l /dev/shm/
41 fi
42}
43
44# mount a ramfs over /dev, if somebody did not already do it
45mount_ramfs() {
46 if grep -E -q "^[^[:space:]]+ /dev ramfs" /proc/mounts; then
47 return 0
48 fi
49
50 # /.dev is used by /sbin/MAKEDEV to access the real /dev directory.
51 # if you don't like this, remove /.dev/.
52 [ -d /.dev ] && mount --bind /dev /.dev
53
54 echo -n "Mounting a ramfs over /dev..."
55 mount -n -o size=$ramfs_size,mode=0755 -t ramfs none /dev
56 echo "done."
57}
58
59# I hate this hack. -- Md
60make_extra_nodes() {
61 if [ -f /etc/udev/links.conf ]; then
62 grep '^[^#]' /etc/udev/links.conf | \
63 while read type name arg1; do
64 [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue
65 case "$type" in
66 L)
67 ln -s $arg1 /dev/$name
68 ;;
69 D)
70 mkdir -p /dev/$name
71 ;;
72 M)
73 mknod -m 600 /dev/$name $arg1
74 ;;
75 *)
76 echo "unparseable line ($type $name $arg1)"
77 ;;
78 esac
79 done
80 fi
81}
82
83##############################################################################
84
85if [ "$udev_root" != "/dev" ]; then
86 echo "WARNING: udev_root != /dev"
87
88case "$1" in
89 start)
90 if [ -e "$udev_root/.udev.tdb" ]; then
91 if mountpoint -q /dev/; then
92 echo "FATAL: udev is already active on $udev_root."
93 exit 1
94 else
95 echo "WARNING: .udev.tdb already exists on the old $udev_root!"
96 fi
97 fi
98 mount -n -o size=$ramfs_size,mode=0755 -t ramfs none $udev_root
99 echo -n "Creating initial device nodes..."
100 $UDEVSTART
101 echo "done."
102 ;;
103 stop)
104 start-stop-daemon -K -x /sbin/udevd
105 echo -n "Unmounting $udev_root..."
106 # unmounting with -l should never fail
107 if umount -l $udev_root; then
108 echo "done."
109 else
110 echo "failed."
111 fi
112 ;;
113 restart|force-reload)
114 $0 stop
115 $0 start
116 ;;
117 *)
118 echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}"
119 exit 1
120 ;;
121esac
122
123 exit 0
124fi # udev_root != /dev/
125
126##############################################################################
127# When modifying this script, do not forget that between the time that
128# the new /dev has been mounted and udevstart has been run there will be
129# no /dev/null. This also means that you cannot use the "&" shell command.
130
131case "$1" in
132 start)
133 if [ -e "$udev_root/.udev.tdb" ]; then
134 if mountpoint -q /dev/; then
135 echo "FATAL: udev is already active on $udev_root."
136 exit 1
137 else
138 echo "WARNING: .udev.tdb already exists on the old $udev_root!"
139 fi
140 fi
141 unmount_devpts
142 mount_ramfs
143 ACTION=add
144 echo -n "Creating initial device nodes..."
145 $UDEVSTART
146 make_extra_nodes
147 echo "done."
148# /etc/init.d/mountvirtfs start
149 ;;
150 stop)
151 start-stop-daemon -K -x /sbin/udevd
152 unmount_devpts
153 echo -n "Unmounting /dev..."
154 # unmounting with -l should never fail
155 if umount -l /dev; then
156 echo "done."
157 umount -l /.dev || true
158# /etc/init.d/mountvirtfs start
159 else
160 echo "failed."
161 fi
162 ;;
163 restart|force-reload)
164 start-stop-daemon -K -x /sbin/udevd
165 echo -n "Recreating device nodes..."
166 ACTION=add
167 $UDEVSTART
168 make_extra_nodes
169 echo "done."
170 ;;
171 *)
172 echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}"
173 exit 1
174 ;;
175esac
176
177exit 0
178
diff --git a/openembedded/packages/udev/files/noasmlinkage.patch b/openembedded/packages/udev/files/noasmlinkage.patch
new file mode 100644
index 0000000000..1694d4d661
--- /dev/null
+++ b/openembedded/packages/udev/files/noasmlinkage.patch
@@ -0,0 +1,27 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- udev-042/udev.c~noasmlinkage
7+++ udev-042/udev.c
8@@ -60,7 +60,7 @@
9 }
10 #endif
11
12-static void asmlinkage sig_handler(int signum)
13+static void sig_handler(int signum)
14 {
15 switch (signum) {
16 case SIGALRM:
17--- udev-042/udevd.c~noasmlinkage
18+++ udev-042/udevd.c
19@@ -308,7 +308,7 @@
20 return;
21 }
22
23-static void asmlinkage sig_handler(int signum)
24+static void sig_handler(int signum)
25 {
26 int rc;
27
diff --git a/openembedded/packages/udev/files/tmpfs.patch b/openembedded/packages/udev/files/tmpfs.patch
new file mode 100644
index 0000000000..9d0d8b4515
--- /dev/null
+++ b/openembedded/packages/udev/files/tmpfs.patch
@@ -0,0 +1,16 @@
1
2#
3# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
4#
5
6--- udev-031/extras/start_udev~tmpfs 2004-09-10 17:10:03.000000000 -0400
7+++ udev-031/extras/start_udev 2004-09-11 15:18:15.560789160 -0400
8@@ -85,7 +85,7 @@
9 fi
10
11 echo "mounting... ramfs at $udev_root"
12-mount -n -t ramfs none $udev_root
13+mount -n -t ramfs none $udev_root || mount -n -t tmpfs none $udev_root
14
15 # propogate /udev from /sys
16 echo "Creating initial udev device nodes:"
diff --git a/openembedded/packages/udev/udev-065/fix-alignment.patch b/openembedded/packages/udev/udev-065/fix-alignment.patch
new file mode 100644
index 0000000000..8c7b8b5ac5
--- /dev/null
+++ b/openembedded/packages/udev/udev-065/fix-alignment.patch
@@ -0,0 +1,24 @@
1diff --git a/udev_rules_parse.c b/udev_rules_parse.c
2--- a/udev_rules_parse.c
3+++ b/udev_rules_parse.c
4@@ -241,6 +241,7 @@ static int add_to_rules(struct udev_rule
5 int valid;
6 char *linepos;
7 char *attr;
8+ size_t padding;
9 int retval;
10
11 /* get all the keys */
12@@ -506,6 +507,11 @@ static int add_to_rules(struct udev_rule
13
14 /* grow buffer and add rule */
15 rule_size = sizeof(struct udev_rule) + rule->bufsize;
16+ padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t);
17+ dbg("add %zi padding bytes", padding);
18+ rule_size += padding;
19+ rule->bufsize += padding;
20+
21 rules->buf = realloc(rules->buf, rules->bufsize + rule_size);
22 if (!rules->buf) {
23 err("realloc failed");
24
diff --git a/openembedded/packages/udev/udev-065/flags.patch b/openembedded/packages/udev/udev-065/flags.patch
new file mode 100644
index 0000000000..d95daa51e2
--- /dev/null
+++ b/openembedded/packages/udev/udev-065/flags.patch
@@ -0,0 +1,66 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- udev-065/Makefile~flags
7+++ udev-065/Makefile
8@@ -106,11 +106,11 @@
9 # check if compiler option is supported
10 cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;}
11
12-CFLAGS += -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith \
13+override CFLAGS += -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith \
14 -Wstrict-prototypes -Wsign-compare
15-CFLAGS += $(call cc-supports, -Wdeclaration-after-statement, )
16-CFLAGS += -pipe
17-CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
18+override CFLAGS += $(call cc-supports, -Wdeclaration-after-statement, )
19+override CFLAGS += -pipe
20+override CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
21
22 # use '-Os' optimization if available, else use -O2
23 OPTFLAGS := $(call cc-supports, -Os, -O2)
24@@ -154,16 +154,16 @@
25
26 SYSFS = $(PWD)/libsysfs/sysfs.a
27
28-CFLAGS += -I$(PWD)/libsysfs/sysfs \
29+override CFLAGS += -I$(PWD)/libsysfs/sysfs \
30 -I$(PWD)/libsysfs
31
32 ifeq ($(strip $(USE_LOG)),true)
33- CFLAGS += -DUSE_LOG
34+ override CFLAGS += -DUSE_LOG
35 endif
36
37 # if DEBUG is enabled, then we do not strip or optimize
38 ifeq ($(strip $(DEBUG)),true)
39- CFLAGS += -O1 -g -DDEBUG
40+ override CFLAGS += -DDEBUG
41 LDFLAGS += -Wl
42 STRIPCMD = /bin/true -Since_we_are_debugging
43 else
44@@ -180,18 +180,18 @@
45 CC = $(KLCC)
46 LD = $(KLCC)
47 else
48- CFLAGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
49+ override CFLAGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
50 endif
51
52 ifeq ($(strip $(USE_SELINUX)),true)
53 UDEV_OBJS += udev_selinux.o
54 LIB_OBJS += -lselinux
55- CFLAGS += -DUSE_SELINUX
56+ override CFLAGS += -DUSE_SELINUX
57 endif
58
59 ifeq ($(strip $(USE_STATIC)),true)
60- CFLAGS += -DUSE_STATIC
61- LDFLAGS += -static
62+ override CFLAGS += -DUSE_STATIC
63+ override LDFLAGS += -static
64 endif
65
66 ifeq ($(strip $(V)),false)
diff --git a/openembedded/packages/udev/udev-065/noasmlinkage.patch b/openembedded/packages/udev/udev-065/noasmlinkage.patch
new file mode 100644
index 0000000000..0d8e854c0e
--- /dev/null
+++ b/openembedded/packages/udev/udev-065/noasmlinkage.patch
@@ -0,0 +1,38 @@
1
2#
3# Patch managed by http://www.holgerschurig.de/patcher.html
4#
5
6--- udev-062/udev.c~noasmlinkage.patch
7+++ udev-062/udev.c
8@@ -54,7 +54,7 @@
9 }
10 #endif
11
12-static void asmlinkage sig_handler(int signum)
13+static void sig_handler(int signum)
14 {
15 switch (signum) {
16 case SIGALRM:
17--- udev-062/udevd.c~noasmlinkage.patch
18+++ udev-062/udevd.c
19@@ -639,7 +639,7 @@
20 return msg;
21 }
22
23-static void asmlinkage sig_handler(int signum)
24+static void sig_handler(int signum)
25 {
26 int rc;
27
28--- udev-062/udevstart.c~noasmlinkage.patch
29+++ udev-062/udevstart.c
30@@ -323,7 +323,7 @@
31 exec_list(&device_list);
32 }
33
34-static void asmlinkage sig_handler(int signum)
35+static void sig_handler(int signum)
36 {
37 switch (signum) {
38 case SIGALRM:
diff --git a/openembedded/packages/udev/udev-065/tty-symlinks.patch b/openembedded/packages/udev/udev-065/tty-symlinks.patch
new file mode 100644
index 0000000000..6a458de64c
--- /dev/null
+++ b/openembedded/packages/udev/udev-065/tty-symlinks.patch
@@ -0,0 +1,11 @@
1--- udev-063/etc/udev/udev.rules.devfs.orig 2005-07-27 19:55:51 +0200
2+++ udev-063/etc/udev/udev.rules.devfs 2005-07-27 19:56:49 +0200
3@@ -103,3 +103,8 @@
4
5 # raw devices
6 KERNEL="raw[0-9]*", NAME="raw/%k"
7+
8+# tty devices
9+KERNEL=="tty[0-9]*", SYMLINK="%k"
10+KERNEL=="ttyS[0-9]*", SYMLINK="%k"
11+
diff --git a/openembedded/packages/udev/udev.inc b/openembedded/packages/udev/udev.inc
new file mode 100644
index 0000000000..0b51df4797
--- /dev/null
+++ b/openembedded/packages/udev/udev.inc
@@ -0,0 +1,42 @@
1DESCRIPTION = "udev is a program which dynamically creates and removes device nodes from \
2/dev/. It responds to /sbin/hotplug device events and requires a 2.6 kernel."
3LICENSE = "GPL"
4
5UDEV_DEVFS_RULES ?= "0"
6
7PACKAGES =+ "udev-utils"
8FILES_udev-utils = "${usrbindir}/udevinfo ${usrbindir}/udevtest"
9
10inherit update-rc.d
11
12INITSCRIPT_NAME = "udev"
13INITSCRIPT_PARAMS = "start 04 S ."
14
15export CROSS = "${TARGET_PREFIX}"
16export HOSTCC = "${BUILD_CC}"
17export udevdir ?= "/dev"
18export usrbindir := "${bindir}"
19export usrsbindir := "${sbindir}"
20export etcdir = "${sysconfdir}"
21LD = "${CC}"
22bindir = "/bin"
23sbindir = "/sbin"
24
25UDEV_EXTRAS = "<override me>"
26FILES_${PN} += "${usrbindir} ${usrsbindir}"
27EXTRA_OEMAKE = "-e \
28 'EXTRAS=${UDEV_EXTRAS}' \
29 'STRIP=echo'"
30
31do_install () {
32 install -d ${D}${usrsbindir} \
33 ${D}${sbindir}
34 oe_runmake 'DESTDIR=${D}' INSTALL=install install
35 install -d ${D}${sysconfdir}/init.d
36 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
37 if [ "${UDEV_DEVFS_RULES}" = "1" ]; then
38 install -m 0644 ${S}/etc/udev/udev.rules.devfs ${D}${sysconfdir}/udev/rules.d/50-udev.rules
39 fi
40 install -d ${D}${sysconfdir}/udev/rules.d/
41 install -m 0644 ${S}/etc/udev/debian/permissions.rules ${D}${sysconfdir}/udev/rules.d/
42}
diff --git a/openembedded/packages/udev/udev_065.bb b/openembedded/packages/udev/udev_065.bb
new file mode 100644
index 0000000000..f6a2783136
--- /dev/null
+++ b/openembedded/packages/udev/udev_065.bb
@@ -0,0 +1,22 @@
1SRC_URI = "http://kernel.org/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
2 file://tmpfs.patch;patch=1 \
3 file://noasmlinkage.patch;patch=1 \
4 file://flags.patch;patch=1 \
5 file://tty-symlinks.patch;patch=1 \
6 file://init"
7
8include udev.inc
9
10PR = "r0"
11UDEV_EXTRAS = "extras/scsi_id/ extras/volume_id/ extras/run_directory/"
12
13#FIXME UDEV MIGRATION PLAN:
14#FIXME a) udevd is now a netlink daemon and needs to be started by the init script (ours is way too old)
15#FIXME b) sbin/hotplug should no longer be called by the kernel, i.e. echo "" >/proc/sys/kernel/hotplug
16#FIXME done c) until d) happens, udev will emulate hotplugd behaviour (see do_install_append()
17#FIXME d) eventually hotplug should no longer be used at all, all agents shall be converted to udev rules
18
19do_install_append() {
20 install -m 0755 extras/run_directory/udev_run_hotplugd ${D}${sbindir}/
21 echo RUN+="/sbin/udev_run_hotplugd" >>${D}${sysconfdir}/udev/rules.d/50-udev.rules
22}