Pull request for branch for-2011.11/pkg-device
Subsystems (3)
Hello,
Here is a minor set of improvement on how the devices are declared in buildroot. For now, All the devices to be created were in two files generic to every compilation. This was fine for most usage, but was a bit problematic when packages needed to create files or use specific permissions.
This set of patches are addressing this issue by creating a new $(PKG)_FILES variable, containing the package specific devices, using the makedevs syntax.
Changes since v1:
* Rename the device tables and all mentions of devices to a more exact term
* Cramfs was still passing a hardcoded device table. Remove it.
The following changes since commit facd602dcad54df769ac759886f48f248b61e692:
Update for 2011.08 (2011-08-31 13:44:55 +0200)
are available in the git repository at:
http://free-electrons.com/~maxime/git/buildroot.git for-2011.11/pkg-device
Maxime Ripard (4):
Cleanup cramfs package declaration. Rename the device table in the code base Add support for package-declared devices Convert busybox to the device declaration method
Makefile | 4 +
fs/common.mk | 15 +-
fs/cramfs/cramfs.mk | 6 +-
package/Makefile.package.in | 1 +
package/busybox/busybox.mk | 5 +
package/cramfs/cramfs-01-devtable.patch | 1269 --------------------
...amfs-02-endian.patch => cramfs-01-endian.patch} | 68 +-
package/cramfs/cramfs-02-cygwin_IO.patch | 15 +
package/cramfs/cramfs-03-cygwin_IO.patch | 13 -
.../{device_table.txt => file_install_table.txt} | 0
target/generic/Config.in | 6 +-
.../{device_table.txt => file_install_table.txt} | 2 -
...evice_table_dev.txt => static_device_table.txt} | 0
target/xtensa/defconfig | 2 +-
14 files changed, 74 insertions(+), 1332 deletions(-)
delete mode 100644 package/cramfs/cramfs-01-devtable.patch
rename package/cramfs/{cramfs-02-endian.patch => cramfs-01-endian.patch} (86%)
create mode 100644 package/cramfs/cramfs-02-cygwin_IO.patch
delete mode 100644 package/cramfs/cramfs-03-cygwin_IO.patch
rename target/device/xtensa/{device_table.txt => file_install_table.txt} (100%)
rename target/generic/{device_table.txt => file_install_table.txt} (90%)
rename target/generic/{device_table_dev.txt => static_device_table.txt} (100%)Thanks,
Signature · 1 line
Maxime Ripard
PATCH 1/4 Cleanup cramfs package declaration.
Cramfs still passes the device table to mkcramfs, which is irrelevant now with fakeroot, remove this behaviour and the associated patch.
---
fs/cramfs/cramfs.mk | 6 +-
package/cramfs/cramfs-01-devtable.patch | 1269 --------------------
...amfs-02-endian.patch => cramfs-01-endian.patch} | 68 +-
package/cramfs/cramfs-02-cygwin_IO.patch | 15 +
package/cramfs/cramfs-03-cygwin_IO.patch | 13 -
5 files changed, 52 insertions(+), 1319 deletions(-)
delete mode 100644 package/cramfs/cramfs-01-devtable.patch
rename package/cramfs/{cramfs-02-endian.patch => cramfs-01-endian.patch} (86%)
create mode 100644 package/cramfs/cramfs-02-cygwin_IO.patch
delete mode 100644 package/cramfs/cramfs-03-cygwin_IO.patchfs/cramfs/cramfs.mk +1 -5
@@ -9,14 +9,10 @@ else CRAMFS_OPTS=-l endif -ifneq ($(ROOTFS_DEVICE_TABLE),) -CRAMFS_OPTS += -D $(ROOTFS_DEVICE_TABLE) -endif - define ROOTFS_CRAMFS_CMD $(HOST_DIR)/usr/bin/mkcramfs -q $(CRAMFS_OPTS) $(TARGET_DIR) $$@ endef ROOTFS_CRAMFS_DEPENDENCIES = host-cramfs -$(eval $(call ROOTFS_TARGET,cramfs)) +$(eval $(call ROOTFS_TARGET,cramfs))
package/cramfs/cramfs-01-devtable.patch deleted +0 -1269
1,269 lines not on this page · raw message
package/cramfs/cramfs-01-endian.patch renamed from package/cramfs/cramfs-02-endian.patch +36 -32
183 lines not on this page · raw message
package/cramfs/cramfs-02-cygwin_IO.patch new file +15 -0
@@ -0,0 +1,15 @@ +Index: cramfs-1.1/cramfsck.c +=================================================================== +--- cramfs-1.1.orig/cramfsck.c 2011-09-09 15:10:06.000000000 +0200 ++++ cramfs-1.1/cramfsck.c 2011-09-09 15:13:49.950897747 +0200 +@@ -57,6 +57,10 @@ + #include <byteswap.h> + #include <zlib.h> + ++#ifdef __CYGWIN__ ++#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) ++#endif /* __CYGWIN__ */ ++ + /* Exit codes used by fsck-type programs */ + #define FSCK_OK 0 /* No errors */ + #define FSCK_NONDESTRUCT 1 /* File system errors corrected */
package/cramfs/cramfs-03-cygwin_IO.patch deleted +0 -13
@@ -1,13 +0,0 @@ ---- cramfs-1.1/cramfsck.c.orig 2006-12-22 22:16:59.328125000 +1100 -+++ cramfs-1.1/cramfsck.c 2006-12-19 01:02:05.531250000 +1100 -@@ -56,6 +56,10 @@ - #include "linux/cramfs_fs.h" - #include <zlib.h> - -+#ifdef __CYGWIN__ -+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) -+#endif /* __CYGWIN__ */ -+ - #define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ - - /* Exit codes used by fsck-type programs */
Signature · 1 line
1.7.4.1
PATCH 2/4 Rename the device table in the code base
In reply to Maxime RipardThe device table has grown into something that is no longer restricted to devices but is now used for permissions, folder creations, etc. Rename the occurences of device_table by file_install_table, which is closer to what is done.
---
fs/common.mk | 14 +++++++-------
.../{device_table.txt => file_install_table.txt} | 0
target/generic/Config.in | 6 +++---
.../{device_table.txt => file_install_table.txt} | 0
...evice_table_dev.txt => static_device_table.txt} | 0
target/xtensa/defconfig | 2 +-
6 files changed, 11 insertions(+), 11 deletions(-)
rename target/device/xtensa/{device_table.txt => file_install_table.txt} (100%)
rename target/generic/{device_table.txt => file_install_table.txt} (100%)
rename target/generic/{device_table_dev.txt => static_device_table.txt} (100%)fs/common.mk +7 -7
@@ -32,9 +32,9 @@ # macro will automatically generate a compressed filesystem image. FAKEROOT_SCRIPT = $(BUILD_DIR)/_fakeroot.fs -FULL_DEVICE_TABLE = $(BUILD_DIR)/_device_table.txt -ROOTFS_DEVICE_TABLES = $(call qstrip,$(BR2_ROOTFS_DEVICE_TABLE)) \ - $(call qstrip,$(BR2_ROOTFS_STATIC_DEVICE_TABLE)) +FULL_FILE_INSTALL_TABLE = $(BUILD_DIR)/_file_install_table.txt +ROOTFS_FILE_INSTALL_TABLES = $(call qstrip,$(BR2_ROOTFS_FILE_INSTALL_TABLE)) \ + $(call qstrip,$(BR2_ROOTFS_STATIC_FILE_INSTALL_TABLE)) define ROOTFS_TARGET_INTERNAL
@@ -48,14 +48,14 @@ $(BINARIES_DIR)/rootfs.$(1): $(ROOTFS_$(2)_DEPENDENCIES) touch $(BUILD_DIR)/.fakeroot.00000 cat $(BUILD_DIR)/.fakeroot* > $(FAKEROOT_SCRIPT) echo "chown -R 0:0 $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT) -ifneq ($(ROOTFS_DEVICE_TABLES),) - cat $(ROOTFS_DEVICE_TABLES) > $(FULL_DEVICE_TABLE) - echo "$(HOST_DIR)/usr/bin/makedevs -d $(FULL_DEVICE_TABLE) $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT) +ifneq ($(ROOTFS_FILE_INSTALL_TABLES),) + cat $(ROOTFS_FILE_INSTALL_TABLES) > $(FULL_FILE_INSTALL_TABLE) + echo "$(HOST_DIR)/usr/bin/makedevs -d $(FULL_FILE_INSTALL_TABLE) $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT) endif echo "$(ROOTFS_$(2)_CMD)" >> $(FAKEROOT_SCRIPT) chmod a+x $(FAKEROOT_SCRIPT) $(HOST_DIR)/usr/bin/fakeroot -- $(FAKEROOT_SCRIPT) - - at rm -f $(FAKEROOT_SCRIPT) $(FULL_DEVICE_TABLE) + - at rm -f $(FAKEROOT_SCRIPT) $(FULL_FILE_INSTALL_TABLE) $(foreach hook,$(ROOTFS_$(2)_POST_GEN_HOOKS),$(call $(hook))$(sep)) ifeq ($$(BR2_TARGET_ROOTFS_$(2)_GZIP),y) gzip -9 -c $$@ > [email protected]
target/device/xtensa/file_install_table.txt renamed from target/device/xtensa/device_table.txt +0 -0
target/generic/Config.in +3 -3
@@ -32,9 +32,9 @@ config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV endchoice -config BR2_ROOTFS_DEVICE_TABLE +config BR2_ROOTFS_FILE_INSTALL_TABLE string "Path to the permission tables" - default "target/generic/device_table.txt" + default "target/generic/file_install_table.txt" help Specify a space-separated list of permission table locations, that will be passed to the makedevs utility to assign
@@ -46,7 +46,7 @@ config BR2_ROOTFS_DEVICE_TABLE config BR2_ROOTFS_STATIC_DEVICE_TABLE string "Path to the device tables" - default "target/generic/device_table_dev.txt" + default "target/generic/static_device_table.txt" depends on BR2_ROOTFS_DEVICE_CREATION_STATIC help Specify a space-separated list of device table locations,
target/generic/file_install_table.txt renamed from target/generic/device_table.txt +0 -0
target/generic/static_device_table.txt renamed from target/generic/device_table_dev.txt +0 -0
target/xtensa/defconfig +1 -1
@@ -102,7 +102,7 @@ BR2_PACKAGE_PORTMAP=y # # filesystem for target device # -BR2_ROOTFS_DEVICE_TABLE="target/device/xtensa/device_table.txt" +BR2_ROOTFS_FILE_INSTALL_TABLE="target/device/xtensa/file_install_table.txt" BR2_TARGET_ROOTFS_CPIO=y BR2_TARGET_ROOTFS_CPIO_GZIP=y BR2_TARGET_ROOTFS_INITRAMFS=y
Signature · 1 line
1.7.4.1
PATCH 3/4 Add support for package-declared devices
In reply to Maxime RipardAdd 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.
--- Makefile | 4 ++++ fs/common.mk | 1 + package/Makefile.package.in | 1 + 3 files changed, 6 insertions(+), 0 deletions(-)
Makefile +4 -0
@@ -52,6 +52,10 @@ qstrip=$(strip $(subst ",,$(1))) comma:=, empty:= space:=$(empty) $(empty) +define newline + + +endef ifneq ("$(origin O)", "command line") O:=output
fs/common.mk +1 -0
@@ -50,6 +50,7 @@ $(BINARIES_DIR)/rootfs.$(1): $(ROOTFS_$(2)_DEPENDENCIES) echo "chown -R 0:0 $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT) ifneq ($(ROOTFS_FILE_INSTALL_TABLES),) cat $(ROOTFS_FILE_INSTALL_TABLES) > $(FULL_FILE_INSTALL_TABLE) + echo -e '$(subst $(newline),\n,$(PACKAGES_FILE_INSTALL_TABLE))' >> $(FULL_FILE_INSTALL_TABLE) echo "$(HOST_DIR)/usr/bin/makedevs -d $(FULL_FILE_INSTALL_TABLE) $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT) endif echo "$(ROOTFS_$(2)_CMD)" >> $(FAKEROOT_SCRIPT)
package/Makefile.package.in +1 -0
@@ -541,6 +541,7 @@ endif ifeq ($$($$($(2)_KCONFIG_VAR)),y) TARGETS += $(1) +PACKAGES_FILE_INSTALL_TABLE += $$($(2)_FILES)$$(newline) ifeq ($$($(2)_SITE_METHOD),svn) DL_TOOLS_DEPENDENCIES += svn
Signature · 1 line
1.7.4.1
PATCH 4/4 Convert busybox to the device declaration method
In reply to Maxime RipardBusybox 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/file_install_table.txt | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-)
package/busybox/busybox.mk +5 -0
@@ -28,6 +28,11 @@ ifndef BUSYBOX_CONFIG_FILE BUSYBOX_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG)) endif +define BUSYBOX_FILES +/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/file_install_table.txt +0 -2
@@ -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
Hi,
Any comments on that ?
Maxime
Le 09/09/2011 16:05, Maxime Ripard a ?crit :
Quoted 53 lines
Hello,
Here is a minor set of improvement on how the devices are declared in buildroot. For now, All the devices to be created were in two files generic to every compilation. This was fine for most usage, but was a bit problematic when packages needed to create files or use specific permissions.
This set of patches are addressing this issue by creating a new $(PKG)_FILES variable, containing the package specific devices, using the makedevs syntax.
Changes since v1:
* Rename the device tables and all mentions of devices to a more exact term
* Cramfs was still passing a hardcoded device table. Remove it.The following changes since commit
facd602dcad54df769ac759886f48f248b61e692:Update for 2011.08 (2011-08-31 13:44:55 +0200)are available in the git repository at:
http://free-electrons.com/~maxime/git/buildroot.git for-2011.11/pkg-deviceMaxime Ripard (4):
Cleanup cramfs package declaration. Rename the device table in the code base Add support for package-declared devices Convert busybox to the device declaration methodMakefile | 4 + fs/common.mk | 15 +- fs/cramfs/cramfs.mk | 6 +- package/Makefile.package.in | 1 + package/busybox/busybox.mk | 5 + package/cramfs/cramfs-01-devtable.patch | 1269 -------------------- ...amfs-02-endian.patch => cramfs-01-endian.patch} | 68 +- package/cramfs/cramfs-02-cygwin_IO.patch | 15 + package/cramfs/cramfs-03-cygwin_IO.patch | 13 - .../{device_table.txt => file_install_table.txt} | 0 target/generic/Config.in | 6 +- .../{device_table.txt => file_install_table.txt} | 2 - ...evice_table_dev.txt => static_device_table.txt} | 0 target/xtensa/defconfig | 2 +- 14 files changed, 74 insertions(+), 1332 deletions(-)delete mode 100644
package/cramfs/cramfs-01-devtable.patch
renamepackage/cramfs/{cramfs-02-endian.patch=> cramfs-01-endian.patch} (86%) create mode 100644package/cramfs/cramfs-02-cygwin_IO.patch
delete mode 100644package/cramfs/cramfs-03-cygwin_IO.patch
renametarget/device/xtensa/{device_table.txt=> file_install_table.txt} (100%) renametarget/generic/{device_table.txt=> file_install_table.txt} (90%) renametarget/generic/{device_table_dev.txt=> static_device_table.txt} (100%)Thanks,
PATCH 1/4 Cleanup cramfs package declaration.
In reply to Maxime RipardQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Maxime" == Maxime Ripard <[email protected]> writes:
Maxime> Cramfs still passes the device table to mkcramfs, which is irrelevant Maxime> now with fakeroot, remove this behaviour and the associated patch.
Maxime> Signed-off-by: Maxime Ripard <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard
Hi,
Any review on that ?
The cramfs patch should obviously be dropped, as it has already been applied. From what I read in the BDD report, the renaming of the device_table should also be dropped. But it also says that a more precise comment on what the attendees expected would be given.
Maxime
Quoted 53 lines · Maxime Ripard
Hello,
Here is a minor set of improvement on how the devices are declared in buildroot. For now, All the devices to be created were in two files generic to every compilation. This was fine for most usage, but was a bit problematic when packages needed to create files or use specific permissions.
This set of patches are addressing this issue by creating a new $(PKG)_FILES variable, containing the package specific devices, using the makedevs syntax.
Changes since v1:
* Rename the device tables and all mentions of devices to a more exact term
* Cramfs was still passing a hardcoded device table. Remove it.The following changes since commit
facd602dcad54df769ac759886f48f248b61e692:Update for 2011.08 (2011-08-31 13:44:55 +0200)
are available in the git repository at:
http://free-electrons.com/~maxime/git/buildroot.git for-2011.11/pkg-deviceMaxime Ripard (4):
Cleanup cramfs package declaration. Rename the device table in the code base Add support for package-declared devices Convert busybox to the device declaration methodMakefile | 4 + fs/common.mk | 15 +- fs/cramfs/cramfs.mk | 6 +- package/Makefile.package.in | 1 + package/busybox/busybox.mk | 5 + package/cramfs/cramfs-01-devtable.patch | 1269 -------------------- ...amfs-02-endian.patch => cramfs-01-endian.patch} | 68 +- package/cramfs/cramfs-02-cygwin_IO.patch | 15 + package/cramfs/cramfs-03-cygwin_IO.patch | 13 - .../{device_table.txt => file_install_table.txt} | 0 target/generic/Config.in | 6 +- .../{device_table.txt => file_install_table.txt} | 2 - ...evice_table_dev.txt => static_device_table.txt} | 0 target/xtensa/defconfig | 2 +- 14 files changed, 74 insertions(+), 1332 deletions(-) delete mode 100644 package/cramfs/cramfs-01-devtable.patch rename package/cramfs/{cramfs-02-endian.patch => cramfs-01-endian.patch} (86%) create mode 100644 package/cramfs/cramfs-02-cygwin_IO.patch delete mode 100644 package/cramfs/cramfs-03-cygwin_IO.patch rename target/device/xtensa/{device_table.txt => file_install_table.txt} (100%) rename target/generic/{device_table.txt => file_install_table.txt} (90%) rename target/generic/{device_table_dev.txt => static_device_table.txt} (100%)Thanks,
Signature · 4 lines
Maxime Ripard, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Le Wed, 14 Dec 2011 11:39:42 +0100,
Maxime Ripard <[email protected]> a ?crit :
Quoted 1 line
Any review on that ?
I don't like the <pkg>_FILES name, because it makes me think that *all* files installed by the package must be listed in this variable, while in fact, only files for which special permissions must be applied, or for device files.
What about having two variables:
<pkg>_PERMISSIONS
and
<pkg>_DEVICES
The idea is that by separating permission-modifications (like the one for Busybox) for device files, it is much easier to use *_PERMISSIONS + *_DEVICES when static /dev is used, and only *_PERMISSIONS when dynamic /dev is used.
Regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com