diff options
author | Koen Kooi <koen@openembedded.org> | 2010-04-17 15:35:36 +0200 |
---|---|---|
committer | Koen Kooi <koen@openembedded.org> | 2010-04-17 15:38:06 +0200 |
commit | dc17170c1cd3138f575b52dc537b94f47da13a2b (patch) | |
tree | f5ee31f8d927b65d9b618c7b8cf7631f82f72019 | |
parent | 0fb52aef77c21a68de87cfc922e2cd6a265ebf25 (diff) |
udev-static 124: prototype for a static udevd and udevadm that can be used as fallback on old kernels (e.g. 2.6.26 or earlier)
-rw-r--r-- | recipes/udev/udev-static-124/flags.patch | 56 | ||||
-rw-r--r-- | recipes/udev/udev-static-124/libvolume-id-soname.patch | 12 | ||||
-rw-r--r-- | recipes/udev/udev-static-124/mtd-exclude-persistent.patch | 13 | ||||
-rw-r--r-- | recipes/udev/udev-static-124/noasmlinkage.patch | 45 | ||||
-rw-r--r-- | recipes/udev/udev-static-124/udevtrigger_add_devname_filtering.patch | 99 | ||||
-rw-r--r-- | recipes/udev/udev-static-124/vol_id_ld.patch | 17 | ||||
-rw-r--r-- | recipes/udev/udev-static_124.bb | 39 |
7 files changed, 281 insertions, 0 deletions
diff --git a/recipes/udev/udev-static-124/flags.patch b/recipes/udev/udev-static-124/flags.patch new file mode 100644 index 0000000000..13f20eb6a8 --- /dev/null +++ b/recipes/udev/udev-static-124/flags.patch @@ -0,0 +1,56 @@ +--- + Makefile | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +Index: udev-115/Makefile +=================================================================== +--- udev-115.orig/Makefile 2007-08-24 01:29:54.000000000 +0200 ++++ udev-115/Makefile 2007-09-20 17:21:45.000000000 +0200 +@@ -112,39 +112,39 @@ + AR = $(CROSS_COMPILE)ar + RANLIB = $(CROSS_COMPILE)ranlib + +-CFLAGS += -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ++override CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 + WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ + -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ + -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes +-CFLAGS += $(WARNINGS) ++override CFLAGS += $(WARNINGS) + + LDFLAGS += -Wl,-warn-common,--as-needed + + OPTFLAGS = -Os +-CFLAGS += $(OPTFLAGS) ++override CFLAGS += $(OPTFLAGS) + + ifeq ($(strip $(USE_LOG)),true) +- CFLAGS += -DUSE_LOG ++ override CFLAGS += -DUSE_LOG + endif + + # if DEBUG is enabled, then we do not strip + ifeq ($(strip $(DEBUG)),true) +- CFLAGS += -DDEBUG ++ override CFLAGS += -DDEBUG + endif + + ifeq ($(strip $(USE_GCOV)),true) +- CFLAGS += -fprofile-arcs -ftest-coverage ++ override CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS += -fprofile-arcs + endif + + ifeq ($(strip $(USE_SELINUX)),true) + UDEV_OBJS += udev_selinux.o + LIB_OBJS += -lselinux -lsepol +- CFLAGS += -DUSE_SELINUX ++ override CFLAGS += -DUSE_SELINUX + endif + + ifeq ($(strip $(USE_STATIC)),true) +- CFLAGS += -DUSE_STATIC ++ override CFLAGS += -DUSE_STATIC + LDFLAGS += -static + endif + diff --git a/recipes/udev/udev-static-124/libvolume-id-soname.patch b/recipes/udev/udev-static-124/libvolume-id-soname.patch new file mode 100644 index 0000000000..56365a4351 --- /dev/null +++ b/recipes/udev/udev-static-124/libvolume-id-soname.patch @@ -0,0 +1,12 @@ +diff -uNr udev-124-orig/extras/volume_id/lib/Makefile udev-124/extras/volume_id/lib/Makefile +--- udev-124-orig/extras/volume_id/lib/Makefile 2008-06-12 01:24:30.000000000 -0400 ++++ udev-124/extras/volume_id/lib/Makefile 2009-01-14 23:32:42.000000000 -0500 +@@ -113,7 +113,7 @@ + ifeq ($(libdir),$(usrlibdir)) + ln -sf $(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so + else +- ln -sf $(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so ++ ln -sf ../..$(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so + endif + $(INSTALL) -d $(DESTDIR)$(usrlibdir)/pkgconfig + $(INSTALL_DATA) libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc diff --git a/recipes/udev/udev-static-124/mtd-exclude-persistent.patch b/recipes/udev/udev-static-124/mtd-exclude-persistent.patch new file mode 100644 index 0000000000..204b7b487d --- /dev/null +++ b/recipes/udev/udev-static-124/mtd-exclude-persistent.patch @@ -0,0 +1,13 @@ +Copyright (c) 2009 MontaVista Software, Inc. All rights reserved. + +--- a/etc/udev/rules.d/60-persistent-storage.rules 2008-06-12 07:24:30.000000000 +0200 ++++ b/etc/udev/rules.d/60-persistent-storage.rules 2009-08-18 11:39:23.595063264 +0200 +@@ -10,7 +10,7 @@ + SUBSYSTEM!="block", GOTO="persistent_storage_end" + + # skip rules for inappropriate block devices +-KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" ++KERNEL=="ram*|loop*|fd*|mtd*|nbd*|gnbd*|dm-*|md*|btibm*", GOTO="persistent_storage_end" + + # never access non-cdrom removable ide devices, the drivers are causing event loops on open() + KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" diff --git a/recipes/udev/udev-static-124/noasmlinkage.patch b/recipes/udev/udev-static-124/noasmlinkage.patch new file mode 100644 index 0000000000..d58a7ea4de --- /dev/null +++ b/recipes/udev/udev-static-124/noasmlinkage.patch @@ -0,0 +1,45 @@ +diff -pru udev-124.orig/test-udev.c udev-124/test-udev.c +--- udev-124.orig/test-udev.c 2008-06-12 06:24:30.000000000 +0100 ++++ udev-124/test-udev.c 2008-07-07 14:43:37.000000000 +0100 +@@ -46,7 +46,7 @@ void log_message(int priority, const cha + } + #endif + +-static void asmlinkage sig_handler(int signum) ++static void sig_handler(int signum) + { + switch (signum) { + case SIGALRM: +diff -pru udev-124.orig/udevd.c udev-124/udevd.c +--- udev-124.orig/udevd.c 2008-06-12 06:24:30.000000000 +0100 ++++ udev-124/udevd.c 2008-07-07 14:43:58.000000000 +0100 +@@ -87,7 +87,7 @@ void log_message(int priority, const cha + + #endif + +-static void asmlinkage udev_event_sig_handler(int signum) ++static void udev_event_sig_handler(int signum) + { + if (signum == SIGALRM) + exit(1); +@@ -798,7 +798,7 @@ static struct udevd_uevent_msg *get_netl + return msg; + } + +-static void asmlinkage sig_handler(int signum) ++static void sig_handler(int signum) + { + switch (signum) { + case SIGINT: +diff -pru udev-124.orig/udevmonitor.c udev-124/udevmonitor.c +--- udev-124.orig/udevmonitor.c 2008-06-12 06:24:30.000000000 +0100 ++++ udev-124/udevmonitor.c 2008-07-07 14:44:24.000000000 +0100 +@@ -97,7 +97,7 @@ static int init_uevent_netlink_sock(void + return 0; + } + +-static void asmlinkage sig_handler(int signum) ++static void sig_handler(int signum) + { + if (signum == SIGINT || signum == SIGTERM) + udev_exit = 1; diff --git a/recipes/udev/udev-static-124/udevtrigger_add_devname_filtering.patch b/recipes/udev/udev-static-124/udevtrigger_add_devname_filtering.patch new file mode 100644 index 0000000000..5182542461 --- /dev/null +++ b/recipes/udev/udev-static-124/udevtrigger_add_devname_filtering.patch @@ -0,0 +1,99 @@ +diff -pru udev-124.orig/udevtrigger.c udev-124/udevtrigger.c +--- udev-124.orig/udevtrigger.c 2008-06-12 06:24:30.000000000 +0100 ++++ udev-124/udevtrigger.c 2008-07-07 15:10:09.000000000 +0100 +@@ -42,6 +42,8 @@ static int dry_run; + LIST_HEAD(device_list); + LIST_HEAD(filter_subsystem_match_list); + LIST_HEAD(filter_subsystem_nomatch_list); ++LIST_HEAD(filter_kernel_match_list); ++LIST_HEAD(filter_kernel_nomatch_list); + LIST_HEAD(filter_attr_match_list); + LIST_HEAD(filter_attr_nomatch_list); + static int sock = -1; +@@ -331,6 +333,26 @@ static int attr_match(const char *path, + return 0; + } + ++static int kernel_filtered(const char *kernel) ++{ ++ struct name_entry *loop_name; ++ ++ /* skip devices matching the prohibited kernel device names */ ++ list_for_each_entry(loop_name, &filter_kernel_nomatch_list, node) ++ if (fnmatch(loop_name->name, kernel, 0) == 0) ++ return 1; ++ ++ /* skip devices not matching the listed kernel device names */ ++ if (!list_empty(&filter_kernel_match_list)) { ++ list_for_each_entry(loop_name, &filter_kernel_match_list, node) ++ if (fnmatch(loop_name->name, kernel, 0) == 0) ++ return 0; ++ return 1; ++ } ++ ++ return 0; ++} ++ + static int attr_filtered(const char *path) + { + struct name_entry *loop_name; +@@ -409,6 +431,9 @@ static void scan_subsystem(const char *s + if (dent2->d_name[0] == '.') + continue; + ++ if (kernel_filtered(dent2->d_name)) ++ continue; ++ + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); +@@ -465,6 +490,9 @@ static void scan_block(void) + if (!strcmp(dent2->d_name,"device")) + continue; + ++ if (kernel_filtered(dent2->d_name)) ++ continue; ++ + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); +@@ -576,6 +604,8 @@ int udevtrigger(int argc, char *argv[], + { "subsystem-nomatch", 1, NULL, 'S' }, + { "attr-match", 1, NULL, 'a' }, + { "attr-nomatch", 1, NULL, 'A' }, ++ { "kernel-match", 1, NULL, 'k' }, ++ { "kernel-nomatch", 1, NULL, 'K' }, + { "env", 1, NULL, 'e' }, + {} + }; +@@ -622,6 +652,12 @@ int udevtrigger(int argc, char *argv[], + case 'A': + name_list_add(&filter_attr_nomatch_list, optarg, 0); + break; ++ case 'k': ++ name_list_add(&filter_kernel_match_list, optarg, 0); ++ break; ++ case 'K': ++ name_list_add(&filter_kernel_nomatch_list, optarg, 0); ++ break; + case 'h': + printf("Usage: udevadm trigger OPTIONS\n" + " --verbose print the list of devices while running\n" +@@ -632,6 +668,8 @@ int udevtrigger(int argc, char *argv[], + " --env=<KEY>=<value> pass an additional key (works only with --socket=)\n" + " --subsystem-match=<subsystem> trigger devices from a matching subystem\n" + " --subsystem-nomatch=<subsystem> exclude devices from a matching subystem\n" ++ " --kernel-match=<subsystem> trigger devices from a matching kernel device name\n" ++ " --kernel-nomatch=<subsystem> exclude devices from a matching kernel device name\n" + " --attr-match=<file[=<value>]> trigger devices with a matching sysfs\n" + " attribute\n" + " --attr-nomatch=<file[=<value>]> exclude devices with a matching sysfs\n" +@@ -701,6 +739,8 @@ int udevtrigger(int argc, char *argv[], + exit: + name_list_cleanup(&filter_subsystem_match_list); + name_list_cleanup(&filter_subsystem_nomatch_list); ++ name_list_cleanup(&filter_kernel_match_list); ++ name_list_cleanup(&filter_kernel_nomatch_list); + name_list_cleanup(&filter_attr_match_list); + name_list_cleanup(&filter_attr_nomatch_list); + diff --git a/recipes/udev/udev-static-124/vol_id_ld.patch b/recipes/udev/udev-static-124/vol_id_ld.patch new file mode 100644 index 0000000000..11126eef8d --- /dev/null +++ b/recipes/udev/udev-static-124/vol_id_ld.patch @@ -0,0 +1,17 @@ +--- + extras/volume_id/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: udev-115/extras/volume_id/Makefile +=================================================================== +--- udev-115.orig/extras/volume_id/Makefile 2007-09-20 18:17:59.000000000 +0200 ++++ udev-115/extras/volume_id/Makefile 2007-09-20 18:18:08.000000000 +0200 +@@ -44,7 +44,7 @@ + ifeq ($(strip $(VOLUME_ID_STATIC)),true) + $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) lib/libvolume_id.a $(LIB_OBJS) + else +- $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) -Llib -lvolume_id $(LIB_OBJS) ++ $(Q) $(LD) -Llib $(LDFLAGS) -o $@ $@.o $(LIBUDEV) -lvolume_id $(LIB_OBJS) + endif + + # man pages diff --git a/recipes/udev/udev-static_124.bb b/recipes/udev/udev-static_124.bb new file mode 100644 index 0000000000..1ea088a6b5 --- /dev/null +++ b/recipes/udev/udev-static_124.bb @@ -0,0 +1,39 @@ +DESCRIPTION = "Static version of udev for devices with an old (e.g. <2.6.27) kernel" + +SRC_URI = "http://kernel.org/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \ + file://noasmlinkage.patch;patch=1 \ + file://flags.patch;patch=1 \ + file://vol_id_ld.patch;patch=1 \ + file://udevtrigger_add_devname_filtering.patch;patch=1 \ + file://libvolume-id-soname.patch;patch=1 \ + file://mtd-exclude-persistent.patch;patch=1 \ + " + +require udev.inc + +S = "${WORKDIR}/udev-${PV}" + +export USE_STATIC = "true" + +CFLAGS += "-DUSE_STATIC" +LDFLAGS += "-static" + +# Overriding PACKAGES is bad, but we only want ${PN} +PACKAGES = "${PN}" +FILES_${PN} = "${base_sbindir}/*-${PV}-static" + + +UDEV_EXTRAS = "extras/firmware/ extras/scsi_id/ extras/volume_id/" +EXTRA_OEMAKE += "libudevdir=/lib/udev libdir=${base_libdir} prefix=" + +do_install () { + install -d ${D}${usrsbindir} \ + ${D}${sbindir} + oe_runmake 'DESTDIR=${D}' INSTALL=install install + + mv ${D}${base_sbindir}/udevd ${D}${base_sbindir}/udevd-${PV}-static + mv ${D}${base_sbindir}/udevadm ${D}${base_sbindir}/udevadm-${PV}-static +} + +SRC_URI[md5sum] = "2ea9229208154229c5d6df6222f74ad7" +SRC_URI[sha256sum] = "cc9f58ff58fbd3f5868e1f1e368e3c93e1f441afd0ac1dcbd5d01a9ce5b5b0d7" |