[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 2/7] Override $(genext2fs) in config/hurd.cfg



Hurd needs a filesystem with 4k blocks as its initrd. Furthermore, since we use
it directly as the root filesystem for now, we need some extra space in there.

In order to be able to override the definition in config/hurd.cfg, the original
one in Makefile has had to be moved before the file in question is included.

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
---
 Makefile        |    8 ++++----
 config/hurd.cfg |    9 +++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 07ab485..d873b58 100644
--- a/Makefile
+++ b/Makefile
@@ -78,6 +78,10 @@ all: list
 targetstring = $(patsubst _%,%,$(if $(SUBARCH),_$(SUBARCH),)$(if $(MEDIUM),_$(MEDIUM),)$(if $(FLAVOUR),_$(FLAVOUR),))
 targetdirs = $(subst _,/,$(targetstring))
 
+# Overridden in config/hurd.cfg
+define genext2fs
+  genext2fs -d $(TREE) -b `expr $$(du -s $(TREE) | cut -f 1) + $$(expr $$(find $(TREE) | wc -l) \* 2)` -m 0
+endef
 
 # Configurations for the varying ARCH, SUBARCH, MEDIUM, FLAVOUR.
 # For simplicity, we use a similiar tree layout for config/, tmp/
@@ -118,10 +122,6 @@ define recurse
   $(if $($(1)_SUPPORTED)$(if $(RECURSE_EXTRA),$($(1)_SUPPORTED_EXTRA)),$(call recurse_many,$(1),$(2),$(3)),$(call recurse_once,$(2),$(3)))
 endef
 
-define genext2fs
-  genext2fs -d $(TREE) -b `expr $$(du -s $(TREE) | cut -f 1) + $$(expr $$(find $(TREE) | wc -l) \* 2)` -m 0
-endef
-
 define mkinitramfs
   (cd $(TREE) && find . | cpio --quiet -o -H newc) > 
 endef
diff --git a/config/hurd.cfg b/config/hurd.cfg
index 120fa1a..70ecdd0 100644
--- a/config/hurd.cfg
+++ b/config/hurd.cfg
@@ -1,6 +1,15 @@
 # Filesystem type for the initrd.
 INITRD_FS = ext2
 
+# We have to redefine genext2fs to use 4k blocks and leave some space
+define genext2fs
+  nb=$$(find $(TREE) | wc -l); \
+  sz=$$(du -s $(TREE) | cut -f 1); \
+  genext2fs -d $(TREE) -B 4096 -o hurd -m 0 \
+	-b $$(expr $$sz / 4 + $$nb / 2 + 1024) \
+	-N $$(expr $$nb + 1024)
+endef
+
 # The image to use for a syslinux splash screen.
 SPLASH_PNG=boot/hurd/pics/klowner-hurd.png
 
-- 
1.7.1


Reply to: