Skip to contentSkip to conversation

fs: make it behave more like the package infra

PATCH New Yann E. MORIN 2 participants 5 messages Dec 28, 2017 – Jan 3, 2018

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover fs: make it behave more like the package infra

Hello All!

Currently, to register a new filesystem, one has to call:

    $(eval $(call ROOTFS_TARGET,blabla))

This is different from the package infrastructure, where the name of the package needs not be specified, and is automatically guessed. This makes the fs infra a bit different, when there is no reason for that.

Well, it turns out that there is a reason: we currently register two filesystems from the same directory: ubifs and ubi. But it turns out that these are in fact not two filesystems, but ubi can be spun off as its own filesystem (that depends on ubifs, which is anyway already the case).

So, after we spin off the UBI image to its own filesystem, we eventually turn the rootfs infra into a package-like infra, whereby naming the filesystem is no longer needed, which allows one to simply write:

   $(eval $(rootfs))

The 'rootfs' keyword may seem rather generic, but it is currently unused in our tree (except in a post-image script for the chromebook defconfig):

    $ git grep -E '\<rootfs[[:space:]]*:?='
    board/chromebook/snow/mksd.sh:rootfs=$BINARIES_DIR/rootfs.ext2

Changes v1 -> v2:
- register the UBI image as a separate filesystem, not an option of the ubifs filesystem (Thomas)

Regards,
Yann E. MORIN.

The following changes since commit 0b39b14b27700ff4cde566b704d9f633f9230a30

Config.in.legacy: update comment that old entries have been removed (2017-12-28 10:06:58 +0100)

are available in the git repository at:

git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to f803f25cacb7d566fdc0bb1af9dd134371e25a86

fs: make it behave a bit more like the package infra (2017-12-28 11:25:35 +0100)

----------------------------------------------------------------
Yann E. MORIN (2):
fs/ubifs: spin-off ubi to be its own filesystem
fs: make it behave a bit more like the package infra

 fs/Config.in                  |  1 +
 fs/axfs/axfs.mk               |  2 +-
 fs/cloop/cloop.mk             |  2 +-
 fs/common.mk                  |  7 +++---
 fs/cpio/cpio.mk               |  2 +-
 fs/cramfs/cramfs.mk           |  2 +-
 fs/ext2/ext2.mk               |  2 +-
 fs/iso9660/iso9660.mk         |  2 +-
 fs/jffs2/jffs2.mk             |  2 +-
 fs/romfs/romfs.mk             |  2 +-
 fs/squashfs/squashfs.mk       |  2 +-
 fs/tar/tar.mk                 |  2 +-
 fs/ubi/Config.in              | 51 +++++++++++++++++++++++++++++++++++++++++++
 fs/{ubifs => ubi}/ubi.mk      |  4 ++--
 fs/{ubifs => ubi}/ubinize.cfg |  0
 fs/ubifs/Config.in            | 51 -------------------------------------------
 fs/ubifs/ubifs.mk             |  2 +-
 fs/yaffs2/yaffs.mk            |  2 +-
 18 files changed, 69 insertions(+), 69 deletions(-)
 create mode 100644 fs/ubi/Config.in
 rename fs/{ubifs => ubi}/ubi.mk (92%)
 rename fs/{ubifs => ubi}/ubinize.cfg (100%)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v2 1/2 fs/ubifs: spin-off ubi to be its own filesystem

Currently, the ubifs-in-ubi-image ("UBI image" thereafter) filesystem is half an option of the ubifs filesystem, half a filesystem on its own:
the configoptions are options of the ubifs filesystem, but the .mk code is in a separate .mk and registers a real filesystem.

Make it a full filesystem on its own, in its own directory tree.

Cc Thomas Petazzoni <[email protected]>

---
Changes v1 -> v2:
- don't make it an option of the ubifs anymore, make it a separate fs (Thomas)

---
 fs/Config.in                  |  1 +
 fs/ubi/Config.in              | 51 +++++++++++++++++++++++++++++++++++++++++++
 fs/{ubifs => ubi}/ubi.mk      |  2 +-
 fs/{ubifs => ubi}/ubinize.cfg |  0
 fs/ubifs/Config.in            | 51 -------------------------------------------
 5 files changed, 53 insertions(+), 52 deletions(-)
 create mode 100644 fs/ubi/Config.in
 rename fs/{ubifs => ubi}/ubi.mk (95%)
 rename fs/{ubifs => ubi}/ubinize.cfg (100%)
fs/Config.in +1 -0
index 51ccf28169..c25b01c3de 100644
@@ -11,6 +11,7 @@ source "fs/jffs2/Config.in"
 source "fs/romfs/Config.in"
 source "fs/squashfs/Config.in"
 source "fs/tar/Config.in"
+source "fs/ubi/Config.in"
 source "fs/ubifs/Config.in"
 source "fs/yaffs2/Config.in"
 
fs/ubi/Config.in new file +51 -0

51 lines not on this page · raw message

fs/ubi/ubi.mk renamed from fs/ubifs/ubi.mk +1 -1
similarity index 95%
rename from fs/ubifs/ubi.mk
rename to fs/ubi/ubi.mk
index 2baece5fb0..b71a555efb 100644
@@ -17,7 +17,7 @@ ROOTFS_UBI_DEPENDENCIES = rootfs-ubifs
 ifeq ($(BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG),y)
 UBINIZE_CONFIG_FILE_PATH = $(call qstrip,$(BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE))
 else
-UBINIZE_CONFIG_FILE_PATH = fs/ubifs/ubinize.cfg
+UBINIZE_CONFIG_FILE_PATH = fs/ubi/ubinize.cfg
 endif
 
 # don't use sed -i as it misbehaves on systems with SELinux enabled when this is
fs/ubi/ubinize.cfg renamed from fs/ubifs/ubinize.cfg +0 -0
similarity index 100%
rename from fs/ubifs/ubinize.cfg
rename to fs/ubi/ubinize.cfg
fs/ubifs/Config.in +0 -51

55 lines not on this page · raw message

Signature · 1 line
2.11.0
#2 lore raw

PATCH v2 2/2 fs: make it behave a bit more like the package infra

In reply to Yann E. MORIN

Currently, to register a filesystem, one has to call:

    $(eval $(call ROOTFS_TARGET,blabla))

This is very unlike the package infrastrucutre, where the name of the packagge os automatically guessed by the infra.

It turns out that we can nowe do that for the filesystem infra too.

---
 fs/axfs/axfs.mk         | 2 +-
 fs/cloop/cloop.mk       | 2 +-
 fs/common.mk            | 7 +++----
 fs/cpio/cpio.mk         | 2 +-
 fs/cramfs/cramfs.mk     | 2 +-
 fs/ext2/ext2.mk         | 2 +-
 fs/iso9660/iso9660.mk   | 2 +-
 fs/jffs2/jffs2.mk       | 2 +-
 fs/romfs/romfs.mk       | 2 +-
 fs/squashfs/squashfs.mk | 2 +-
 fs/tar/tar.mk           | 2 +-
 fs/ubi/ubi.mk           | 2 +-
 fs/ubifs/ubifs.mk       | 2 +-
 fs/yaffs2/yaffs.mk      | 2 +-
 14 files changed, 16 insertions(+), 17 deletions(-)
fs/axfs/axfs.mk +1 -1
index 6c795d7062..4b93df55c0 100644
@@ -10,4 +10,4 @@ define ROOTFS_AXFS_CMD
 	$(HOST_DIR)/bin/mkfs.axfs -s -a $(TARGET_DIR) $@
 endef
 
-$(eval $(call ROOTFS_TARGET,axfs))
+$(eval $(rootfs))
fs/cloop/cloop.mk +1 -1
index cbfc79b0d1..17749c5a3b 100644
@@ -11,4 +11,4 @@ define ROOTFS_CLOOP_CMD
 		$(HOST_DIR)/bin/create_compressed_fs - 65536 > $@
 endef
 
-$(eval $(call ROOTFS_TARGET,cloop))
+$(eval $(rootfs))
fs/common.mk +3 -4
index b06e9b5597..98232f0b9f 100644
@@ -37,7 +37,7 @@ ROOTFS_USERS_TABLES = $(call qstrip,$(BR2_ROOTFS_USERS_TABLES))
 
 # Since this function will be called from within an $(eval ...)
 # all variable references except the arguments must be $$-quoted.
-define ROOTFS_TARGET_INTERNAL
+define inner-rootfs
 
 # extra deps
 ROOTFS_$(2)_DEPENDENCIES += host-fakeroot host-makedevs \
@@ -128,8 +128,7 @@ endif
 
 endef
 
-define ROOTFS_TARGET
-	$(call ROOTFS_TARGET_INTERNAL,$(1),$(call UPPERCASE,$(1)))
-endef
+# $(pkgname) also works well to return the filesystem name
+rootfs = $(call inner-rootfs,$(pkgname),$(call UPPERCASE,$(pkgname)))
 
 include $(sort $(wildcard fs/*/*.mk))
fs/cpio/cpio.mk +1 -1
index c68e0bfb97..aa4d947fa5 100644
@@ -40,4 +40,4 @@ endef
 ROOTFS_CPIO_POST_GEN_HOOKS += ROOTFS_CPIO_UBOOT_MKIMAGE
 endif
 
-$(eval $(call ROOTFS_TARGET,cpio))
+$(eval $(rootfs))
fs/cramfs/cramfs.mk +1 -1
index 85b98b8ccd..f880871935 100644
@@ -16,4 +16,4 @@ endef
 
 ROOTFS_CRAMFS_DEPENDENCIES = host-cramfs
 
-$(eval $(call ROOTFS_TARGET,cramfs))
+$(eval $(rootfs))
fs/ext2/ext2.mk +1 -1
index 12b87a722c..6bb4b1c7f8 100644
@@ -43,4 +43,4 @@ endef
 ROOTFS_EXT2_POST_GEN_HOOKS += ROOTFS_EXT2_SYMLINK
 endif
 
-$(eval $(call ROOTFS_TARGET,ext2))
+$(eval $(rootfs))
fs/iso9660/iso9660.mk +1 -1
index c2de27101a..ab11a393e1 100644
@@ -128,4 +128,4 @@ endef
 ROOTFS_ISO9660_POST_GEN_HOOKS += ROOTFS_ISO9660_GEN_HYBRID
 endif
 
-$(eval $(call ROOTFS_TARGET,iso9660))
+$(eval $(rootfs))
fs/jffs2/jffs2.mk +1 -1
index 9a36a75ff4..740ab3e03d 100644
@@ -49,4 +49,4 @@ define ROOTFS_JFFS2_CMD
 endef
 endif
 
-$(eval $(call ROOTFS_TARGET,jffs2))
+$(eval $(rootfs))
fs/romfs/romfs.mk +1 -1
index eded91df0a..163751b4e2 100644
@@ -10,4 +10,4 @@ define ROOTFS_ROMFS_CMD
 	$(HOST_DIR)/bin/genromfs -d $(TARGET_DIR) -f $@
 endef
 
-$(eval $(call ROOTFS_TARGET,romfs))
+$(eval $(rootfs))
fs/squashfs/squashfs.mk +1 -1
index 7de7f51af1..51abd5d7d0 100644
@@ -24,4 +24,4 @@ define ROOTFS_SQUASHFS_CMD
 	$(HOST_DIR)/bin/mksquashfs $(TARGET_DIR) $@ $(ROOTFS_SQUASHFS_ARGS)
 endef
 
-$(eval $(call ROOTFS_TARGET,squashfs))
+$(eval $(rootfs))
fs/tar/tar.mk +1 -1
index 0e3eacbedf..e39c2fdbf1 100644
@@ -11,4 +11,4 @@ define ROOTFS_TAR_CMD
 		tar $(TAR_OPTS) -cf $@ --null --no-recursion -T - --numeric-owner)
 endef
 
-$(eval $(call ROOTFS_TARGET,tar))
+$(eval $(rootfs))
fs/ubi/ubi.mk +1 -1
index b71a555efb..c78feda5a3 100644
@@ -29,4 +29,4 @@ define ROOTFS_UBI_CMD
 	rm $(BUILD_DIR)/ubinize.cfg
 endef
 
-$(eval $(call ROOTFS_TARGET,ubi))
+$(eval $(rootfs))
fs/ubifs/ubifs.mk +1 -1
index 4f45acdc4a..2cfc397aca 100644
@@ -27,4 +27,4 @@ define ROOTFS_UBIFS_CMD
 	$(HOST_DIR)/sbin/mkfs.ubifs -d $(TARGET_DIR) $(UBIFS_OPTS) -o $@
 endef
 
-$(eval $(call ROOTFS_TARGET,ubifs))
+$(eval $(rootfs))
fs/yaffs2/yaffs.mk +1 -1
index 30570735fa..9cba27af70 100644
@@ -10,4 +10,4 @@ define ROOTFS_YAFFS2_CMD
 	$(HOST_DIR)/bin/mkyaffs2 --all-root $(TARGET_DIR) $@
 endef
 
-$(eval $(call ROOTFS_TARGET,yaffs2))
+$(eval $(rootfs))
Signature · 1 line
2.11.0
#3 lore raw

v2 cover fs: make it behave more like the package infra

In reply to Yann E. MORIN

Hello,

Quoted 3 lines · Yann E. MORIN

Yann E. MORIN (2):
fs/ubifs: spin-off ubi to be its own filesystem
fs: make it behave a bit more like the package infra

This now looks good to me. I'll wait a few days to see if there are other comments or some opposition, and if nothing happens, I'll apply.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

v2 cover fs: make it behave more like the package infra

In reply to Yann E. MORIN

Hello,

Quoted 3 lines · Yann E. MORIN

Yann E. MORIN (2):
fs/ubifs: spin-off ubi to be its own filesystem
fs: make it behave a bit more like the package infra

I've fixed a few typos in the commit logs, and applied. Thanks!

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com