All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] eudev: create static nodes from modules
@ 2022-05-12  5:43 changqing.li
  2022-05-12  7:45 ` [OE-core] " Alex Kiernan
  0 siblings, 1 reply; 9+ messages in thread
From: changqing.li @ 2022-05-12  5:43 UTC (permalink / raw)
  To: openembedded-core

From: Changqing Li <changqing.li@windriver.com>

dev in modules.devname should be populated in /dev on boot.
remove create static mode from udevd will make these devices
cannot be populated. When use sysVinit, devices like /dev/net/tun
will not be created.

more info:
udevd in systemd also remove create static mode in udevd, but using
service kmod-static-nodes.service and
systemd-tmpfiles-setup-dev.service in systemd to create these node, so
systemd works well.

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 ...dev-create-static-nodes-from-modules.patch | 115 ++++++++++++++++++
 meta/recipes-core/udev/eudev_3.2.11.bb        |   1 +
 2 files changed, 116 insertions(+)
 create mode 100644 meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch

diff --git a/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
new file mode 100644
index 0000000000..19611f4e89
--- /dev/null
+++ b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
@@ -0,0 +1,115 @@
+From 573d6c4106d5b3828da43d2843c1d599ae3cd1cd Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li@windriver.com>
+Date: Tue, 10 May 2022 14:04:35 +0800
+Subject: [PATCH] eudev: create static nodes from modules
+
+Revert commit <src/udev/udevd.c: remove create static nodes from modules>
+https://gitweb.gentoo.org/proj/eudev.git/commit/?id=2b7abd5ec9cc47a8b895df6db77fb1537c6f1a39
+
+Upstream-Status: Inappropriate [oe-specific]
+
+Upstream intentionally remove create static nodes from modules, it is
+expected handled by tmpfiles services, refer [1].
+[1] https://github.com/eudev-project/eudev/issues/229 
+
+For yocto, when start with sysVinit, to enable systemd distro feature,
+and install systemd-tmpfiles is not proper, so revert this commit.
+
+Signed-off-by: Li Zhou <li.zhou@windriver.com>
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+---
+ src/udev/udevd.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 71 insertions(+)
+
+diff --git a/src/udev/udevd.c b/src/udev/udevd.c
+index 7ffd174..ff53fe4 100644
+--- a/src/udev/udevd.c
++++ b/src/udev/udevd.c
+@@ -993,6 +993,76 @@ static void handle_signal(struct udev *udev, int signo) {
+         }
+ }
+ 
++static void static_dev_create_from_modules(struct udev *udev) {
++        struct utsname kernel;
++        char modules[UTIL_PATH_SIZE];
++        char buf[4096];
++        FILE *f;
++
++        if (uname(&kernel) < 0) {
++                log_error("uname failed: %m");
++                return;
++        }
++
++        strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL);
++        f = fopen(modules, "re");
++        if (f == NULL)
++                return;
++
++        while (fgets(buf, sizeof(buf), f) != NULL) {
++                char *s;
++                const char *modname;
++                const char *devname;
++                const char *devno;
++                int maj, min;
++                char type;
++                mode_t mode;
++                char filename[UTIL_PATH_SIZE];
++
++                if (buf[0] == '#')
++                        continue;
++
++                modname = buf;
++                s = strchr(modname, ' ');
++                if (s == NULL)
++                        continue;
++                s[0] = '\0';
++
++                devname = &s[1];
++                s = strchr(devname, ' ');
++                if (s == NULL)
++                        continue;
++                s[0] = '\0';
++
++                devno = &s[1];
++                s = strchr(devno, ' ');
++                if (s == NULL)
++                        s = strchr(devno, '\n');
++                if (s != NULL)
++                        s[0] = '\0';
++                if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3)
++                        continue;
++
++                mode  = 0600;
++                if (type == 'c')
++                        mode |= S_IFCHR;
++                else if (type == 'b')
++                        mode |= S_IFBLK;
++                else
++                        continue;
++
++                strscpyl(filename, sizeof(filename), "/dev/", devname, NULL);
++                mkdir_parents_label(filename, 0755);
++                mac_selinux_create_file_prepare(filename, mode);
++                log_debug("mknod '%s' %c%u:%u", filename, type, maj, min);
++                if (mknod(filename, mode, makedev(maj, min)) < 0 && errno == EEXIST)
++                        utimensat(AT_FDCWD, filename, NULL, 0);
++                mac_selinux_create_file_clear();
++        }
++
++        fclose(f);
++}
++
+ /*
+  * read the kernel command line, in case we need to get into debug mode
+  *   udev.log-priority=<level>                 syslog priority
+@@ -1199,6 +1269,7 @@ int main(int argc, char *argv[]) {
+         }
+ 
+         dev_setup(NULL, UID_INVALID, GID_INVALID);
++        static_dev_create_from_modules(udev);
+ 
+         /* before opening new files, make sure std{in,out,err} fds are in a sane state */
+         if (arg_daemonize) {
+-- 
+2.25.1
+
diff --git a/meta/recipes-core/udev/eudev_3.2.11.bb b/meta/recipes-core/udev/eudev_3.2.11.bb
index 841039f6d7..deb6c90a82 100644
--- a/meta/recipes-core/udev/eudev_3.2.11.bb
+++ b/meta/recipes-core/udev/eudev_3.2.11.bb
@@ -12,6 +12,7 @@ PROVIDES = "udev"
 SRC_URI = "https://github.com/eudev-project/${BPN}/releases/download/v${PV}/${BP}.tar.gz \
            file://init \
            file://local.rules \
+           file://0001-eudev-create-static-nodes-from-modules.patch \
 "
 
 SRC_URI[sha256sum] = "19847cafec67897da855fde56f9dc7d92e21c50e450aa79068a7e704ed44558b"
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH] eudev: create static nodes from modules
  2022-05-12  5:43 [PATCH] eudev: create static nodes from modules changqing.li
@ 2022-05-12  7:45 ` Alex Kiernan
  2022-05-12 10:33   ` richard.purdie
  0 siblings, 1 reply; 9+ messages in thread
From: Alex Kiernan @ 2022-05-12  7:45 UTC (permalink / raw)
  To: Changqing Li; +Cc: Patches and discussions about the oe-core layer

On Thu, May 12, 2022 at 6:43 AM Changqing Li <changqing.li@windriver.com> wrote:
>
> From: Changqing Li <changqing.li@windriver.com>
>
> dev in modules.devname should be populated in /dev on boot.
> remove create static mode from udevd will make these devices
> cannot be populated. When use sysVinit, devices like /dev/net/tun
> will not be created.
>
> more info:
> udevd in systemd also remove create static mode in udevd, but using
> service kmod-static-nodes.service and
> systemd-tmpfiles-setup-dev.service in systemd to create these node, so
> systemd works well.
>
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>  ...dev-create-static-nodes-from-modules.patch | 115 ++++++++++++++++++
>  meta/recipes-core/udev/eudev_3.2.11.bb        |   1 +
>  2 files changed, 116 insertions(+)
>  create mode 100644 meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
>
> diff --git a/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> new file mode 100644
> index 0000000000..19611f4e89
> --- /dev/null
> +++ b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> @@ -0,0 +1,115 @@
> +From 573d6c4106d5b3828da43d2843c1d599ae3cd1cd Mon Sep 17 00:00:00 2001
> +From: Changqing Li <changqing.li@windriver.com>
> +Date: Tue, 10 May 2022 14:04:35 +0800
> +Subject: [PATCH] eudev: create static nodes from modules
> +
> +Revert commit <src/udev/udevd.c: remove create static nodes from modules>
> +https://gitweb.gentoo.org/proj/eudev.git/commit/?id=2b7abd5ec9cc47a8b895df6db77fb1537c6f1a39
> +
> +Upstream-Status: Inappropriate [oe-specific]
> +
> +Upstream intentionally remove create static nodes from modules, it is
> +expected handled by tmpfiles services, refer [1].
> +[1] https://github.com/eudev-project/eudev/issues/229
> +
> +For yocto, when start with sysVinit, to enable systemd distro feature,
> +and install systemd-tmpfiles is not proper, so revert this commit.
> +

Reading the upstream issue, I'm not sure this really is an
"Inappropriate" upstream. eudev has dropped this commit, because you
can use systemd-tmpfiles ("as it works without systemd and can be
compiled individually" - presumably using our unsupported musl
patches...) or opentmpfiles (which is dead and points you back to
systemd-tmpfiles).

Feels like this is an engage with upstream rather than carry a patch
forever which just causes us to be perpetually divergent.

> +Signed-off-by: Li Zhou <li.zhou@windriver.com>
> +Signed-off-by: Changqing Li <changqing.li@windriver.com>
> +---
> + src/udev/udevd.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++
> + 1 file changed, 71 insertions(+)
> +
> +diff --git a/src/udev/udevd.c b/src/udev/udevd.c
> +index 7ffd174..ff53fe4 100644
> +--- a/src/udev/udevd.c
> ++++ b/src/udev/udevd.c
> +@@ -993,6 +993,76 @@ static void handle_signal(struct udev *udev, int signo) {
> +         }
> + }
> +
> ++static void static_dev_create_from_modules(struct udev *udev) {
> ++        struct utsname kernel;
> ++        char modules[UTIL_PATH_SIZE];
> ++        char buf[4096];
> ++        FILE *f;
> ++
> ++        if (uname(&kernel) < 0) {
> ++                log_error("uname failed: %m");
> ++                return;
> ++        }
> ++
> ++        strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL);
> ++        f = fopen(modules, "re");
> ++        if (f == NULL)
> ++                return;
> ++
> ++        while (fgets(buf, sizeof(buf), f) != NULL) {
> ++                char *s;
> ++                const char *modname;
> ++                const char *devname;
> ++                const char *devno;
> ++                int maj, min;
> ++                char type;
> ++                mode_t mode;
> ++                char filename[UTIL_PATH_SIZE];
> ++
> ++                if (buf[0] == '#')
> ++                        continue;
> ++
> ++                modname = buf;
> ++                s = strchr(modname, ' ');
> ++                if (s == NULL)
> ++                        continue;
> ++                s[0] = '\0';
> ++
> ++                devname = &s[1];
> ++                s = strchr(devname, ' ');
> ++                if (s == NULL)
> ++                        continue;
> ++                s[0] = '\0';
> ++
> ++                devno = &s[1];
> ++                s = strchr(devno, ' ');
> ++                if (s == NULL)
> ++                        s = strchr(devno, '\n');
> ++                if (s != NULL)
> ++                        s[0] = '\0';
> ++                if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3)
> ++                        continue;
> ++
> ++                mode  = 0600;
> ++                if (type == 'c')
> ++                        mode |= S_IFCHR;
> ++                else if (type == 'b')
> ++                        mode |= S_IFBLK;
> ++                else
> ++                        continue;
> ++
> ++                strscpyl(filename, sizeof(filename), "/dev/", devname, NULL);
> ++                mkdir_parents_label(filename, 0755);
> ++                mac_selinux_create_file_prepare(filename, mode);
> ++                log_debug("mknod '%s' %c%u:%u", filename, type, maj, min);
> ++                if (mknod(filename, mode, makedev(maj, min)) < 0 && errno == EEXIST)
> ++                        utimensat(AT_FDCWD, filename, NULL, 0);
> ++                mac_selinux_create_file_clear();
> ++        }
> ++
> ++        fclose(f);
> ++}
> ++
> + /*
> +  * read the kernel command line, in case we need to get into debug mode
> +  *   udev.log-priority=<level>                 syslog priority
> +@@ -1199,6 +1269,7 @@ int main(int argc, char *argv[]) {
> +         }
> +
> +         dev_setup(NULL, UID_INVALID, GID_INVALID);
> ++        static_dev_create_from_modules(udev);
> +
> +         /* before opening new files, make sure std{in,out,err} fds are in a sane state */
> +         if (arg_daemonize) {
> +--
> +2.25.1
> +
> diff --git a/meta/recipes-core/udev/eudev_3.2.11.bb b/meta/recipes-core/udev/eudev_3.2.11.bb
> index 841039f6d7..deb6c90a82 100644
> --- a/meta/recipes-core/udev/eudev_3.2.11.bb
> +++ b/meta/recipes-core/udev/eudev_3.2.11.bb
> @@ -12,6 +12,7 @@ PROVIDES = "udev"
>  SRC_URI = "https://github.com/eudev-project/${BPN}/releases/download/v${PV}/${BP}.tar.gz \
>             file://init \
>             file://local.rules \
> +           file://0001-eudev-create-static-nodes-from-modules.patch \
>  "
>
>  SRC_URI[sha256sum] = "19847cafec67897da855fde56f9dc7d92e21c50e450aa79068a7e704ed44558b"
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#165533): https://lists.openembedded.org/g/openembedded-core/message/165533
> Mute This Topic: https://lists.openembedded.org/mt/91052396/3618097
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kiernan@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


-- 
Alex Kiernan


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH] eudev: create static nodes from modules
  2022-05-12  7:45 ` [OE-core] " Alex Kiernan
@ 2022-05-12 10:33   ` richard.purdie
  2022-05-13  1:42     ` Li, Changqing
  0 siblings, 1 reply; 9+ messages in thread
From: richard.purdie @ 2022-05-12 10:33 UTC (permalink / raw)
  To: Alex Kiernan, Changqing Li
  Cc: Patches and discussions about the oe-core layer

On Thu, 2022-05-12 at 08:45 +0100, Alex Kiernan wrote:
> On Thu, May 12, 2022 at 6:43 AM Changqing Li <changqing.li@windriver.com> wrote:
> > 
> > From: Changqing Li <changqing.li@windriver.com>
> > 
> > dev in modules.devname should be populated in /dev on boot.
> > remove create static mode from udevd will make these devices
> > cannot be populated. When use sysVinit, devices like /dev/net/tun
> > will not be created.
> > 
> > more info:
> > udevd in systemd also remove create static mode in udevd, but using
> > service kmod-static-nodes.service and
> > systemd-tmpfiles-setup-dev.service in systemd to create these node, so
> > systemd works well.
> > 
> > Signed-off-by: Changqing Li <changqing.li@windriver.com>
> > ---
> >  ...dev-create-static-nodes-from-modules.patch | 115 ++++++++++++++++++
> >  meta/recipes-core/udev/eudev_3.2.11.bb        |   1 +
> >  2 files changed, 116 insertions(+)
> >  create mode 100644 meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > 
> > diff --git a/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > new file mode 100644
> > index 0000000000..19611f4e89
> > --- /dev/null
> > +++ b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > @@ -0,0 +1,115 @@
> > +From 573d6c4106d5b3828da43d2843c1d599ae3cd1cd Mon Sep 17 00:00:00 2001
> > +From: Changqing Li <changqing.li@windriver.com>
> > +Date: Tue, 10 May 2022 14:04:35 +0800
> > +Subject: [PATCH] eudev: create static nodes from modules
> > +
> > +Revert commit <src/udev/udevd.c: remove create static nodes from modules>
> > +https://gitweb.gentoo.org/proj/eudev.git/commit/?id=2b7abd5ec9cc47a8b895df6db77fb1537c6f1a39
> > +
> > +Upstream-Status: Inappropriate [oe-specific]
> > +
> > +Upstream intentionally remove create static nodes from modules, it is
> > +expected handled by tmpfiles services, refer [1].
> > +[1] https://github.com/eudev-project/eudev/issues/229
> > +
> > +For yocto, when start with sysVinit, to enable systemd distro feature,
> > +and install systemd-tmpfiles is not proper, so revert this commit.
> > +
> 
> Reading the upstream issue, I'm not sure this really is an
> "Inappropriate" upstream. eudev has dropped this commit, because you
> can use systemd-tmpfiles ("as it works without systemd and can be
> compiled individually" - presumably using our unsupported musl
> patches...) or opentmpfiles (which is dead and points you back to
> systemd-tmpfiles).
> 
> Feels like this is an engage with upstream rather than carry a patch
> forever which just causes us to be perpetually divergent.

I agree, this does sound like something we need to address to keep the
project maintainable...

Cheers,

Richard


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH] eudev: create static nodes from modules
  2022-05-12 10:33   ` richard.purdie
@ 2022-05-13  1:42     ` Li, Changqing
  2022-05-15 14:59       ` Alex Kiernan
  0 siblings, 1 reply; 9+ messages in thread
From: Li, Changqing @ 2022-05-13  1:42 UTC (permalink / raw)
  To: richard.purdie, Alex Kiernan
  Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 3467 bytes --]



________________________________
From: richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>
Sent: Thursday, May 12, 2022 6:33 PM
To: Alex Kiernan <alex.kiernan@gmail.com>; Li, Changqing <Changqing.Li@windriver.com>
Cc: Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules

[Please note: This e-mail is from an EXTERNAL e-mail address]

On Thu, 2022-05-12 at 08:45 +0100, Alex Kiernan wrote:
> On Thu, May 12, 2022 at 6:43 AM Changqing Li <changqing.li@windriver.com> wrote:
> >
> > From: Changqing Li <changqing.li@windriver.com>
> >
> > dev in modules.devname should be populated in /dev on boot.
> > remove create static mode from udevd will make these devices
> > cannot be populated. When use sysVinit, devices like /dev/net/tun
> > will not be created.
> >
> > more info:
> > udevd in systemd also remove create static mode in udevd, but using
> > service kmod-static-nodes.service and
> > systemd-tmpfiles-setup-dev.service in systemd to create these node, so
> > systemd works well.
> >
> > Signed-off-by: Changqing Li <changqing.li@windriver.com>
> > ---
> >  ...dev-create-static-nodes-from-modules.patch | 115 ++++++++++++++++++
> >  meta/recipes-core/udev/eudev_3.2.11.bb        |   1 +
> >  2 files changed, 116 insertions(+)
> >  create mode 100644 meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> >
> > diff --git a/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > new file mode 100644
> > index 0000000000..19611f4e89
> > --- /dev/null
> > +++ b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > @@ -0,0 +1,115 @@
> > +From 573d6c4106d5b3828da43d2843c1d599ae3cd1cd Mon Sep 17 00:00:00 2001
> > +From: Changqing Li <changqing.li@windriver.com>
> > +Date: Tue, 10 May 2022 14:04:35 +0800
> > +Subject: [PATCH] eudev: create static nodes from modules
> > +
> > +Revert commit <src/udev/udevd.c: remove create static nodes from modules>
> > +https://gitweb.gentoo.org/proj/eudev.git/commit/?id=2b7abd5ec9cc47a8b895df6db77fb1537c6f1a39
> > +
> > +Upstream-Status: Inappropriate [oe-specific]
> > +
> > +Upstream intentionally remove create static nodes from modules, it is
> > +expected handled by tmpfiles services, refer [1].
> > +[1] https://github.com/eudev-project/eudev/issues/229
> > +
> > +For yocto, when start with sysVinit, to enable systemd distro feature,
> > +and install systemd-tmpfiles is not proper, so revert this commit.
> > +
>
> Reading the upstream issue, I'm not sure this really is an
> "Inappropriate" upstream. eudev has dropped this commit, because you
> can use systemd-tmpfiles ("as it works without systemd and can be
> compiled individually" - presumably using our unsupported musl
> patches...) or opentmpfiles (which is dead and points you back to
> systemd-tmpfiles).
>
> Feels like this is an engage with upstream rather than carry a patch
> forever which just causes us to be perpetually divergent.

I agree, this does sound like something we need to address to keep the
project maintainable...

I tried to suggest  upstream to add this back,  but  upstream seems prefer to use tmpfile solution.

Regrads
Sandy


Cheers,

Richard

[-- Attachment #2: Type: text/html, Size: 5523 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH] eudev: create static nodes from modules
  2022-05-13  1:42     ` Li, Changqing
@ 2022-05-15 14:59       ` Alex Kiernan
  2022-05-16  5:35         ` Li, Changqing
  0 siblings, 1 reply; 9+ messages in thread
From: Alex Kiernan @ 2022-05-15 14:59 UTC (permalink / raw)
  To: Li, Changqing
  Cc: richard.purdie, Patches and discussions about the oe-core layer

On Fri, May 13, 2022 at 2:42 AM Li, Changqing
<Changqing.Li@windriver.com> wrote:
>
>
>
> ________________________________
> From: richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>
> Sent: Thursday, May 12, 2022 6:33 PM
> To: Alex Kiernan <alex.kiernan@gmail.com>; Li, Changqing <Changqing.Li@windriver.com>
> Cc: Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
> Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules
>
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On Thu, 2022-05-12 at 08:45 +0100, Alex Kiernan wrote:
> > On Thu, May 12, 2022 at 6:43 AM Changqing Li <changqing.li@windriver.com> wrote:
> > >
> > > From: Changqing Li <changqing.li@windriver.com>
> > >
> > > dev in modules.devname should be populated in /dev on boot.
> > > remove create static mode from udevd will make these devices
> > > cannot be populated. When use sysVinit, devices like /dev/net/tun
> > > will not be created.
> > >
> > > more info:
> > > udevd in systemd also remove create static mode in udevd, but using
> > > service kmod-static-nodes.service and
> > > systemd-tmpfiles-setup-dev.service in systemd to create these node, so
> > > systemd works well.
> > >
> > > Signed-off-by: Changqing Li <changqing.li@windriver.com>
> > > ---
> > >  ...dev-create-static-nodes-from-modules.patch | 115 ++++++++++++++++++
> > >  meta/recipes-core/udev/eudev_3.2.11.bb        |   1 +
> > >  2 files changed, 116 insertions(+)
> > >  create mode 100644 meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > >
> > > diff --git a/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > new file mode 100644
> > > index 0000000000..19611f4e89
> > > --- /dev/null
> > > +++ b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > @@ -0,0 +1,115 @@
> > > +From 573d6c4106d5b3828da43d2843c1d599ae3cd1cd Mon Sep 17 00:00:00 2001
> > > +From: Changqing Li <changqing.li@windriver.com>
> > > +Date: Tue, 10 May 2022 14:04:35 +0800
> > > +Subject: [PATCH] eudev: create static nodes from modules
> > > +
> > > +Revert commit <src/udev/udevd.c: remove create static nodes from modules>
> > > +https://gitweb.gentoo.org/proj/eudev.git/commit/?id=2b7abd5ec9cc47a8b895df6db77fb1537c6f1a39
> > > +
> > > +Upstream-Status: Inappropriate [oe-specific]
> > > +
> > > +Upstream intentionally remove create static nodes from modules, it is
> > > +expected handled by tmpfiles services, refer [1].
> > > +[1] https://github.com/eudev-project/eudev/issues/229
> > > +
> > > +For yocto, when start with sysVinit, to enable systemd distro feature,
> > > +and install systemd-tmpfiles is not proper, so revert this commit.
> > > +
> >
> > Reading the upstream issue, I'm not sure this really is an
> > "Inappropriate" upstream. eudev has dropped this commit, because you
> > can use systemd-tmpfiles ("as it works without systemd and can be
> > compiled individually" - presumably using our unsupported musl
> > patches...) or opentmpfiles (which is dead and points you back to
> > systemd-tmpfiles).
> >
> > Feels like this is an engage with upstream rather than carry a patch
> > forever which just causes us to be perpetually divergent.
>
> I agree, this does sound like something we need to address to keep the
> project maintainable...
>
> I tried to suggest  upstream to add this back,  but  upstream seems prefer to use tmpfile solution.
>

Given how limited the output format which static-nodes generates for
tmpfiles is (just d and c! entries), parsing that output directly as
part the eudev init script wouldn't be horrible. Or make kmod generate
files in the format that volatiles expects? Though that would need
populate-volatile extending to generate device nodes.

-- 
Alex Kiernan


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH] eudev: create static nodes from modules
  2022-05-15 14:59       ` Alex Kiernan
@ 2022-05-16  5:35         ` Li, Changqing
  2022-05-16  8:06           ` Alex Kiernan
       [not found]           ` <16EF875D3CF1EBA0.26893@lists.openembedded.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Li, Changqing @ 2022-05-16  5:35 UTC (permalink / raw)
  To: Alex Kiernan
  Cc: richard.purdie, Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 4583 bytes --]



________________________________
From: Alex Kiernan <alex.kiernan@gmail.com>
Sent: Sunday, May 15, 2022 10:59 PM
To: Li, Changqing <Changqing.Li@windriver.com>
Cc: richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>; Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules

[Please note: This e-mail is from an EXTERNAL e-mail address]

On Fri, May 13, 2022 at 2:42 AM Li, Changqing
<Changqing.Li@windriver.com> wrote:
>
>
>
> ________________________________
> From: richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>
> Sent: Thursday, May 12, 2022 6:33 PM
> To: Alex Kiernan <alex.kiernan@gmail.com>; Li, Changqing <Changqing.Li@windriver.com>
> Cc: Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
> Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules
>
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On Thu, 2022-05-12 at 08:45 +0100, Alex Kiernan wrote:
> > On Thu, May 12, 2022 at 6:43 AM Changqing Li <changqing.li@windriver.com> wrote:
> > >
> > > From: Changqing Li <changqing.li@windriver.com>
> > >
> > > dev in modules.devname should be populated in /dev on boot.
> > > remove create static mode from udevd will make these devices
> > > cannot be populated. When use sysVinit, devices like /dev/net/tun
> > > will not be created.
> > >
> > > more info:
> > > udevd in systemd also remove create static mode in udevd, but using
> > > service kmod-static-nodes.service and
> > > systemd-tmpfiles-setup-dev.service in systemd to create these node, so
> > > systemd works well.
> > >
> > > Signed-off-by: Changqing Li <changqing.li@windriver.com>
> > > ---
> > >  ...dev-create-static-nodes-from-modules.patch | 115 ++++++++++++++++++
> > >  meta/recipes-core/udev/eudev_3.2.11.bb        |   1 +
> > >  2 files changed, 116 insertions(+)
> > >  create mode 100644 meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > >
> > > diff --git a/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > new file mode 100644
> > > index 0000000000..19611f4e89
> > > --- /dev/null
> > > +++ b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > @@ -0,0 +1,115 @@
> > > +From 573d6c4106d5b3828da43d2843c1d599ae3cd1cd Mon Sep 17 00:00:00 2001
> > > +From: Changqing Li <changqing.li@windriver.com>
> > > +Date: Tue, 10 May 2022 14:04:35 +0800
> > > +Subject: [PATCH] eudev: create static nodes from modules
> > > +
> > > +Revert commit <src/udev/udevd.c: remove create static nodes from modules>
> > > +https://gitweb.gentoo.org/proj/eudev.git/commit/?id=2b7abd5ec9cc47a8b895df6db77fb1537c6f1a39
> > > +
> > > +Upstream-Status: Inappropriate [oe-specific]
> > > +
> > > +Upstream intentionally remove create static nodes from modules, it is
> > > +expected handled by tmpfiles services, refer [1].
> > > +[1] https://github.com/eudev-project/eudev/issues/229
> > > +
> > > +For yocto, when start with sysVinit, to enable systemd distro feature,
> > > +and install systemd-tmpfiles is not proper, so revert this commit.
> > > +
> >
> > Reading the upstream issue, I'm not sure this really is an
> > "Inappropriate" upstream. eudev has dropped this commit, because you
> > can use systemd-tmpfiles ("as it works without systemd and can be
> > compiled individually" - presumably using our unsupported musl
> > patches...) or opentmpfiles (which is dead and points you back to
> > systemd-tmpfiles).
> >
> > Feels like this is an engage with upstream rather than carry a patch
> > forever which just causes us to be perpetually divergent.
>
> I agree, this does sound like something we need to address to keep the
> project maintainable...
>
> I tried to suggest upstream to add this back,  but  upstream seems prefer to use tmpfile solution.
>

Given how limited the output format which static-nodes generates for
tmpfiles is (just d and c! entries), parsing that output directly as
part the eudev init script wouldn't be horrible. Or make kmod generate
files in the format that volatiles expects? Though that would need
populate-volatile extending to generate device nodes.

Thanks, I will dig more about the tmpfile solution, and send a V2 patch.

Regards
Changqing

--
Alex Kiernan

[-- Attachment #2: Type: text/html, Size: 6878 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH] eudev: create static nodes from modules
  2022-05-16  5:35         ` Li, Changqing
@ 2022-05-16  8:06           ` Alex Kiernan
       [not found]           ` <16EF875D3CF1EBA0.26893@lists.openembedded.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Alex Kiernan @ 2022-05-16  8:06 UTC (permalink / raw)
  To: Li, Changqing
  Cc: richard.purdie, Patches and discussions about the oe-core layer

Untested, but if its useful (I suspect cut & paste will have broken spaces):

diff --git a/meta/recipes-core/udev/eudev/init
b/meta/recipes-core/udev/eudev/init
index c60dbbf6d512..64cd0ea3ef39 100644
--- a/meta/recipes-core/udev/eudev/init
+++ b/meta/recipes-core/udev/eudev/init
@@ -23,6 +23,38 @@ kill_udevd () {
     [ -n "$pid" ] && kill $pid
 }

+make_static_nodes () {
+       kmod static-nodes --format=tmpfiles |
+       while read TTYPE TPATH TMODE TUSER TGROUP TAGE TARG; do
+       case "${TTYPE}" in
+       'd')
+               test -d "${TPATH}" || mkdir -p -m "${TMODE}" "${TPATH}"
+               ;;
+
+       'c!')
+               if [ ! -c "${TPATH}" ]; then
+                       old_ifs="${IFS}"
+                       IFS=:
+                       set -- ${TARG}
+                       IFS="${old_ifs}"
+                       mknod -m "${TMODE}" "${TPATH}" c "$@"
+               fi
+               ;;
+
+       *)
+               echo ERROR
+               exit 1
+               ;;
+       esac
+       if [ "${TUSER}" != "-" ]; then
+               chown "${TUSER}" "${TPATH}"
+       fi
+       if [ "${TGROUP}" != "-" ]; then
+               chown "${TGROUP}" "${TPATH}"
+       fi
+       done
+}
+
 case "$1" in
   start)
     export ACTION=add
@@ -51,6 +83,8 @@ case "$1" in
     # make_extra_nodes
     kill_udevd > "/dev/null" 2>&1

+    make_static_nodes
+
     # trigger the sorted events
     [ -e /proc/sys/kernel/hotplug ] && printf '\0\n' >/proc/sys/kernel/hotplug
     @UDEVD@ -d

On Mon, May 16, 2022 at 6:35 AM Li, Changqing
<Changqing.Li@windriver.com> wrote:
>
>
>
> ________________________________
> From: Alex Kiernan <alex.kiernan@gmail.com>
> Sent: Sunday, May 15, 2022 10:59 PM
> To: Li, Changqing <Changqing.Li@windriver.com>
> Cc: richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>; Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
> Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules
>
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On Fri, May 13, 2022 at 2:42 AM Li, Changqing
> <Changqing.Li@windriver.com> wrote:
> >
> >
> >
> > ________________________________
> > From: richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>
> > Sent: Thursday, May 12, 2022 6:33 PM
> > To: Alex Kiernan <alex.kiernan@gmail.com>; Li, Changqing <Changqing.Li@windriver.com>
> > Cc: Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
> > Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules
> >
> > [Please note: This e-mail is from an EXTERNAL e-mail address]
> >
> > On Thu, 2022-05-12 at 08:45 +0100, Alex Kiernan wrote:
> > > On Thu, May 12, 2022 at 6:43 AM Changqing Li <changqing.li@windriver.com> wrote:
> > > >
> > > > From: Changqing Li <changqing.li@windriver.com>
> > > >
> > > > dev in modules.devname should be populated in /dev on boot.
> > > > remove create static mode from udevd will make these devices
> > > > cannot be populated. When use sysVinit, devices like /dev/net/tun
> > > > will not be created.
> > > >
> > > > more info:
> > > > udevd in systemd also remove create static mode in udevd, but using
> > > > service kmod-static-nodes.service and
> > > > systemd-tmpfiles-setup-dev.service in systemd to create these node, so
> > > > systemd works well.
> > > >
> > > > Signed-off-by: Changqing Li <changqing.li@windriver.com>
> > > > ---
> > > >  ...dev-create-static-nodes-from-modules.patch | 115 ++++++++++++++++++
> > > >  meta/recipes-core/udev/eudev_3.2.11.bb        |   1 +
> > > >  2 files changed, 116 insertions(+)
> > > >  create mode 100644 meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > >
> > > > diff --git a/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > > new file mode 100644
> > > > index 0000000000..19611f4e89
> > > > --- /dev/null
> > > > +++ b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > > @@ -0,0 +1,115 @@
> > > > +From 573d6c4106d5b3828da43d2843c1d599ae3cd1cd Mon Sep 17 00:00:00 2001
> > > > +From: Changqing Li <changqing.li@windriver.com>
> > > > +Date: Tue, 10 May 2022 14:04:35 +0800
> > > > +Subject: [PATCH] eudev: create static nodes from modules
> > > > +
> > > > +Revert commit <src/udev/udevd.c: remove create static nodes from modules>
> > > > +https://gitweb.gentoo.org/proj/eudev.git/commit/?id=2b7abd5ec9cc47a8b895df6db77fb1537c6f1a39
> > > > +
> > > > +Upstream-Status: Inappropriate [oe-specific]
> > > > +
> > > > +Upstream intentionally remove create static nodes from modules, it is
> > > > +expected handled by tmpfiles services, refer [1].
> > > > +[1] https://github.com/eudev-project/eudev/issues/229
> > > > +
> > > > +For yocto, when start with sysVinit, to enable systemd distro feature,
> > > > +and install systemd-tmpfiles is not proper, so revert this commit.
> > > > +
> > >
> > > Reading the upstream issue, I'm not sure this really is an
> > > "Inappropriate" upstream. eudev has dropped this commit, because you
> > > can use systemd-tmpfiles ("as it works without systemd and can be
> > > compiled individually" - presumably using our unsupported musl
> > > patches...) or opentmpfiles (which is dead and points you back to
> > > systemd-tmpfiles).
> > >
> > > Feels like this is an engage with upstream rather than carry a patch
> > > forever which just causes us to be perpetually divergent.
> >
> > I agree, this does sound like something we need to address to keep the
> > project maintainable...
> >
> > I tried to suggest upstream to add this back,  but  upstream seems prefer to use tmpfile solution.
> >
>
> Given how limited the output format which static-nodes generates for
> tmpfiles is (just d and c! entries), parsing that output directly as
> part the eudev init script wouldn't be horrible. Or make kmod generate
> files in the format that volatiles expects? Though that would need
> populate-volatile extending to generate device nodes.
>
> Thanks, I will dig more about the tmpfile solution, and send a V2 patch.
>
> Regards
> Changqing
>
> --
> Alex Kiernan



-- 
Alex Kiernan


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH] eudev: create static nodes from modules
       [not found]           ` <16EF875D3CF1EBA0.26893@lists.openembedded.org>
@ 2022-05-16 13:25             ` Alex Kiernan
  2022-05-17  1:07               ` Li, Changqing
  0 siblings, 1 reply; 9+ messages in thread
From: Alex Kiernan @ 2022-05-16 13:25 UTC (permalink / raw)
  To: Alex Kiernan
  Cc: Li, Changqing, richard.purdie,
	Patches and discussions about the oe-core layer

On Mon, May 16, 2022 at 9:07 AM Alex Kiernan via
lists.openembedded.org <alex.kiernan=gmail.com@lists.openembedded.org>
wrote:
>
> Untested, but if its useful (I suspect cut & paste will have broken spaces):
>
> diff --git a/meta/recipes-core/udev/eudev/init
> b/meta/recipes-core/udev/eudev/init
> index c60dbbf6d512..64cd0ea3ef39 100644
> --- a/meta/recipes-core/udev/eudev/init
> +++ b/meta/recipes-core/udev/eudev/init
> @@ -23,6 +23,38 @@ kill_udevd () {
>      [ -n "$pid" ] && kill $pid
>  }
>
> +make_static_nodes () {
> +       kmod static-nodes --format=tmpfiles |
> +       while read TTYPE TPATH TMODE TUSER TGROUP TAGE TARG; do
> +       case "${TTYPE}" in
> +       'd')
> +               test -d "${TPATH}" || mkdir -p -m "${TMODE}" "${TPATH}"
> +               ;;
> +
> +       'c!')
> +               if [ ! -c "${TPATH}" ]; then
> +                       old_ifs="${IFS}"
> +                       IFS=:
> +                       set -- ${TARG}
> +                       IFS="${old_ifs}"
> +                       mknod -m "${TMODE}" "${TPATH}" c "$@"
> +               fi
> +               ;;
> +
> +       *)
> +               echo ERROR
> +               exit 1
> +               ;;
> +       esac
> +       if [ "${TUSER}" != "-" ]; then
> +               chown "${TUSER}" "${TPATH}"
> +       fi
> +       if [ "${TGROUP}" != "-" ]; then
> +               chown "${TGROUP}" "${TPATH}"

chgrp

> +       fi
> +       done
> +}
> +
>  case "$1" in
>    start)
>      export ACTION=add
> @@ -51,6 +83,8 @@ case "$1" in
>      # make_extra_nodes
>      kill_udevd > "/dev/null" 2>&1
>
> +    make_static_nodes
> +
>      # trigger the sorted events
>      [ -e /proc/sys/kernel/hotplug ] && printf '\0\n' >/proc/sys/kernel/hotplug
>      @UDEVD@ -d
>
> On Mon, May 16, 2022 at 6:35 AM Li, Changqing
> <Changqing.Li@windriver.com> wrote:
> >
> >
> >
> > ________________________________
> > From: Alex Kiernan <alex.kiernan@gmail.com>
> > Sent: Sunday, May 15, 2022 10:59 PM
> > To: Li, Changqing <Changqing.Li@windriver.com>
> > Cc: richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>; Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
> > Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules
> >
> > [Please note: This e-mail is from an EXTERNAL e-mail address]
> >
> > On Fri, May 13, 2022 at 2:42 AM Li, Changqing
> > <Changqing.Li@windriver.com> wrote:
> > >
> > >
> > >
> > > ________________________________
> > > From: richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>
> > > Sent: Thursday, May 12, 2022 6:33 PM
> > > To: Alex Kiernan <alex.kiernan@gmail.com>; Li, Changqing <Changqing.Li@windriver.com>
> > > Cc: Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
> > > Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules
> > >
> > > [Please note: This e-mail is from an EXTERNAL e-mail address]
> > >
> > > On Thu, 2022-05-12 at 08:45 +0100, Alex Kiernan wrote:
> > > > On Thu, May 12, 2022 at 6:43 AM Changqing Li <changqing.li@windriver.com> wrote:
> > > > >
> > > > > From: Changqing Li <changqing.li@windriver.com>
> > > > >
> > > > > dev in modules.devname should be populated in /dev on boot.
> > > > > remove create static mode from udevd will make these devices
> > > > > cannot be populated. When use sysVinit, devices like /dev/net/tun
> > > > > will not be created.
> > > > >
> > > > > more info:
> > > > > udevd in systemd also remove create static mode in udevd, but using
> > > > > service kmod-static-nodes.service and
> > > > > systemd-tmpfiles-setup-dev.service in systemd to create these node, so
> > > > > systemd works well.
> > > > >
> > > > > Signed-off-by: Changqing Li <changqing.li@windriver.com>
> > > > > ---
> > > > >  ...dev-create-static-nodes-from-modules.patch | 115 ++++++++++++++++++
> > > > >  meta/recipes-core/udev/eudev_3.2.11.bb        |   1 +
> > > > >  2 files changed, 116 insertions(+)
> > > > >  create mode 100644 meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > > >
> > > > > diff --git a/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > > > new file mode 100644
> > > > > index 0000000000..19611f4e89
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > > > @@ -0,0 +1,115 @@
> > > > > +From 573d6c4106d5b3828da43d2843c1d599ae3cd1cd Mon Sep 17 00:00:00 2001
> > > > > +From: Changqing Li <changqing.li@windriver.com>
> > > > > +Date: Tue, 10 May 2022 14:04:35 +0800
> > > > > +Subject: [PATCH] eudev: create static nodes from modules
> > > > > +
> > > > > +Revert commit <src/udev/udevd.c: remove create static nodes from modules>
> > > > > +https://gitweb.gentoo.org/proj/eudev.git/commit/?id=2b7abd5ec9cc47a8b895df6db77fb1537c6f1a39
> > > > > +
> > > > > +Upstream-Status: Inappropriate [oe-specific]
> > > > > +
> > > > > +Upstream intentionally remove create static nodes from modules, it is
> > > > > +expected handled by tmpfiles services, refer [1].
> > > > > +[1] https://github.com/eudev-project/eudev/issues/229
> > > > > +
> > > > > +For yocto, when start with sysVinit, to enable systemd distro feature,
> > > > > +and install systemd-tmpfiles is not proper, so revert this commit.
> > > > > +
> > > >
> > > > Reading the upstream issue, I'm not sure this really is an
> > > > "Inappropriate" upstream. eudev has dropped this commit, because you
> > > > can use systemd-tmpfiles ("as it works without systemd and can be
> > > > compiled individually" - presumably using our unsupported musl
> > > > patches...) or opentmpfiles (which is dead and points you back to
> > > > systemd-tmpfiles).
> > > >
> > > > Feels like this is an engage with upstream rather than carry a patch
> > > > forever which just causes us to be perpetually divergent.
> > >
> > > I agree, this does sound like something we need to address to keep the
> > > project maintainable...
> > >
> > > I tried to suggest upstream to add this back,  but  upstream seems prefer to use tmpfile solution.
> > >
> >
> > Given how limited the output format which static-nodes generates for
> > tmpfiles is (just d and c! entries), parsing that output directly as
> > part the eudev init script wouldn't be horrible. Or make kmod generate
> > files in the format that volatiles expects? Though that would need
> > populate-volatile extending to generate device nodes.
> >
> > Thanks, I will dig more about the tmpfile solution, and send a V2 patch.
> >
> > Regards
> > Changqing
> >
> > --
> > Alex Kiernan
>
>
>
> --
> Alex Kiernan
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#165667): https://lists.openembedded.org/g/openembedded-core/message/165667
> Mute This Topic: https://lists.openembedded.org/mt/91052396/3618097
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kiernan@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


-- 
Alex Kiernan


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-core] [PATCH] eudev: create static nodes from modules
  2022-05-16 13:25             ` Alex Kiernan
@ 2022-05-17  1:07               ` Li, Changqing
  0 siblings, 0 replies; 9+ messages in thread
From: Li, Changqing @ 2022-05-17  1:07 UTC (permalink / raw)
  To: Alex Kiernan
  Cc: richard.purdie, Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 7945 bytes --]



________________________________
From: Alex Kiernan <alex.kiernan@gmail.com>
Sent: Monday, May 16, 2022 9:25 PM
To: Alex Kiernan <alex.kiernan@gmail.com>
Cc: Li, Changqing <Changqing.Li@windriver.com>; richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>; Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules

[Please note: This e-mail is from an EXTERNAL e-mail address]

On Mon, May 16, 2022 at 9:07 AM Alex Kiernan via
lists.openembedded.org <alex.kiernan=gmail.com@lists.openembedded.org>
wrote:
>
> Untested, but if its useful (I suspect cut & paste will have broken spaces):
Thanks.  I will test this.
>
> diff --git a/meta/recipes-core/udev/eudev/init
> b/meta/recipes-core/udev/eudev/init
> index c60dbbf6d512..64cd0ea3ef39 100644
> --- a/meta/recipes-core/udev/eudev/init
> +++ b/meta/recipes-core/udev/eudev/init
> @@ -23,6 +23,38 @@ kill_udevd () {
>      [ -n "$pid" ] && kill $pid
>  }
>
> +make_static_nodes () {
> +       kmod static-nodes --format=tmpfiles |
> +       while read TTYPE TPATH TMODE TUSER TGROUP TAGE TARG; do
> +       case "${TTYPE}" in
> +       'd')
> +               test -d "${TPATH}" || mkdir -p -m "${TMODE}" "${TPATH}"
> +               ;;
> +
> +       'c!')
> +               if [ ! -c "${TPATH}" ]; then
> +                       old_ifs="${IFS}"
> +                       IFS=:
> +                       set -- ${TARG}
> +                       IFS="${old_ifs}"
> +                       mknod -m "${TMODE}" "${TPATH}" c "$@"
> +               fi
> +               ;;
> +
> +       *)
> +               echo ERROR
> +               exit 1
> +               ;;
> +       esac
> +       if [ "${TUSER}" != "-" ]; then
> +               chown "${TUSER}" "${TPATH}"
> +       fi
> +       if [ "${TGROUP}" != "-" ]; then
> +               chown "${TGROUP}" "${TPATH}"

chgrp

> +       fi
> +       done
> +}
> +
>  case "$1" in
>    start)
>      export ACTION=add
> @@ -51,6 +83,8 @@ case "$1" in
>      # make_extra_nodes
>      kill_udevd > "/dev/null" 2>&1
>
> +    make_static_nodes
> +
>      # trigger the sorted events
>      [ -e /proc/sys/kernel/hotplug ] && printf '\0\n' >/proc/sys/kernel/hotplug
>      @UDEVD@ -d
>
> On Mon, May 16, 2022 at 6:35 AM Li, Changqing
> <Changqing.Li@windriver.com> wrote:
> >
> >
> >
> > ________________________________
> > From: Alex Kiernan <alex.kiernan@gmail.com>
> > Sent: Sunday, May 15, 2022 10:59 PM
> > To: Li, Changqing <Changqing.Li@windriver.com>
> > Cc: richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>; Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
> > Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules
> >
> > [Please note: This e-mail is from an EXTERNAL e-mail address]
> >
> > On Fri, May 13, 2022 at 2:42 AM Li, Changqing
> > <Changqing.Li@windriver.com> wrote:
> > >
> > >
> > >
> > > ________________________________
> > > From: richard.purdie@linuxfoundation.org <richard.purdie@linuxfoundation.org>
> > > Sent: Thursday, May 12, 2022 6:33 PM
> > > To: Alex Kiernan <alex.kiernan@gmail.com>; Li, Changqing <Changqing.Li@windriver.com>
> > > Cc: Patches and discussions about the oe-core layer <openembedded-core@lists.openembedded.org>
> > > Subject: Re: [OE-core] [PATCH] eudev: create static nodes from modules
> > >
> > > [Please note: This e-mail is from an EXTERNAL e-mail address]
> > >
> > > On Thu, 2022-05-12 at 08:45 +0100, Alex Kiernan wrote:
> > > > On Thu, May 12, 2022 at 6:43 AM Changqing Li <changqing.li@windriver.com> wrote:
> > > > >
> > > > > From: Changqing Li <changqing.li@windriver.com>
> > > > >
> > > > > dev in modules.devname should be populated in /dev on boot.
> > > > > remove create static mode from udevd will make these devices
> > > > > cannot be populated. When use sysVinit, devices like /dev/net/tun
> > > > > will not be created.
> > > > >
> > > > > more info:
> > > > > udevd in systemd also remove create static mode in udevd, but using
> > > > > service kmod-static-nodes.service and
> > > > > systemd-tmpfiles-setup-dev.service in systemd to create these node, so
> > > > > systemd works well.
> > > > >
> > > > > Signed-off-by: Changqing Li <changqing.li@windriver.com>
> > > > > ---
> > > > >  ...dev-create-static-nodes-from-modules.patch | 115 ++++++++++++++++++
> > > > >  meta/recipes-core/udev/eudev_3.2.11.bb        |   1 +
> > > > >  2 files changed, 116 insertions(+)
> > > > >  create mode 100644 meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > > >
> > > > > diff --git a/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > > > new file mode 100644
> > > > > index 0000000000..19611f4e89
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-core/udev/eudev/0001-eudev-create-static-nodes-from-modules.patch
> > > > > @@ -0,0 +1,115 @@
> > > > > +From 573d6c4106d5b3828da43d2843c1d599ae3cd1cd Mon Sep 17 00:00:00 2001
> > > > > +From: Changqing Li <changqing.li@windriver.com>
> > > > > +Date: Tue, 10 May 2022 14:04:35 +0800
> > > > > +Subject: [PATCH] eudev: create static nodes from modules
> > > > > +
> > > > > +Revert commit <src/udev/udevd.c: remove create static nodes from modules>
> > > > > +https://gitweb.gentoo.org/proj/eudev.git/commit/?id=2b7abd5ec9cc47a8b895df6db77fb1537c6f1a39
> > > > > +
> > > > > +Upstream-Status: Inappropriate [oe-specific]
> > > > > +
> > > > > +Upstream intentionally remove create static nodes from modules, it is
> > > > > +expected handled by tmpfiles services, refer [1].
> > > > > +[1] https://github.com/eudev-project/eudev/issues/229
> > > > > +
> > > > > +For yocto, when start with sysVinit, to enable systemd distro feature,
> > > > > +and install systemd-tmpfiles is not proper, so revert this commit.
> > > > > +
> > > >
> > > > Reading the upstream issue, I'm not sure this really is an
> > > > "Inappropriate" upstream. eudev has dropped this commit, because you
> > > > can use systemd-tmpfiles ("as it works without systemd and can be
> > > > compiled individually" - presumably using our unsupported musl
> > > > patches...) or opentmpfiles (which is dead and points you back to
> > > > systemd-tmpfiles).
> > > >
> > > > Feels like this is an engage with upstream rather than carry a patch
> > > > forever which just causes us to be perpetually divergent.
> > >
> > > I agree, this does sound like something we need to address to keep the
> > > project maintainable...
> > >
> > > I tried to suggest upstream to add this back,  but  upstream seems prefer to use tmpfile solution.
> > >
> >
> > Given how limited the output format which static-nodes generates for
> > tmpfiles is (just d and c! entries), parsing that output directly as
> > part the eudev init script wouldn't be horrible. Or make kmod generate
> > files in the format that volatiles expects? Though that would need
> > populate-volatile extending to generate device nodes.
> >
> > Thanks, I will dig more about the tmpfile solution, and send a V2 patch.
> >
> > Regards
> > Changqing
> >
> > --
> > Alex Kiernan
>
>
>
> --
> Alex Kiernan
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#165667): https://lists.openembedded.org/g/openembedded-core/message/165667
> Mute This Topic: https://lists.openembedded.org/mt/91052396/3618097
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kiernan@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


--
Alex Kiernan

[-- Attachment #2: Type: text/html, Size: 13680 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-17  1:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  5:43 [PATCH] eudev: create static nodes from modules changqing.li
2022-05-12  7:45 ` [OE-core] " Alex Kiernan
2022-05-12 10:33   ` richard.purdie
2022-05-13  1:42     ` Li, Changqing
2022-05-15 14:59       ` Alex Kiernan
2022-05-16  5:35         ` Li, Changqing
2022-05-16  8:06           ` Alex Kiernan
     [not found]           ` <16EF875D3CF1EBA0.26893@lists.openembedded.org>
2022-05-16 13:25             ` Alex Kiernan
2022-05-17  1:07               ` Li, Changqing

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.