触觉智能RK3568_OpenHarmony开发板适配
2023-5-24 master openharmony 4.0.7.3
openharmony版本更新代码会变化,请看当前文件夹其他md
准备环境
确保无任何修改能编译RK3568
docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
编译方式
./build.sh --product-name rk3568
如果出现
root@3de51292b422:/home/openharmony# hb build -f
[OHOS INFO] Set cache size limit to 100.0 GB
[OHOS INFO] root_out_dir=//out/rk3568
[OHOS INFO] root_build_dir=//out/rk3568
[OHOS INFO] root_gen_dir=//out/rk3568/gen
[OHOS INFO] current_toolchain=//build/toolchain/ohos:ohos_clang_arm
[OHOS INFO] host_toolchain=//build/toolchain/linux:clang_x64
[OHOS INFO] build configs generation is complete.
[OHOS INFO] ERROR at //build/core/gn/BUILD.gn:59:14: Unable to load "/home/openharmony/out/rk3568/build_configs/BUILD.gn".
[OHOS INFO] deps = [ "$root_build_dir/build_configs:inner_kits" ]
[OHOS INFO] ^-----------------------------------------
[OHOS INFO] ---------------------------------------------
[OHOS INFO] ccache summary:
[OHOS INFO] cache hit (direct) : 0
[OHOS INFO] cache hit (preprocessed) : 0
[OHOS INFO] cache miss : 0
[OHOS INFO] hit rate: 0.00%
[OHOS INFO] mis rate: 0.00%
[OHOS INFO] ---------------------------------------------
[OHOS INFO] file: /home/openharmony/out/rk3568/.ninja_log not exists
[OHOS INFO] parse file fail
[OHOS ERROR] Please check build log in /home/openharmony/out/rk3568/build.log
请执行下面的命令安装新版本
python -m pip uninstall ohos-build
python -m pip install --user build/hb
适配
复制下面三个文件到device/board/hihope/rk3568/kernel
修改build_kernel.sh文件
修改make-ohos.sh文件
文件完整内容
device/board/hihope/rk3568/kernel/build_kernel.sh
#!/bin/bash
# Copyright (c) 2021-2023 HiHope Open Source Organization .
# 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.
set -e
pushd ${1}
ROOT_DIR=${5}
export PRODUCT_PATH=${4}
export DEVICE_COMPANY=${6}
export DEVICE_NAME=${7}
export PRODUCT_COMPANY=${8}
KERNEL_FORM=${9}
KERNEL_PROD=${10}
ENABLE_LTO_O0=${11}
KERNEL_SRC_TMP_PATH=${ROOT_DIR}/out/kernel/src_tmp/linux-5.10
KERNEL_OBJ_TMP_PATH=${ROOT_DIR}/out/kernel/OBJ/linux-5.10
KERNEL_SOURCE=${ROOT_DIR}/kernel/linux/linux-5.10
KERNEL_PATCH_PATH=${ROOT_DIR}/kernel/linux/patches/linux-5.10
KERNEL_PATCH=${ROOT_DIR}/kernel/linux/patches/linux-5.10/rk3568_patch/kernel.patch
BUILD_SCRIPT_PATH=${3}
NEWIP_PATCH_FILE=${ROOT_DIR}/kernel/linux/common_modules/newip/apply_newip.sh
XPM_PATCH_FILE=${ROOT_DIR}/kernel/linux/common_modules/xpm/apply_xpm.sh
KERNEL_CONFIG_FILE=${ROOT_DIR}/device/board/hihope/rk3568/kernel/rk3568_standard_defconfig
KERNEL_DTS_FILE=${ROOT_DIR}/device/board/hihope/rk3568/kernel/ido-evb3568-hdmi.dts
KERNEL_DTSI_FILE=${ROOT_DIR}/device/board/hihope/rk3568/kernel/ido-som3568.dtsi
KERNEL_MAKE_OHOS_FILE=${ROOT_DIR}/device/board/hihope/rk3568/kernel/make-ohos.sh
HARMONY_CONFIG_PATH=${ROOT_DIR}/kernel/linux/config/linux-5.10
DEVICE_CONFIG_PATH=${ROOT_DIR}/kernel/linux/config/linux-5.10/${DEVICE_NAME}
DEFCONFIG_BASE_FILE=${HARMONY_CONFIG_PATH}/base_defconfig
DEFCONFIG_TYPE_FILE=${HARMONY_CONFIG_PATH}/type/standard_defconfig
DEFCONFIG_FORM_FILE=${HARMONY_CONFIG_PATH}/form/${KERNEL_FORM}_defconfig
DEFCONFIG_ARCH_FILE=${DEVICE_CONFIG_PATH}/arch/arm64_defconfig
DEFCONFIG_PROC_FILE=${DEVICE_CONFIG_PATH}/product/${KERNEL_PROD}_defconfig
RAMDISK_ARG="disable_ramdisk"
MAKE_OHOS_ENV="GPUDRIVER=mali"
export KBUILD_OUTPUT=${KERNEL_OBJ_TMP_PATH}
source ${BUILD_SCRIPT_PATH}/kernel/kernel_source_checker.sh
for i in "$@"
do
case $i in
enable_ramdisk)
RAMDISK_ARG=enable_ramdisk
;;
enable_mesa3d)
MAKE_OHOS_ENV="GPUDRIVER=mesa3d"
;;
esac
done
function copy_and_patch_kernel_source()
{
rm -rf ${KERNEL_SRC_TMP_PATH}
mkdir -p ${KERNEL_SRC_TMP_PATH}
rm -rf ${KERNEL_OBJ_TMP_PATH}
mkdir -p ${KERNEL_OBJ_TMP_PATH}
cp -arf ${KERNEL_SOURCE}/* ${KERNEL_SRC_TMP_PATH}/
cd ${KERNEL_SRC_TMP_PATH}
#HDF patch
bash ${ROOT_DIR}/drivers/hdf_core/adapter/khdf/linux/patch_hdf.sh ${ROOT_DIR} ${KERNEL_SRC_TMP_PATH} ${KERNEL_PATCH_PATH} ${DEVICE_NAME}
#kernel patch
patch -p1 < ${KERNEL_PATCH}
#newip
if [ -f $NEWIP_PATCH_FILE ]; then
bash $NEWIP_PATCH_FILE ${ROOT_DIR} ${KERNEL_SRC_TMP_PATH} ${DEVICE_NAME} linux-5.10
fi
#xpm
if [ -f $XPM_PATCH_FILE ]; then
bash $XPM_PATCH_FILE ${ROOT_DIR} ${KERNEL_SRC_TMP_PATH} ${DEVICE_NAME} linux-5.10
fi
cp -rf ${BUILD_SCRIPT_PATH}/kernel/logo* ${KERNEL_SRC_TMP_PATH}/
#config
if [ ! -f "$DEFCONFIG_FORM_FILE" ]; then
DEFCONFIG_FORM_FILE=
echo "warning no form config file $(DEFCONFIG_FORM_FILE)"
fi
if [ ! -f "$DEFCONFIG_PROC_FILE" ]; then
DEFCONFIG_PROC_FILE=
echo "warning no prod config file $(DEFCONFIG_PROC_FILE)"
fi