Whamcloud - gitweb
Allow debugfs to be built for use in Android
authorTheodore Ts'o <tytso@mit.edu>
Tue, 26 May 2015 02:26:20 +0000 (22:26 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 26 May 2015 02:26:20 +0000 (22:26 -0400)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/Android.mk [new file with mode: 0644]
lib/ss/Android.mk [new file with mode: 0644]
util/gen-android-files

diff --git a/debugfs/Android.mk b/debugfs/Android.mk
new file mode 100644 (file)
index 0000000..246280b
--- /dev/null
@@ -0,0 +1,72 @@
+LOCAL_PATH := $(call my-dir)
+
+#########################
+# Build the debugfs binary
+
+debugfs_src_files :=  \
+       debug_cmds.c \
+       debugfs.c \
+       util.c \
+       ncheck.c\
+       icheck.c \
+       ls.c \
+       lsdel.c \
+       dump.c \
+       set_fields.c \
+       logdump.c \
+       htree.c \
+       unused.c \
+       e2freefrag.c \
+       filefrag.c \
+       extent_cmds.c \
+       extent_inode.c \
+       zap.c \
+       create_inode.c \
+       quota.c \
+       xattrs.c \
+       journal.c \
+       revoke.c \
+       recovery.c \
+       do_journal.c \
+       plausible.c
+
+debugfs_shared_libraries := \
+       libext2fs \
+       libext2_blkid \
+       libext2_uuid \
+       libext2_ss \
+       libext2_quota \
+       libext2_com_err \
+       libext2_e2p
+
+debugfs_system_shared_libraries := libc
+
+debugfs_c_includes := \
+       external/e2fsprogs/e2fsck \
+       external/e2fsprogs/misc \
+       external/e2fsprogs/lib
+
+debugfs_cflags := -O2 -g -W -Wall -fno-strict-aliasing -DDEBUGFS
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(debugfs_src_files)
+LOCAL_C_INCLUDES := $(debugfs_c_includes)
+LOCAL_CFLAGS := $(debugfs_cflags)
+LOCAL_SYSTEM_SHARED_LIBRARIES := $(debugfs_system_shared_libraries)
+LOCAL_SHARED_LIBRARIES := $(debugfs_shared_libraries)
+LOCAL_MODULE := debugfs
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(debugfs_src_files)
+LOCAL_C_INCLUDES := $(debugfs_c_includes)
+LOCAL_CFLAGS := $(debugfs_cflags)
+LOCAL_SHARED_LIBRARIES := $(addsuffix _host, $(debugfs_shared_libraries))
+LOCAL_MODULE := debugfs_host
+LOCAL_MODULE_STEM := debugfs
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_HOST_EXECUTABLE)
diff --git a/lib/ss/Android.mk b/lib/ss/Android.mk
new file mode 100644 (file)
index 0000000..9231793
--- /dev/null
@@ -0,0 +1,49 @@
+LOCAL_PATH := $(call my-dir)
+
+libext2_ss_src_files := \
+       ss_err.c \
+       std_rqs.c \
+       invocation.c help.c \
+       execute_cmd.c \
+       listen.c \
+       parse.c \
+       error.c \
+       prompt.c \
+       request_tbl.c \
+       list_rqs.c \
+       pager.c \
+       requests.c \
+       data.c \
+       get_readline.c
+
+libext2_ss_c_includes := external/e2fsprogs/lib
+
+libext2_ss_cflags := -O2 -g -W -Wall
+
+libext2_ss_shared_libraries := \
+       libext2_com_err
+
+libext2_ss_system_shared_libraries := libc
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(libext2_ss_src_files)
+LOCAL_C_INCLUDES := $(libext2_ss_c_includes)
+LOCAL_CFLAGS := $(libext2_ss_cflags)
+LOCAL_SHARED_LIBRARIES := $(libext2_ss_shared_libraries)
+LOCAL_SYSTEM_SHARED_LIBRARIES := $(libext2_ss_system_shared_libraries)
+LOCAL_MODULE := libext2_ss
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(libext2_ss_src_files)
+LOCAL_SHARED_LIBRARIES := $(addsuffix _host, $(libext2_ss_shared_libraries))
+LOCAL_C_INCLUDES := $(libext2_ss_c_includes)
+LOCAL_CFLAGS := $(libext2_ss_cflags)
+LOCAL_MODULE := libext2_ss_host
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_HOST_SHARED_LIBRARY)
index 240b930..0be3c04 100755 (executable)
@@ -6,7 +6,16 @@ ANDROID_GENERATED_FILES="lib/ext2fs/ext2_err.c lib/ext2fs/ext2_err.h \
        e2fsck/nls-enable.h e2fsck/plausible.c e2fsck/plausible.h \
        lib/blkid/blkid_types.h lib/uuid/uuid_types.h \
        lib/ext2fs/ext2_types.h lib/config.h lib/blkid/blkid.h \
-       lib/uuid/uuid.h lib/ext2fs/crc32c_table.h misc/default_profile.c"
+       lib/uuid/uuid.h lib/ext2fs/crc32c_table.h misc/default_profile.c \
+       lib/ss/std_rqs.c debugfs/debug_cmds.c debugfs/ro_debug_cmds.c \
+       debugfs/extent_cmds.c debugfs/e2freefrag.c debugfs/create_inode.c \
+       debugfs/plausible.c debugfs/recovery.c debugfs/revoke.c"
+
+SS_DIR=$(pwd)/lib/ss
+MK_CMDS=/tmp/mk_cmds$$.sh
+
+sed -e "s;@SS_DIR@;$SS_DIR;" < $SS_DIR/mk_cmds.sh.in \
+    | sed -e "s/@AWK@/awk/" | sed -e "s/@SED@/sed/" > $MK_CMDS
 
 sed -e "s/@E2FSPROGS_VERSION@/$(git describe)/" < lib/ext2fs/ext2_err.et.in > lib/ext2fs/ext2_err.et
 
@@ -16,6 +25,16 @@ do
    awk -f lib/et/et_c.awk outfile=$i.c outfn=$(basename $i.c) $i.et
    awk -f lib/et/et_h.awk outfile=$i.h outfn=$(basename $i.h) $i.et
 done
+
+for i in lib/ss/std_rqs debugfs/debug_cmds debugfs/ro_debug_cmds \
+                       debugfs/extent_cmds
+do
+    /bin/sh $MK_CMDS $i.ct
+    mv -f $(basename $i).c $i.c
+done
+
+rm -f $MK_CMDS
+
 rm -f misc/prof_err.[ch]
 cp e2fsck/prof_err.[ch] misc/
 
@@ -27,6 +46,8 @@ cp util/android_types.h lib/uuid/uuid_types.h
 cp util/android_config.h lib/config.h
 cp misc/plausible.? e2fsck/
 cp misc/nls-enable.h e2fsck/
+cp misc/e2freefrag.c misc/create_inode.c misc/plausible.c debugfs/
+cp e2fsck/recovery.c e2fsck/revoke.c debugfs/
 
 gcc -o gen_crc32ctable lib/ext2fs/gen_crc32ctable.c
 ./gen_crc32ctable > lib/ext2fs/crc32c_table.h