1 EXTRA_DIST = kernel_patches
7 modulefs_DATA = ldiskfs$(KMODEXT)
9 ldiskfs$(KMODEXT): sources
13 ldiskfs_linux_headers := \
14 $(addprefix linux/,$(subst ext4,ldiskfs,$(notdir $(linux_headers)))) \
15 $(addprefix uapi/linux/,$(subst ext4,ldiskfs,$(notdir $(uapi_linux_headers))))
17 $(filter %.c,$(ldiskfs_patched_sources)): \
18 sources $(ldiskfs_linux_headers) $(filter %.h,$(ldiskfs_patched_sources))
20 # Convert LDISKFS_SUPER_MAGIC back to EXT4_SUPER_MAGIC so that the ldiskfs
21 # code can use the existing kernel headers instead of defining this itself.
23 -e "s/dx_hash_info/ext4_dx_hash_info/g" \
24 -e "s/DX_HASH/EXT4_DX_HASH/g" \
25 -e "s/EXT4/LDISKFS/g" -e "s/ext4/ldiskfs/g" \
26 -e "s/LDISKFS_SUPER_MAGIC/EXT4_SUPER_MAGIC/g"
28 %.c: linux-stage/fs/ext4/%.c
29 sed $(strip $(ldiskfs_sed_flags)) $< > $@
31 %.h: linux-stage/fs/ext4/%.h
32 sed $(strip $(ldiskfs_sed_flags)) $< > $@
34 linux/ldiskfs%.h: linux-stage/include/linux/ext4%.h
35 @echo sed $(strip $(ldiskfs_sed_flags)) $< '=>' $@
36 sed $(strip $(ldiskfs_sed_flags)) $< > $@
38 uapi/linux/ldiskfs%.h: linux-stage/include/uapi/linux/ext4%.h
39 @echo sed $(strip $(ldiskfs_sed_flags)) $< '=>' $@
40 sed $(strip $(ldiskfs_sed_flags)) $< > $@
42 series := @top_srcdir@/ldiskfs/kernel_patches/series/ldiskfs-$(LDISKFS_SERIES)
43 patches := @top_srcdir@/ldiskfs/kernel_patches/patches
45 sources: $(backfs_sources) $(backfs_headers) $(linux_headers) $(uapi_linux_headers) $(series) $(trace_headers)
46 rm -rf linux-stage uapi linux sources trace $(ldiskfs_SOURCES)
47 mkdir -p linux-stage/fs/ext4 linux-stage/include/linux \
48 linux-stage/include/uapi/linux \
49 linux-stage/include/trace/events
50 cp $(backfs_sources) $(backfs_headers) $(backfs_extra) linux-stage/fs/ext4
51 if test -n "$(linux_headers)" ; then \
52 cp $(linux_headers) linux-stage/include/linux; \
54 if test -n "$(uapi_linux_headers)" ; then \
55 cp $(uapi_linux_headers) linux-stage/include/uapi/linux; \
57 if test -n "$(trace_headers)" ; then \
58 cp $(trace_headers) linux-stage/include/trace/events; \
61 ln -s ../$(patches) linux-stage/patches
62 ln -s ../$(series) linux-stage/series
63 cd linux-stage && quilt push -a -q
65 @echo -n "Applying ext4 patches:"
66 @cd linux-stage && for i in $$(<../$(series)) ; do \
68 patch -s -p1 < ../$(patches)/$$i || exit 1 ; \
72 mkdir -p uapi/linux linux trace/events
73 @echo -n "Replacing 'ext4' with 'ldiskfs':"
74 for i in $(notdir $(backfs_headers) $(backfs_sources)) $(new_sources) ; do \
75 [ -f linux-stage/fs/ext4/$$i ] || continue; \
77 sed $(strip $(ldiskfs_sed_flags)) \
78 linux-stage/fs/ext4/$$i > $$i ; \
80 for i in $(subst ext4,,$(notdir $(backfs_headers))) ; do \
81 if test -f "ext4$$i" ; then \
82 echo -n " ext4$$i" ; \
83 mv ext4$$i ldiskfs$$i ; \
86 for i in $(subst ext4,,$(notdir $(uapi_linux_headers))) ; do \
87 echo -n " ext4$$i" ; \
88 sed $(strip $(ldiskfs_sed_flags)) \
89 linux-stage/include/uapi/linux/ext4$$i \
90 > uapi/linux/ldiskfs$$i ; \
92 for i in $(subst ext4,,$(notdir $(linux_headers) $(new_headers))) ; do \
93 echo -n " ext4$$i" ; \
94 sed $(strip $(ldiskfs_sed_flags)) \
95 linux-stage/include/linux/ext4$$i \
96 > linux/ldiskfs$$i ; \
98 for i in $(subst ext4,,$(notdir $(trace_headers))) ; do \
100 sed $(strip $(ldiskfs_sed_flags)) \
101 linux-stage/include/trace/events/ext4$$i \
102 > trace/events/ldiskfs$$i ; \
104 for i in $(notdir $(linux_new_headers)) ; do \
106 sed $(strip $(ldiskfs_sed_flags)) \
107 linux-stage/include/linux/$$i \
114 @echo "ldiskfs_sources: $(ldiskfs_sources)"
115 @echo "ldiskfs_SOURCES: $(ldiskfs_SOURCES)"
116 @echo "ldiskfs_headers: $(ldiskfs_headers)"
117 @echo "ldiskfs_objects: $(ldiskfs_objects)"
118 @echo "ldiskfs_OBJECTS: $(ldiskfs_OBJECTS)"
119 @echo "ldiskfs_LDADD: $(ldiskfs_LDADD)"
121 MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
122 CLEANFILES = sources $(notdir $(linux_new_headers) $(linux_headers) $(backfs_headers) $(backfs_sources) $(new_sources) $(new_headers) $(trace_headers))
125 rm -rf linux linux-stage ldiskfs*.h trace modules.order