[3/3] fs: fix condition to create static devices

Message ID 99d38f609529976ec574c3a05b6665cf3dd0669d.1540626349.git.yann.morin.1998@free.fr
State Changes Requested
Headers show
Series
  • [1/3] fs: apply permissions late
Related show

Commit Message

Yann E. MORIN Oct. 27, 2018, 7:46 a.m.
Currently, we parse the static devices tables even when we're not using
static device nodes; this is a left over from when we mixed devices
tables and permissions tables together. Creating package-defined device
nodes is guarded by the condition that there is at elast one devices
table.

This means that, when using static device nodes, but no device table, we
would miss on the package-defined device nodes.

We fix that by inverting the condition: static device tables are now
parsed only when using static devices, but the package-defined device
nodes are no longer conditioned to there being at least one devices
table.

Note: when there is no device table, the package-defined device ndoes
are appended to the file. That file can't exist from a previous build,
because the whole directory is rmoved at the beginning of the rule.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 fs/common.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Matthew Weber Nov. 2, 2018, 8:34 p.m. | #1
Yann,

On Sat, Oct 27, 2018 at 2:46 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> Currently, we parse the static devices tables even when we're not using
> static device nodes; this is a left over from when we mixed devices
> tables and permissions tables together. Creating package-defined device
> nodes is guarded by the condition that there is at elast one devices

elast -> least

> table.
>
> This means that, when using static device nodes, but no device table, we
> would miss on the package-defined device nodes.
>
> We fix that by inverting the condition: static device tables are now
> parsed only when using static devices, but the package-defined device
> nodes are no longer conditioned to there being at least one devices
> table.
>
> Note: when there is no device table, the package-defined device ndoes

ndoes -> nodes

> are appended to the file. That file can't exist from a previous build,
> because the whole directory is rmoved at the beginning of the rule.

rmoved -> removed

>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Reviewed-by: Matthew Weber <matthew.weber@rockwellcollins.com>

> ---
>  fs/common.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/common.mk b/fs/common.mk
> index fd1e80ab93..a0699b035d 100644
> --- a/fs/common.mk
> +++ b/fs/common.mk
> @@ -84,11 +84,11 @@ ifneq ($(ROOTFS_USERS_TABLES),)
>         cat $(ROOTFS_USERS_TABLES) >> $(USERS_TABLE)
>  endif
>         PATH=$(BR_PATH) $(TOPDIR)/support/scripts/mkusers $(USERS_TABLE) $(TARGET_DIR) >> $(FAKEROOT_SCRIPT)
> +ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
>  ifneq ($(ROOTFS_STATIC_DEVICE_TABLES),)
>         cat $(ROOTFS_STATIC_DEVICE_TABLES) > $(FULL_DEVICE_TABLE)
> -ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
> +endif
>         $(call PRINTF,$(PACKAGES_DEVICES_TABLE)) >> $(FULL_DEVICE_TABLE)
> -endif
>         echo "$(HOST_DIR)/bin/makedevs -d $(FULL_DEVICE_TABLE) $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
>  endif
>         $(foreach s,$(call qstrip,$(BR2_ROOTFS_POST_FAKEROOT_SCRIPT)),\
> --

Patch

diff --git a/fs/common.mk b/fs/common.mk
index fd1e80ab93..a0699b035d 100644
--- a/fs/common.mk
+++ b/fs/common.mk
@@ -84,11 +84,11 @@  ifneq ($(ROOTFS_USERS_TABLES),)
 	cat $(ROOTFS_USERS_TABLES) >> $(USERS_TABLE)
 endif
 	PATH=$(BR_PATH) $(TOPDIR)/support/scripts/mkusers $(USERS_TABLE) $(TARGET_DIR) >> $(FAKEROOT_SCRIPT)
+ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
 ifneq ($(ROOTFS_STATIC_DEVICE_TABLES),)
 	cat $(ROOTFS_STATIC_DEVICE_TABLES) > $(FULL_DEVICE_TABLE)
-ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y)
+endif
 	$(call PRINTF,$(PACKAGES_DEVICES_TABLE)) >> $(FULL_DEVICE_TABLE)
-endif
 	echo "$(HOST_DIR)/bin/makedevs -d $(FULL_DEVICE_TABLE) $(TARGET_DIR)" >> $(FAKEROOT_SCRIPT)
 endif
 	$(foreach s,$(call qstrip,$(BR2_ROOTFS_POST_FAKEROOT_SCRIPT)),\