def set_config(type, macro, macro_val, macro_cfg, env_type=None, env_mod_type=None, depends=None): type_list = ['module', 'lib_cfg', 'env_cfg'] if type not in type_list: print('[ERROR] type err') sys.exit(1) elif type == 'module': if scons_get_cfg_val(macro) == macro_val: compile_module.append(macro_cfg) elif type == 'lib_cfg': if scons_get_cfg_val(macro) == macro_val: for mod in macro_cfg: libs = macro_cfg[mod] for lib in libs: src = macro_cfg[mod][lib] if lib not in proj_lib_cfg[mod]: proj_lib_cfg[mod][lib] = src else: proj_lib_cfg[mod][lib].extend(src) elif type == 'env_cfg': cfg = select_added_cfg(macro, macro_val, macro_cfg, depends) if cfg is not None: proj_environment[env_type][env_mod_type].extend(cfg) set_str_2make(type, macro, macro_val, macro_cfg, env_type, env_mod_type, depends)
# main function # if __name__ == '__main__': args = len(sys.argv) list = ['boot_ota', 'ota', 'burn_bin', 'ota_compress', 'factory_bin'] if args >= 6 and sys.argv[1] in list: type = sys.argv[1] app_name = sys.argv[2] sign_alg = int(sys.argv[3], 16) kernel_file_ver = int(sys.argv[4]) flashboot_file_ver = int(sys.argv[5]) target = sys.argv[6] usr_output = sys.argv[7].split('=')[1] if len( sys.argv[7].split('=')) == 2 else '' ota_flag = 1 if scons_get_cfg_val( 'CONFIG_COMPRESSION_OTA_SUPPORT') != 'y' else 0 chip_product = 'Hi3861' if scons_get_cfg_val( 'CONFIG_TARGET_CHIP_HI3861') == 'y' else 'Hi3861L' fu = ImageBuild(app_name, sign_alg, kernel_file_ver, flashboot_file_ver, chip_product, usr_realtive_output=usr_output, ota_mode=ota_flag) fu.set_pkt_path(os.path.join(root_path, usr_output, 'output', 'bin')) bootBinPath = os.path.join(root_path, usr_output, 'output', 'bin', '%s_boot_signed.bin' % chip_product) fu.set_src_path(bootBinPath) fu.set_file_attr_encrypt(0x1) if scons_get_cfg_val( 'CONFIG_FLASH_ENCRYPT_SUPPORT') != 'y' else None
kernel_file_ver = int(sys.argv[4]) flashboot_file_ver = int(sys.argv[5]) target = sys.argv[6] usr_output = sys.argv[7].split('=')[1] if len( sys.argv[7].split('=')) == 2 else '' usr_output = os.path.join('..', '..', usr_output) fu = ImageBuild(app_name, sign_alg, kernel_file_ver, flashboot_file_ver, usr_realtive_output=usr_output) fu.set_pkt_path(os.path.join(root_path, usr_output, 'output', 'bin')) bootBinPath = os.path.join(root_path, usr_output, 'output', 'bin', 'Hi3861_boot_signed.bin') fu.set_src_path(bootBinPath) fu.set_file_attr_encrypt(0x1) if scons_get_cfg_val( 'CONFIG_FLASH_ENCRYPT_SUPPORT') != 'y' else None fu.set_flashboot_file_attr_ota(0x3) if scons_get_cfg_val( 'CONFIG_COMPRESSION_OTA_SUPPORT') != 'y' else None if type == 'boot_ota': print('boot_ota') fu.BuildUpgBoot(target) elif type == 'ota': print('ota') kernelBinPath = sys.argv[8] sign = 1 if sys.argv[9] == 'A' else 2 fu.set_src_path(kernel_bin_path=kernelBinPath) fu.set_kernel_max_size(sign) if scons_get_cfg_val( 'CONFIG_COMPRESSION_OTA_SUPPORT' ) != 'y' else fu.set_kernel_max_size(0) fu.set_kernel_file_attr_ota(sign) if scons_get_cfg_val( 'CONFIG_COMPRESSION_OTA_SUPPORT') != 'y' else None
'-fsanitize=kernel-address', '-fasan-shadow-offset=1835008', '--param asan-stack=1', '-fsanitize=bounds-strict' ], 'opts', 'common', depends=('LOSCFG_KASAN_LITEOS_NET_COAP', 'y')) # -------------------------------hilink support------------------------------- if scons_usr_bool_option('CONFIG_HILINK') == 'y': os_lib_path.append(os.path.join('components', 'hilink', 'lib')) set_config('module', 'CONFIG_HILINK', 'y', 'hilink') set_config('env_cfg', 'CONFIG_HILINK', 'y', ['CONFIG_HILINK'], 'defines', 'common') # -------------------------------OHOS support------------------------------- if scons_get_cfg_val('CONFIG_OHOS') == 'y': os_lib_path.append(os.path.join('components', 'OHOS', 'ndk', 'libs')) set_config('module', 'CONFIG_OHOS', 'y', 'OHOS') set_config('env_cfg', 'CONFIG_OHOS', 'y', [ 'CONFIG_OHOS', ('HOS_PRODUCT_TYPE', r'\"\"'), ('HOS_SERIAL', r'\"\"'), ('HOS_MANUFACTURE', r'\"\"'), ('HOS_BRAND', r'\"\"'), ('HOS_MARKET_NAME', r'\"\"'), ('HOS_PRODUCT_SERIES', r'\"\"'), ('HOS_PRODUCT_MODEL', r'\"\"'), ('HOS_SOFTWARE_MODEL', r'\"\"'), ('HOS_HARDWARE_MODEL', r'\"\"'), ('HOS_HARDWARE_PROFILE', r'\"\"'), ('HOS_BOOTLOADER_VERSION', r'\"\"'), ('HOS_SECURITY_PATCH_TAG', r'\"\"'), ('HOS_ABI_LIST', r'\"\"'), ('HOS_INCREMENTAL_VERSION', r'\"OHOS_2.0.1.28\"'), ('HOS_BUILD_TYPE', r'\"release\"'), ('HOS_BUILD_USER', r'\"jenkins\"'), ('HOS_BUILD_TIME', r'\"2020-09-15_15:30:38\"'), ('HOS_BUILD_HOST', r'\"linux\"'), ('HOS_BUILD_ROOTHASH', r'\"\"') ], 'defines', 'common')