[ELDK] [PATCH 3/5] Split POPULATE step into CLEAN and ADD_DIRS

Wolfgang Denk wd at denx.de
Thu Apr 29 12:35:04 CEST 2010

When creating a new, empty root file system, the code also added some
commonly needed directories like "/usr", "/tmp", or "/var".  This
caused problems when a user wanted to install these names differently
as part of his "custom" files - for example, in read-only file systems
one might want to install "/tmp" and "/var" as symbolic links pointing
to some other, writable file system.

To make this possible, the POPULATE step war renamed and split into
two steps: CLEAN will perform the initial part of creating a new,
empty root file system, while ADD_DIRS will be run after all other
activities and then only add these standard directories that are still

Signed-off-by: Wolfgang Denk <wd at denx.de>
 Makefile |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index c973afc..67af08c 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,8 @@ SQUASHFS_FILE     := $(BUILD)/images/image.squashfs
 MKDEV_SCRIPT      := /tmp/mkdev.rfsb.tmp
 STATUS_DIR        := status
-STAMP_POPULATE    := $(STATUS_DIR)/stamp.populate
+STAMP_CLEAN	  := $(STATUS_DIR)/stamp.clean
+STAMP_ADD_DIRS    := $(STATUS_DIR)/stamp.add-dirs
 STAMP_RFSB_SKEL   := $(STATUS_DIR)/stamp.rfsb-skel
 STAMP_CHROOT      := $(STATUS_DIR)/stamp.chroot
 STAMP_ELDK_PKGS   := $(STATUS_DIR)/stamp.eldk-pkgs
@@ -149,12 +150,15 @@ rootfs:	$(STAMP_ROOTFS)
 chroot:	$(STAMP_CHROOT)
 # Make sure build directory is empty
 	@echo "Cleaning $(BUILD)"
 	@rm -fr $(BUILD) $(STATUS)
 	@mkdir -p $(BUILD) $(STATUS_DIR)
+	@touch $(STAMP_CLEAN)
+# Make sure build directory contains some vital directories
 	@echo "Populating $(BUILD) with directories"
 	@for dir in images rootfs \
            rootfs/{bin,dev,etc,ftp,home,lib,proc,sbin,tmp} \
@@ -162,9 +166,9 @@ $(STAMP_POPULATE):
 	do \
 	    mkdir -p $(BUILD)/$$dir ;\
-	@touch $(STAMP_POPULATE)
+	@touch $(STAMP_ADD_DIRS)
 	@if [ "$(SKEL_SELF)" = "y" ]; then \
 	    echo "Using SELF skeleton from 'config/skeleton/self' to populate file system" ;\
 	    ( cd config/skeleton/self ; find . | cpio -Bpdum $(BUILD_RFS) ) ;\
@@ -203,7 +207,7 @@ $(STAMP_CUSTOM_COPY):
 	@echo "Adding dependency libraries"
 	@scripts/list-deps -l "$(shell echo $(extra_libs) | sed 's/ /,/g')"  $(BUILD_RFS) | sed -e "s!$(ELDK_ROOTFS)\/!!" | \
 	    ( cd $(ELDK_ROOTFS) ; cpio -Bpdum $(BUILD_RFS) )

More information about the eldk mailing list