@ -522,7 +522,7 @@ def gen_blueprints(
arch_prefix = os . path . join ( ' arch ' , header_arch , generic_prefix )
generic_src = os . path . join ( generic_prefix , rel_glob )
arch_src = os . path . join ( arch_prefix , rel_glob )
techpack_src = ' techpack/* '
techpack_src = os . path . join ( ' techpack/* ' , generic_prefix , ' * ' , rel_glob )
# Excluded sources, architecture specific.
exclude_srcs = [ ]
@ -561,7 +561,27 @@ def gen_blueprints(
f . write ( ' // ***** DO NOT EDIT ***** \n ' )
f . write ( ' // This file is generated by %s \n ' % kernel_headers_py )
f . write ( ' \n ' )
f . write ( ' gen_headers_ %s = [ \n ' % header_arch )
f . write ( ' gen_headers_srcs_ %s = [ \n ' % header_arch )
f . write ( ' " %s " , \n ' % rel_arch_asm_kbuild )
f . write ( ' " %s " , \n ' % rel_asm_generic_kbuild )
f . write ( ' " %s " , \n ' % makefile )
if header_arch == " arm " :
f . write ( ' " %s " , \n ' % arm_syscall_tbl )
f . write ( ' " %s " , \n ' % generic_src )
f . write ( ' " %s " , \n ' % arch_src )
f . write ( ' ] \n ' )
f . write ( ' \n ' )
if exclude_srcs :
f . write ( ' gen_headers_exclude_srcs_ %s = [ \n ' % header_arch )
for h in exclude_srcs :
f . write ( ' " %s " , \n ' % os . path . join ( generic_prefix , h ) )
f . write ( ' ] \n ' )
f . write ( ' \n ' )
f . write ( ' gen_headers_out_ %s = [ \n ' % header_arch )
if generated_list :
f . write ( ' \n ' )
@ -616,7 +636,10 @@ def gen_blueprints(
f . write ( ' // checked later to ensure that it matches the checked- \n ' )
f . write ( ' // in version (this file). \n ' )
f . write ( ' name: " %s " , \n ' % gen_blueprints_module_name )
f . write ( ' srcs: [ " %s " , " %s " , " %s " ], \n ' % ( rel_arch_asm_kbuild , rel_asm_generic_kbuild , arch_src ) )
f . write ( ' srcs: gen_headers_srcs_ %s , \n ' % header_arch )
if exclude_srcs :
f . write ( ' exclude_srcs: gen_headers_exclude_srcs_ %s , \n ' % header_arch )
f . write ( ' tool_files: [ " kernel_headers.py " ], \n ' )
f . write ( ' cmd: " python3 $(location kernel_headers.py) " + \n ' )
f . write ( ' kernel_headers_verbose + \n ' )
@ -625,7 +648,8 @@ def gen_blueprints(
f . write ( ' " --arch_asm_kbuild $(location %s ) " + \n ' % rel_arch_asm_kbuild )
f . write ( ' " --arch_include_uapi $(locations %s ) " + \n ' % arch_src )
f . write ( ' " --asm_generic_kbuild $(location %s ) " + \n ' % rel_asm_generic_kbuild )
f . write ( ' " blueprints " , \n ' )
f . write ( ' " blueprints " + \n ' )
f . write ( ' " # $(in) " , \n ' )
f . write ( ' out: [ " gen_headers_ %s .bp " ], \n ' % header_arch )
f . write ( ' } \n ' )
f . write ( ' \n ' )
@ -640,25 +664,13 @@ def gen_blueprints(
f . write ( ' " %s " , \n ' % arm_syscall_tool )
f . write ( ' ], \n ' )
f . write ( ' srcs: [ \n ' )
f . write ( ' " %s " , \n ' % rel_arch_asm_kbuild )
f . write ( ' " %s " , \n ' % rel_asm_generic_kbuild )
f . write ( ' srcs: gen_headers_srcs_ %s +[ \n ' % header_arch )
f . write ( ' " %s " , \n ' % old_gen_headers_bp )
f . write ( ' " : %s " , \n ' % gen_blueprints_module_name )
f . write ( ' " %s " , \n ' % makefile )
if header_arch == " arm " :
f . write ( ' " %s " , \n ' % arm_syscall_tbl )
f . write ( ' " %s " , \n ' % generic_src )
f . write ( ' " %s " , \n ' % arch_src )
f . write ( ' ], \n ' )
if exclude_srcs :
f . write ( ' exclude_srcs: [ \n ' )
for h in exclude_srcs :
f . write ( ' " %s " , \n ' % os . path . join ( generic_prefix , h ) )
f . write ( ' ], \n ' )
f . write ( ' exclude_srcs: gen_headers_exclude_srcs_ %s , \n ' % header_arch )
f . write ( ' cmd: " python3 $(location %s ) " + \n ' % kernel_headers_py )
f . write ( ' kernel_headers_verbose + \n ' )
@ -678,14 +690,14 @@ def gen_blueprints(
f . write ( ' " --headers_install $(location %s ) " + \n ' % headers_install_sh )
f . write ( ' " --include_uapi $(locations %s ) " , \n ' % generic_src )
f . write ( ' out: [ " linux/version.h " ] + gen_headers_ %s , \n ' % header_arch )
f . write ( ' out: [ " linux/version.h " ] + gen_headers_out_ %s , \n ' % header_arch )
f . write ( ' } \n ' )
return 0
def parse_bp_for_headers ( file_name , headers ) :
parsing_headers = False
pattern = re . compile ( " gen_headers_[a-zA-Z0-9]+ \ s*= \ s* \ [ \ s* " )
pattern = re . compile ( " gen_headers_out_ [a-zA-Z0-9]+ \ s*= \ s* \ [ \ s* " )
with open ( file_name , ' r ' ) as f :
for line in f :
line = line . strip ( )
@ -949,13 +961,13 @@ def main():
if args . verbose :
print ( ' module_dir [ %s ] ' % module_dir )
# Get list of techpack uapi headers to be exported from techpack/* directories.
techpack_uapi = extract_techpack_uapi_headers ( args . verbose , module_dir )
techpack_include_uapi = [ ]
if args . mode == ' blueprints ' :
return gen_blueprints (
args . verbose , args . header_arch , args . gen_dir , args . arch_asm_kbuild ,
args . asm_generic_kbuild , module_dir , rel_arch_asm_kbuild , rel_asm_generic_kbuild , args . arch_include_uapi , techpack_uapi )
args . asm_generic_kbuild , module_dir , rel_arch_asm_kbuild , rel_asm_generic_kbuild , args . arch_include_uapi , techpack_include_ uapi )
if args . mode == ' headers ' :
if args . verbose :
@ -970,7 +982,7 @@ def main():
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 , techpack_uapi )
args . headers_install , args . include_uapi , args . arch_include_uapi , techpack_include_ uapi )
print ( ' error: unknown mode: %s ' % args . mode )
return 1