camera_legacy: update camera uapi kernel headers installation

Due to camera legacy, the camera uapi kernel headers installation
routines need to be updated to consider the camera legacy support.
This commit fixes the routines to install kernel headers for
'make headers_install' and also 'qti_generate_kernel_headers_arm'
and 'qti_generate_kernel_headers_arm64'.

Change-Id: Iec98dad164d5efc0acaa8f90c29a9672efbe3142
Reviewed-on: https://gerrit.mot.com/2619497
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Rafael Ortolan <rafones@motorola.com>
Reviewed-by: Rav(CR) Vembu <raviv@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Gilberto Gambugge 2023-05-24 13:37:37 -03:00 • committed by Xiaojun Ji
commit 224f161870
5 changed files with 122 additions and 35 deletions

View file

@ -28,6 +28,109 @@ kernel_headers_verbose = ""
build = ["gen_headers_arm.bp", "gen_headers_arm64.bp"]
soong_config_module_type {
name: "mmi_camera_legacy_genrule_defaults",
module_type: "genrule_defaults",
config_namespace: "mmi_camera_legacy",
variables: ["board_config_camera_legacy_kernel"],
properties: ["cmd"],
}
soong_config_string_variable {
name: "board_config_camera_legacy_kernel",
values: ["enabled", "disabled"],
}
mmi_camera_legacy_genrule_defaults {
name: "mmi_kernel_headers_cmdrules_arm",
soong_config_variables: {
board_config_camera_legacy_kernel: {
disabled: {
cmd: "python3 $(location kernel_headers.py) " +
kernel_headers_verbose +
"--header_arch arm " +
"--gen_dir $(genDir) " +
"--arch_asm_kbuild $(location arch/arm/include/uapi/asm/Kbuild) " +
"--arch_include_uapi $(locations arch/arm/include/uapi/**/*.h) " +
"--techpack_include_uapi $(locations techpack/*/include/uapi/*/**/*.h) " +
"--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild) " +
"headers " +
"--old_gen_headers_bp $(location gen_headers_arm.bp) " +
"--new_gen_headers_bp $(location :qti_generate_gen_headers_arm) " +
"--version_makefile $(location Makefile) " +
"--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)",
},
enabled: {
cmd: "python3 $(location kernel_headers.py) " +
kernel_headers_verbose +
"--header_arch arm " +
"--gen_dir $(genDir) " +
"--arch_asm_kbuild $(location arch/arm/include/uapi/asm/Kbuild) " +
"--arch_include_uapi $(locations arch/arm/include/uapi/**/*.h) " +
"--techpack_include_uapi $(locations techpack/*/include/uapi/*/**/*.h) " +
"--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild) " +
"headers " +
"--old_gen_headers_bp $(location gen_headers_arm.bp) " +
"--new_gen_headers_bp $(location :qti_generate_gen_headers_arm) " +
"--version_makefile $(location Makefile) " +
"--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) " +
"--camera_legacy ",
},
},
},
}
mmi_camera_legacy_genrule_defaults {
name: "mmi_kernel_headers_cmdrules_arm64",
soong_config_variables: {
board_config_camera_legacy_kernel: {
disabled: {
cmd: "python3 $(location kernel_headers.py) " +
kernel_headers_verbose +
"--header_arch arm64 " +
"--gen_dir $(genDir) " +
"--arch_asm_kbuild $(location arch/arm64/include/uapi/asm/Kbuild) " +
"--arch_include_uapi $(locations arch/arm64/include/uapi/**/*.h) " +
"--techpack_include_uapi $(locations techpack/*/include/uapi/*/**/*.h) " +
"--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild) " +
"headers " +
"--old_gen_headers_bp $(location gen_headers_arm64.bp) " +
"--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)",
},
enabled: {
cmd: "python3 $(location kernel_headers.py) " +
kernel_headers_verbose +
"--header_arch arm64 " +
"--gen_dir $(genDir) " +
"--arch_asm_kbuild $(location arch/arm64/include/uapi/asm/Kbuild) " +
"--arch_include_uapi $(locations arch/arm64/include/uapi/**/*.h) " +
"--techpack_include_uapi $(locations techpack/*/include/uapi/*/**/*.h) " +
"--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild) " +
"headers " +
"--old_gen_headers_bp $(location gen_headers_arm64.bp) " +
"--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) " +
"--camera_legacy ",
},
},
},
}
cc_library_headers {
name: "qti_kernel_headers",
arch: {

View file

@ -1334,7 +1334,13 @@ PHONY += archheaders archscripts
hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
ifeq ($(BOARD_CONFIG_CAMERA_KERNEL_NAME),)
techpack-dirs := $(shell find $(srctree)/techpack -maxdepth 1 -mindepth 1 -type d -not -name ".*")
else
techpack-dirs := $(shell find $(srctree)/techpack -maxdepth 1 -mindepth 1 -type d -not -name ".*"\
| grep -v camera)
techpack-dirs += $(shell find $(srctree)/techpack -maxdepth 2 -mindepth 2 -name "$(BOARD_CONFIG_CAMERA_KERNEL_NAME)")
endif
techpack-dirs := $(subst $(srctree)/,,$(techpack-dirs))
PHONY += headers

View file

@ -1064,22 +1064,6 @@ genrule {
":qti_generate_gen_headers_arm",
],
exclude_srcs: gen_headers_exclude_srcs_arm,
cmd: "python3 $(location kernel_headers.py) " +
kernel_headers_verbose +
"--header_arch arm " +
"--gen_dir $(genDir) " +
"--arch_asm_kbuild $(location arch/arm/include/uapi/asm/Kbuild) " +
"--arch_include_uapi $(locations arch/arm/include/uapi/**/*.h) " +
"--techpack_include_uapi $(locations techpack/*/include/uapi/*/**/*.h) " +
"--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild) " +
"headers " +
"--old_gen_headers_bp $(location gen_headers_arm.bp) " +
"--new_gen_headers_bp $(location :qti_generate_gen_headers_arm) " +
"--version_makefile $(location Makefile) " +
"--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,
defaults: ["mmi_kernel_headers_cmdrules_arm"],
}

View file

@ -1058,20 +1058,6 @@ genrule {
":qti_generate_gen_headers_arm64",
],
exclude_srcs: gen_headers_exclude_srcs_arm64,
cmd: "python3 $(location kernel_headers.py) " +
kernel_headers_verbose +
"--header_arch arm64 " +
"--gen_dir $(genDir) " +
"--arch_asm_kbuild $(location arch/arm64/include/uapi/asm/Kbuild) " +
"--arch_include_uapi $(locations arch/arm64/include/uapi/**/*.h) " +
"--techpack_include_uapi $(locations techpack/*/include/uapi/*/**/*.h) " +
"--asm_generic_kbuild $(location include/uapi/asm-generic/Kbuild) " +
"headers " +
"--old_gen_headers_bp $(location gen_headers_arm64.bp) " +
"--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,
defaults: ["mmi_kernel_headers_cmdrules_arm64"],
}

View file

@ -754,7 +754,7 @@ 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, unifdef, include_uapi,
arch_include_uapi, techpack_include_uapi):
arch_include_uapi, techpack_include_uapi, camera_legacy):
"""Generate the kernel headers.
This script generates the version.h file, the arch-specific headers including
@ -781,7 +781,6 @@ def gen_headers(
Return:
The number of errors encountered.
"""
if headers_diff(old_gen_headers_bp, new_gen_headers_bp):
print('error: gen_headers blueprints file is out of date, suggested fix:')
print('#######Please add or remove the above mentioned headers from %s' % (old_gen_headers_bp))
@ -813,6 +812,10 @@ def gen_headers(
arch_uapi_include_prefix, h):
error_count += 1
if camera_legacy == True:
legacy_product = os.getenv('TARGET_PRODUCT').split("_", 1)[0]
techpack_include_uapi = [i.replace('techpack/camera','techpack/camera-legacy/' + legacy_product) for i in techpack_include_uapi]
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(
@ -952,6 +955,11 @@ def main():
required=True,
nargs='*',
help='The list of include/uapi header files.')
parser_headers.add_argument(
'--camera_legacy',
default=False,
action='store_true',
help='If set, define the camera legacy folder being used. By default, it\'s disabled.')
args = parser.parse_args()
@ -1002,7 +1010,7 @@ def main():
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.unifdef, args.include_uapi, args.arch_include_uapi,
args.techpack_include_uapi)
args.techpack_include_uapi, args.camera_legacy)
print('error: unknown mode: %s' % args.mode)
return 1