• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright (c) 2022 Unionman Technology Co., Ltd.
4#
5# This software is licensed under the terms of the GNU General Public
6# License version 2, as published by the Free Software Foundation, and
7# may be copied, distributed, and modified under those terms.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14#
15
16set -e
17
18OHOS_SOURCE_ROOT=$1
19KERNEL_BUILD_ROOT=$2
20HDF_PATCH_FILE=$3
21
22ln_list=(
23    $OHOS_SOURCE_ROOT/drivers/hdf_core/adapter/khdf/linux    drivers/hdf/khdf
24    $OHOS_SOURCE_ROOT/drivers/hdf_core/framework             drivers/hdf/framework
25    $OHOS_SOURCE_ROOT/drivers/hdf_core/interfaces/inner_api  drivers/hdf/inner_api
26    $OHOS_SOURCE_ROOT/drivers/hdf_core/framework/include     include/hdf
27    $OHOS_SOURCE_ROOT/device/soc/amlogic/a311d/soc           vendor
28    $OHOS_SOURCE_ROOT/device/board/unionman/unionpi_tiger/kernel/drivers   vendor/drivers
29)
30
31cp_list=(
32    $OHOS_SOURCE_ROOT/third_party/bounds_checking_function  ./
33    $OHOS_SOURCE_ROOT/device/soc/hisilicon/common/platform/wifi         drivers/hdf/
34    $OHOS_SOURCE_ROOT/third_party/FreeBSD/sys/dev/evdev     drivers/hdf/
35)
36
37function copy_external_compents()
38{
39    for ((i=0; i<${#cp_list[*]}; i+=2))
40    do
41        dst_dir=${cp_list[$(expr $i + 1)]}/${cp_list[$i]##*/}
42        mkdir -p $dst_dir
43        [ -d "${cp_list[$i]}"/ ] && cp -arf ${cp_list[$i]}/* $dst_dir/
44    done
45}
46
47function ln_hdf_repos()
48{
49    for ((i=0; i<${#ln_list[*]}; i+=2))
50    do
51        ln -sf ${ln_list[$i]} ${ln_list[$(expr $i + 1)]}
52    done
53}
54
55function main()
56{
57    cd $KERNEL_BUILD_ROOT
58    patch -p1 < $HDF_PATCH_FILE
59    ln_hdf_repos
60    copy_external_compents
61    cd -
62}
63
64main
65