summaryrefslogtreecommitdiff
path: root/fs/ext2/ext2.mk
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2010-03-10 22:31:32 +0100
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2010-04-09 11:04:36 +0200
commit3474716bff31a3d287d0d3813eb7e107cedfa3ef (patch)
treea9147e6975f19c05791e7886c628f968c2258ef7 /fs/ext2/ext2.mk
parent0585241505cfaddc9db6ae92739bdfb5ce5f9794 (diff)
Coherent naming for .mk files in fs/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'fs/ext2/ext2.mk')
-rw-r--r--fs/ext2/ext2.mk40
1 files changed, 40 insertions, 0 deletions
diff --git a/fs/ext2/ext2.mk b/fs/ext2/ext2.mk
new file mode 100644
index 000000000..68b3b813c
--- /dev/null
+++ b/fs/ext2/ext2.mk
@@ -0,0 +1,40 @@
+#############################################################
+#
+# Build the ext2 root filesystem image
+#
+#############################################################
+
+EXT2_OPTS :=
+
+ifeq ($(BR2_TARGET_ROOTFS_EXT2_SQUASH),y)
+EXT2_OPTS += -U
+endif
+
+ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
+EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
+endif
+
+ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)),0)
+EXT2_OPTS += -N $(BR2_TARGET_ROOTFS_EXT2_INODES)
+endif
+
+ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),)
+EXT2_OPTS += -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
+endif
+
+ROOTFS_EXT2_DEPENDENCIES = host-genext2fs
+
+ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
+GENEXT2_REALSIZE=$(shell LC_ALL=C du -s -c -k $(TARGET_DIR) | grep total | sed -e "s/total//")
+GENEXT2_ADDTOROOTSIZE=$(shell if [ $(GENEXT2_REALSIZE) -ge 20000 ]; then echo 16384; else echo 2400; fi)
+GENEXT2_SIZE=$(shell expr $(GENEXT2_REALSIZE) + $(GENEXT2_ADDTOROOTSIZE))
+GENEXT2_ADDTOINODESIZE=$(shell find $(TARGET_DIR) | wc -l)
+GENEXT2_INODES=$(shell expr $(GENEXT2_ADDTOINODESIZE) + 400)
+EXT2_OPTS += -b $(GENEXT2_SIZE) -N $(GENEXT2_INODES)
+endif
+
+define ROOTFS_EXT2_CMD
+ $(HOST_DIR)/usr/bin/genext2fs -d $(TARGET_DIR) $(EXT2_OPTS) $$@
+endef
+
+$(eval $(call ROOTFS_TARGET,ext2)) \ No newline at end of file