summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/udev
diff options
context:
space:
mode:
authorAlex Kiernan <alex.kiernan@gmail.com>2022-05-07 11:22:09 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-08 22:50:34 (GMT)
commit363a20327e1374116abe1ea716aef7fc4be16450 (patch)
treef99b8b0ea33c91fc71e5efe22c1442b21a519af9 /meta/recipes-core/udev
parentf564bf2bbd96f2297e639c87b6e427f31a25aa46 (diff)
downloadpoky-363a20327e1374116abe1ea716aef7fc4be16450.tar.gz
eudev: Upgrade 3.2.10 -> 3.2.11
The upstream has moved from Gentoo to GitHub and is now maintained by a new collection of cross-distribution contributors. Drop the revert of the userspace firmware loading removal patch as these are only required to support kernels older than 3.7, do not apply cleanly and will never be merged upstream. (From OE-Core rev: 31005f24d302082c98bdd33c1fc0fb3db81c74e4) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Alex Kiernan <alexk@zuma.ai> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/udev')
-rw-r--r--meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch28
-rw-r--r--meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch364
-rw-r--r--meta/recipes-core/udev/eudev_3.2.11.bb (renamed from meta/recipes-core/udev/eudev_3.2.10.bb)12
3 files changed, 6 insertions, 398 deletions
diff --git a/meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch b/meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch
deleted file mode 100644
index fe2ba53..0000000
--- a/meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 4f0a722489154da99e7f6b3051afde984eed2f74 Mon Sep 17 00:00:00 2001
2From: Jonathan Liu <net147@gmail.com>
3Date: Thu, 19 Mar 2015 15:01:29 +1100
4Subject: [PATCH] Revert "rules: remove firmware loading rules"
5
6This reverts commit 70e7d754ddb356fb1a2942b262f8cee9650e2a19.
7Userspace firmware loading support is needed for Linux < 3.7.
8
9Upstream-Status: Inappropriate [OE specific]
10
11Signed-off-by: Jonathan Liu <net147@gmail.com>
12---
13 rules/50-firmware.rules | 3 +++
14 1 file changed, 3 insertions(+)
15 create mode 100644 rules/50-firmware.rules
16
17diff --git a/rules/50-firmware.rules b/rules/50-firmware.rules
18new file mode 100644
19index 0000000..f0ae684
20--- /dev/null
21+++ b/rules/50-firmware.rules
22@@ -0,0 +1,3 @@
23+# do not edit this file, it will be overwritten on update
24+
25+SUBSYSTEM=="firmware", ACTION=="add", RUN{builtin}="firmware"
26--
272.3.3
28
diff --git a/meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch b/meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch
deleted file mode 100644
index db333e9..0000000
--- a/meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch
+++ /dev/null
@@ -1,364 +0,0 @@
1From e415372cc7a2f52e70e1cfa8c6c1f633b411355d Mon Sep 17 00:00:00 2001
2From: Lauren Post <lauren.post@nxp.com>
3Date: Wed, 8 Jun 2016 06:51:56 -0500
4Subject: [PATCH] Revert "udev: remove userspace firmware loading support"
5
6This reverts commit 3b717594600fa717cdf9bcfd0c7c1b703b245482.
7
8Conflicts:
9 configure.ac
10 src/udev/udevd.c
11
12Upstream-Status: Inappropriate [OE specific]
13
14Signed-off-by: Lauren Post <lauren.post@nxp.com>
15---
16 configure.ac | 39 +++++++++-
17 rules/Makefile.am | 5 ++
18 src/udev/Makefile.am | 10 +++
19 src/udev/udev-builtin-firmware.c | 154 +++++++++++++++++++++++++++++++++++++++
20 src/udev/udev-builtin.c | 3 +
21 src/udev/udev.h | 6 ++
22 src/udev/udevd.c | 13 ++++
23 7 files changed, 227 insertions(+), 3 deletions(-)
24 create mode 100644 src/udev/udev-builtin-firmware.c
25
26diff --git a/configure.ac b/configure.ac
27index 8691891..65028c2 100644
28--- a/configure.ac
29+++ b/configure.ac
30@@ -238,9 +238,42 @@ AC_CHECK_DECL([unshare],
31 [#include <sched.h>])
32
33 # ------------------------------------------------------------------------------
34-AC_PATH_TOOL(GPERF, gperf)
35-if test -z "$GPERF" ; then
36- AC_MSG_ERROR([*** gperf not found])
37+AC_ARG_WITH(firmware-path,
38+ AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
39+ [Firmware search path (default=ROOTPREFIX/lib/firmware/updates:ROOTPREFIX/lib/firmware)]),
40+ [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"])
41+OLD_IFS=$IFS
42+IFS=:
43+for i in $with_firmware_path; do
44+ if test "x${FIRMWARE_PATH}" = "x"; then
45+ FIRMWARE_PATH="\\\"${i}/\\\""
46+ else
47+ FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
48+ fi
49+done
50+IFS=$OLD_IFS
51+AC_SUBST(FIRMWARE_PATH)
52+AS_IF([test "x${FIRMWARE_PATH}" != "x"], [ AC_DEFINE(HAVE_FIRMWARE, 1, [Define if FIRMWARE is available]) ])
53+AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"])
54+
55+# ------------------------------------------------------------------------------
56+AC_ARG_ENABLE([gudev],
57+ AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
58+ [], [enable_gudev=yes])
59+AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ])
60+AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"])
61+
62+# ------------------------------------------------------------------------------
63+AC_ARG_ENABLE([keymap],
64+ AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]),
65+ [], [enable_keymap=yes])
66+
67+if test "x$enable_keymap" = "xyes"; then
68+ AC_PATH_TOOL(GPERF, gperf)
69+ if test -z "$GPERF" ; then
70+ AC_MSG_ERROR([*** gperf not found])
71+ fi
72+ AC_DEFINE([ENABLE_KEYMAP], [1], [Define if we are enabling rule generator])
73 fi
74
75 # ------------------------------------------------------------------------------
76diff --git a/rules/Makefile.am b/rules/Makefile.am
77index 24c099c..d714ae3 100644
78--- a/rules/Makefile.am
79+++ b/rules/Makefile.am
80@@ -22,6 +22,11 @@ dist_udevrules_DATA += \
81 80-net-name-slot.rules
82 endif
83
84+if ENABLE_FIRMWARE
85+dist_udevrules_DATA += \
86+ 50-firmware.rules
87+endif
88+
89 if HAVE_BLKID
90 dist_udevrules_DATA += \
91 60-persistent-storage.rules
92diff --git a/src/udev/Makefile.am b/src/udev/Makefile.am
93index 401af01..742fbc8 100644
94--- a/src/udev/Makefile.am
95+++ b/src/udev/Makefile.am
96@@ -53,12 +53,18 @@ libudev_core_la_SOURCES = \
97 udev-ctrl.c \
98 udev-builtin.c \
99 udev-builtin-btrfs.c \
100+ udev-builtin-firmware.c \
101 udev-builtin-hwdb.c \
102 udev-builtin-input_id.c \
103 udev-builtin-net_id.c \
104 udev-builtin-path_id.c \
105 udev-builtin-usb_id.c
106
107+if ENABLE_FIRMWARE
108+libudev_core_la_SOURCES += \
109+ udev-builtin-firmware.c
110+endif
111+
112 include_HEADERS = \
113 udev.h
114
115@@ -86,6 +92,10 @@ libudev_core_la_LIBADD += \
116 $(KMOD_LIBS)
117 endif
118
119+libudev_core_la_CPPFLAGS = \
120+ $(AM_CPPFLAGS) \
121+ -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
122+
123 #
124 # Extras
125 #
126diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c
127new file mode 100644
128index 0000000..bd8c2fb
129--- /dev/null
130+++ b/src/udev/udev-builtin-firmware.c
131@@ -0,0 +1,154 @@
132+/*
133+ * firmware - Kernel firmware loader
134+ *
135+ * Copyright (C) 2009 Piter Punk <piterpunk@slackware.com>
136+ * Copyright (C) 2009-2011 Kay Sievers <kay@vrfy.org>
137+ *
138+ * This program is free software; you can redistribute it and/or
139+ * modify it under the terms of the GNU General Public License as
140+ * published by the Free Software Foundation; either version 2 of the
141+ * License, or (at your option) any later version.
142+ *
143+ * This program is distributed in the hope that it will be useful, but
144+ * WITHOUT ANY WARRANTY; without even the implied warranty of
145+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
146+ * General Public License for more details:*
147+ */
148+
149+#include <unistd.h>
150+#include <stdlib.h>
151+#include <string.h>
152+#include <stdio.h>
153+#include <getopt.h>
154+#include <errno.h>
155+#include <stdbool.h>
156+#include <sys/utsname.h>
157+#include <sys/stat.h>
158+
159+#include "udev.h"
160+
161+static bool set_loading(struct udev *udev, char *loadpath, const char *state) {
162+ FILE *ldfile;
163+
164+ ldfile = fopen(loadpath, "we");
165+ if (ldfile == NULL) {
166+ log_error("error: can not open '%s'", loadpath);
167+ return false;
168+ };
169+ fprintf(ldfile, "%s\n", state);
170+ fclose(ldfile);
171+ return true;
172+}
173+
174+static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) {
175+ char *buf;
176+ FILE *fsource = NULL, *ftarget = NULL;
177+ bool ret = false;
178+
179+ buf = malloc(size);
180+ if (buf == NULL) {
181+ log_error("No memory available to load firmware file");
182+ return false;
183+ }
184+
185+ log_debug("writing '%s' (%zi) to '%s'", source, size, target);
186+
187+ fsource = fopen(source, "re");
188+ if (fsource == NULL)
189+ goto exit;
190+ ftarget = fopen(target, "we");
191+ if (ftarget == NULL)
192+ goto exit;
193+ if (fread(buf, size, 1, fsource) != 1)
194+ goto exit;
195+ if (fwrite(buf, size, 1, ftarget) == 1)
196+ ret = true;
197+exit:
198+ if (ftarget != NULL)
199+ fclose(ftarget);
200+ if (fsource != NULL)
201+ fclose(fsource);
202+ free(buf);
203+ return ret;
204+}
205+
206+static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) {
207+ struct udev *udev = udev_device_get_udev(dev);
208+ static const char *searchpath[] = { FIRMWARE_PATH };
209+ char loadpath[UTIL_PATH_SIZE];
210+ char datapath[UTIL_PATH_SIZE];
211+ char fwpath[UTIL_PATH_SIZE];
212+ const char *firmware;
213+ FILE *fwfile = NULL;
214+ struct utsname kernel;
215+ struct stat statbuf;
216+ unsigned int i;
217+ int rc = EXIT_SUCCESS;
218+
219+ firmware = udev_device_get_property_value(dev, "FIRMWARE");
220+ if (firmware == NULL) {
221+ log_error("firmware parameter missing");
222+ rc = EXIT_FAILURE;
223+ goto exit;
224+ }
225+
226+ /* lookup firmware file */
227+ uname(&kernel);
228+ for (i = 0; i < ELEMENTSOF(searchpath); i++) {
229+ strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL);
230+ fwfile = fopen(fwpath, "re");
231+ if (fwfile != NULL)
232+ break;
233+
234+ strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL);
235+ fwfile = fopen(fwpath, "re");
236+ if (fwfile != NULL)
237+ break;
238+ }
239+
240+ strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL);
241+
242+ if (fwfile == NULL) {
243+ log_debug("did not find firmware file '%s'", firmware);
244+ rc = EXIT_FAILURE;
245+ /*
246+ * Do not cancel the request in the initrd, the real root might have
247+ * the firmware file and the 'coldplug' run in the real root will find
248+ * this pending request and fulfill or cancel it.
249+ * */
250+ if (!in_initrd())
251+ set_loading(udev, loadpath, "-1");
252+ goto exit;
253+ }
254+
255+ if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) {
256+ if (!in_initrd())
257+ set_loading(udev, loadpath, "-1");
258+ rc = EXIT_FAILURE;
259+ goto exit;
260+ }
261+
262+ if (!set_loading(udev, loadpath, "1"))
263+ goto exit;
264+
265+ strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL);
266+ if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) {
267+ log_error("error sending firmware '%s' to device", firmware);
268+ set_loading(udev, loadpath, "-1");
269+ rc = EXIT_FAILURE;
270+ goto exit;
271+ };
272+
273+ set_loading(udev, loadpath, "0");
274+exit:
275+ if (fwfile)
276+ fclose(fwfile);
277+ return rc;
278+}
279+
280+const struct udev_builtin udev_builtin_firmware = {
281+ .name = "firmware",
282+ .cmd = builtin_firmware,
283+ .help = "kernel firmware loader",
284+ .run_once = true,
285+};
286diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
287index 74b3bdc..3657106 100644
288--- a/src/udev/udev-builtin.c
289+++ b/src/udev/udev-builtin.c
290@@ -34,6 +34,9 @@ static const struct udev_builtin *builtins[] = {
291 [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid,
292 #endif
293 [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs,
294+#ifdef HAVE_FIRMWARE
295+ [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware,
296+#endif
297 [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb,
298 [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id,
299 [UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard,
300diff --git a/src/udev/udev.h b/src/udev/udev.h
301index 198cb2c..01a1e9c 100644
302--- a/src/udev/udev.h
303+++ b/src/udev/udev.h
304@@ -149,6 +149,9 @@ enum udev_builtin_cmd {
305 UDEV_BUILTIN_BLKID,
306 #endif
307 UDEV_BUILTIN_BTRFS,
308+#ifdef HAVE_FIRMWARE
309+ UDEV_BUILTIN_FIRMWARE,
310+#endif
311 UDEV_BUILTIN_HWDB,
312 UDEV_BUILTIN_INPUT_ID,
313 UDEV_BUILTIN_KEYBOARD,
314@@ -173,6 +176,9 @@ struct udev_builtin {
315 extern const struct udev_builtin udev_builtin_blkid;
316 #endif
317 extern const struct udev_builtin udev_builtin_btrfs;
318+#ifdef HAVE_FIRMWARE
319+extern const struct udev_builtin udev_builtin_firmware;
320+#endif
321 extern const struct udev_builtin udev_builtin_hwdb;
322 extern const struct udev_builtin udev_builtin_input_id;
323 extern const struct udev_builtin udev_builtin_keyboard;
324diff --git a/src/udev/udevd.c b/src/udev/udevd.c
325index b1de97a..35655d8 100644
326--- a/src/udev/udevd.c
327+++ b/src/udev/udevd.c
328@@ -101,6 +101,9 @@ struct event {
329 bool is_block;
330 usec_t start_usec;
331 bool warned;
332+#ifdef HAVE_FIRMWARE
333+ bool nodelay;
334+#endif
335 };
336
337 static inline struct event *node_to_event(struct udev_list_node *node) {
338@@ -491,6 +494,10 @@ static int event_queue_insert(struct udev_device *dev) {
339 event->devnum = udev_device_get_devnum(dev);
340 event->is_block = streq("block", udev_device_get_subsystem(dev));
341 event->ifindex = udev_device_get_ifindex(dev);
342+#ifdef HAVE_FIRMWARE
343+ if (streq(udev_device_get_subsystem(dev), "firmware"))
344+ event->nodelay = true;
345+#endif
346
347 log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev),
348 udev_device_get_action(dev), udev_device_get_subsystem(dev));
349@@ -566,6 +573,12 @@ static bool is_devpath_busy(struct event *event) {
350 return true;
351 }
352
353+#ifdef HAVE_FIRMWARE
354+ /* allow to bypass the dependency tracking */
355+ if (event->nodelay)
356+ continue;
357+#endif
358+
359 /* parent device event found */
360 if (event->devpath[common] == '/') {
361 event->delaying_seqnum = loop_event->seqnum;
362--
3631.9.1
364
diff --git a/meta/recipes-core/udev/eudev_3.2.10.bb b/meta/recipes-core/udev/eudev_3.2.11.bb
index b053612..56a3932 100644
--- a/meta/recipes-core/udev/eudev_3.2.10.bb
+++ b/meta/recipes-core/udev/eudev_3.2.11.bb
@@ -1,5 +1,5 @@
1SUMMARY = "eudev is a fork of systemd's udev" 1SUMMARY = "eudev is a fork of systemd's udev"
2HOMEPAGE = "https://wiki.gentoo.org/wiki/Eudev" 2HOMEPAGE = "https://github.com/eudev-project/eudev"
3DESCRIPTION = "eudev is Gentoo's fork of udev, systemd's device file manager for the Linux kernel. It manages device nodes in /dev and handles all user space actions when adding or removing devices." 3DESCRIPTION = "eudev is Gentoo's fork of udev, systemd's device file manager for the Linux kernel. It manages device nodes in /dev and handles all user space actions when adding or removing devices."
4LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later" 4LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later"
5LICENSE:libudev = "LGPL-2.1-or-later" 5LICENSE:libudev = "LGPL-2.1-or-later"
@@ -9,15 +9,15 @@ DEPENDS = "glib-2.0 glib-2.0-native gperf-native kmod libxslt-native util-linux"
9 9
10PROVIDES = "udev" 10PROVIDES = "udev"
11 11
12SRC_URI = "https://dev.gentoo.org/~blueness/${BPN}/${BP}.tar.gz \ 12SRC_URI = "https://github.com/eudev-project/${BPN}/releases/download/v${PV}/${BP}.tar.gz \
13 file://0014-Revert-rules-remove-firmware-loading-rules.patch \
14 file://Revert-udev-remove-userspace-firmware-loading-suppor.patch \
15 file://init \ 13 file://init \
16 file://local.rules \ 14 file://local.rules \
17" 15"
18 16
19SRC_URI[md5sum] = "60b135a189523f333cea5f71a3345c8d" 17SRC_URI[sha256sum] = "19847cafec67897da855fde56f9dc7d92e21c50e450aa79068a7e704ed44558b"
20SRC_URI[sha256sum] = "87bb028d470fd1b85169349b44c55d5b733733dc2d50ddf1196e026725ead034" 18
19UPSTREAM_CHECK_URI = "https://github.com/eudev-project/eudev/releases"
20UPSTREAM_CHECK_REGEX = "eudev-(?P<pver>\d+(\.\d+)+)\.tar"
21 21
22inherit autotools update-rc.d qemu pkgconfig features_check 22inherit autotools update-rc.d qemu pkgconfig features_check
23 23