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 @LINUX_SYMBOLS@ ]; then $(RM) @LINUX_SYMBOLS@; fi
82 if [ -f Module.markers ]; then $(RM) Module.markers; fi
85 @# Install the kernel modules
86 $(MAKE) -C @LINUX_OBJ@ M=$(shell pwd) \
87 INSTALL_MOD_PATH=$(DESTDIR) \
88 INSTALL_MOD_DIR=updates/kernel/fs/lustre-ldiskfs $@
89 @# Remove extraneous build products when packaging
90 if [ -n "$(DESTDIR)" ]; then \
91 find $(DESTDIR)/lib/modules/@LINUX_VERSION@ \
92 -name 'modules.*' | xargs $(RM); \
94 sysmap=$(DESTDIR)/boot/System.map-@LINUX_VERSION@; \
95 if [ -f $$sysmap ]; then \
96 depmod -ae -F $$sysmap @LINUX_VERSION@; \
99 ################################################
100 # Patched ldiskfs Sources Build Infrastructure #
101 ################################################
103 sources: $(backfs_sources) $(backfs_headers) $(linux_headers) $(series) $(trace_headers)
104 rm -rf linux-stage linux sources trace $(ldiskfs_SOURCES)
105 mkdir -p linux-stage/fs/ext4 linux-stage/include/linux \
106 linux-stage/include/trace/events
107 cp $(backfs_sources) $(backfs_headers) $(backfs_extra) linux-stage/fs/ext4
108 if test -n "$(linux_headers)" ; then \
109 cp $(linux_headers) linux-stage/include/linux; \
111 if test -n "$(trace_headers)" ; then \
112 cp $(trace_headers) linux-stage/include/trace/events; \
115 @USE_QUILT_TRUE@ ln -s ../$(patches) linux-stage/patches
116 @USE_QUILT_TRUE@ ln -s ../$(series) linux-stage/series
117 @USE_QUILT_TRUE@ cd linux-stage && quilt push -a -q
119 @USE_QUILT_FALSE@ @echo -n "Applying ext4 patches:"
120 @USE_QUILT_FALSE@ @cd linux-stage && for i in $$(<../$(series)) ; do \
121 @USE_QUILT_FALSE@ echo -n " $$i" ; \
122 @USE_QUILT_FALSE@ patch -s -p1 < ../$(patches)/$$i || exit 1 ; \
123 @USE_QUILT_FALSE@ done
124 @USE_QUILT_FALSE@ @echo
126 mkdir -p linux trace/events
127 @echo -n "Replacing 'ext4' with 'ldiskfs':"
128 for i in $(notdir $(backfs_headers) $(backfs_sources)) $(new_sources) ; do \
130 sed $(strip $(ldiskfs_sed_flags)) \
131 linux-stage/fs/ext4/$$i > $$i ; \
133 for i in $(subst ext4,,$(notdir $(backfs_headers))) ; do \
134 if test -f "ext4$$i" ; then \
135 echo -n " ext4$$i" ; \
136 mv ext4$$i ldiskfs$$i ; \
139 for i in $(subst ext4,,$(notdir $(linux_headers) $(new_headers))) ; do \
140 echo -n " ext4$$i" ; \
141 sed $(strip $(ldiskfs_sed_flags)) \
142 linux-stage/include/linux/ext4$$i \
143 > linux/ldiskfs$$i ; \
145 for i in $(subst ext4,,$(notdir $(trace_headers))) ; do \
146 echo -n " ext4$$i"; \
147 sed $(strip $(ldiskfs_sed_flags)) \
148 linux-stage/include/trace/events/ext4$$i \
149 > trace/events/ldiskfs$$i ; \
151 for i in $(notdir $(linux_new_headers)) ; do \
153 sed $(strip $(ldiskfs_sed_flags)) \
154 linux-stage/include/linux/$$i \
162 @echo "ldiskfs_sources: $(ldiskfs_sources)"
163 @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
164 @echo "ldiskfs_headers: $(ldiskfs_headers)"
165 @echo "ldiskfs_objects: $(ldiskfs_objects)"
166 @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
167 @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
169 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
170 CLEANFILES = sources $(notdir $(linux_new_headers) $(linux_headers) $(backfs_headers) $(backfs_sources) $(new_sources) $(new_headers) $(trace_headers))
172 #--- autoMakefile cut-and-paste end