15f9996aaSopenharmony_ci#!/bin/bash 25f9996aaSopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd. 35f9996aaSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 45f9996aaSopenharmony_ci# you may not use this file except in compliance with the License. 55f9996aaSopenharmony_ci# You may obtain a copy of the License at 65f9996aaSopenharmony_ci# 75f9996aaSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 85f9996aaSopenharmony_ci# 95f9996aaSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 105f9996aaSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 115f9996aaSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 125f9996aaSopenharmony_ci# See the License for the specific language governing permissions and 135f9996aaSopenharmony_ci# limitations under the License. 145f9996aaSopenharmony_ci 155f9996aaSopenharmony_ciset -e 165f9996aaSopenharmony_ciSOURCE_FILE_DIR=${1} 175f9996aaSopenharmony_ciTARGET_KO_NAME=${2} 185f9996aaSopenharmony_ciOUT_DIR=${3} 195f9996aaSopenharmony_ciPROJECT_DIR=${4} 205f9996aaSopenharmony_ciDEVICE_NAME=${5} 215f9996aaSopenharmony_ciDEVICE_ARCH=${6} 225f9996aaSopenharmony_ci 235f9996aaSopenharmony_ciargs=("$@") 245f9996aaSopenharmony_ciafter_args=("${args[@]:6}") 255f9996aaSopenharmony_ci 265f9996aaSopenharmony_ciobj_list="" 275f9996aaSopenharmony_cifor item in "${after_args[@]}" 285f9996aaSopenharmony_cido 295f9996aaSopenharmony_ci obj_list+="$item.o" 305f9996aaSopenharmony_ci obj_list+="&" 315f9996aaSopenharmony_cidone 325f9996aaSopenharmony_ci 335f9996aaSopenharmony_cipushd ${SOURCE_FILE_DIR} 345f9996aaSopenharmony_cicp ${PROJECT_DIR}/build/templates/kernel/linux-6.6/Makefile . 355f9996aaSopenharmony_cicp ${PROJECT_DIR}/out/kernel/OBJ/linux-6.6/certs/signing_key.pem . 365f9996aaSopenharmony_ciexport PATH=${PROJECT_DIR}/out/kernel/OBJ/linux-6.6/scripts/:$PATH 375f9996aaSopenharmony_ci 385f9996aaSopenharmony_cimake PROJECTDIR=${PROJECT_DIR} DEVICENAME=${DEVICE_NAME} DEVICEARCH=${DEVICE_ARCH} TARGETKONAME=${TARGET_KO_NAME} OBJLIST=${obj_list} 395f9996aaSopenharmony_cisign-file sha512 signing_key.pem signing_key.pem *.ko 405f9996aaSopenharmony_ciif [ -d "${OUT_DIR}" ]; then 415f9996aaSopenharmony_ci echo "The ko build out dir exist" 425f9996aaSopenharmony_cielse 435f9996aaSopenharmony_ci mkdir ${OUT_DIR} 445f9996aaSopenharmony_cifi 455f9996aaSopenharmony_ci 465f9996aaSopenharmony_cicp -f *.ko ${OUT_DIR} 475f9996aaSopenharmony_cimake clean 485f9996aaSopenharmony_cirm -f Makefile 495f9996aaSopenharmony_cirm -rf signing_key.pem 505f9996aaSopenharmony_ciexit 0 51