1419b0af8Sopenharmony_ci#!/bin/bash
2419b0af8Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
3419b0af8Sopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd.
4419b0af8Sopenharmony_ci#
5419b0af8Sopenharmony_ci# Description: Create a symbolic link for NewIP in Linux 5.10
6419b0af8Sopenharmony_ci#
7419b0af8Sopenharmony_ci# Author: Yang Yanjun <yangyanjun@huawei.com>
8419b0af8Sopenharmony_ci#
9419b0af8Sopenharmony_ci# Data: 2022-07-25
10419b0af8Sopenharmony_ci#
11419b0af8Sopenharmony_ci
12419b0af8Sopenharmony_ciset -e
13419b0af8Sopenharmony_ci
14419b0af8Sopenharmony_ciOHOS_SOURCE_ROOT=$1
15419b0af8Sopenharmony_ciKERNEL_BUILD_ROOT=$2
16419b0af8Sopenharmony_ciPRODUCT_NAME=$3
17419b0af8Sopenharmony_ciKERNEL_VERSION=$4
18419b0af8Sopenharmony_ciNEWIP_SOURCE_ROOT=$OHOS_SOURCE_ROOT/kernel/linux/common_modules/newip
19419b0af8Sopenharmony_ci
20419b0af8Sopenharmony_cifunction main()
21419b0af8Sopenharmony_ci{
22419b0af8Sopenharmony_ci	pushd .
23419b0af8Sopenharmony_ci
24419b0af8Sopenharmony_ci	cd $KERNEL_BUILD_ROOT/include/linux/
25419b0af8Sopenharmony_ci	ln -s -f $(realpath --relative-to=$KERNEL_BUILD_ROOT/include/linux      $NEWIP_SOURCE_ROOT/third_party/linux-5.10/include/linux)/*.h ./
26419b0af8Sopenharmony_ci	cd $KERNEL_BUILD_ROOT/include/net/netns
27419b0af8Sopenharmony_ci	ln -s -f $(realpath --relative-to=$KERNEL_BUILD_ROOT/include/net/netns  $NEWIP_SOURCE_ROOT/third_party/linux-5.10/include/net/netns)/*.h ./
28419b0af8Sopenharmony_ci	cd $KERNEL_BUILD_ROOT/include/net
29419b0af8Sopenharmony_ci	ln -s -f $(realpath --relative-to=$KERNEL_BUILD_ROOT/include/net        $NEWIP_SOURCE_ROOT/third_party/linux-5.10/include/net)/*.h ./
30419b0af8Sopenharmony_ci	cd $KERNEL_BUILD_ROOT/include/uapi/linux
31419b0af8Sopenharmony_ci	ln -s -f $(realpath --relative-to=$KERNEL_BUILD_ROOT/include/uapi/linux $NEWIP_SOURCE_ROOT/third_party/linux-5.10/include/uapi/linux)/*.h ./
32419b0af8Sopenharmony_ci
33419b0af8Sopenharmony_ci	if [ ! -d "$KERNEL_BUILD_ROOT/net/newip" ]; then
34419b0af8Sopenharmony_ci		mkdir $KERNEL_BUILD_ROOT/net/newip
35419b0af8Sopenharmony_ci	fi
36419b0af8Sopenharmony_ci
37419b0af8Sopenharmony_ci	cd $KERNEL_BUILD_ROOT/net/newip/
38419b0af8Sopenharmony_ci	ln -s -f $(realpath --relative-to=$KERNEL_BUILD_ROOT/net/newip  $NEWIP_SOURCE_ROOT/src/linux-5.10/net/newip)/* ./
39419b0af8Sopenharmony_ci	ln -s -f $(realpath --relative-to=$KERNEL_BUILD_ROOT/net/newip  $NEWIP_SOURCE_ROOT/src/common)/* ./
40419b0af8Sopenharmony_ci	ln -s -f $(realpath --relative-to=$KERNEL_BUILD_ROOT/net/newip  $NEWIP_SOURCE_ROOT/third_party/linux-5.10/net/newip)/* ./
41419b0af8Sopenharmony_ci	cd $KERNEL_BUILD_ROOT/include/uapi/linux
42419b0af8Sopenharmony_ci	ln -s -f $(realpath --relative-to=$KERNEL_BUILD_ROOT/include/uapi/linux $NEWIP_SOURCE_ROOT/src/common)/nip_addr.h nip_addr.h
43419b0af8Sopenharmony_ci
44419b0af8Sopenharmony_ci	cd $KERNEL_BUILD_ROOT/drivers/net/
45419b0af8Sopenharmony_ci	ln -s -f $(realpath --relative-to=$KERNEL_BUILD_ROOT/drivers/net/  $NEWIP_SOURCE_ROOT/src/linux-5.10/drivers/net/bt)
46419b0af8Sopenharmony_ci
47419b0af8Sopenharmony_ci	popd
48419b0af8Sopenharmony_ci}
49419b0af8Sopenharmony_ci
50419b0af8Sopenharmony_cimain
51