fix device specific fs_config on build server

fs_config function from libcutils, in order to properly set the xattr FS
used to define device specific uid, gid, permissions and capabilities,
now needs TARGET_OUT make variable to be passed explicitly to all tools
using it:
  fs_config
  fs_get_stats used by mktarball.sh
  make_ext4fs used by mkuserimg.sh
  mksquashfs used by mksquashfsimage.sh

Bug: 21989305
Bug: 22048934
Change-Id: I6caf9cf870882fce2ead93027767092c29b75ded
Signed-off-by: Thierry Strudel <tstrudel@google.com>
diff --git a/tools/fs_config/fs_config.c b/tools/fs_config/fs_config.c
index f594c1e..b9a14e1 100644
--- a/tools/fs_config/fs_config.c
+++ b/tools/fs_config/fs_config.c
@@ -68,16 +68,17 @@
 }
 
 static void usage() {
-  fprintf(stderr, "Usage: fs_config [-S context_file] [-C]\n");
+  fprintf(stderr, "Usage: fs_config [-D product_out_path] [-S context_file] [-C]\n");
 }
 
 int main(int argc, char** argv) {
   char buffer[1024];
   const char* context_file = NULL;
+  const char* product_out_path = NULL;
   struct selabel_handle* sehnd = NULL;
   int print_capabilities = 0;
   int opt;
-  while((opt = getopt(argc, argv, "CS:")) != -1) {
+  while((opt = getopt(argc, argv, "CS:D:")) != -1) {
     switch(opt) {
     case 'C':
       print_capabilities = 1;
@@ -85,6 +86,9 @@
     case 'S':
       context_file = optarg;
       break;
+    case 'D':
+      product_out_path = optarg;
+      break;
     default:
       usage();
       exit(EXIT_FAILURE);
@@ -115,7 +119,7 @@
 
     unsigned uid = 0, gid = 0, mode = 0;
     uint64_t capabilities;
-    fs_config(buffer, is_dir, &uid, &gid, &mode, &capabilities);
+    fs_config(buffer, is_dir, product_out_path, &uid, &gid, &mode, &capabilities);
     printf("%s %d %d %o", buffer, uid, gid, mode);
 
     if (sehnd != NULL) {