build: Modernize device installation
PATCH 1/1 build: Modernize device installation
Drop the obsoleted mknod calls - all modern systems use devtmpfs, and that creates the rtp nodes for us.
Furthermore, switch the remaining installation of udev rules to proper automake, using sysconfdir, INSTALL_DATA etc., dropping sudo from those steps (installation into privileged folders implies "sudo make install" or running as root in the first place).
Finally, only differentiate between pre-existing udev.rules and default installation into rules.d.
This removes the need for the install-user target - drop it.
--- Makefile.am | 54 ++++++++++++++---------------------------------------- 1 file changed, 14 insertions(+), 40 deletions(-)
Makefile.am +14 -40
@@ -31,48 +31,22 @@ dist-hook: rm -fr `find $(distdir) -name '.svn' -o -name CVS -o -name '.#*' \ -o -name '*~' -o -name autom4te.cache` -dev devices: +udev-rules: if XENO_COBALT - @$(mkinstalldirs) $(DESTDIR)/dev; \ - if test x`id -u` = x0; then \ - sudo= ; \ - else if test \! "x`type $(SUDO)`" = x ; then \ - echo "sudo found (sudo is $(SUDO)), testing it..." ; \ - $(SUDO) sh -c "( mknod $(DESTDIR)/dev/dummy c 150 0 && rm -f $(DESTDIR)/dev/dummy )" && \ - sudo="$(SUDO)" || { \ -echo '*** Warning: you are not super-user and sudo does not work, real-time devices' ; \ -echo '*** nodes will not be created.' ; \ -echo '*** If you do not create these devices by hand, Xenomai test programs will not' ; \ -echo '*** work.' ; \ -echo '*** To create these devices please run "make devices" with super-user' ; \ -echo '*** privileges.' ; \ - exit 0 ; } ; \ - echo 'sudo is working.' ; \ - fi ; \ - fi ; \ - if test -r $(DESTDIR)/etc/udev/udev.rules ; then \ - for f in $(srcdir)/kernel/cobalt/udev/*.rules ; do \ - b=`basename $$f` ; \ - grep -q Xenomai:`basename $$b .rules` $(DESTDIR)/etc/udev/udev.rules || \ - $$sudo sh -c "( echo ; cat $$f ) >> $(DESTDIR)/etc/udev/udev.rules" ; \ - done ; \ - else if test -d $(DESTDIR)/etc/udev/rules.d ; then \ - for f in $(srcdir)/kernel/cobalt/udev/*.rules ; do \ - $$sudo cp $$f $(DESTDIR)/etc/udev/rules.d/ ; \ - done ; \ - fi ; \ - fi ; \ - for n in `seq 0 31` ; do \ - f="$(DESTDIR)/dev/rtp$$n" ; \ - if test \! -c $$f ; then \ - $$sudo mknod -m 666 $$f c 150 $$n ; \ - fi ; \ - done + if test -r $(DESTDIR)/$(sysconfdir)/udev/udev.rules ; then \ + for f in $(srcdir)/kernel/cobalt/udev/*.rules ; do \ + b=`basename $$f` ; \ + grep -q Xenomai:`basename $$b .rules` $(DESTDIR)/$(sysconfdir)/udev/udev.rules || \ + ( echo ; cat $$f ) >> $(DESTDIR)/$(sysconfdir)/udev/udev.rules ; \ + done ; \ + else \ + $(mkinstalldirs) $(DESTDIR)/$(sysconfdir)/udev/rules.d; \ + for f in $(srcdir)/kernel/cobalt/udev/*.rules ; do \ + $(INSTALL_DATA) $$f $(DESTDIR)/$(sysconfdir)/udev/rules.d/ ; \ + done ; \ + fi endif -install-exec-local: devices - -install-user: - $(MAKE) SUDO=false install +install-exec-local: udev-rules .PHONY: FORCE
Signature · 1 line
2.16.4
Quoted 8 lines · Jan Kiszka
Drop the obsoleted mknod calls - all modern systems use devtmpfs, and that creates the rtp nodes for us.
Furthermore, switch the remaining installation of udev rules to proper automake, using sysconfdir,
INSTALL_DATAetc., dropping sudo from those steps (installation into privileged folders implies "sudo make install" or running as root in the first place).
Quoted 6 lines
Finally, only differentiate between pre-existing udev.rules and default installation into rules.d.
This removes the need for the install-user target - drop it.
Signed-off-by Jan Kiszka <[email protected]>
Ack.
Signature · 1 line
Philippe.
Quoted 8 lines · Jan Kiszka
Drop the obsoleted mknod calls - all modern systems use devtmpfs, and that creates the rtp nodes for us.
Furthermore, switch the remaining installation of udev rules to proper automake, using sysconfdir,
INSTALL_DATAetc., dropping sudo from those steps (installation into privileged folders implies "sudo make install" or running as root in the first place).
Quoted 5 lines
Finally, only differentiate between pre-existing udev.rules and default installation into rules.d.
This removes the need for the install-user target - drop it.
It looks like this one broke buildroot, which expects install-user. A compat one-liner like below may help in preventing a regression:
Makefile.am +2 -0
@@ -49,4 +49,6 @@ endif install-exec-local: udev-rules +install-user: udev-rules + .PHONY: FORCE
Signature · 1 line
Philippe.
Quoted 24 lines · Philippe Gerum
Quoted 8 lines · Jan Kiszka
Drop the obsoleted mknod calls - all modern systems use devtmpfs, and that creates the rtp nodes for us.
Furthermore, switch the remaining installation of udev rules to proper automake, using sysconfdir,
INSTALL_DATAetc., dropping sudo from those steps (installation into privileged folders implies "sudo make install" or running as root in the first place).Quoted 5 lines
Finally, only differentiate between pre-existing udev.rules and default installation into rules.d.
This removes the need for the install-user target - drop it.
It looks like this one broke buildroot, which expects install-user. A compat one-liner like below may help in preventing a regression:
Makefile.am +0
-0
Makefile.am endif · line 54
Quoted 6 lines
Makefile.am +2
-0@@ -49,4 +49,6 @@ endif install-exec-local: udev-rules +install-user: udev-rules + .PHONY: FORCE
Why not
install-user: install
?
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Quoted 34 lines · Jan Kiszka
Quoted 28 lines · Philippe Gerum
Quoted 8 lines · Jan Kiszka
Drop the obsoleted mknod calls - all modern systems use devtmpfs, and that creates the rtp nodes for us.
Furthermore, switch the remaining installation of udev rules to proper automake, using sysconfdir,
INSTALL_DATAetc., dropping sudo from those steps (installation into privileged folders implies "sudo make install" or running as root in the first place).Quoted 5 lines
Finally, only differentiate between pre-existing udev.rules and default installation into rules.d.
This removes the need for the install-user target - drop it.
It looks like this one broke buildroot, which expects install-user. A compat one-liner like below may help in preventing a regression:
Makefile.am +0
-0@@ -49,4 +49,6 @@ endifinstall-exec-local: udev-rules
Makefile.am +2
-0+install-user: udev-rules +Quoted 2 lines
.PHONY: FORCE
Why not
Quoted 3 lines
install-user: install
?
Yes, even better.
Signature · 1 line
Philippe.