Merge "Change the subprocess argument to fix the build issue"

This commit is contained in:
qctecmdr 2021-06-30 01:35:22 -07:00 committed by Gerrit - the friendly Code Review server
commit 42f1dec57a
4 changed files with 35 additions and 12 deletions

View file

@ -9,9 +9,9 @@ cc_binary_host {
genrule {
name: "gen-headers_install.sh",
srcs: ["scripts/headers_install.sh"],
tools: ["unifdef"],
out: ["headers_install.sh"],
cmd: "sed 's+scripts/unifdef+$(location unifdef)+g' $(in) > $(out)",
// (Ie3b8c36b7d60bd950c28bac566e04f43de78cf98,b/178500203)
cmd: "sed 's+scripts/unifdef+$$LOC_UNIFDEF+g' $(in) > $(out)",
}
cc_prebuilt_binary {

View file

@ -1021,7 +1021,10 @@ genrule {
genrule {
name: "qti_generate_kernel_headers_arm",
tools: ["headers_install.sh"],
tools: [
"headers_install.sh",
"unifdef",
],
tool_files: [
"kernel_headers.py",
"arch/arm/tools/syscallhdr.sh",
@ -1046,6 +1049,7 @@ genrule {
"--arch_syscall_tool $(location arch/arm/tools/syscallhdr.sh) " +
"--arch_syscall_tbl $(location arch/arm/tools/syscall.tbl) " +
"--headers_install $(location headers_install.sh) " +
"--unifdef $(location unifdef) " +
"--include_uapi $(locations include/uapi/**/*.h)",
out: ["linux/version.h"] + gen_headers_out_arm,
}

View file

@ -1015,7 +1015,10 @@ genrule {
genrule {
name: "qti_generate_kernel_headers_arm64",
tools: ["headers_install.sh"],
tools: [
"headers_install.sh",
"unifdef",
],
tool_files: [
"kernel_headers.py",
],
@ -1037,6 +1040,7 @@ genrule {
"--new_gen_headers_bp $(location :qti_generate_gen_headers_arm64) " +
"--version_makefile $(location Makefile) " +
"--headers_install $(location headers_install.sh) " +
"--unifdef $(location unifdef) " +
"--include_uapi $(locations include/uapi/**/*.h)",
out: ["linux/version.h"] + gen_headers_out_arm64,
}

View file

@ -310,7 +310,7 @@ def gen_arch_headers(
return error_count
def run_headers_install(verbose, gen_dir, headers_install, prefix, h):
def run_headers_install(verbose, gen_dir, headers_install, unifdef, prefix, h):
"""Process a header through the headers_install script.
The headers_install script does some processing of a header so that it is
@ -325,6 +325,7 @@ def run_headers_install(verbose, gen_dir, headers_install, prefix, h):
verbose: Set True to print progress messages.
gen_dir: Where to place the generated files.
headers_install: The script that munges the header.
unifdef: The unifdef tool used by headers_install.
prefix: The prefix to strip from h to generate the output filename.
h: The input header to process.
Return:
@ -344,7 +345,9 @@ def run_headers_install(verbose, gen_dir, headers_install, prefix, h):
if verbose:
print('run_headers_install: cmd is %s' % cmd)
result = subprocess.call(cmd)
env = os.environ.copy()
env["LOC_UNIFDEF"] = unifdef
result = subprocess.call(['sh', headers_install, out_h_dirname, h_dirname, out_h_basename], env=env)
if result != 0:
print('error: run_headers_install: cmd %s failed %d' % (cmd, result))
@ -511,6 +514,7 @@ def gen_blueprints(
# Tools and tool files.
headers_install_sh = 'headers_install.sh'
unifdef = 'unifdef'
kernel_headers_py = 'kernel_headers.py'
arm_syscall_tool = 'arch/arm/tools/syscallhdr.sh'
@ -658,7 +662,10 @@ def gen_blueprints(
f.write('genrule {\n')
f.write(' name: "qti_generate_kernel_headers_%s",\n' % header_arch)
f.write(' tools: ["%s"],\n' % headers_install_sh)
f.write(' tools: [\n')
f.write(' "%s",\n' % headers_install_sh)
f.write(' "%s",\n' % unifdef)
f.write(' ],\n')
f.write(' tool_files: [\n')
f.write(' "%s",\n' % kernel_headers_py)
@ -692,6 +699,7 @@ def gen_blueprints(
f.write(' "--arch_syscall_tbl $(location %s) " +\n' % arm_syscall_tbl)
f.write(' "--headers_install $(location %s) " +\n' % headers_install_sh)
f.write(' "--unifdef $(location %s) " +\n' % unifdef)
f.write(' "--include_uapi $(locations %s)",\n' % generic_src)
f.write(' out: ["linux/version.h"] + gen_headers_out_%s,\n' % header_arch)
f.write('}\n')
@ -746,7 +754,7 @@ def headers_diff(old_file, new_file):
def gen_headers(
verbose, header_arch, gen_dir, arch_asm_kbuild, asm_generic_kbuild, module_dir,
old_gen_headers_bp, new_gen_headers_bp, version_makefile,
arch_syscall_tool, arch_syscall_tbl, headers_install, include_uapi,
arch_syscall_tool, arch_syscall_tbl, headers_install, unifdef, include_uapi,
arch_include_uapi, techpack_include_uapi):
"""Generate the kernel headers.
@ -768,6 +776,7 @@ def gen_headers(
arch_syscall_tool: The arch script that generates syscall headers.
arch_syscall_tbl: The arch script that defines syscall vectors.
headers_install: The headers_install tool to process input headers.
unifdef: The unifdef tool used by headers_install.
include_uapi: The list of include/uapi header files.
arch_include_uapi: The list of arch/<arch>/include/uapi header files.
Return:
@ -795,20 +804,20 @@ def gen_headers(
for h in include_uapi:
if not run_headers_install(
verbose, gen_dir, headers_install,
verbose, gen_dir, headers_install, unifdef,
uapi_include_prefix, h):
error_count += 1
for h in arch_include_uapi:
if not run_headers_install(
verbose, gen_dir, headers_install,
verbose, gen_dir, headers_install, unifdef,
arch_uapi_include_prefix, h):
error_count += 1
for h in techpack_include_uapi:
techpack_uapi_include_prefix = os.path.join(h.split('/include/uapi')[0], 'include', 'uapi') + os.sep
if not run_headers_install(
verbose, gen_dir, headers_install,
verbose, gen_dir, headers_install, unifdef,
techpack_uapi_include_prefix, h):
error_count += 1
@ -935,6 +944,10 @@ def main():
'--headers_install',
required=True,
help='The headers_install tool to process input headers.')
parser_headers.add_argument(
'--unifdef',
required=True,
help='The unifdef tool used by headers_install.')
parser_headers.add_argument(
'--include_uapi',
required=True,
@ -983,12 +996,14 @@ def main():
print('arch_syscall_tool [%s]' % args.arch_syscall_tool)
print('arch_syscall_tbl [%s]' % args.arch_syscall_tbl)
print('headers_install [%s]' % args.headers_install)
print('unifdef [%s]' % args.unifdef)
return gen_headers(
args.verbose, args.header_arch, args.gen_dir, args.arch_asm_kbuild,
args.asm_generic_kbuild, module_dir, args.old_gen_headers_bp, args.new_gen_headers_bp,
args.version_makefile, args.arch_syscall_tool, args.arch_syscall_tbl,
args.headers_install, args.include_uapi, args.arch_include_uapi, args.techpack_include_uapi)
args.headers_install, args.unifdef, args.include_uapi, args.arch_include_uapi,
args.techpack_include_uapi)
print('error: unknown mode: %s' % args.mode)
return 1