summaryrefslogtreecommitdiff
path: root/libc/kernel/tools/utils.py
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2015-09-15 14:13:17 -0700
committerChristopher Ferris <cferris@google.com>2015-09-17 21:02:52 -0700
commitd12c332018143e731337292910b03fa0f41b2ca2 (patch)
treee87bc9b2828da12f90cdf15bd7f07a00ff8de4a2 /libc/kernel/tools/utils.py
parent14545d4ce3dd446f20a14dcff37d60ff8d756f7a (diff)
Add support for manually modified kernel headers.
This changes the scripts so that if some kernel files exists in external/kernel-headers/modified, that they will be preferred over the same files found in original. This is to support the case where the kernel headers cannot be taken without some small modifications. Included with this change, is a general cleanup of the python scripts. This also modifies the generate uapi headers script to indicate if the source of the modified headers has changed. Change-Id: Id13523b244ced52a2ecd9f1399c43996dd8296fa
Diffstat (limited to 'libc/kernel/tools/utils.py')
-rw-r--r--libc/kernel/tools/utils.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/libc/kernel/tools/utils.py b/libc/kernel/tools/utils.py
index e5a310e03..e2cc9ce10 100644
--- a/libc/kernel/tools/utils.py
+++ b/libc/kernel/tools/utils.py
@@ -13,8 +13,26 @@ def panic(msg):
sys.exit(1)
-def find_program_dir():
- return os.path.dirname(sys.argv[0])
+def get_kernel_headers_dir():
+ return os.path.join(get_android_root(), "external/kernel-headers")
+
+
+def get_kernel_headers_original_dir():
+ return os.path.join(get_kernel_headers_dir(), "original")
+
+
+def get_kernel_headers_modified_dir():
+ return os.path.join(get_kernel_headers_dir(), "modified")
+
+
+def get_kernel_dir():
+ return os.path.join(get_android_root(), "bionic/libc/kernel")
+
+
+def get_android_root():
+ if "ANDROID_BUILD_TOP" in os.environ:
+ return os.environ["ANDROID_BUILD_TOP"]
+ panic("Unable to find root of tree, did you forget to lunch a target?")
class StringOutput: