Skip to contentSkip to conversation

New attempt to move $BUILD_DIR/.root

PATCH New Jérôme Pouiller 3 participants 3 messages Apr 1, 2014 – Oct 12, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 New attempt to move $BUILD_DIR/.root

Since $STAMP_DIR does no more exist[1], I suggest to embed $BUILD_DIR/.root in a package infrastructure.

This patch add a special package called rootfs-dirs. Toolchain package was used as exemple for this work. rootfs-dirs package create and populate $TARGET_DIR and $STAGING_DIR.

[1] http://permalink.gmane.org/gmane.comp.lib.uclibc.buildroot/79825

---
I have a few questions:
- I dislike the name "rootfs-dirs". I think "skeleton" would be better, but it conflicts with system/skeleton directory. However, I may force name of this package by calling inner-generic-package macro directly, but I am not sure everyone agrees with that.

- I moved the management of a few variables to rootfs-dirs.mk. These variables are only used during creation of $TARGET_DIR and $STAGING_DIR. But now, rootfs creation related stuff is splited between main Makefile, system.mk and rootfs-dirs.mk. Should rootfs-dirs.mk should be merge with system.mk? Or, maybe some other Makefile targets should be moved to rootfs-dirs.mk?

---
 Makefile                          | 42 +------------------------
 package/pkg-generic.mk            | 10 +++++-
 system/rootfs-dirs/rootfs-dirs.mk | 64 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+), 42 deletions(-)
 create mode 100644 system/rootfs-dirs/rootfs-dirs.mk
Makefile +1 -41
index 41c51c6..8f8da1f 100644
@@ -332,12 +332,6 @@ HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
 # locales to generate
 GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
 
-TARGET_SKELETON=$(TOPDIR)/system/skeleton
-
-# Location of a file giving a big fat warning that output/target
-# should not be used as the root filesystem.
-TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
-
 ifeq ($(BR2_CCACHE),y)
 CCACHE:=$(HOST_DIR)/usr/bin/ccache
 BR_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
@@ -391,6 +385,7 @@ include $(sort $(wildcard package/*/*.mk))
 include boot/common.mk
 include linux/linux.mk
 include system/system.mk
+include system/rootfs-dirs/rootfs-dirs.mk
 
 include $(BR2_EXTERNAL)/external.mk
 
@@ -466,45 +461,10 @@ world: target-post-image
 $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(LEGAL_INFO_DIR) $(REDIST_SOURCES_DIR_TARGET) $(REDIST_SOURCES_DIR_HOST):
 	@mkdir -p $@
 
-# We make a symlink lib32->lib or lib64->lib as appropriate
-# MIPS64/n32 requires lib32 even though it's a 64-bit arch.
-ifeq ($(BR2_ARCH_IS_64)$(BR2_MIPS_NABI32),y)
-LIB_SYMLINK = lib64
-else
-LIB_SYMLINK = lib32
-endif
-
-$(STAGING_DIR):
-	@mkdir -p $(STAGING_DIR)/bin
-	@mkdir -p $(STAGING_DIR)/lib
-	@ln -snf lib $(STAGING_DIR)/$(LIB_SYMLINK)
-	@mkdir -p $(STAGING_DIR)/usr/lib
-	@ln -snf lib $(STAGING_DIR)/usr/$(LIB_SYMLINK)
-	@mkdir -p $(STAGING_DIR)/usr/include
-	@mkdir -p $(STAGING_DIR)/usr/bin
-	@ln -snf $(STAGING_DIR) $(BASE_DIR)/staging
-
-ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y)
-TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH)
-endif
-
 RSYNC_VCS_EXCLUSIONS = \
 	--exclude .svn --exclude .git --exclude .hg --exclude .bzr \
 	--exclude CVS
 
-$(BUILD_DIR)/.root:
-	mkdir -p $(TARGET_DIR)
-	rsync -a --ignore-times $(RSYNC_VCS_EXCLUSIONS) \
-		--chmod=Du+w --exclude .empty --exclude '*~' \
-		$(TARGET_SKELETON)/ $(TARGET_DIR)/
-	$(INSTALL) -m 0644 support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
-	@ln -snf lib $(TARGET_DIR)/$(LIB_SYMLINK)
-	@mkdir -p $(TARGET_DIR)/usr
-	@ln -snf lib $(TARGET_DIR)/usr/$(LIB_SYMLINK)
-	touch $@
-
-$(TARGET_DIR): $(BUILD_DIR)/.root
-
 STRIP_FIND_CMD = find $(TARGET_DIR)
 ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
 STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
package/pkg-generic.mk +9 -1
index 339c3eb..6e316b7 100644
@@ -351,6 +351,11 @@ endif
 
 $(2)_REDISTRIBUTE		?= YES
 
+# When a target package is rootfs-dirs (which is used to create TARGET_DIR
+# and STAGING_DIR). this variable to 'NO' so the 'dirs' dependency is not
+# added to prevent a circular dependency
+$(2)_ADD_DIRS_DEPENDENCY	?= YES
+
 # When a target package is a toolchain dependency set this variable to
 # 'NO' so the 'toolchain' dependency is not added to prevent a circular
 # dependency
@@ -449,7 +454,10 @@ $$($(2)_TARGET_BUILD):	$$($(2)_TARGET_CONFIGURE)
 $(1)-configure:			$$($(2)_TARGET_CONFIGURE)
 $$($(2)_TARGET_CONFIGURE):	| $$($(2)_DEPENDENCIES)
 
-$$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dirs prepare
+ifeq ($$($(2)_ADD_DIRS_DEPENDENCY),YES)
+$$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dirs
+endif
+$$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | prepare
 ifeq ($(filter $(1),$(DEPENDENCIES_HOST_PREREQ)),)
 $$($(2)_TARGET_SOURCE) $$($(2)_TARGET_RSYNC): | dependencies
 endif
system/rootfs-dirs/rootfs-dirs.mk new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 New attempt to move $BUILD_DIR/.root

Dear J?r?me Pouiller,

Quoted 10 lines · J?r?me Pouiller

Since $STAMP_DIR does no more exist[1], I suggest to embed $BUILD_DIR/.root in a package infrastructure.

This patch add a special package called rootfs-dirs. Toolchain package was used as exemple for this work. rootfs-dirs package create and populate $TARGET_DIR and $STAGING_DIR.

[1] http://permalink.gmane.org/gmane.comp.lib.uclibc.buildroot/79825

I think I like the idea of moving the skeleton installation into a package, but this patch mixes that with creating $(HOST_DIR) and some subdirectories in $(STAGING_DIR).

Could you send a patch that only takes care of moving into a package the installation of the skeleton? I.e, only take care of $(BUILD_DIR)/.root itself, and not the $(STAGING_DIR) target.

This way, I believe you also don't need the $(2)_ADD_DIRS_DEPENDENCY stuff, since this simplified package can have 'dirs' has a dependency.

Of course, all target packages should have this new 'skeleton' package in their dependencies.

We'll mark your patch as Changes Requested in patchwork, awaiting for your new updated version.

Of course, once the skeleton logic has been moved to a package, we can see if some of the other Makefile logic can be reworked, but that should be done separately.

Thanks,

Thomas

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

PATCH 1/1 New attempt to move $BUILD_DIR/.root

Quoted 2 lines · Thomas Petazzoni

Of course, all target packages should have this new 'skeleton' package in their dependencies.

Actually for the first patch I think it is better to replace

$(TARGET_DIR): $(BUILD_DIR)/.root

with

$(TARGET_DIR): rootfs-dirs

Moving this to the pkg-generic infrastructure is better done in a follow-up
patch. IMHO.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
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