2 install: modules_install
5 # copy makefile over to not break patches
6 backfs_extra := $(wildcard @LINUX@/fs/ext4/Makefile)
8 backfs_headers := $(wildcard @EXT_DIR@/*.h)
9 linux_headers := $(wildcard @LINUX@/include/linux/ext4*.h)
10 linux_new_headers := dynlocks.h
11 linux_new_headers += htree_lock.h
12 trace_headers := $(wildcard @LINUX@/include/trace/events/ext4*.h)
14 backfs_sources := $(filter-out %.mod.c,$(wildcard @EXT_DIR@/*.c))
16 ext3_new_sources := extents.c mballoc.c group.h dynlocks.c fiemap.h
17 ext3_new_headers := ext3_extents.h
19 ext4_new_sources := dynlocks.c fiemap.h mmp.c
20 ext4_new_sources += htree_lock.c
23 new_sources := $(ext4_new_sources)
24 new_headers := $(ext4_new_headers)
26 ldiskfs_patched_sources := $(notdir $(backfs_sources) $(backfs_headers)) $(new_sources) $(new_headers)
27 ldiskfs_sources := $(ldiskfs_patched_sources)
28 ldiskfs_obj := $(filter %.o,$(ldiskfs_sources:.c=.o))
30 #--- autoMakefile cut-and-paste start
32 ldiskfs_linux_headers := $(addprefix linux/,$(subst ext4,ldiskfs,$(notdir $(linux_headers))))
34 $(filter %.c,$(ldiskfs_patched_sources)): sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_patched_sources))
37 -e "s/dx_hash_info/ext4_dx_hash_info/g" \
38 -e "s/DX_HASH/EXT4_DX_HASH/g" \
39 -e "s/EXT4/LDISKFS/g" -e "s/ext4/ldiskfs/g"
41 %.c: linux-stage/fs/ext4/%.c
42 sed $(strip $(ldiskfs_sed_flags)) $< > $@
44 %.h: linux-stage/fs/ext4/%.h
45 sed $(strip $(ldiskfs_sed_flags)) $< > $@
47 linux/ldiskfs%.h: linux-stage/include/linux/ext4%.h
48 sed $(strip $(ldiskfs_sed_flags)) $< > $@
50 series := @top_srcdir@/kernel_patches/series/ldiskfs-@LDISKFS_SERIES@
51 patches := @top_srcdir@/kernel_patches/patches
53 #install-data-local: sources
54 # destname=@LDISKFS_META_NAME@-@LDISKFS_META_VERSION@/@LINUX_VERSION@; \
55 # instdest=$(DESTDIR)/usr/src/$$destname; \
56 # instfiles=$$(find . -name '*.h' | grep -v linux-stage); \
57 # for instfile in $$instfiles; do \
58 # if [ "$$(dirname $$instfile)" = "." ]; then \
59 # /usr/bin/install -c -D $$instfile $$instdest/ldiskfs/$$instfile; \
61 # /usr/bin/install -c -D $$instfile $$instdest/$$instfile; \
65 ###############################
66 # Kernel Build Infrastructure #
67 ###############################
69 EXTRA_CFLAGS += -I@LINUX@/fs -I@LDISKFSDIR@
70 EXTRA_CFLAGS += -include @abs_top_builddir@/ldiskfs/ldiskfs_config.h
71 EXTRA_CFLAGS += -include @abs_top_builddir@/config.h
74 ldiskfs-objs := $(ldiskfs_obj)
77 $(MAKE) -C @LINUX_OBJ@ M=$(shell pwd) $@
80 $(MAKE) -C @LINUX_OBJ@ M=$(shell pwd) $@
81 if [ -f Module.markers ]; then $(RM) Module.markers; fi
90 @# Install the kernel modules
91 $(MAKE) -C @LINUX_OBJ@ M=$(shell pwd) \
92 INSTALL_MOD_PATH=$(DESTDIR) \
93 INSTALL_MOD_DIR=updates/kernel/fs/lustre-ldiskfs $@
94 @# Remove extraneous build products when packaging
95 if [ -n "$(DESTDIR)" ]; then \
96 find $(DESTDIR)/lib/modules/@LINUX_VERSION@ \
97 -name 'modules.*' | xargs $(RM); \
99 sysmap=$(DESTDIR)/boot/System.map-@LINUX_VERSION@; \
100 if [ -f $$sysmap ]; then \
101 depmod -ae -F $$sysmap @LINUX_VERSION@; \
104 ################################################
105 # Patched ldiskfs Sources Build Infrastructure #
106 ################################################
108 sources: $(backfs_sources) $(backfs_headers) $(linux_headers) $(series) $(trace_headers)
109 rm -rf linux-stage linux sources trace $(ldiskfs_SOURCES)
110 mkdir -p linux-stage/fs/ext4 linux-stage/include/linux \
111 linux-stage/include/trace/events
112 cp $(backfs_sources) $(backfs_headers) $(backfs_extra) linux-stage/fs/ext4
113 if test -n "$(linux_headers)" ; then \
114 cp $(linux_headers) linux-stage/include/linux; \
116 if test -n "$(trace_headers)" ; then \
117 cp $(trace_headers) linux-stage/include/trace/events; \
120 @USE_QUILT_TRUE@ ln -s ../$(patches) linux-stage/patches
121 @USE_QUILT_TRUE@ ln -s ../$(series) linux-stage/series
122 @USE_QUILT_TRUE@ cd linux-stage && quilt push -a -q
124 @USE_QUILT_FALSE@ @echo -n "Applying ext4 patches:"
125 @USE_QUILT_FALSE@ @cd linux-stage && for i in $$(<../$(series)) ; do \
126 @USE_QUILT_FALSE@ echo -n " $$i" ; \
127 @USE_QUILT_FALSE@ patch -s -p1 < ../$(patches)/$$i || exit 1 ; \
128 @USE_QUILT_FALSE@ done
129 @USE_QUILT_FALSE@ @echo
131 mkdir -p linux trace/events
132 @echo -n "Replacing 'ext4' with 'ldiskfs':"
133 for i in $(notdir $(backfs_headers) $(backfs_sources)) $(new_sources) ; do \
135 sed $(strip $(ldiskfs_sed_flags)) \
136 linux-stage/fs/ext4/$$i > $$i ; \
138 for i in $(subst ext4,,$(notdir $(backfs_headers))) ; do \
139 if test -f "ext4$$i" ; then \
140 echo -n " ext4$$i" ; \
141 mv ext4$$i ldiskfs$$i ; \
144 for i in $(subst ext4,,$(notdir $(linux_headers) $(new_headers))) ; do \
145 echo -n " ext4$$i" ; \
146 sed $(strip $(ldiskfs_sed_flags)) \
147 linux-stage/include/linux/ext4$$i \
148 > linux/ldiskfs$$i ; \
150 for i in $(subst ext4,,$(notdir $(trace_headers))) ; do \
151 echo -n " ext4$$i"; \
152 sed $(strip $(ldiskfs_sed_flags)) \
153 linux-stage/include/trace/events/ext4$$i \
154 > trace/events/ldiskfs$$i ; \
156 for i in $(notdir $(linux_new_headers)) ; do \
158 sed $(strip $(ldiskfs_sed_flags)) \
159 linux-stage/include/linux/$$i \
167 @echo "ldiskfs_sources: $(ldiskfs_sources)"
168 @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
169 @echo "ldiskfs_headers: $(ldiskfs_headers)"
170 @echo "ldiskfs_objects: $(ldiskfs_objects)"
171 @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
172 @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
174 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
175 CLEANFILES = sources $(notdir $(linux_new_headers) $(linux_headers) $(backfs_headers) $(backfs_sources) $(new_sources) $(new_headers) $(trace_headers))
177 #--- autoMakefile cut-and-paste end