diff options
author | Bertrand SIMONNET <bsimonnet@google.com> | 2015-09-01 13:18:18 -0700 |
---|---|---|
committer | Bertrand SIMONNET <bsimonnet@google.com> | 2015-09-01 13:39:07 -0700 |
commit | 70c3349d3c1dad47ded90d8da38811c1a8c3fef3 (patch) | |
tree | 867565ee7f5d305761408f7effcfe49fd3ac4681 | |
parent | aae1b064f16bfa2692138760be618cdf143f96c7 (diff) | |
download | rootdev-70c3349d3c1dad47ded90d8da38811c1a8c3fef3.tar.gz |
Add Android.mk.
BUG: 22953719
Change-Id: Ie7d9ff703e50210e1b6a1ab8bd7f52ae6a6e46f7
-rw-r--r-- | Android.mk | 38 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | rootdev.c | 4 |
3 files changed, 42 insertions, 4 deletions
diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..613fa85 --- /dev/null +++ b/Android.mk @@ -0,0 +1,38 @@ +# Copyright (C) 2015 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LOCAL_PATH := $(call my-dir) + +rootdev_CPPFLAGS := -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ + -D_LARGEFILE64_SOURCE + +rootdev_CFLAGS := -Wall -Werror -Wno-sign-compare + +# Build the shared library. +include $(CLEAR_VARS) +LOCAL_MODULE := librootdev +LOCAL_CFLAGS += $(rootdev_CFLAGS) +LOCAL_CPPFLAGS += $(rootdev_CPPFLAGS) +LOCAL_SRC_FILES := rootdev.c +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) +include $(BUILD_SHARED_LIBRARY) + +# Build the command line tool. +include $(CLEAR_VARS) +LOCAL_MODULE := rootdev +LOCAL_CFLAGS += $(rootdev_CFLAGS) +LOCAL_CPPFLAGS += $(rootdev_CPPFLAGS) +LOCAL_SHARED_LIBRARIES := librootdev +LOCAL_SRC_FILES := main.c +include $(BUILD_EXECUTABLE) @@ -47,8 +47,8 @@ static int flag_create = 0; static int flag_major = 0; static int flag_minor = 0; static const char *flag_path = "/"; -static char *flag_block_path = "/sys/block"; -static char *flag_dev_path = "/dev"; +static char *flag_block_path = NULL; +static char *flag_dev_path = NULL; static void parse_args(int argc, char **argv) { while (1) { @@ -29,7 +29,7 @@ #define MAX_SLAVE_DEPTH 8 static const char *kDefaultSearchPath = "/sys/block"; -static const char *kDefaultDevPath = "/dev"; +static const char *kDefaultDevPath = "/dev/block"; /* Encode the root device structuring here for Chromium OS */ static const char kActiveRoot[] = "/dev/ACTIVE_ROOT"; @@ -407,7 +407,7 @@ int rootdev(char *path, size_t size, bool full, bool strip) { dev_t _root_dev, *root_dev = &_root_dev; /* Yields the containing dev_t in st_dev. */ - if (stat("/", &root_statbuf) != 0) + if (stat("/data", &root_statbuf) != 0) return -1; /* Some ABIs (like mips o32) are broken and the st_dev field isn't actually |