18d6344f9Sopenharmony_ci#!/bin/bash
28d6344f9Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
38d6344f9Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
48d6344f9Sopenharmony_ci# you may not use this file except in compliance with the License.
58d6344f9Sopenharmony_ci# You may obtain a copy of the License at
68d6344f9Sopenharmony_ci#
78d6344f9Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
88d6344f9Sopenharmony_ci#
98d6344f9Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
108d6344f9Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
118d6344f9Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128d6344f9Sopenharmony_ci# See the License for the specific language governing permissions and
138d6344f9Sopenharmony_ci# limitations under the License.
148d6344f9Sopenharmony_ci
158d6344f9Sopenharmony_ci#kernel deps dir, must be a git repo
168d6344f9Sopenharmony_ciDEPS=(
178d6344f9Sopenharmony_ci    "kernel/linux/build"
188d6344f9Sopenharmony_ci    "kernel/linux/linux-5.10"
198d6344f9Sopenharmony_ci    "kernel/linux/linux-6.6"
208d6344f9Sopenharmony_ci    "kernel/linux/patches"
218d6344f9Sopenharmony_ci    "kernel/linux/config"
228d6344f9Sopenharmony_ci    "kernel/linux/common_modules"
238d6344f9Sopenharmony_ci    "third_party/bounds_checking_function"
248d6344f9Sopenharmony_ci    "device/soc/hisilicon/common/platform/wifi"
258d6344f9Sopenharmony_ci    "third_party/FreeBSD/sys/dev/evdev"
268d6344f9Sopenharmony_ci    "drivers/hdf_core"
278d6344f9Sopenharmony_ci)
288d6344f9Sopenharmony_ci
298d6344f9Sopenharmony_cicase $(uname -m) in
308d6344f9Sopenharmony_ci    aarch64)
318d6344f9Sopenharmony_ci        DEPS+=("prebuilts/clang/ohos/linux-aarch64/llvm/bin")
328d6344f9Sopenharmony_ci        ;;
338d6344f9Sopenharmony_ci    *)
348d6344f9Sopenharmony_ci        DEPS+=("prebuilts/clang/ohos/linux-x86_64/llvm/bin")
358d6344f9Sopenharmony_ciesac
368d6344f9Sopenharmony_ci
378d6344f9Sopenharmony_cifunction is_kernel_change
388d6344f9Sopenharmony_ci{
398d6344f9Sopenharmony_ci    ROOT_PATH=$1
408d6344f9Sopenharmony_ci    BUILD_INFO_PATH=$ROOT_PATH/out/kernel/checkpoint
418d6344f9Sopenharmony_ci
428d6344f9Sopenharmony_ci    if [ ! -d "$BUILD_INFO_PATH" ]; then
438d6344f9Sopenharmony_ci        mkdir -p $BUILD_INFO_PATH
448d6344f9Sopenharmony_ci    fi
458d6344f9Sopenharmony_ci
468d6344f9Sopenharmony_ci    touch $BUILD_INFO_PATH/last_build.info
478d6344f9Sopenharmony_ci    rm -f $BUILD_INFO_PATH/current_build.info
488d6344f9Sopenharmony_ci
498d6344f9Sopenharmony_ci    for dep in ${DEPS[@]}
508d6344f9Sopenharmony_ci    do
518d6344f9Sopenharmony_ci        if [[ $dep == "prebuilts/clang/ohos/linux-x86_64/llvm/bin" || $dep == "prebuilts/clang/ohos/linux-aarch64/llvm/bin" ]];then
528d6344f9Sopenharmony_ci            echo $dep: >> $BUILD_INFO_PATH/current_build.info
538d6344f9Sopenharmony_ci            echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" >> $BUILD_INFO_PATH/current_build.info
548d6344f9Sopenharmony_ci            cd $ROOT_PATH/$dep
558d6344f9Sopenharmony_ci            md5sum clang >> $BUILD_INFO_PATH/current_build.info
568d6344f9Sopenharmony_ci            cd -
578d6344f9Sopenharmony_ci            echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" >> $BUILD_INFO_PATH/current_build.info
588d6344f9Sopenharmony_ci        else
598d6344f9Sopenharmony_ci            echo $dep: >> $BUILD_INFO_PATH/current_build.info
608d6344f9Sopenharmony_ci            echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" >> $BUILD_INFO_PATH/current_build.info
618d6344f9Sopenharmony_ci            cd $ROOT_PATH/$dep
628d6344f9Sopenharmony_ci            git log -n 2 >> $BUILD_INFO_PATH/current_build.info
638d6344f9Sopenharmony_ci            cd -
648d6344f9Sopenharmony_ci            echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" >> $BUILD_INFO_PATH/current_build.info
658d6344f9Sopenharmony_ci        fi
668d6344f9Sopenharmony_ci
678d6344f9Sopenharmony_ci    done
688d6344f9Sopenharmony_ci
698d6344f9Sopenharmony_ci    diff $BUILD_INFO_PATH/last_build.info $BUILD_INFO_PATH/current_build.info
708d6344f9Sopenharmony_ci}
71