techpack: add camera legacy support

Add camera legacy support by checking BOARD_CONFIG_CAMERA_KERNEL_NAME
to decide which folder will be used to compile the camera techpack.
Also, due to camera legacy, the camera uapi kernel headers installation
routines need to be updated to consider the camera legacy support.
This commit also 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: I845c5cb49c388bc15eba2fbf0ed0724e93de5192
Reviewed-on: https://gerrit.mot.com/2632695
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Reviewed-by: Rafael Ortolan <rafones@motorola.com>
Reviewed-by: Rav(CR) Vembu <raviv@motorola.com>
Reviewed-by: Miguel Nicodemus <miguelh@motorola.com>
Tested-by: Jira Key
Submit-Approved: Jira Key
This commit is contained in:
Gilberto Gambugge authored and Gilberto Gambugge Neto committed 2023-06-12 18:49:53 -05:00
1 parent 73fa1b6be0
commit 657b260037
6 files changed
+154 -36

No files matched your search

+103
View File
@@ -28,6 +28,109 @@ kernel_headers_verbose = ""
build = ["gen_headers_arm.bp", "gen_headers_arm64.bp"] 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.asm) " +
"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.asm) " +
"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.asm) " +
"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.asm) " +
"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 { cc_library_headers {
name: "qti_kernel_headers", name: "qti_kernel_headers",
arch: { arch: {
+1 -17
View File
@@ -1035,22 +1035,6 @@ genrule {
":qti_generate_gen_headers_arm", ":qti_generate_gen_headers_arm",
], ],
exclude_srcs: gen_headers_exclude_srcs_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.asm) " +
"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, out: ["linux/version.h"] + gen_headers_out_arm,
defaults: ["mmi_kernel_headers_cmdrules_arm"],
} }
+1 -15
View File
@@ -1028,20 +1028,6 @@ genrule {
":qti_generate_gen_headers_arm64", ":qti_generate_gen_headers_arm64",
], ],
exclude_srcs: gen_headers_exclude_srcs_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.asm) " +
"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, out: ["linux/version.h"] + gen_headers_out_arm64,
defaults: ["mmi_kernel_headers_cmdrules_arm64"],
} }
+12 -2
View File
@@ -755,7 +755,7 @@ def gen_headers(
verbose, header_arch, gen_dir, arch_asm_kbuild, asm_generic_kbuild, module_dir, verbose, header_arch, gen_dir, arch_asm_kbuild, asm_generic_kbuild, module_dir,
old_gen_headers_bp, new_gen_headers_bp, version_makefile, old_gen_headers_bp, new_gen_headers_bp, version_makefile,
arch_syscall_tool, arch_syscall_tbl, headers_install, unifdef, include_uapi, 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. """Generate the kernel headers.
This script generates the version.h file, the arch-specific headers including This script generates the version.h file, the arch-specific headers including
@@ -814,6 +814,11 @@ def gen_headers(
arch_uapi_include_prefix, h): arch_uapi_include_prefix, h):
error_count += 1 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: for h in techpack_include_uapi:
techpack_uapi_include_prefix = os.path.join(h.split('/include/uapi')[0], 'include', 'uapi') + os.sep techpack_uapi_include_prefix = os.path.join(h.split('/include/uapi')[0], 'include', 'uapi') + os.sep
if not run_headers_install( if not run_headers_install(
@@ -953,6 +958,11 @@ def main():
required=True, required=True,
nargs='*', nargs='*',
help='The list of include/uapi header files.') 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() args = parser.parse_args()
@@ -1003,7 +1013,7 @@ def main():
args.asm_generic_kbuild, module_dir, args.old_gen_headers_bp, args.new_gen_headers_bp, 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.version_makefile, args.arch_syscall_tool, args.arch_syscall_tbl,
args.headers_install, args.unifdef, args.include_uapi, args.arch_include_uapi, 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) print('error: unknown mode: %s' % args.mode)
return 1 return 1
+16
View File
@@ -35,13 +35,29 @@ $(subdirs):
# We have only sub-directories there. # We have only sub-directories there.
skip-inst := $(if $(filter %/uapi,$(obj)),1) skip-inst := $(if $(filter %/uapi,$(obj)),1)
ifeq ($(skip-inst),)
ifeq ($(BOARD_CONFIG_CAMERA_KERNEL_NAME),)
skip-inst := $(if $(filter legacy,$(obj)),1)
else
ifneq (, $(findstring camera, $(obj)))
ifeq (, $(findstring $(BOARD_CONFIG_CAMERA_KERNEL_NAME), $(obj)))
skip-inst := 1
endif
endif
endif
endif
ifeq ($(skip-inst),) ifeq ($(skip-inst),)
# Kbuild file is optional # Kbuild file is optional
kbuild-file := $(srctree)/$(obj)/Kbuild kbuild-file := $(srctree)/$(obj)/Kbuild
-include $(kbuild-file) -include $(kbuild-file)
ifeq (, $(findstring $(BOARD_CONFIG_CAMERA_KERNEL_NAME), $(obj)))
installdir := $(INSTALL_HDR_PATH)/$(dst) installdir := $(INSTALL_HDR_PATH)/$(dst)
else
installdir := $(INSTALL_HDR_PATH)/$(subst camera-legacy/$(BOARD_CONFIG_CAMERA_KERNEL_NAME),camera,$(dst))
endif
gendir := $(objtree)/$(subst include/,include/generated/,$(obj)) gendir := $(objtree)/$(subst include/,include/generated/,$(obj))
header-files := $(notdir $(wildcard $(srcdir)/*.h)) header-files := $(notdir $(wildcard $(srcdir)/*.h))
header-files += $(notdir $(wildcard $(srcdir)/*.agh)) header-files += $(notdir $(wildcard $(srcdir)/*.agh))
+21 -2
View File
@@ -1,8 +1,27 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
TECHPACK?=y TECHPACK?=y
techpack-dirs := $(shell find $(srctree)/techpack -maxdepth 1 -mindepth 1 -type d -not -name ".*") ifeq ($(BOARD_CONFIG_CAMERA_KERNEL_NAME),)
$(info "using default camera path")
techpack-dirs := $(shell find $(srctree)/techpack -maxdepth 1 -mindepth 1 -type d -not -name ".*"\
| grep -v legacy)
else
$(info "using camera-legacy/$(BOARD_CONFIG_CAMERA_KERNEL_NAME)")
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
obj-${TECHPACK} += stub/ $(addsuffix /,$(subst $(srctree)/techpack/,,$(techpack-dirs))) obj-${TECHPACK} += stub/ $(addsuffix /,$(subst $(srctree)/techpack/,,$(techpack-dirs)))
techpack-header-dirs := $(shell find $(srctree)/techpack -maxdepth 1 -mindepth 1 -type d -not -name ".*") ifeq ($(BOARD_CONFIG_CAMERA_KERNEL_NAME),)
$(info "using default camera path")
techpack-header-dirs := $(shell find $(srctree)/techpack -maxdepth 1 -mindepth 1 -type d -not -name ".*"\
| grep -v legacy)
else
$(info "using camera-legacy/$(BOARD_CONFIG_CAMERA_KERNEL_NAME)")
techpack-header-dirs := $(shell find $(srctree)/techpack -maxdepth 1 -mindepth 1 -type d -not -name ".*"\
| grep -v camera)
techpack-header-dirs += $(shell find $(srctree)/techpack -maxdepth 2 -mindepth 2 -name "$(BOARD_CONFIG_CAMERA_KERNEL_NAME)")
endif
header-${TECHPACK} += $(addsuffix /include/uapi/,$(subst $(srctree)/techpack/,,$(techpack-header-dirs))) header-${TECHPACK} += $(addsuffix /include/uapi/,$(subst $(srctree)/techpack/,,$(techpack-header-dirs)))