1 #############################################################
3 # genext2fs to build to target ext2 filesystems
5 #############################################################
7 GENEXT2_DIR
=$(BUILD_DIR
)/genext2fs-
$(GENEXT2_VERSION
)
8 GENEXT2_SOURCE
=genext2fs-
$(GENEXT2_VERSION
).
tar.gz
9 GENEXT2_SITE
:=http
://$(BR2_SOURCEFORGE_MIRROR
).dl.sourceforge.net
/sourceforge
/genext2fs
11 $(DL_DIR
)/$(GENEXT2_SOURCE
):
12 $(WGET
) -P
$(DL_DIR
) $(GENEXT2_SITE
)/$(GENEXT2_SOURCE
)
14 $(GENEXT2_DIR
)/.unpacked
: $(DL_DIR
)/$(GENEXT2_SOURCE
)
15 $(ZCAT
) $(DL_DIR
)/$(GENEXT2_SOURCE
) |
tar -C
$(BUILD_DIR
) -xvf
-
16 toolchain
/patch-kernel.sh
$(GENEXT2_DIR
) target
/ext2
/ genext2fs\
*.patch
19 $(GENEXT2_DIR
)/.configured
: $(GENEXT2_DIR
)/.unpacked
20 chmod a
+x
$(GENEXT2_DIR
)/configure
21 (cd
$(GENEXT2_DIR
); rm -rf config.cache
; \
24 --prefix=$(STAGING_DIR
) \
28 $(GENEXT2_DIR
)/genext2fs
: $(GENEXT2_DIR
)/.configured
29 $(MAKE
) CFLAGS
="-Wall -O2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
30 -D_FILE_OFFSET_BITS=64" -C
$(GENEXT2_DIR
)
33 genext2fs
: $(GENEXT2_DIR
)/genext2fs
37 #############################################################
39 # Build the ext2 root filesystem image
41 #############################################################
45 ifeq ($(BR2_TARGET_ROOTFS_EXT2_SQUASH
),y
)
49 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS
)),0)
50 EXT2_OPTS
+= -b
$(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS
))
53 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES
)),0)
54 EXT2_OPTS
+= -N
$(strip $(BR2_TARGET_ROOTFS_EXT2_INODES
))
57 ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS
)),)
58 EXT2_OPTS
+= -m
$(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS
))
61 EXT2_BASE
:= $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_OUTPUT))
64 EXT2_ROOTFS_COMPRESSOR
:=
65 EXT2_ROOTFS_COMPRESSOR_EXT
:=
66 EXT2_ROOTFS_COMPRESSOR_PREREQ
:=
67 ifeq ($(BR2_TARGET_ROOTFS_EXT2_GZIP
),y
)
68 EXT2_ROOTFS_COMPRESSOR
:=gzip
-9 -c
69 EXT2_ROOTFS_COMPRESSOR_EXT
:=gz
70 #EXT2_ROOTFS_COMPRESSOR_PREREQ:= gzip-host
72 ifeq ($(BR2_TARGET_ROOTFS_EXT2_BZIP2
),y
)
73 EXT2_ROOTFS_COMPRESSOR
:=bzip2
-9 -c
74 EXT2_ROOTFS_COMPRESSOR_EXT
:=bz2
75 #EXT2_ROOTFS_COMPRESSOR_PREREQ:= bzip2-host
77 ifeq ($(BR2_TARGET_ROOTFS_EXT2_LZMA
),y
)
78 EXT2_ROOTFS_COMPRESSOR
:=lzma
-9 -c
79 EXT2_ROOTFS_COMPRESSOR_EXT
:=lzma
80 EXT2_ROOTFS_COMPRESSOR_PREREQ
:= lzma-host
83 ifneq ($(EXT2_ROOTFS_COMPRESSOR
),)
84 EXT2_TARGET
:= $(EXT2_BASE
).
$(EXT2_ROOTFS_COMPRESSOR_EXT
)
86 EXT2_TARGET
:= $(EXT2_BASE
)
89 $(EXT2_BASE
): host-fakeroot makedevs genext2fs
90 -@find
$(TARGET_DIR
) -type f
-perm
+111 | xargs
$(STRIPCMD
) 2>/dev
/null || true
91 ifneq ($(BR2_HAVE_MANPAGES
),y
)
92 @
rm -rf
$(TARGET_DIR
)/usr
/share
/man
94 ifneq ($(BR2_HAVE_INFOPAGES
),y
)
95 @
rm -rf
$(TARGET_DIR
)/usr
/share
/info
97 @
test -d
$(TARGET_DIR
)/usr
/share
&& \
98 rmdir
-p
--ignore-fail-on-non-empty
$(TARGET_DIR
)/usr
/share || \
100 $(if
$(TARGET_LDCONFIG
),test ! -x
$(TARGET_LDCONFIG
) && true ||
$(TARGET_LDCONFIG
) -r
$(TARGET_DIR
) 2>/dev
/null
)
101 # Use fakeroot to pretend all target binaries are owned by root
102 rm -f
$(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(EXT2_TARGET
))
103 touch
$(PROJECT_BUILD_DIR
)/.fakeroot
.00000
104 cat
$(PROJECT_BUILD_DIR
)/.fakeroot
* > $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(EXT2_TARGET
))
105 echo
"chown -R 0:0 $(TARGET_DIR)" >> $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(EXT2_TARGET
))
106 ifneq ($(TARGET_DEVICE_TABLE
),)
107 # Use fakeroot to pretend to create all needed device nodes
108 echo
"$(STAGING_DIR)/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(TARGET_DIR)" \
109 >> $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(EXT2_TARGET
))
111 # Use fakeroot so genext2fs believes the previous fakery
112 ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS
)),0)
113 GENEXT2_REALSIZE
=`LC_ALL=C du -s -c -k $(TARGET_DIR) | grep total | sed -e "s/total//"`; \
114 GENEXT2_ADDTOROOTSIZE
=`if [ $$GENEXT2_REALSIZE -ge 20000 ]; then echo 16384; else echo 2400; fi`; \
115 GENEXT2_SIZE
=`expr $$GENEXT2_REALSIZE + $$GENEXT2_ADDTOROOTSIZE`; \
116 GENEXT2_ADDTOINODESIZE
=`find $(TARGET_DIR) | wc -l`; \
117 GENEXT2_INODES
=`expr $$GENEXT2_ADDTOINODESIZE + 400`; \
119 echo
"$(GENEXT2_DIR)/genext2fs -b $$GENEXT2_SIZE " \
120 "-N $$GENEXT2_INODES -d $(TARGET_DIR) " \
121 "$(EXT2_OPTS) $(EXT2_BASE)" >> $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(EXT2_TARGET
))
123 echo
"$(GENEXT2_DIR)/genext2fs -d $(TARGET_DIR) " \
124 "$(EXT2_OPTS) $(EXT2_BASE)" >> $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(EXT2_TARGET
))
126 chmod a
+x
$(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(EXT2_TARGET
))
127 $(STAGING_DIR
)/usr
/bin
/fakeroot
-- $(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(EXT2_TARGET
))
128 -@
rm -f
$(PROJECT_BUILD_DIR
)/_fakeroot.
$(notdir $(EXT2_TARGET
))
130 ifneq ($(EXT2_ROOTFS_COMPRESSOR
),)
131 $(EXT2_BASE
).
$(EXT2_ROOTFS_COMPRESSOR_EXT
): $(EXT2_ROOTFS_COMPRESSOR_PREREQ
) $(EXT2_BASE
)
132 $(EXT2_ROOTFS_COMPRESSOR
) $(EXT2_BASE
) > $(EXT2_TARGET
)
135 EXT2_COPYTO
:= $(strip $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_COPYTO)))
138 ext2root
: $(EXT2_TARGET
)
139 @ls
-l
$(EXT2_TARGET
)
140 ifneq ($(EXT2_COPYTO
),)
141 @cp
-f
$(EXT2_TARGET
) $(EXT2_COPYTO
)
144 ext2root-source
: $(DL_DIR
)/$(GENEXT2_SOURCE
)
147 -$(MAKE
) -C
$(GENEXT2_DIR
) clean
150 rm -rf
$(GENEXT2_DIR
)
152 #############################################################
154 # Toplevel Makefile options
156 #############################################################
157 ifeq ($(BR2_TARGET_ROOTFS_EXT2
),y
)