1#!/bin/bash 2# Copyright (c) 2021 Huawei Device Co., Ltd. 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 2 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16set -e 17 18#$1 - kernel build script work dir 19#$2 - kernel build script stage dir 20#$3 - GN target output dir 21 22echo build_kernel 23pushd ${1} 24./kernel_module_build.sh ${2} ${4} ${5} ${6} ${7} ${8} 25mkdir -p ${3} 26rm -rf ${3}/../../../kernel.timestamp 27 28# it needs more adaptation 29if [ "$5" == "arm" ];then 30 cp ${2}/kernel/OBJ/${8}/arch/arm/boot/uImage ${3}/uImage 31if [ "$7" == "hispark_phoenix" ];then 32 cp ${2}/kernel/OBJ/${8}/arch/arm/boot/dts/hi3751v350.dtb ${3}/dtbo.img 33 cat ${2}/kernel/OBJ/${8}/arch/arm/boot/zImage ${3}/dtbo.img > ${3}/zImage-dtb 34else 35 cp ${2}/kernel/OBJ/${8}/arch/arm/boot/zImage-dtb ${3}/zImage-dtb 36fi 37 38elif [ "$5" == "arm64" ];then 39 cp ${2}/kernel/OBJ/${8}/arch/arm64/boot/Image ${3}/Image 40 41elif [ "$5" == "riscv64" ];then 42 cp ${2}/kernel/OBJ/${8}/arch/riscv/boot/Image ${3}/Image 43 44elif [ "$5" == "x86_64" ];then 45 cp ${2}/kernel/OBJ/${8}/arch/x86/boot/bzImage ${3}/bzImage 46fi 47 48popd 49