1# Copyright (c) 2023 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/kernel/kernel.gni") 15 16template("ohos_build_ko") { 17 _device_name = invoker.device_name 18 _arch = invoker.device_arch 19 _target_ko_name = invoker.target_ko_name 20 action("${target_name}") { 21 sources = invoker.sources 22 sources_name = get_path_info(sources, "name") 23 source_path_info = get_path_info(sources[0], "dir") 24 ko_out_dir = "$root_out_dir/packages/phone/chip_ckm" 25 script = "//build/templates/kernel/${linux_kernel_version}/make_ko.sh" 26 args = [ 27 rebase_path(source_path_info, root_out_dir), 28 _target_ko_name, 29 rebase_path(ko_out_dir), 30 rebase_path("//"), 31 _device_name, 32 _arch, 33 ] 34 args += sources_name 35 if (is_standard_system && _device_name == "rk3568") { 36 deps = [ "//device/board/hihope/rk3568/kernel:kernel" ] 37 } 38 outputs = [ "$ko_out_dir/${_target_ko_name}.ko" ] 39 } 40} 41