diff --git a/Android.bp b/Android.bp index 3912ac5210..a53dcbbc40 100644 --- a/Android.bp +++ b/Android.bp @@ -1,5 +1,42 @@ +headers_src = [ + "linux/smc*ke.h", + "linux/smc*_object.h", + "linux/IClientE*v.h", +] + +smcinvoke_headers_out = [ + "linux/smcinvoke.h", + "linux/smcinvoke_object.h", + "linux/IClientEnv.h", +] + +smcinvoke_kernel_headers_verbose = "--verbose " + +genrule { + name: "qti_generate_smcinvoke_kernel_headers", + tools: ["headers_install.sh", + "unifdef" + ], + tool_files: [ + "ssg_kernel_headers.py", + ], + srcs: headers_src, + cmd: "python3 -u $(location ssg_kernel_headers.py) " + + smcinvoke_kernel_headers_verbose + + "--header_arch arm64 " + + "--gen_dir $(genDir) " + + "--smcinvoke_headers_to_expose $(locations linux/smc*ke.h) $(locations linux/smc*_object.h) $(locations linux/IClientE*v.h) " + + "--unifdef $(location unifdef) " + + "--headers_install $(location headers_install.sh)", + out: smcinvoke_headers_out, +} + + cc_library_headers { name: "smcinvoke_kernel_headers", - vendor_available: true, export_include_dirs: ["."], + generated_headers: ["qti_generate_smcinvoke_kernel_headers"], + export_generated_headers: ["qti_generate_smcinvoke_kernel_headers"], + vendor: true, + recovery_available: true } diff --git a/ssg_kernel_headers.py b/ssg_kernel_headers.py index 2285c65cbb..6708388a5c 100644 --- a/ssg_kernel_headers.py +++ b/ssg_kernel_headers.py @@ -1,4 +1,5 @@ # Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. +# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 as published by @@ -24,6 +25,10 @@ def run_headers_install(verbose, gen_dir, headers_install, unifdef, prefix, h): print('error: expected prefix [%s] on header [%s]' % (prefix, h)) return False + # out_h is combining the relative path to the header file (made in gen_smcinvoke_headers()) to the gen_dir out/soong/.temp/sbox//out/ + # ex. out/soong/.temp/sbox//out/linux/smcinvoke.h + # After the build is complete, you can find the headers that you exposed located in the following gen path: + # out/soong/.intermediates/.../qti_generate_smcinvoke_kernel_headers/gen/ out_h = os.path.join(gen_dir, h[len(prefix):]) (out_h_dirname, out_h_basename) = os.path.split(out_h) env = os.environ.copy() @@ -40,17 +45,19 @@ def run_headers_install(verbose, gen_dir, headers_install, unifdef, prefix, h): return False return True -def gen_audio_headers(verbose, gen_dir, headers_install, unifdef, audio_include_uapi): +def gen_smcinvoke_headers(verbose, gen_dir, headers_install, unifdef, smcinvoke_headers_to_expose): error_count = 0 - for h in audio_include_uapi: - audio_uapi_include_prefix = os.path.join(h.split('/include/uapi/')[0], - 'include', - 'uapi', - 'audio') + os.sep - - if not run_headers_install( - verbose, gen_dir, headers_install, unifdef, - audio_uapi_include_prefix, h): error_count += 1 + # smcinvoke_headers_to_expose is a string list of individual paths to headers to expose + # They are passed using Android.bp variable substition: $(locations