aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-07-20 23:19:08 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-07-20 23:19:08 +0000
commit0e4687aea6893115b87e647db97e211c38beee30 (patch)
tree05e882831d4a251129ad3183bf0ad3d407dd85bf
parent6eac3894a6ecb39005121910c020d348955e59b4 (diff)
parent2967b43fd18e5db50a93bb0a290141c66351427c (diff)
downloade2fsprogs-0e4687aea6893115b87e647db97e211c38beee30.tar.gz
Merge changes from topic 'mke2fs_e2fsprogs'
* changes: build static version of mke2fs and e2fsdroid for host e2fsdroid: use libselinux function to read file context on device Require mke2fs.conf when building mke2fs build mke2fs and e2fsdroid as static executables for recovery mode
-rw-r--r--contrib/android/Android.bp37
-rw-r--r--contrib/android/Android.mk42
-rw-r--r--contrib/android/perms.c9
-rw-r--r--contrib/android/perms.h2
-rw-r--r--misc/Android.bp41
-rw-r--r--misc/Android.mk42
6 files changed, 153 insertions, 20 deletions
diff --git a/contrib/android/Android.bp b/contrib/android/Android.bp
index afa335e0..18d38501 100644
--- a/contrib/android/Android.bp
+++ b/contrib/android/Android.bp
@@ -18,15 +18,34 @@ cc_binary {
"hashmap.c",
],
cflags: ["-W", "-Wall"],
- shared_libs: [
- "libext2fs",
- "libext2_com_err",
- "libext2_misc",
- "libcutils",
- "libbase",
- "libselinux",
- "libcrypto",
- ],
+ target: {
+ host: {
+ static_libs: [
+ "libext2_com_err",
+ "libext2_misc",
+ "libext2fs",
+ "libsparse",
+ "libz",
+ "libcutils",
+ "libbase",
+ "libselinux",
+ "libcrypto",
+ "liblog",
+ ],
+ },
+ android: {
+ shared_libs: [
+ "libext2fs",
+ "libext2_com_err",
+ "libext2_misc",
+ "libcutils",
+ "libbase",
+ "libselinux",
+ "libcrypto",
+ ],
+ },
+ },
+ stl: "libc++_static",
}
//##########################################################################
diff --git a/contrib/android/Android.mk b/contrib/android/Android.mk
new file mode 100644
index 00000000..98ce01d8
--- /dev/null
+++ b/contrib/android/Android.mk
@@ -0,0 +1,42 @@
+LOCAL_PATH := $(call my-dir)
+
+#########################################################################
+# Build statically linked e2fsdroid for recovery
+e2fsdroid_src_files := \
+ e2fsdroid.c \
+ block_range.c \
+ fsmap.c \
+ block_list.c \
+ base_fs.c \
+ perms.c \
+ basefs_allocator.c \
+ hashmap.c \
+
+e2fsdroid_cflags := -W -Wall
+
+e2fsdroid_static_libraries := \
+ libext2_com_err \
+ libext2_misc \
+ libcutils \
+ libselinux \
+ libcrypto \
+ libsparse \
+ liblog \
+ libz \
+
+e2fsdroid_whole_static_libraries := \
+ libbase \
+ libext2fs \
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(e2fsdroid_src_files)
+LOCAL_CFLAGS := $(e2fsdroid_cflags)
+LOCAL_WHOLE_STATIC_LIBRARIES := $(e2fsdroid_whole_static_libraries)
+LOCAL_STATIC_LIBRARIES := $(e2fsdroid_static_libraries)
+LOCAL_MODULE := e2fsdroid_static
+LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
+LOCAL_FORCE_STATIC_EXECUTABLE := true
+
+include $(BUILD_EXECUTABLE)
+
diff --git a/contrib/android/perms.c b/contrib/android/perms.c
index 9a7a93f5..9ae8e586 100644
--- a/contrib/android/perms.c
+++ b/contrib/android/perms.c
@@ -297,6 +297,7 @@ errcode_t android_configure_fs(ext2_filsys fs, char *src_dir, char *target_out,
struct selabel_handle *sehnd = NULL;
/* Retrieve file contexts */
+#if !defined(__ANDROID__)
if (nopt > 0) {
sehnd = selabel_open(SELABEL_CTX_FILE, seopts, nopt);
if (!sehnd) {
@@ -306,6 +307,14 @@ errcode_t android_configure_fs(ext2_filsys fs, char *src_dir, char *target_out,
return -EINVAL;
}
}
+#else
+ sehnd = selinux_android_file_context_handle();
+ if (!sehnd) {
+ com_err(__func__, -EINVAL,
+ _("while opening android file_contexts"));
+ return -EINVAL;
+ }
+#endif
/* Load the FS config */
if (fs_config_file) {
diff --git a/contrib/android/perms.h b/contrib/android/perms.h
index 9955bb56..c404cb90 100644
--- a/contrib/android/perms.h
+++ b/contrib/android/perms.h
@@ -25,7 +25,7 @@ static inline errcode_t android_configure_fs(ext2_filsys fs,
# else
# include <selinux/selinux.h>
# include <selinux/label.h>
-# if !defined(HOST)
+# if defined(__ANDROID__)
# include <selinux/android.h>
# endif
# include <private/android_filesystem_config.h>
diff --git a/misc/Android.bp b/misc/Android.bp
index ae7d9b6e..e388d1ef 100644
--- a/misc/Android.bp
+++ b/misc/Android.bp
@@ -31,17 +31,38 @@ cc_binary {
"mk_hugefiles.c",
"default_profile.c",
],
- cflags: ["-W", "-Wall", "-Wno-macro-redefined"],
- shared_libs: [
- "libext2fs",
- "libext2_blkid",
- "libext2_misc",
- "libext2_uuid",
- "libext2_quota",
- "libext2_com_err",
- "libext2_e2p",
+ required: [
+ "mke2fs.conf",
],
- system_shared_libs: ["libc"],
+ cflags: ["-W", "-Wall", "-Wno-macro-redefined"],
+ target: {
+ host: {
+ static_libs: [
+ "libext2_blkid",
+ "libext2_misc",
+ "libext2_uuid",
+ "libext2_quota",
+ "libext2_com_err",
+ "libext2_e2p",
+ "libext2fs",
+ "libsparse",
+ "libbase",
+ "libz",
+ ],
+ },
+ android: {
+ shared_libs: [
+ "libext2fs",
+ "libext2_blkid",
+ "libext2_misc",
+ "libext2_uuid",
+ "libext2_quota",
+ "libext2_com_err",
+ "libext2_e2p",
+ ],
+ },
+ },
+ stl: "libc++_static",
include_dirs: ["external/e2fsprogs/e2fsck"],
}
diff --git a/misc/Android.mk b/misc/Android.mk
new file mode 100644
index 00000000..d3bb8207
--- /dev/null
+++ b/misc/Android.mk
@@ -0,0 +1,42 @@
+LOCAL_PATH := $(call my-dir)
+
+#########################################################################
+# Build statically linked mke2fs for recovery
+mke2fs_src_files := \
+ mke2fs.c \
+ util.c \
+ mk_hugefiles.c \
+ default_profile.c \
+ create_inode.c \
+
+mke2fs_c_includes := \
+ external/e2fsprogs/e2fsck
+
+mke2fs_cflags := -W -Wall -Wno-macro-redefined
+
+mke2fs_static_libraries := \
+ libext2_blkid \
+ libext2_uuid \
+ libext2_quota \
+ libext2_com_err \
+ libext2_e2p \
+ libsparse \
+ libz \
+
+mke2fs_whole_static_libraries := \
+ libbase \
+ libext2fs \
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(mke2fs_src_files)
+LOCAL_C_INCLUDES := $(mke2fs_c_includes)
+LOCAL_CFLAGS := $(mke2fs_cflags)
+LOCAL_WHOLE_STATIC_LIBRARIES := $(mke2fs_whole_static_libraries)
+LOCAL_STATIC_LIBRARIES := $(mke2fs_static_libraries)
+LOCAL_MODULE := mke2fs_static
+LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
+LOCAL_FORCE_STATIC_EXECUTABLE := true
+
+include $(BUILD_EXECUTABLE)
+