From 66adf26aa4ff9d4033e748f74377576f7aab6d79 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sat, 12 Feb 2005 04:32:17 +0000 Subject: We need to calculate filesystem size right when we run genext2fs. As was, size was calculated right when 'make' was run, at which point the rootfs may well be empty... --- target/ext2/ext2root.mk | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) (limited to 'target/ext2') diff --git a/target/ext2/ext2root.mk b/target/ext2/ext2root.mk index 2d80999fe..61aedddce 100644 --- a/target/ext2/ext2root.mk +++ b/target/ext2/ext2root.mk @@ -39,32 +39,20 @@ genext2fs: $(GENEXT2_DIR)/genext2fs # ############################################################# -# How much KB we want to add to the calculated size for slack space -GENEXT2_REALSIZE=$(subst total,, $(shell LANG=C du $(TARGET_DIR) -s -c -k | grep total )) -GENEXT2_ADDTOROOTSIZE=$(shell if [ $(GENEXT2_REALSIZE) -ge 20000 ] ; then echo 16384; else echo 16; fi) -GENEXT2_SIZE=$(shell expr $(GENEXT2_REALSIZE) + $(GENEXT2_ADDTOROOTSIZE) + 200) -# We currently add about 400 device nodes, so add that into the total -GENEXT2_INODES=$(shell expr $(shell find $(TARGET_DIR) | wc -l) + 400) -#GENEXT2_SIZE=100000 +EXT2_OPTS := -EXT2_OPTS := +ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_SQUASH)),y) +EXT2_OPTS += -q +endif -ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0) -EXT2_OPTS += -b $(GENEXT2_SIZE) -else +ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0) EXT2_OPTS += -b $(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)) endif -ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)),0) -EXT2_OPTS += -i $(GENEXT2_INODES) -else +ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)),0) EXT2_OPTS += -i $(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)) endif -ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_SQUASH)),y) -EXT2_OPTS += -q -endif - ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0) EXT2_OPTS += -r $(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)) endif @@ -87,21 +75,35 @@ $(EXT2_BASE): genext2fs @rm -rf $(TARGET_DIR)/usr/man @rm -rf $(TARGET_DIR)/usr/share/man @rm -rf $(TARGET_DIR)/usr/info +ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0) + GENEXT2_REALSIZE=`LANG=C du -l -s -c -k $(TARGET_DIR) | grep total | sed -e "s/total//"`; \ + GENEXT2_ADDTOROOTSIZE=`if [ $$GENEXT2_REALSIZE -ge 20000 ] ; then echo 16384; else echo 1200; fi`; \ + GENEXT2_SIZE=`expr $$GENEXT2_REALSIZE + $$GENEXT2_ADDTOROOTSIZE`; \ + GENEXT2_ADDTOINODESIZE=`find $(TARGET_DIR) | wc -l`; \ + GENEXT2_INODES=`expr $$GENEXT2_ADDTOINODESIZE + 400`; \ + set -x; \ + $(GENEXT2_DIR)/genext2fs \ + -b $$GENEXT2_SIZE \ + -i $$GENEXT2_INODES \ + -d $(TARGET_DIR) \ + $(EXT2_OPTS) $(EXT2_BASE) +else $(GENEXT2_DIR)/genext2fs \ -d $(TARGET_DIR) \ $(EXT2_OPTS) \ $(EXT2_BASE) - +endif + $(EXT2_BASE).gz: $(EXT2_BASE) @gzip --best -fv $(EXT2_BASE) - + EXT2_COPYTO := $(strip $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_COPYTO))) - + ext2root: $(EXT2_TARGET) @ls -l $(EXT2_TARGET) ifneq ($(EXT2_COPYTO),) @cp -f $(EXT2_TARGET) $(EXT2_COPYTO) -endif +endif ext2root-source: $(DL_DIR)/$(GENEXT2_SOURCE) -- cgit v1.2.3