-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
msm: camera: export UAPI header files
Export UAPI header files for userspace to use them. Correct header file inclusion within a file. Change-Id: Ifc6736a32a8597537e2f50aa61febae89af626a9 Signed-off-by: Nirmal Abraham <[email protected]>
- Loading branch information
Nirmal Abraham
committed
Sep 7, 2022
1 parent
7d19958
commit 15a3a59
Showing
10 changed files
with
155 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
headers_src = [ | ||
"include/uapi/*/**/*.h", | ||
] | ||
|
||
camera_headers_out = [ | ||
"media/cam_cpas.h", | ||
"media/cam_custom.h", | ||
"media/cam_defs.h", | ||
"media/cam_fd.h", | ||
"media/cam_icp.h", | ||
"media/cam_isp.h", | ||
"media/cam_isp_ife.h", | ||
"media/cam_isp_tfe.h", | ||
"media/cam_isp_vfe.h", | ||
"media/cam_jpeg.h", | ||
"media/cam_lrme.h", | ||
"media/cam_ope.h", | ||
"media/cam_req_mgr.h", | ||
"media/cam_sensor.h", | ||
"media/cam_sync.h", | ||
"media/cam_tfe.h", | ||
] | ||
|
||
camera_kernel_headers_verbose = "--verbose " | ||
genrule { | ||
name: "qti_generate_camera_kernel_headers", | ||
tools: ["headers_install.sh", | ||
"unifdef" | ||
], | ||
tool_files: [ | ||
"camera_kernel_headers.py", | ||
], | ||
srcs: headers_src, | ||
cmd: "python3 -u $(location camera_kernel_headers.py) " + | ||
camera_kernel_headers_verbose + | ||
"--header_arch arm64 " + | ||
"--gen_dir $(genDir) " + | ||
"--camera_include_uapi $(locations include/uapi/*/**/*.h) " + | ||
"--unifdef $(location unifdef) " + | ||
"--headers_install $(location headers_install.sh)", | ||
out: camera_headers_out, | ||
} | ||
|
||
cc_library_headers { | ||
name: "qti_camera_kernel_uapi", | ||
generated_headers: ["qti_generate_camera_kernel_headers"], | ||
export_generated_headers: ["qti_generate_camera_kernel_headers"], | ||
vendor: true, | ||
recovery_available: true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. | ||
|
||
import argparse | ||
import filecmp | ||
import os | ||
import re | ||
import subprocess | ||
import sys | ||
|
||
def run_headers_install(verbose, gen_dir, headers_install, unifdef, prefix, h): | ||
if not h.startswith(prefix): | ||
print('error: expected prefix [%s] on header [%s]' % (prefix, h)) | ||
return False | ||
|
||
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() | ||
env["LOC_UNIFDEF"] = unifdef | ||
cmd = ["sh", headers_install, h, out_h] | ||
|
||
if verbose: | ||
print('run_headers_install: cmd is %s' % cmd) | ||
|
||
result = subprocess.call(cmd, env=env) | ||
|
||
if result != 0: | ||
print('error: run_headers_install: cmd %s failed %d' % (cmd, result)) | ||
return False | ||
return True | ||
|
||
def gen_camera_headers(verbose, gen_dir, headers_install, unifdef, camera_include_uapi): | ||
error_count = 0 | ||
for h in camera_include_uapi: | ||
camera_uapi_include_prefix = os.path.join(h.split('/include/uapi/camera')[0], | ||
'include', | ||
'uapi', | ||
'camera') + os.sep | ||
|
||
if not run_headers_install( | ||
verbose, gen_dir, headers_install, unifdef, | ||
camera_uapi_include_prefix, h): error_count += 1 | ||
return error_count | ||
|
||
def main(): | ||
"""Parse command line arguments and perform top level control.""" | ||
parser = argparse.ArgumentParser( | ||
description=__doc__, | ||
formatter_class=argparse.RawDescriptionHelpFormatter) | ||
|
||
# Arguments that apply to every invocation of this script. | ||
parser.add_argument( | ||
'--verbose', action='store_true', | ||
help='Print output that describes the workings of this script.') | ||
parser.add_argument( | ||
'--header_arch', required=True, | ||
help='The arch for which to generate headers.') | ||
parser.add_argument( | ||
'--gen_dir', required=True, | ||
help='Where to place the generated files.') | ||
parser.add_argument( | ||
'--camera_include_uapi', required=True, nargs='*', | ||
help='The list of techpack/*/include/uapi header files.') | ||
parser.add_argument( | ||
'--headers_install', required=True, | ||
help='The headers_install tool to process input headers.') | ||
parser.add_argument( | ||
'--unifdef', | ||
required=True, | ||
help='The unifdef tool used by headers_install.') | ||
|
||
args = parser.parse_args() | ||
|
||
if args.verbose: | ||
print('header_arch [%s]' % args.header_arch) | ||
print('gen_dir [%s]' % args.gen_dir) | ||
print('camera_include_uapi [%s]' % args.camera_include_uapi) | ||
print('headers_install [%s]' % args.headers_install) | ||
print('unifdef [%s]' % args.unifdef) | ||
|
||
return gen_camera_headers(args.verbose, args.gen_dir, | ||
args.headers_install, args.unifdef, args.camera_include_uapi) | ||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters