# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos/kernel/kernel.gni")
template("ohos_build_ko") {
_device_name = invoker.device_name
_arch = invoker.device_arch
_target_ko_name = invoker.target_ko_name
action("${target_name}") {
sources = invoker.sources
sources_name = get_path_info(sources, "name")
source_path_info = get_path_info(sources[0], "dir")
ko_out_dir = "$root_out_dir/packages/phone/chip_ckm"
script = "//build/templates/kernel/${linux_kernel_version}/make_ko.sh"
args = [
rebase_path(source_path_info, root_out_dir),
_target_ko_name,
rebase_path(ko_out_dir),
rebase_path("//"),
_device_name,
_arch,
]
args += sources_name
if (is_standard_system && _device_name == "rk3568") {
deps = [ "//device/board/hihope/rk3568/kernel:kernel" ]
}
outputs = [ "$ko_out_dir/${_target_ko_name}.ko" ]
}
}