[ELDK] [PATCH] Add support for "empty" skeleton
Wolfgang Denk
wd at denx.de
Thu Oct 28 14:31:38 CEST 2010
Although this tool is called "_root_ file system builder" it is also
handy to build other file system images as well, that then can be
mounted additionally. In such cases, we normally don't need nor want
the standard directory hierarchy with /etc, /bin, /usr, /var, /tmp
etc.
We add an "empty" skeleton which does not create any files in the file
system, so only custom selections will be added.
Signed-off-by: Wolfgang Denk <wd at denx.de>
---
Config.in | 6 ++++++
Makefile | 42 +++++++++++++++++++++++++++++++++---------
2 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/Config.in b/Config.in
index 7934544..4dc6560 100644
--- a/Config.in
+++ b/Config.in
@@ -61,6 +61,12 @@ config SKEL_CRAMFS
described in
http://www.denx.de/wiki/view/DULG/RootFileSystemOnACramfsFileSystem
+config SKEL_EMPTY
+ bool "EMPTY"
+ help
+ This skeleton creates an empty file system with only the
+ content explicitly selected by the user.
+
config SKEL_NONE
bool "No precanned skeleton"
diff --git a/Makefile b/Makefile
index 6625005..f683e28 100644
--- a/Makefile
+++ b/Makefile
@@ -44,14 +44,16 @@ SQUASHFS_FILE := $(BUILD)/images/image.squashfs
MKDEV_SCRIPT := /tmp/mkdev.rfsb.tmp
STATUS_DIR := status
-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
+STAMP_CLEAN := $(STATUS_DIR)/stamp.clean
+STAMP_CUSTOM_COPY := $(STATUS_DIR)/stamp.custom-copy
STAMP_CUSTOM_PKGS := $(STATUS_DIR)/stamp.custom-pkgs
+STAMP_DEPLIB := $(STATUS_DIR)/stamp.deplib
+STAMP_ELDK_PKGS := $(STATUS_DIR)/stamp.eldk-pkgs
+STAMP_RFSB_SKEL := $(STATUS_DIR)/stamp.rfsb-skel
STAMP_ROOTFS := $(STATUS_DIR)/stamp.rootfs
-STAMP_CUSTOM_COPY := $(STATUS_DIR)/stamp.custom-copy
+STAMP_TIMESTAMP := $(STATUS_DIR)/stamp.timestamp
noconfig_targets := menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig release tags
@@ -159,17 +161,32 @@ rootfs: $(STAMP_ROOTFS)
chroot: $(STAMP_CHROOT)
+# For SKEL_EMPTY only copy custom files
+ifeq ($(SKEL_EMPTY),y)
+DEP_ROOTFS += $(STAMP_CUSTOM_COPY)
+DEP_ROOTFS += $(STAMP_TIMESTAMP)
+else
+DEP_ROOTFS = $(STAMP_ADD_DIRS)
+DEP_ROOTFS += $(STAMP_ELDK_PKGS)
+DEP_ROOTFS += $(STAMP_CUSTOM_PKGS)
+DEP_ROOTFS += $(STAMP_CUSTOM_COPY)
+DEP_ROOTFS += $(STAMP_RFSB_SKEL)
+DEP_ROOTFS += $(STAMP_TIMESTAMP)
+endif
+
$(STAMP_CLEAN):
# Make sure build directory is empty
@echo "Cleaning $(BUILD)"
@rm -fr $(BUILD) $(STATUS_DIR)
@mkdir -p $(BUILD) $(STATUS_DIR)
+ @scripts/mkdir_safe $(BUILD)/images
+ @scripts/mkdir_safe $(BUILD)/rootfs
@touch $(STAMP_CLEAN)
-$(STAMP_ADD_DIRS):
+$(STAMP_ADD_DIRS): $(STAMP_CLEAN)
# Make sure build directory contains some vital directories
@echo "Populating $(BUILD) with directories"
- @for dir in images rootfs \
+ @for dir in \
rootfs/{bin,dev,etc,ftp,home,lib,proc,sbin,tmp} \
rootfs/{usr,usr/sbin,usr/bin,var,var/log,var/run} ; \
do \
@@ -222,20 +239,27 @@ $(STAMP_ELDK_PKGS): $(STAMP_RFSB_SKEL)
@touch $(STAMP_ELDK_PKGS)
-$(STAMP_CUSTOM_COPY):
+$(STAMP_CUSTOM_COPY): $(STAMP_CLEAN)
@if [ -d custom/rootfs ]; then \
echo "Copying files from custom/rootfs" ;\
( cd custom/rootfs ; find . | cpio -Bpdum $(BUILD_RFS) ) ;\
fi
@touch $(STAMP_CUSTOM_COPY)
-$(STAMP_ROOTFS): $(STAMP_ELDK_PKGS) $(STAMP_CUSTOM_PKGS) $(STAMP_CUSTOM_COPY) $(STAMP_ADD_DIRS)
+$(STAMP_DEPLIB): $(STAMP_ELDK_PKGS) $(STAMP_CUSTOM_PKGS) $(STAMP_CUSTOM_COPY) $(STAMP_ADD_DIRS)
@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) )
- if [ $(DATE_FILE) ] ; then \
+ @touch $(STAMP_DEPLIB)
+
+$(STAMP_TIMESTAMP): $(STAMP_CLEAN)
+ @if [ $(DATE_FILE) ] ; then \
date $(DATE_FORMAT) >> $(BUILD_RFS)$(DATE_FILE) ; \
fi
+ @touch $(STAMP_TIMESTAMP)
+
+# Dummy target to collect all pieces
+$(STAMP_ROOTFS): $(DEP_ROOTFS)
@touch $(STAMP_ROOTFS)
$(STAMP_CHROOT): $(STAMP_ROOTFS)
--
1.7.2.3
More information about the eldk
mailing list