From 5fd7e00d9d8e624e460342e40a450566f2b70907 Mon Sep 17 00:00:00 2001
From: John Crispin <john@openwrt.org>
Date: Mon, 2 Jun 2014 12:44:07 +0000
Subject: [PATCH] image: ext4: allow creation of a journaling filesystem

Signed-off-by: Michael Heimpold <mhei@heimpold.de>

SVN-Revision: 40925
---
 config/Config-images.in | 7 +++++++
 include/image.mk        | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/config/Config-images.in b/config/Config-images.in
index 368f14768d..636a868d59 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -110,6 +110,13 @@ menu "Target Images"
 			default 1024 if TARGET_EXT4_BLOCKSIZE_1K
 			depends TARGET_ROOTFS_EXT4FS
 
+		config TARGET_EXT4_JOURNAL
+			bool "Create a journaling filesystem"
+			depends on TARGET_ROOTFS_EXT4FS
+			default n
+			help
+			  Create an ext4 filesystem with a journal
+
 	config TARGET_ROOTFS_ISO
 		bool "iso"
 		default n
diff --git a/include/image.mk b/include/image.mk
index e9cb0cc8f0..2f60ce06d9 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -190,7 +190,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_EXT4FS),)
 # generate an ext2 fs
 	$(STAGING_DIR_HOST)/bin/genext2fs -U -B $(CONFIG_TARGET_EXT4_BLOCKSIZE) -b $(E2SIZE) -N $(CONFIG_TARGET_ROOTFS_MAXINODE) -d $(TARGET_DIR)/ $(KDIR)/root.ext4 -m $(CONFIG_TARGET_ROOTFS_RESERVED_PCT) $(MKFS_DEVTABLE_OPT)
 # convert it to ext4
-	$(STAGING_DIR_HOST)/bin/tune2fs -O extents,uninit_bg,dir_index $(KDIR)/root.ext4
+	$(STAGING_DIR_HOST)/bin/tune2fs $(if $(CONFIG_TARGET_EXT4_JOURNAL),-j) -O extents,uninit_bg,dir_index $(KDIR)/root.ext4
 # fix it up
 	$(STAGING_DIR_HOST)/bin/e2fsck -fy $(KDIR)/root.ext4
 	$(call Image/Build,ext4)
-- 
2.25.1