From d12c332018143e731337292910b03fa0f41b2ca2 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Tue, 15 Sep 2015 14:13:17 -0700 Subject: 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 --- libc/kernel/tools/utils.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'libc/kernel/tools/utils.py') 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: -- cgit v1.2.3