summaryrefslogtreecommitdiff
path: root/fs/ext2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/Config.in61
-rw-r--r--fs/ext2/ext2root.mk40
2 files changed, 101 insertions, 0 deletions
diff --git a/fs/ext2/Config.in b/fs/ext2/Config.in
new file mode 100644
index 000000000..02ec18f40
--- /dev/null
+++ b/fs/ext2/Config.in
@@ -0,0 +1,61 @@
+config BR2_TARGET_ROOTFS_EXT2
+ bool "ext2 root filesystem"
+ default y
+ help
+ Build an ext2 root filesystem
+
+config BR2_TARGET_ROOTFS_EXT2_BLOCKS
+ int "size in blocks (leave at 0 for auto calculation)"
+ depends on BR2_TARGET_ROOTFS_EXT2
+ default 0
+
+config BR2_TARGET_ROOTFS_EXT2_INODES
+ int "inodes (leave at 0 for auto calculation)"
+ depends on BR2_TARGET_ROOTFS_EXT2
+ default 0
+
+config BR2_TARGET_ROOTFS_EXT2_RESBLKS
+ int "reserved blocks percentage"
+ depends on BR2_TARGET_ROOTFS_EXT2
+ default 0
+
+config BR2_TARGET_ROOTFS_EXT2_SQUASH
+ bool "Make all files be owned by root"
+ depends on BR2_TARGET_ROOTFS_EXT2
+ default y
+
+choice
+ prompt "Compression method"
+ default BR2_TARGET_ROOTFS_EXT2_NONE
+ depends on BR2_TARGET_ROOTFS_EXT2
+ help
+ Select compressor for ext2 filesystem of the root filesystem
+
+config BR2_TARGET_ROOTFS_EXT2_NONE
+ bool "no compression"
+ help
+ Do not compress the ext2 filesystem.
+
+config BR2_TARGET_ROOTFS_EXT2_GZIP
+ bool "gzip"
+ help
+ Do compress the ext2 filesystem with gzip.
+ Note that you either have to have gzip installed on your host
+ or select to build a gzip for your host. See the packages submenu.
+
+config BR2_TARGET_ROOTFS_EXT2_BZIP2
+ bool "bzip2"
+ help
+ Do compress the ext2 filesystem with bzip2.
+ Note that you either have to have bzip2 installed on your host
+ or select to build a bzip2 for your host. See the packages submenu.
+
+config BR2_TARGET_ROOTFS_EXT2_LZMA
+ bool "lzma"
+ help
+ Do compress the ext2 filesystem with lzma.
+ Note that you either have to have lzma installed on your host
+ or select to build a lzma for your host. See the packages submenu.
+
+endchoice
+
diff --git a/fs/ext2/ext2root.mk b/fs/ext2/ext2root.mk
new file mode 100644
index 000000000..68b3b813c
--- /dev/null
+++ b/fs/ext2/ext2root.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