• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
18export OUT_DIR=$1
19export BUILD_TYPE=$2
20export KERNEL_ARCH=$3
21export PRODUCT_PATH=$4
22export DEVICE_NAME=$5
23export KERNEL_VERSION=$6
24if [ "$BUILD_TYPE" == "small" ];then
25    LINUX_KERNEL_OUT=${OUT_DIR}/kernel/${KERNEL_VERSION}
26elif [ "$BUILD_TYPE" == "standard" ];then
27    LINUX_KERNEL_OUT=${OUT_DIR}/kernel/src_tmp/${KERNEL_VERSION}
28fi
29LINUX_KERNEL_OBJ_OUT=${OUT_DIR}/kernel/OBJ/${KERNEL_VERSION}
30
31export OHOS_ROOT_PATH=$(pwd)/../../..
32# it needs adaptation for more device target
33kernel_image=""
34if [ "$KERNEL_ARCH" == "arm" ];then
35    kernel_image="uImage"
36elif [ "$KERNEL_ARCH" == "arm64" ];then
37    kernel_image="Image"
38elif [ "$KERNEL_ARCH" == "x86_64" ];then
39    kernel_image="bzImage"
40fi
41export KERNEL_IMAGE=${kernel_image}
42LINUX_KERNEL_IMAGE_FILE=${LINUX_KERNEL_OBJ_OUT}/arch/${KERNEL_ARCH}/boot/${kernel_image}
43
44if [ "$DEVICE_NAME" == "hispark_phoenix"  ];then
45export SDK_SOURCE_DIR=${OHOS_ROOT_PATH}/device/soc/hisilicon/hi3751v350/sdk_linux/source
46fi
47
48make -f kernel.mk
49
50if [ -f "${LINUX_KERNEL_IMAGE_FILE}" ];then
51    echo "Image: ${LINUX_KERNEL_IMAGE_FILE} build success"
52else
53    echo "Image: ${LINUX_KERNEL_IMAGE_FILE} build failed!!!"
54    exit 1
55fi
56
57if [ "$5" == "hispark_taurus" ];then
58    cp -rf ${LINUX_KERNEL_IMAGE_FILE} ${OUT_DIR}/uImage_${DEVICE_NAME}_smp
59fi
60
61exit 0
62