summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0008-Revert-udev-remove-userspace-firmware-loading-suppor.patch
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2018-07-17 10:05:11 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-18 10:18:42 +0100
commitada8a5d9175b141b4fe532f542f5c1f7ffa26d88 (patch)
tree64af2142c781c13ee7669004b615d41cfb787f92 /meta/recipes-core/systemd/systemd/0008-Revert-udev-remove-userspace-firmware-loading-suppor.patch
parent219eed186d32b01a7132233c5110c08055ed6e27 (diff)
downloadpoky-ada8a5d9175b141b4fe532f542f5c1f7ffa26d88.tar.gz
systemd: upgrade to 239
Upgrade systemd to 239. 1. Patch Changes * Rebased Patches 0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch 0003-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch 0006-Make-root-s-home-directory-configurable.patch 0027-remove-nobody-user-group-checking.patch 0011-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch 0013-add-fallback-parse_printf_format-implementation.patch 0014-src-basic-missing.h-check-for-missing-strndupa.patch 0015-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch 0016-src-basic-missing.h-check-for-missing-__compar_fn_t-.patch 0017-Include-netinet-if_ether.h.patch 0019-Do-not-enable-nss-tests-if-nss-systemd-is-not-enable.patch 0022-don-t-use-glibc-specific-qsort_r.patch 0024-comparison_fn_t-is-glibc-specific-use-raw-signature-.patch 0026-Use-uintmax_t-for-handling-rlim_t.patch 0030-fix-missing-of-__register_atfork-for-non-glibc-build.patch 0031-fix-missing-ULONG_LONG_MAX-definition-in-case-of-mus.patch 0001-core-device.c-Change-the-default-device-timeout-to-2.patch 0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch * Dropped Patches and Reasons 0001-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch This patch is dropped because the problem has been fixed by binutils upstream. And this workaround could be dropped. https://sourceware.org/bugzilla/show_bug.cgi?id=18548 0007-Revert-rules-remove-firmware-loading-rules.patch 0008-Revert-udev-remove-userspace-firmware-loading-suppor.patch These two patches are dropped because they are for kernel < 3.7. But the current minimal requirement of kernel to build systemd is as below. REQUIREMENTS: Linux kernel >= 3.13 Linux kernel >= 4.2 for unified cgroup hierarchy support So these two patches no long make any sense. Also remove non-exist firmware-path option 0009-remove-duplicate-include-uchar.h.patch 0010-check-for-uchar.h-in-meson.build.patch These two patches are dropped because musl has implemented uchar.h. See commit below from musl repo. """ ab9672ae73248f51e30f4553c4b8878525e46383 implement uchar.h (C11 UTF-16/32 conversion) interfaces """ 0018-check-for-missing-canonicalize_file_name.patch The above patch is dropped because current systemd does not need canonicalize_file_name. 0025-Define-_PATH_WTMPX-and-_PATH_UTMPX-if-not-defined.patch The above patch is dropped because utmp makes no sense in musl. Check code below from musl. include/utmp.h:#define _PATH_UTMP "/dev/null/utmp" And utmp PACKAGECONFIG has been explicitly disabled for musl. So we don't need this patch. 0032-memfd.patch 0033-basic-macros-rename-noreturn-into-_noreturn_-8456.patch libmount.patch 0034-Fix-format-truncation-compile-failure-by-typecasting.patch The above patches are dropped because they are backported patches. And current systemd has contained these patches. 0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch The above patch is dropped because it has been merged and is now in new version. * Newly Added Patch 0005-include-gshadow-only-if-ENABLE_GSHADOW-is-1.patch This patch is added to fix build for musl. 0019-Do-not-disable-buffering-when-writing-to-oom_score_a.patch This patch is added to fix the following error which caused system unable to boot up. systemd-udevd.service: Failed to adjust OOM setting: Invalid argument dbus.service: Failed to adjust OOM setting: Invalid argument 0020-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch This patch is added to fix segment fault error on musl systems. 0001-login-use-parse_uid-when-unmounting-user-runtime-dir.patch This patch is backported to solve a race condition between user-runtime-dir@xxx.service stop and user deletion. 2. PACKAGECONFIG and Dependency Changes * Add a new PACKAGECONFIG item 'gshadow'. Enable it by default for glibc but disable it by default for musl. This is because musl does not provide gshadow.h. * Add a new PACKAGECONFIG item 'portabled'. Default to disable it because it's still experimental, according to the announcement letter. """ Currently, the support is still experimental, but this is expected to change soon. Reflecting this experimental state, the "portablectl" binary is not installed into /usr/bin yet. """ * Change 'kmod' from a hard dependency to a PACKAGECONFIG item. Default to enable it. * Change 'acl' from a hard dependency to a PACKAGECONFIG item. Default to enable it. * Remove 'readline' from DEPENDS. systemd does not need it. * Remove 'libcgroup' from DEPENDS. The dependency on libcgroup has been removed from systemd a long time ago. We now remove this unnecessary dependency from DEPENDS. 3. update-alternatives changes The utilities like shutdown, poweroff, etc. are now created as symlinks at do_install. So there's no need to use update-alternatives mechanism anymore to create the symlinks now. In addtion, I don't think we now support multiple init systems at one running system, so there's really no need to use update-alternatives mechanism here. Also update the FILES_${PN} to include these files to avoid QA issue. (From OE-Core rev: 597f4645faf61486eb1d2ab73f3d974460ab9466) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0008-Revert-udev-remove-userspace-firmware-loading-suppor.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/0008-Revert-udev-remove-userspace-firmware-loading-suppor.patch377
1 files changed, 0 insertions, 377 deletions
diff --git a/meta/recipes-core/systemd/systemd/0008-Revert-udev-remove-userspace-firmware-loading-suppor.patch b/meta/recipes-core/systemd/systemd/0008-Revert-udev-remove-userspace-firmware-loading-suppor.patch
deleted file mode 100644
index 15d7e0290a..0000000000
--- a/meta/recipes-core/systemd/systemd/0008-Revert-udev-remove-userspace-firmware-loading-suppor.patch
+++ /dev/null
@@ -1,377 +0,0 @@
1From 5cce7626f33e92f624ac06b613125813fb47d445 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 28 Feb 2018 21:05:39 -0800
4Subject: [PATCH 08/31] Revert "udev: remove userspace firmware loading
5 support"
6
7This reverts commit be2ea723b1d023b3d385d3b791ee4607cbfb20ca.
8Userspace firmware loading support is needed for Linux < 3.7.
9
10Upstream-Status: Inappropriate [OE specific]
11
12Signed-off-by: Jonathan Liu <net147@gmail.com>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
15---
16 README | 4 +-
17 TODO | 1 +
18 meson.build | 9 +++
19 meson_options.txt | 2 +
20 rules/meson.build | 4 +
21 src/udev/meson.build | 4 +
22 src/udev/udev-builtin-firmware.c | 154 +++++++++++++++++++++++++++++++++++++++
23 src/udev/udev-builtin.c | 3 +
24 src/udev/udev.h | 6 ++
25 src/udev/udevd.c | 12 +++
26 10 files changed, 197 insertions(+), 2 deletions(-)
27 create mode 100644 src/udev/udev-builtin-firmware.c
28
29diff --git a/README b/README
30index 8807e5cfe..bfd7a35de 100644
31--- a/README
32+++ b/README
33@@ -58,8 +58,8 @@ REQUIREMENTS:
34 Legacy hotplug slows down the system and confuses udev:
35 CONFIG_UEVENT_HELPER_PATH=""
36
37- Userspace firmware loading is not supported and should
38- be disabled in the kernel:
39+ Userspace firmware loading is deprecated, will go away, and
40+ sometimes causes problems:
41 CONFIG_FW_LOADER_USER_HELPER=n
42
43 Some udev rules and virtualization detection relies on it:
44diff --git a/TODO b/TODO
45index a77028c7b..39e72d7ec 100644
46--- a/TODO
47+++ b/TODO
48@@ -783,6 +783,7 @@ Features:
49 * initialize the hostname from the fs label of /, if /etc/hostname does not exist?
50
51 * udev:
52+ - remove src/udev/udev-builtin-firmware.c (CONFIG_FW_LOADER_USER_HELPER=n)
53 - move to LGPL
54 - kill scsi_id
55 - add trigger --subsystem-match=usb/usb_device device
56diff --git a/meson.build b/meson.build
57index 918101d6b..9c25022a4 100644
58--- a/meson.build
59+++ b/meson.build
60@@ -72,6 +72,12 @@ conf.set10('HAVE_SYSV_COMPAT', have,
61 description : 'SysV init scripts and rcN.d links are supported')
62 m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
63
64+firmware_path = get_option('firmware-path')
65+have = firmware_path != ''
66+conf.set10('HAVE_FIRMWARE', have,
67+ description : 'Userspace firmware loading is supported')
68+m4_defines += have ? ['-DHAVE_FIRMWARE'] : []
69+
70 # join_paths ignore the preceding arguments if an absolute component is
71 # encountered, so this should canonicalize various paths when they are
72 # absolute or relative.
73@@ -178,6 +184,7 @@ conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysc
74 conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
75 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
76 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
77+conf.set_quoted('FIRMWARE_PATH', firmware_path)
78 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
79 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
80 conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
81@@ -258,6 +265,7 @@ substs.set('SYSTEMCTL', join_paths(rootbin
82 substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
83 substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
84 substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
85+substs.set('FIRMWARE_PATH', firmware_path)
86 substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
87 substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
88
89@@ -2715,6 +2723,7 @@ status = [
90 'roothome directory: @0@'.format(roothomedir),
91 'SysV init scripts: @0@'.format(sysvinit_path),
92 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
93+ 'firmware path: @0@'.format(firmware_path),
94 'PAM modules directory: @0@'.format(pamlibdir),
95 'PAM configuration directory: @0@'.format(pamconfdir),
96 'RPM macros directory: @0@'.format(rpmmacrosdir),
97diff --git a/meson_options.txt b/meson_options.txt
98index 0b24f0e0f..92d25fa35 100644
99--- a/meson_options.txt
100+++ b/meson_options.txt
101@@ -108,6 +108,8 @@ option('tmpfiles', type : 'boolean',
102 description : 'support for tmpfiles.d')
103 option('importd', type : 'combo', choices : ['auto', 'true', 'false'],
104 description : 'install the systemd-importd daemon')
105+option('firmware-path', type : 'string', value : '',
106+ description : 'Firmware search path')
107 option('hwdb', type : 'boolean',
108 description : 'support for the hardware database')
109 option('rfkill', type : 'boolean',
110diff --git a/rules/meson.build b/rules/meson.build
111index e253b9f59..5eee5fbca 100644
112--- a/rules/meson.build
113+++ b/rules/meson.build
114@@ -41,6 +41,10 @@ rules = files('''
115 install_data(rules,
116 install_dir : udevrulesdir)
117
118+if conf.get('HAVE_FIRMWARE') == 1
119+ install_data('50-firmware.rules', install_dir : udevrulesdir)
120+endif
121+
122 all_rules = rules
123
124 rules_in = '''
125diff --git a/src/udev/meson.build b/src/udev/meson.build
126index de2fd2d9c..b6b0ca006 100644
127--- a/src/udev/meson.build
128+++ b/src/udev/meson.build
129@@ -67,6 +67,10 @@ if conf.get('HAVE_ACL') == 1
130 sd_login_c]
131 endif
132
133+if conf.get('HAVE_FIRMWARE') == 1
134+ libudev_core_sources += ['udev-builtin-firmware.c']
135+endif
136+
137 ############################################################
138
139 generate_keyboard_keys_list = find_program('generate-keyboard-keys-list.sh')
140diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c
141new file mode 100644
142index 000000000..bd8c2fb96
143--- /dev/null
144+++ b/src/udev/udev-builtin-firmware.c
145@@ -0,0 +1,154 @@
146+/*
147+ * firmware - Kernel firmware loader
148+ *
149+ * Copyright (C) 2009 Piter Punk <piterpunk@slackware.com>
150+ * Copyright (C) 2009-2011 Kay Sievers <kay@vrfy.org>
151+ *
152+ * This program is free software; you can redistribute it and/or
153+ * modify it under the terms of the GNU General Public License as
154+ * published by the Free Software Foundation; either version 2 of the
155+ * License, or (at your option) any later version.
156+ *
157+ * This program is distributed in the hope that it will be useful, but
158+ * WITHOUT ANY WARRANTY; without even the implied warranty of
159+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
160+ * General Public License for more details:*
161+ */
162+
163+#include <unistd.h>
164+#include <stdlib.h>
165+#include <string.h>
166+#include <stdio.h>
167+#include <getopt.h>
168+#include <errno.h>
169+#include <stdbool.h>
170+#include <sys/utsname.h>
171+#include <sys/stat.h>
172+
173+#include "udev.h"
174+
175+static bool set_loading(struct udev *udev, char *loadpath, const char *state) {
176+ FILE *ldfile;
177+
178+ ldfile = fopen(loadpath, "we");
179+ if (ldfile == NULL) {
180+ log_error("error: can not open '%s'", loadpath);
181+ return false;
182+ };
183+ fprintf(ldfile, "%s\n", state);
184+ fclose(ldfile);
185+ return true;
186+}
187+
188+static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) {
189+ char *buf;
190+ FILE *fsource = NULL, *ftarget = NULL;
191+ bool ret = false;
192+
193+ buf = malloc(size);
194+ if (buf == NULL) {
195+ log_error("No memory available to load firmware file");
196+ return false;
197+ }
198+
199+ log_debug("writing '%s' (%zi) to '%s'", source, size, target);
200+
201+ fsource = fopen(source, "re");
202+ if (fsource == NULL)
203+ goto exit;
204+ ftarget = fopen(target, "we");
205+ if (ftarget == NULL)
206+ goto exit;
207+ if (fread(buf, size, 1, fsource) != 1)
208+ goto exit;
209+ if (fwrite(buf, size, 1, ftarget) == 1)
210+ ret = true;
211+exit:
212+ if (ftarget != NULL)
213+ fclose(ftarget);
214+ if (fsource != NULL)
215+ fclose(fsource);
216+ free(buf);
217+ return ret;
218+}
219+
220+static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) {
221+ struct udev *udev = udev_device_get_udev(dev);
222+ static const char *searchpath[] = { FIRMWARE_PATH };
223+ char loadpath[UTIL_PATH_SIZE];
224+ char datapath[UTIL_PATH_SIZE];
225+ char fwpath[UTIL_PATH_SIZE];
226+ const char *firmware;
227+ FILE *fwfile = NULL;
228+ struct utsname kernel;
229+ struct stat statbuf;
230+ unsigned int i;
231+ int rc = EXIT_SUCCESS;
232+
233+ firmware = udev_device_get_property_value(dev, "FIRMWARE");
234+ if (firmware == NULL) {
235+ log_error("firmware parameter missing");
236+ rc = EXIT_FAILURE;
237+ goto exit;
238+ }
239+
240+ /* lookup firmware file */
241+ uname(&kernel);
242+ for (i = 0; i < ELEMENTSOF(searchpath); i++) {
243+ strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL);
244+ fwfile = fopen(fwpath, "re");
245+ if (fwfile != NULL)
246+ break;
247+
248+ strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL);
249+ fwfile = fopen(fwpath, "re");
250+ if (fwfile != NULL)
251+ break;
252+ }
253+
254+ strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL);
255+
256+ if (fwfile == NULL) {
257+ log_debug("did not find firmware file '%s'", firmware);
258+ rc = EXIT_FAILURE;
259+ /*
260+ * Do not cancel the request in the initrd, the real root might have
261+ * the firmware file and the 'coldplug' run in the real root will find
262+ * this pending request and fulfill or cancel it.
263+ * */
264+ if (!in_initrd())
265+ set_loading(udev, loadpath, "-1");
266+ goto exit;
267+ }
268+
269+ if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) {
270+ if (!in_initrd())
271+ set_loading(udev, loadpath, "-1");
272+ rc = EXIT_FAILURE;
273+ goto exit;
274+ }
275+
276+ if (!set_loading(udev, loadpath, "1"))
277+ goto exit;
278+
279+ strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL);
280+ if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) {
281+ log_error("error sending firmware '%s' to device", firmware);
282+ set_loading(udev, loadpath, "-1");
283+ rc = EXIT_FAILURE;
284+ goto exit;
285+ };
286+
287+ set_loading(udev, loadpath, "0");
288+exit:
289+ if (fwfile)
290+ fclose(fwfile);
291+ return rc;
292+}
293+
294+const struct udev_builtin udev_builtin_firmware = {
295+ .name = "firmware",
296+ .cmd = builtin_firmware,
297+ .help = "kernel firmware loader",
298+ .run_once = true,
299+};
300diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
301index db2b6874f..ccd88638c 100644
302--- a/src/udev/udev-builtin.c
303+++ b/src/udev/udev-builtin.c
304@@ -32,6 +32,9 @@ static const struct udev_builtin *builtins[] = {
305 [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid,
306 #endif
307 [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs,
308+#if HAVE_FIRMWARE
309+ [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware,
310+#endif
311 [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb,
312 [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id,
313 [UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard,
314diff --git a/src/udev/udev.h b/src/udev/udev.h
315index ea11c2d29..c47dd3d88 100644
316--- a/src/udev/udev.h
317+++ b/src/udev/udev.h
318@@ -151,6 +151,9 @@ enum udev_builtin_cmd {
319 UDEV_BUILTIN_BLKID,
320 #endif
321 UDEV_BUILTIN_BTRFS,
322+#if HAVE_FIRMWARE
323+ UDEV_BUILTIN_FIRMWARE,
324+#endif
325 UDEV_BUILTIN_HWDB,
326 UDEV_BUILTIN_INPUT_ID,
327 UDEV_BUILTIN_KEYBOARD,
328@@ -179,6 +182,9 @@ struct udev_builtin {
329 extern const struct udev_builtin udev_builtin_blkid;
330 #endif
331 extern const struct udev_builtin udev_builtin_btrfs;
332+#if HAVE_FIRMWARE
333+extern const struct udev_builtin udev_builtin_firmware;
334+#endif
335 extern const struct udev_builtin udev_builtin_hwdb;
336 extern const struct udev_builtin udev_builtin_input_id;
337 extern const struct udev_builtin udev_builtin_keyboard;
338diff --git a/src/udev/udevd.c b/src/udev/udevd.c
339index 5c757d513..2f3313007 100644
340--- a/src/udev/udevd.c
341+++ b/src/udev/udevd.c
342@@ -127,6 +127,9 @@ struct event {
343 bool is_block;
344 sd_event_source *timeout_warning;
345 sd_event_source *timeout;
346+#if HAVE_FIRMWARE
347+ bool nodelay;
348+#endif
349 };
350
351 static void event_queue_cleanup(Manager *manager, enum event_state type);
352@@ -609,6 +612,10 @@ static int event_queue_insert(Manager *manager, struct udev_device *dev) {
353 event->devnum = udev_device_get_devnum(dev);
354 event->is_block = streq("block", udev_device_get_subsystem(dev));
355 event->ifindex = udev_device_get_ifindex(dev);
356+#if HAVE_FIRMWARE
357+ if (streq(udev_device_get_subsystem(dev), "firmware"))
358+ event->nodelay = true;
359+#endif
360
361 log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev),
362 udev_device_get_action(dev), udev_device_get_subsystem(dev));
363@@ -692,6 +699,11 @@ static bool is_devpath_busy(Manager *manager, struct event *event) {
364 return true;
365 }
366
367+#if HAVE_FIRMWARE
368+ /* allow to bypass the dependency tracking */
369+ if (event->nodelay)
370+ continue;
371+#endif
372 /* parent device event found */
373 if (event->devpath[common] == '/') {
374 event->delaying_seqnum = loop_event->seqnum;
375--
3762.13.0
377