android_kernel_xiaomi_sdm845/Androidbp
Bill Peckham a6248a1ad3 Use environment variable to find unifdef tool
Tools used within the sandbox are now copied into the
sandbox, see aosp/1531944. This caused the modified
headers_install.sh, which is no longer installed, to
point to a non-existent location.

This change adds a level of indirection. The
gen-headers_install.sh module no longer uses unifdef as
a tool, but still modifies the headers_install.sh
script, but not to point to a particular location, but
to find the unifdef tool via an environment variable,
LOC_UNIFDEF.

Next, we modify qti_generate_kernel_headers_arm and
qti_generate_kernel_headers_arm64 to need the unifdef
tool (which is copied into the sandbox for these tools).

We add a new --unifdef option to the kernel_headers.py
script so that it can find the tool in the sandbox. The
kernel_headers.py script sets the LOC_UNIFDEF
environment variable before invoking the altered
headers_install.sh script (also copied into the
sandbox).

Finally, we generate gen_headers_arm.bp and
gen_headers_arm64.bp with all of these changes.

Bug: 178500203
Change-Id: Ie3b8c36b7d60bd950c28bac566e04f43de78cf98
Signed-off-by: Mohammed Athar <athar@codeaurora.org>
Signed-off-by: Shadab Naseem <snaseem@codeaurora.org>
Signed-off-by: Eruvaram Kumar Raja Reddy <erajared@codeaurora.org>
2021-08-19 17:06:25 +05:30

45 lines
1.2 KiB
Plaintext

cc_binary_host {
name: "unifdef",
srcs: ["scripts/unifdef.c"],
sanitize: {
never: true,
},
}
genrule {
name: "gen-headers_install.sh",
srcs: ["scripts/headers_install.sh"],
out: ["headers_install.sh"],
cmd: "sed 's+scripts/unifdef+$$LOC_UNIFDEF+g' $(in) > $(out)",
}
cc_prebuilt_binary {
name: "headers_install.sh",
device_supported: false,
host_supported: true,
srcs: [":gen-headers_install.sh"],
}
// Use the following for verbose output from kernel_headers.py.
// kernel_headers_verbose = "--verbose "
// Use the following for minimal output from kernel_headers.py.
kernel_headers_verbose = ""
build = ["gen_headers_arm.bp", "gen_headers_arm64.bp"]
cc_library_headers {
name: "qti_kernel_headers",
arch: {
arm: {
generated_headers: ["qti_generate_kernel_headers_arm"],
export_generated_headers: ["qti_generate_kernel_headers_arm"],
},
arm64: {
generated_headers: ["qti_generate_kernel_headers_arm64"],
export_generated_headers: ["qti_generate_kernel_headers_arm64"],
},
},
vendor: true,
recovery_available: true,
}