Skip to contentSkip to conversation

Pull request for branch for-2012.02/pkg-device

GIT PULL New Maxime Ripard 4 participants 13 messages Jan 11, 2012 – Feb 19, 2012 VFS

lore
Share & tools
lore
#0 lore raw

Hi all,

This is an update of the patches adding the $(PKG)_DEVICES and $(PKG)_PERMISSIONS variables.

In this version, I just added a patch for the documentation presenting a basic example on how to use such variables.

Maxime

The following changes since commit e6480f2bb91e2df46096ed5f6ef8d3138cd38470:

sshfs: bump to version 2.3, adjust SITE and description (2012-01-11 15:36:45 +0100)

are available in the git repository at:
http://free-electrons.com/~maxime/git/buildroot.git for-2012.02/pkg-device

Maxime Ripard (4):
Add support for package-declared devices Convert busybox to the device declaration method Migrate Xenomai to the new infrastructure Update the documentation to add these changes

 docs/manual/adding-packages-gentargets.txt |   19 +++++++++++++++++--
 fs/common.mk                               |    4 ++++
 package/Makefile.package.in                |    2 ++
 package/busybox/busybox.mk                 |    5 +++++
 package/xenomai/xenomai.mk                 |    8 ++++++--
 target/generic/device_table.txt            |    2 --
 target/generic/device_table_dev.txt        |    5 -----
 7 files changed, 34 insertions(+), 11 deletions(-)

Thanks,

Signature · 1 line
Maxime Ripard
#1 lore raw

PATCH 1/4 Add support for package-declared devices

Add a way for packages to declare files they need instead of relying only on device tables, which creates files no matter if the package is indeed enabled, as we can see for busybox.

---
 fs/common.mk                |    4 ++++
 package/Makefile.package.in |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)
fs/common.mk +4 -0
index f793ff9..d426f37 100644
@@ -50,6 +50,10 @@ $(BINARIES_DIR)/rootfs.$(1): $(ROOTFS_$(2)_DEPENDENCIES)
 	echo "chown -R 0:0 $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
 ifneq ($(ROOTFS_DEVICE_TABLES),)
 	cat $(ROOTFS_DEVICE_TABLES) > $(FULL_DEVICE_TABLE)
+ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
+	echo -e '$(subst $(sep),\n,$(PACKAGES_DEVICES_TABLE))' >> $(FULL_DEVICE_TABLE)
+endif
+	echo -e '$(subst $(sep),\n,$(PACKAGES_PERMISSIONS_TABLE))' >> $(FULL_DEVICE_TABLE)
 	echo "$(HOST_DIR)/usr/bin/makedevs -d $(FULL_DEVICE_TABLE) $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
 endif
 	echo "$(ROOTFS_$(2)_CMD)" >> $(FAKEROOT_SCRIPT)
package/Makefile.package.in +2 -0
index e85eb15..24333f7 100644
@@ -713,6 +713,8 @@ endif
 ifeq ($$($$($(2)_KCONFIG_VAR)),y)
 
 TARGETS += $(1)
+PACKAGES_PERMISSIONS_TABLE += $$($(2)_PERMISSIONS)$$(sep)
+PACKAGES_DEVICES_TABLE += $$($(2)_DEVICES)$$(sep)
 
 ifeq ($$($(2)_SITE_METHOD),svn)
 DL_TOOLS_DEPENDENCIES += svn
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 1/4 Add support for package-declared devices

Quoted 6 lines · On Wednesday 11 January 2012 18:53:38 Maxime Ripard wrote:

Add a way for packages to declare files they need instead of relying only on device tables, which creates files no matter if the package is indeed enabled, as we can see for busybox.

Is there anything stopping this from going in?

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 2/4 Convert busybox to the device declaration method

In reply to Maxime Ripard

Busybox used to declare and create files even if the package was not enabled through the device table. Remove the entries for busybox in the device table and move them to the package declaration.

---
 package/busybox/busybox.mk      |    5 +++++
 target/generic/device_table.txt |    2 --
 2 files changed, 5 insertions(+), 2 deletions(-)
package/busybox/busybox.mk +5 -0
index d18b6d0..59448d5 100644
@@ -28,6 +28,11 @@ ifndef BUSYBOX_CONFIG_FILE
 	BUSYBOX_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG))
 endif
 
+define BUSYBOX_PERMISSIONS
+/bin/busybox			 f 4755	0 0 - - - - -
+/usr/share/udhcpc/default.script f 755  0 0 - - - - -
+endef
+
 # If mdev will be used for device creation enable it and copy S10mdev to /etc/init.d
 ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
 define BUSYBOX_INSTALL_MDEV_SCRIPT
target/generic/device_table.txt +0 -2
index 12f35b2..d3e394b 100644
@@ -10,13 +10,11 @@
 /tmp					d	1777	0	0	-	-	-	-	-
 /etc					d	755	0	0	-	-	-	-	-
 /home/default				d	2755	1000	1000	-	-	-	-	-
-/bin/busybox				f	4755	0	0	-	-	-	-	-
 /etc/shadow				f	600	0	0	-	-	-	-	-
 /etc/passwd				f	644	0	0	-	-	-	-	-
 /etc/network/if-up.d			d	755	0	0	-	-	-	-	-
 /etc/network/if-pre-up.d		d	755	0	0	-	-	-	-	-
 /etc/network/if-down.d			d	755	0	0	-	-	-	-	-
 /etc/network/if-post-down.d		d	755	0	0	-	-	-	-	-
-/usr/share/udhcpc/default.script	f	755	0	0	-	-	-	-	-
 # uncomment this to allow starting x as non-root
 #/usr/X11R6/bin/Xfbdev		     	f	4755	0	0	-	-	-	-	-
Signature · 1 line
1.7.4.1
#4 lore raw

PATCH 2/4 Convert busybox to the device declaration method

Quoted 6 lines · On Wednesday 11 January 2012 18:53:39 Maxime Ripard wrote:

Busybox used to declare and create files even if the package was not enabled through the device table. Remove the entries for busybox in the device table and move them to the package declaration.

Quoted 10 lines
---
 package/busybox/busybox.mk      |    5 +++++
 target/generic/device_table.txt |    2 --
 2 files changed, 5 insertions(+), 2 deletions(-)
package/busybox/busybox.mk +0 -0
index d18b6d0..59448d5 100644

package/busybox/busybox.mk ifndef BUSYBOX_CONFIG_FILE · line 33

Quoted 6 lines
package/busybox/busybox.mk +3 -0
@@ -28,6 +28,11 @@ ifndef BUSYBOX_CONFIG_FILE
 	BUSYBOX_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG))
 endif
 
+define BUSYBOX_PERMISSIONS
+/bin/busybox			 f 4755	0 0 - - - - -
+/usr/share/udhcpc/default.script f 755  0 0 - - - - -

Actually, the default.script doesn't need to be touched. busybox.mk will
install it with install -m 0755 so the line above doesn't change it. (Note:
I verified that.)

package/busybox/busybox.mk ifndef BUSYBOX_CONFIG_FILE · line 35

Quoted 2 lines
package/busybox/busybox.mk +2 -0
+endef
+

[snip]

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#5 lore raw

PATCH 2/4 Convert busybox to the device declaration method

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Hi,

Quoted 8 lines

package/busybox/busybox.mk ifndef BUSYBOX_CONFIG_FILE · line 33

Quoted 8 lines

+++ b/package/busybox/busybox.mk

package/busybox/busybox.mk +0 -0
@@ -28,6 +28,11 @@ ifndef BUSYBOX_CONFIG_FILE
 BUSYBOX_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG))

endif

package/busybox/busybox.mk +3 -0
+define BUSYBOX_PERMISSIONS
+/bin/busybox			 f 4755	0 0 - - - - -
+/usr/share/udhcpc/default.script f 755  0 0 - - - - -

Arnout> Actually, the default.script doesn't need to be touched. Arnout> busybox.mk will install it with install -m 0755 so the line Arnout> above doesn't change it. (Note: I verified that.)

But it only does so if it isn't present in the target skeleton. You could argue that people should just mark it executable there though.

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

PATCH 3/4 Migrate Xenomai to the new infrastructure

In reply to Maxime Ripard

Xenomai used to have commented out devices to be created in the device table that the user had to uncomment. Use the new infrastructure to do just that.

---
 package/xenomai/xenomai.mk          |    8 ++++++--
 target/generic/device_table_dev.txt |    5 -----
 2 files changed, 6 insertions(+), 7 deletions(-)
package/xenomai/xenomai.mk +6 -2
index f795579..02e5152 100644
@@ -98,8 +98,12 @@ endef
 
 XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_REMOVE_SKINS
 
-# If you use static /dev creation don't forget to update your
-#  device_table_dev.txt
+define XENOMAI_DEVICES
+/dev/rtheap  c  666  0  0  10  254  0  0  -
+/dev/rtscope c  666  0  0  10  253  0  0  -
+/dev/rtp     c  666  0  0  150 0    0  1  32
+endef
+
 ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV),y)
 XENOMAI_DEPENDENCIES += udev
 
target/generic/device_table_dev.txt +0 -5
index 71cd083..a3d53d4 100644
@@ -141,8 +141,3 @@
 
 # I2C device nodes
 /dev/i2c-	c	666	0	0	89	0	0	1	4
-
-# Xenomai
-#/dev/rtheap     c       666     0       0       10      254     0       0       -
-#/dev/rtscope    c       666     0       0       10      253     0       0       -
-#/dev/rtp        c       666     0       0       150     0       0       1       32
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 4/4 Update the documentation to add these changes

In reply to Maxime Ripard
---
 docs/manual/adding-packages-gentargets.txt |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
docs/manual/adding-packages-gentargets.txt +17 -2
index b344494..6617e26 100644
@@ -38,7 +38,15 @@ system is based on hand-written Makefiles or shell scripts.
 24: 	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/foo.d
 25: endef
 26:
-27: $(eval $(call GENTARGETS))
+27: define LIBFOO_DEVICES
+28: 	/dev/foo  c  666  0  0  42  0  -  -  -
+29: endef
+30:
+31: define LIBFOO_PERMISSIONS
+32: 	/bin/foo  f  4755  0  0  -  -  -  -  -
+33: endef
+34:
+35: $(eval $(call GENTARGETS))
 --------------------------------
 
 The Makefile begins on line 6 to 8 with metadata information: the
@@ -75,7 +83,7 @@ All these steps rely on the +$(@D)+ variable, which
 contains the directory where the source code of the package has been
 extracted.
 
-Finally, on line 27, we call the +GENTARGETS+ which
+Finally, on line 35, we call the +GENTARGETS+ which
 generates, according to the variables defined previously, all the
 Makefile code necessary to make your package working.
 
@@ -188,6 +196,13 @@ information is (assuming the package name is +libfoo+) :
   variables are executed to install the package into the target
   directory.
 
+* +LIBFOO_DEVICES+ lists the device files to be created by Buildroot
+  when using the static device table. The syntax to use is the
+  makedevs one.
+
+* +LIBFOO_PERMISSIONS+ lists the changes of permissions to be done at
+  the end of the build process. The syntax is once again the makedevs one.
+
 The recommended way to define these variables is to use the following
 syntax:
 
Signature · 1 line
1.7.4.1
#8 lore raw

PATCH 4/4 Update the documentation to add these changes

Le Wed, 11 Jan 2012 18:53:41 +0100,
Maxime Ripard <[email protected]> a ?crit :

docs/manual/adding-packages-gentargets.txt information is (assuming the package name is +libfoo+) : · line 201

Quoted 3 lines
docs/manual/adding-packages-gentargets.txt +3 -0
+* +LIBFOO_DEVICES+ lists the device files to be created by Buildroot
+  when using the static device table. The syntax to use is the
+  makedevs one.

Would be great to mention that <foo>_DEVICES and <foo>_PERMISSIONS are optional, and where to find the makedevs syntax, or mention it directly in the documentation (better).

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#9 lore raw

PATCH 4/4 Update the documentation to add these changes

Quoted 5 lines

docs/manual/adding-packages-gentargets.txt information is (assuming the package name is +libfoo+) : · line 201

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

docs/manual/adding-packages-gentargets.txt +3 -0
+* +LIBFOO_DEVICES+ lists the device files to be created by Buildroot
+  when using the static device table. The syntax to use is the
+  makedevs one.

Thomas> Would be great to mention that <foo>_DEVICES and <foo>_PERMISSIONS are Thomas> optional, and where to find the makedevs syntax, or mention it directly Thomas> in the documentation (better).

Agreed. Care to write something up Thomas/Maxime?

Signature · 1 line
Bye, Peter Korsgaard
#10 lore raw

PATCH 1/1 Add documentation for makedev

---
 docs/manual/adding-packages-gentargets.txt |    5 ++-
 docs/manual/appendix.txt                   |    4 ++
 docs/manual/makedev-syntax.txt             |   54 ++++++++++++++++++++++++++++
 docs/manual/manual.txt                     |    2 +
 4 files changed, 64 insertions(+), 1 deletions(-)
 create mode 100644 docs/manual/appendix.txt
 create mode 100644 docs/manual/makedev-syntax.txt
docs/manual/adding-packages-gentargets.txt +4 -1
index 3656a53..cfcee8c 100644
@@ -210,10 +210,13 @@ information is (assuming the package name is +libfoo+) :
 
 * +LIBFOO_DEVICES+ lists the device files to be created by Buildroot
   when using the static device table. The syntax to use is the
-  makedevs one.
+  makedevs one. You can find some documentation for this syntax in the
+  xref:makedev-syntax[]. This variable is optional.
 
 * +LIBFOO_PERMISSIONS+ lists the changes of permissions to be done at
   the end of the build process. The syntax is once again the makedevs one.
+  You can find some documentation for this syntax in the xref:makedev-syntax[].
+  This variable is optional.
 
 The recommended way to define these variables is to use the following
 syntax:
docs/manual/appendix.txt new file +4 -0
new file mode 100644
index 0000000..f41c82c
@@ -0,0 +1,4 @@
+Appendix
+========
+
+include::makedev-syntax.txt[]
docs/manual/makedev-syntax.txt new file +54 -0

54 lines not on this page · raw message

docs/manual/manual.txt +2 -0
index 10ce695..732b50c 100644
@@ -30,3 +30,5 @@ include::ccache-support.txt[]
 include::download-location.txt[]
 
 include::adding-packages.txt[]
+
+include::appendix.txt[]
Signature · 1 line
1.7.5.4
#11 lore raw

PATCH 1/1 Add documentation for makedev

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Maxime" == Maxime Ripard <[email protected]> writes:

Maxime> Signed-off-by: Maxime Ripard <[email protected]>

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#12 lore raw
In reply to Maxime Ripard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Maxime" == Maxime Ripard <[email protected]> writes:

Maxime> Hi all,
Maxime> This is an update of the patches adding the $(PKG)_DEVICES and Maxime> $(PKG)_PERMISSIONS variables.

Maxime> In this version, I just added a patch for the documentation Maxime> presenting a basic example on how to use such variables.

Committed, thanks and sorry for slow reponse.

Signature · 1 line
Bye, Peter Korsgaard