1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") 16import("$hdf_framework_path/tools/hc-gen/hc_gen.gni") 17 18hcs_source = "hdf.hcs" 19if (product_company == "openharmony") { 20 hcs_file = "default/$hcs_source" 21} else { 22 hcs_file = 23 "//vendor/$product_company/$product_name/hdf_config/uhdf/$hcs_source" 24} 25 26hc_gen("build_hcs") { 27 sources = [ rebase_path(hcs_file) ] 28 outputs = [ "$target_gen_dir/hdf_default.hcb" ] 29} 30 31ohos_prebuilt_etc("hdf_default.hcb") { 32 deps = [ ":build_hcs" ] 33 hcs_outputs = get_target_outputs(":build_hcs") 34 source = hcs_outputs[0] 35 relative_install_dir = "hdfconfig" 36 install_images = [ chipset_base_dir ] 37 subsystem_name = "hdf" 38 part_name = "hdf_core" 39} 40 41hc_gen_start_cfg("gen_start_cfg") { 42 sources = [ rebase_path(hcs_file) ] 43 outputs = [ "$target_gen_dir/hdf_devhost.cfg" ] 44} 45 46ohos_prebuilt_etc("hdf_devhost.cfg") { 47 deps = [ ":gen_start_cfg" ] 48 outputs = get_target_outputs(":gen_start_cfg") 49 source = outputs[0] 50 relative_install_dir = "init" 51 install_images = [ chipset_base_dir ] 52 subsystem_name = "hdf" 53 part_name = "hdf_core" 54} 55 56group("hcs_entry") { 57 deps = [] 58 hcs_file_path = rebase_path("$hcs_file") 59 if (exec_script( 60 "//build/lite/run_shell_cmd.py", 61 [ "if [ -f ${hcs_file_path} ]; then echo true; else echo false; fi" ], 62 "value")) { 63 deps += [ 64 ":hdf_default.hcb", 65 ":hdf_devhost.cfg", 66 ] 67 } 68} 69