Modify the copyright.

Signed-off-by: 13359001024 <wenfei9@huawei.com>
This commit is contained in:
13359001024
2022-08-08 21:10:25 +08:00
parent 30ab39bb15
commit e98f8b2ede
16 changed files with 252 additions and 105 deletions
+12 -1
View File
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Kconfig for tracepoint test
#
+12 -1
View File
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for tracepoint test
#
-1
View File
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM emmc
+23 -11
View File
@@ -1,11 +1,23 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 5.10.79 Kernel Configuration
#
CONFIG_VENDOR_HOOKS=y
CONFIG_TRACEPOINT_MMAP=m
CONFIG_TRACEPOINT_MPROTECT_PKEY=m
CONFIG_TRACEPOINT_TEST=m
CONFIG_TRACEPOINT_AML_EMMC_PARTITION=m
CONFIG_TRACEPOINT_FAKE_BOOT_PARTITION=m
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 5.10.79 Kernel Configuration
#
CONFIG_VENDOR_HOOKS=y
CONFIG_TRACEPOINT_MMAP=m
CONFIG_TRACEPOINT_MPROTECT_PKEY=m
CONFIG_TRACEPOINT_TEST=m
CONFIG_TRACEPOINT_AML_EMMC_PARTITION=m
CONFIG_TRACEPOINT_FAKE_BOOT_PARTITION=m
+71 -72
View File
@@ -26,11 +26,10 @@
################################################################################
CURRENT_DIR=$(pwd)
ROOT_DIR=$(cd $CURRENT_DIR/../../ && pwd)
ROOT_FILE_DIR=$ROOT_DIR/kernel/linux/build/test/tracepointtest
#ROOT_TEST_DIR=$(cd $CURRENT_DIR/../../../../../ && pwd)
COMPILE_DIR=$ROOT_DIR/out/kernel/src_tmp/linux-5.10
OBJ_DIR=$ROOT_DIR/out/kernel/OBJ
ROOT_DIR=$(cd ${CURRENT_DIR}/../../ && pwd)
ROOT_FILE_DIR=${ROOT_DIR}/kernel/linux/build/test/tracepointtest
COMPILE_DIR=${ROOT_DIR}/out/kernel/src_tmp/linux-5.10
OBJ_DIR=${ROOT_DIR}/out/kernel/OBJ
DRIVERS_DIR=${ROOT_DIR}/out/kernel/src_tmp/linux-5.10/drivers
TRACEPOINT_INCLUDE_DIR=${ROOT_DIR}/out/kernel/src_tmp/linux-5.10/include/trace/hooks
DRIVERS_TRACEPOINT_DIR=${ROOT_DIR}/out/kernel/src_tmp/linux-5.10/drivers/tracepointtest
@@ -42,70 +41,70 @@ copy() {
}
modify_config() {
if [ -e $CONFIG_DIR/tmp ]; then
rm -f $CONFIG_DIR/tmp
if [ -e ${CONFIG_DIR}/tmp ]; then
rm -f ${CONFIG_DIR}/tmp
fi
cp -f $CONFIG_DIR/$2 $CONFIG_DIR/$2_tmpfile
cp -f ${CONFIG_DIR}/$2 ${CONFIG_DIR}/$2_tmpfile
while read line; do
echo "$line" >>$CONFIG_DIR/tmp
done <$CONFIG_DIR/$2
echo "$line" >>${CONFIG_DIR}/tmp
done <${CONFIG_DIR}/$2
while read line; do
if [[ "$line" != "#"* ]]; then
echo "$line" >>$CONFIG_DIR/tmp
echo "$line" >>${CONFIG_DIR}/tmp
fi
done <$1
mv $CONFIG_DIR/tmp $CONFIG_DIR/$2
mv ${CONFIG_DIR}/tmp ${CONFIG_DIR}/$2
}
modify_files() {
KCONFIG=$DRIVERS_DIR/Kconfig
MAKEFILE=$DRIVERS_DIR/Makefile
VENDOR_HOOKS=$DRIVERS_DIR/hooks/vendor_hooks.c
TMPFILE=$DRIVERS_DIR/tmp
KCONFIG=${DRIVERS_DIR}/Kconfig
MAKEFILE=${DRIVERS_DIR}/Makefile
VENDOR_HOOKS=${DRIVERS_DIR}/hooks/vendor_hooks.c
TMPFILE=${DRIVERS_DIR}/tmp
cp -f $KCONFIG ${KCONFIG}_tmpfile
cp -f $MAKEFILE ${MAKEFILE}_tmpfile
cp -f $VENDOR_HOOKS ${VENDOR_HOOKS}_tmpfile
cp -f ${KCONFIG} ${KCONFIG}_tmpfile
cp -f ${MAKEFILE} ${MAKEFILE}_tmpfile
cp -f ${VENDOR_HOOKS} ${VENDOR_HOOKS}_tmpfile
if [ -e $TMPFILE ]; then
rm -f $TMPFILE
if [ -e ${TMPFILE} ]; then
rm -f ${TMPFILE}
fi
while read line; do
if [[ "$line" != "endmenu" ]]; then
echo "$line" >>$TMPFILE
echo "$line" >>${TMPFILE}
fi
done <$KCONFIG
echo "source \"drivers/tracepointtest/Kconfig\"" >>$TMPFILE
echo "endmenu" >>$TMPFILE
mv $TMPFILE $KCONFIG
done <${KCONFIG}
echo "source \"drivers/tracepointtest/Kconfig\"" >>${TMPFILE}
echo "endmenu" >>${TMPFILE}
mv ${TMPFILE} ${KCONFIG}
while read line; do
echo "$line" >>$TMPFILE
done <$MAKEFILE
echo "obj-y += tracepointtest/" >>$TMPFILE
mv $TMPFILE $MAKEFILE
echo "$line" >>${TMPFILE}
done <${MAKEFILE}
echo "obj-y += tracepointtest/" >>${TMPFILE}
mv ${TMPFILE} ${MAKEFILE}
while read line; do
echo "$line" >>$TMPFILE
done <$VENDOR_HOOKS
echo "#include <trace/hooks/emmc.h>" >>$TMPFILE
echo "EXPORT_TRACEPOINT_SYMBOL_GPL(vendor_aml_emmc_partition);" >>$TMPFILE
echo "EXPORT_TRACEPOINT_SYMBOL_GPL(vendor_fake_boot_partition);" >>$TMPFILE
mv $TMPFILE $VENDOR_HOOKS
echo "$line" >>${TMPFILE}
done <${VENDOR_HOOKS}
echo "#include <trace/hooks/emmc.h>" >>${TMPFILE}
echo "EXPORT_TRACEPOINT_SYMBOL_GPL(vendor_aml_emmc_partition);" >>${TMPFILE}
echo "EXPORT_TRACEPOINT_SYMBOL_GPL(vendor_fake_boot_partition);" >>${TMPFILE}
mv ${TMPFILE} ${VENDOR_HOOKS}
}
compile() {
cd $COMPILE_DIR || exit
cd ${COMPILE_DIR} || exit
export PRODUCT_COMPANY=hihope
export DEVICE_NAME=rk3568
export DEVICE_COMPANY=rockchip
export PRODUCT_PATH=~/OpenHarmony/master/out/kernel/vendor/hihope/rk3568
./make-ohos.sh TB-RK3568X0 >null
export PRODUCT_PATH=${ROOT_DIR}/out/kernel/vendor/hihope/rk3568
bash -c ./make-ohos.sh TB-RK3568X0 >null
if [ $? -ne 0 ]; then
echo "compile failed"
exit 1
@@ -114,62 +113,62 @@ compile() {
fi
}
collectKO() {
if [ -e $OBJ_DIR/kofiles ]; then
rm -f $OBJ_DIR/kofiles
mkdir -p $OBJ_DIR/kofiles
collect_ko() {
if [ -e ${OBJ_DIR}/kofiles ]; then
rm -f ${OBJ_DIR}/kofiles
mkdir -p ${OBJ_DIR}/kofiles
else
mkdir -p $OBJ_DIR/kofiles
mkdir -p ${OBJ_DIR}/kofiles
fi
find $DRIVERS_TRACEPOINT_DIR -name '*.ko' | xargs cp -t $OBJ_DIR/kofiles
find ${DRIVERS_TRACEPOINT_DIR} -name '*.ko' | xargs cp -t ${OBJ_DIR}/kofiles
}
restore() {
CONFIGNAME=rockchip_linux_defconfig
KCONFIG=$DRIVERS_DIR/Kconfig
MAKEFILE=$DRIVERS_DIR/Makefile
VENDOR_HOOKS=$DRIVERS_DIR/hooks/vendor_hooks.c
KCONFIG=${DRIVERS_DIR}/Kconfig
MAKEFILE=${DRIVERS_DIR}/Makefile
VENDOR_HOOKS=${DRIVERS_DIR}/hooks/vendor_hooks.c
rm -rf $DRIVERS_TRACEPOINT_DIR
mv -f $CONFIG_DIR/${CONFIGNAME}_tmpfile $CONFIG_DIR/$CONFIGNAME
mv -f ${KCONFIG}_tmpfile $KCONFIG
mv -f ${MAKEFILE}_tmpfile $MAKEFILE
mv -f ${VENDOR_HOOKS}_tmpfile $VENDOR_HOOKS
rm -rf $COMPILE_DIR/.lock
rm -rf ${DRIVERS_TRACEPOINT_DIR}
mv -f ${CONFIG_DIR}/${CONFIGNAME}_tmpfile ${CONFIG_DIR}/${CONFIGNAME}
mv -f ${KCONFIG}_tmpfile ${KCONFIG}
mv -f ${MAKEFILE}_tmpfile ${MAKEFILE}
mv -f ${VENDOR_HOOKS}_tmpfile ${VENDOR_HOOKS}
rm -rf ${COMPILE_DIR}/.lock
}
main() {
if [ -e $COMPILE_DIR/.lock ]; then
if [ -e ${COMPILE_DIR}/.lock ]; then
restore
fi
echo "" >$COMPILE_DIR/.lock
echo "" >${COMPILE_DIR}/.lock
if [ -d $DRIVERS_DIR/tracepointtest ]; then
rm -rf $DRIVERS_DIR/tracepointtest
mkdir -p $DRIVERS_DIR/tracepointtest
if [ -d ${DRIVERS_DIR}/tracepointtest ]; then
rm -rf ${DRIVERS_DIR}/tracepointtest
mkdir -p ${DRIVERS_DIR}/tracepointtest
else
mkdir -p $DRIVERS_DIR/tracepointtest
mkdir -p ${DRIVERS_DIR}/tracepointtest
fi
for dir in $(ls $ROOT_FILE_DIR); do
if [ -d $ROOT_FILE_DIR/$dir ]; then
copy $ROOT_FILE_DIR/$dir $DRIVERS_TRACEPOINT_DIR/$dir
elif [[ "$dir" == "Makefile" ]]; then
copy $ROOT_FILE_DIR/$dir $DRIVERS_TRACEPOINT_DIR/$dir
elif [[ "$dir" == "Kconfig" ]]; then
copy $ROOT_FILE_DIR/$dir $DRIVERS_TRACEPOINT_DIR/$dir
elif [[ $dir == *.h ]]; then
copy $ROOT_FILE_DIR/$dir $TRACEPOINT_INCLUDE_DIR/$dir
elif [[ "$dir" == "rockchip_linux_defconfig" ]]; then
modify_config $ROOT_FILE_DIR/$dir $dir
for dir in $(ls ${ROOT_FILE_DIR}); do
if [ -d ${ROOT_FILE_DIR}/${dir} ]; then
copy ${ROOT_FILE_DIR}/${dir} ${DRIVERS_TRACEPOINT_DIR}/${dir}
elif [[ "${dir}" == "Makefile" ]]; then
copy ${ROOT_FILE_DIR}/${dir} ${DRIVERS_TRACEPOINT_DIR}/${dir}
elif [[ "${dir}" == "Kconfig" ]]; then
copy ${ROOT_FILE_DIR}/${dir} ${DRIVERS_TRACEPOINT_DIR}/${dir}
elif [[ ${dir} == *.h ]]; then
copy ${ROOT_FILE_DIR}/${dir} ${TRACEPOINT_INCLUDE_DIR}/${dir}
elif [[ "${dir}" == "rockchip_linux_defconfig" ]]; then
modify_config ${ROOT_FILE_DIR}/${dir} ${dir}
fi
done
modify_files
compile
collectKO
collect_ko
restore
}
+12 -1
View File
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
config TRACEPOINT_TEST
tristate "Test Tracepoint For Vendor Hooks"
+12 -1
View File
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for test tracepoint
#
+14 -9
View File
@@ -26,17 +26,22 @@
################################################################################
CURRENT_DIR=$(pwd)
KO_DIR=$CURRENT_DIR/kofile
KO_DIR=${CURRENT_DIR}/kofile
insmod_ko() {
for dir in $(ls $KO_DIR); do
if [[ "$dir" != "tracepoint_test.ko" ]]; then
insmod $KO_DIR/$dir
echo "$KO_DIR/$dir is loaded"
for file in $(ls ${KO_DIR}); do
if [[ "${file}" != "tracepoint_test.ko" ]]; then
insmod ${KO_DIR}/${file}
echo "${KO_DIR}/${file} is loaded"
fi
done
insmod $KO_DIR/tracepoint_test.ko
if [ -e ${KO_DIR}/tracepoint_test.ko ]; then
insmod ${KO_DIR}/tracepoint_test.ko
else
echo "no such file tracepoint_test.ko"
exit 1
fi
arr=(vendor_do_mmap vendor_do_mprotect_pkey vendor_aml_emmc_partition vendor_fake_boot_partition)
for i in ${arr[@]}; do
@@ -50,9 +55,9 @@ insmod_ko() {
}
rmmod_ko() {
for dir in $(ls $KO_DIR); do
rmmod $KO_DIR/$dir
echo "$KO_DIR/$dir is removed"
for dir in $(ls ${KO_DIR}); do
rmmod ${KO_DIR}/${dir}
echo "${KO_DIR}/${dir} is removed"
done
}
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
config TRACEPOINT_AML_EMMC_PARTITION
tristate "AML_EMMC_PARTITION Tracepoint For Vendor Hooks"
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for aml emmc partition tracepoint
#
+12 -1
View File
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
config TRACEPOINT_MMAP
tristate "MMAP Tracepoint For Vendor Hooks"
+12 -1
View File
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for mmap tracepoint
#
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
config TRACEPOINT_MPROTECT_PKEY
tristate "MPROTECT_PKEY Tracepoint For Vendor Hooks"
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for mprotect pkey tracepoint
#
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
config TRACEPOINT_FAKE_BOOT_PARTITION
tristate "FAKE_BOOT_PARTITION Tracepoint For Vendor Hooks"
@@ -1,4 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for fake boot partition tracepoint
#