diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch b/meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch index 85af81f0f95..5c90397194d 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch +++ b/meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch @@ -1,19 +1,50 @@ +From aa669312a380611d280d126cb509fa282080707e Mon Sep 17 00:00:00 2001 +From: Markus Mayer +Date: Wed, 7 Sep 2016 12:58:47 +0300 +Subject: [PATCH] android-tools: add recipe from AOSP tag android-5.1.1_r37 + Description: add -o argument to preserve ownership -Author: Markus Mayer See also https://android-review.googlesource.com/#/c/100312/ Upstream-Status: Inappropriate + --- - system/extras/ext4_utils/make_ext4fs.c | 6 ++++++ - system/extras/ext4_utils/make_ext4fs_main.c | 10 ++++++++-- + ext4_utils/make_ext4fs.c | 6 ++++++ + ext4_utils/make_ext4fs_main.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) ---- a/system/extras/ext4_utils/make_ext4fs_main.c -+++ b/system/extras/ext4_utils/make_ext4fs_main.c -@@ -49,13 +49,15 @@ extern struct fs_info info; +diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c +index 2f89ae8a..cc41d623 100644 +--- a/ext4_utils/make_ext4fs.c ++++ b/ext4_utils/make_ext4fs.c +@@ -68,6 +68,8 @@ + + #endif + ++int preserve_owner = 0; ++ + /* TODO: Not implemented: + Allocating blocks in the same block group as the file inode + Hash or binary tree directories +@@ -186,6 +188,10 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path + } else { + dentries[i].mtime = fixed_time; + } ++ if (preserve_owner) { ++ dentries[i].uid = stat.st_uid; ++ dentries[i].gid = stat.st_gid; ++ } + uint64_t capabilities; + if (fs_config_func != NULL) { + #ifdef ANDROID +diff --git a/ext4_utils/make_ext4fs_main.c b/ext4_utils/make_ext4fs_main.c +index a6c5f616..7af0dddf 100644 +--- a/ext4_utils/make_ext4fs_main.c ++++ b/ext4_utils/make_ext4fs_main.c +@@ -48,13 +48,15 @@ struct selabel_handle; + extern struct fs_info info; - extern struct selabel_handle* selinux_android_file_context_handle(void); +extern int preserve_owner; + @@ -28,7 +59,7 @@ Upstream-Status: Inappropriate fprintf(stderr, " []\n"); } -@@ -81,7 +83,7 @@ int main(int argc, char **argv) +@@ -80,7 +82,7 @@ int main(int argc, char **argv) struct selinux_opt seopts[] = { { SELABEL_OPT_PATH, "" } }; #endif @@ -37,7 +68,7 @@ Upstream-Status: Inappropriate switch (opt) { case 'l': info.len = parse_num(optarg); -@@ -144,6 +146,10 @@ int main(int argc, char **argv) +@@ -143,6 +145,10 @@ int main(int argc, char **argv) } #endif break; @@ -48,25 +79,3 @@ Upstream-Status: Inappropriate case 'v': verbose = 1; break; ---- a/system/extras/ext4_utils/make_ext4fs.c -+++ b/system/extras/ext4_utils/make_ext4fs.c -@@ -67,6 +67,8 @@ - - #endif - -+int preserve_owner = 0; -+ - /* TODO: Not implemented: - Allocating blocks in the same block group as the file inode - Hash or binary tree directories -@@ -185,6 +187,10 @@ static u32 build_directory_structure(con - } else { - dentries[i].mtime = fixed_time; - } -+ if (preserve_owner) { -+ dentries[i].uid = stat.st_uid; -+ dentries[i].gid = stat.st_gid; -+ } - uint64_t capabilities; - if (fs_config_func != NULL) { - #ifdef ANDROID diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb index d3ccd1d064a..5d8f8a84357 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb @@ -26,7 +26,7 @@ SRC_URI = " \ file://remove-selinux-android.patch \ file://use-capability.patch \ file://use-local-socket.patch \ - file://preserve-ownership.patch \ + file://preserve-ownership.patch;patchdir=system/extras \ file://mkbootimg-Add-dt-parameter-to-specify-DT-image.patch \ file://remove-bionic-android.patch \ file://define-shell-command.patch \