From 94101a2cd9baed60360f68096033dc75cbb1dcb3 Mon Sep 17 00:00:00 2001 From: android <android@lingyun.com> Date: Wed, 10 Jul 2024 19:27:36 +0800 Subject: [PATCH] Add STM8S003F3 eDP LCD drvier --- android_sdk/build.sh | 211 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 211 insertions(+), 0 deletions(-) diff --git a/android_sdk/build.sh b/android_sdk/build.sh new file mode 100755 index 0000000..c4eac55 --- /dev/null +++ b/android_sdk/build.sh @@ -0,0 +1,211 @@ +#!/bin/bash + +# this project absolute path +PRJ_PATH=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd) + +# top project absolute path +TOP_PATH=$(realpath $PRJ_PATH/..) + +# SDK build workspace +SDK_DIR=/work/sdk_build + +# binaries build prefix install path +PRFX_PATH=$PRJ_PATH/install + +# binaries finally install path if needed +#INST_PATH=/tftp + +# download taballs path +TARBALL_PATH=$PRJ_PATH/tarballs + +# config file path +CONF_FILE=$TOP_PATH/config.json + +#4g files path +FILES_PATCH_4G=$PRJ_PATH/apps/Quectel_RILv3.6.24 + +#wifi firmware path +FILES_PATCH_WIFI=$PRJ_PATH/apps +# shell script will exit once get command error +set -e + +#+-------------------------+ +#| Shell script functions | +#+-------------------------+ + +function pr_error() { + echo -e "\033[40;31m $1 \033[0m" +} + +function pr_warn() { + echo -e "\033[40;33m $1 \033[0m" +} + +function pr_info() { + echo -e "\033[40;32m $1 \033[0m" +} + +# decompress a packet to destination path +function do_unpack() +{ + tarball=$1 + dstpath='pwd' + + if [[ $# == 2 ]] ; then + dstpath=$2 + fi + + pr_info "decompress $tarball => $dstpath" + + mkdir -p $dstpath + case $tarball in + *.tar.gz) + tar -xzf $tarball -C $dstpath + ;; + + *.tgz) + tar -xzf $tarball -C $dstpath + ;; + + *.tar.bz2) + tar -xjf $tarball -C $dstpath + ;; + + *.tar.xz) + tar -xJf $tarball -C $dstpath + ;; + + *.tar.zst) + tar -I zstd -xf $tarball -C $dstpath + ;; + + *.tar) + tar -xf $tarball -C $dstpath + ;; + + *.zip) + unzip -qo $tarball -d $dstpath + ;; + + *) + pr_error "decompress Unsupport packet: $tarball" + return 1; + ;; + esac +} + +# parser configure file and export environment variable +function export_env() +{ + export BOARD=`jq -r ".board" $CONF_FILE | tr 'A-Z' 'a-z'` + export SDK_VER=`jq -r ".android.sdk_ver" $CONF_FILE` + export SDK_PATH=`jq -r ".android.sdk_path" $CONF_FILE` + + export ARCH=arm64 + + if [[ $BOARD =~ igkboard-rk3568 ]] ; then + LUNCH_BOARD=rk3568_t-userdebug + fi + + PYTHON_VERSION=$(python --version 2>&1 | awk '{print $2}' | cut -d. -f1) + if [ $PYTHON_VERSION != "3" ] ; then + PYTHON_VERSION=$(python --version 2>&1) + pr_error "ERROR: This SDK build need Python3, current version is $PYTHON_VERSION" + pr_warn "You can use 'sudo update-alternatives --config python' command to switch it" + exit + fi +} + +function do_fetch() +{ + SDK_FPATH=$SDK_PATH/$SDK_VER + + PATCH_FLAG="$SDK_DIR/kernel-5.10/arch/arm64/configs/rockchip_defconfig" + if [ -e $PATCH_FLAG ] ; then + pr_warn "SDK source code fetched already, skip do fetch" + fi + + if [ ! -d $SDK_DIR/.repo ] ; then + + SDK_FILE=$SDK_PATH/$SDK_VER.tar.bz2 + + if [ ! -e $SDK_FILE ] ; then + pr_error "ERROR: SDK package '$SDK_FILE' doesn't exist!" + exit + fi + + pr_info "decompress SDK tarball $SDK_FILE..." + + do_unpack $SDK_FILE $SDK_DIR + fi + + cd $SDK_DIR + + if [ ! -e $PATCH_FLAG ] ; then + pr_info "repo sync to checkout source code..." + ./.repo/repo/repo sync -l + fi + + if ! grep -q '^CONFIG_CAN=y' $PATCH_FLAG ; then + pr_info "patch for android..." + cd kernel-5.10 + patch -p1 < $PRJ_PATH/patches/kernel.patch + + cd ../vendor/rockchip/common/ + patch -p1 < $PRJ_PATH/patches/4g_patch/vendor.patch + + cd $SDK_DIR/device/rockchip/common/ + patch -p1 < $PRJ_PATH/patches/4g_patch/device_rockchip.patch + + cd $SDK_DIR/device/google/atv/ + patch -p1 < $PRJ_PATH/patches/4g_patch/device_google.patch + + cd $SDK_DIR/hardware/interfaces/ + patch -p1 < $PRJ_PATH/patches/4g_patch/hardware_interfaces.patch + + cd $SDK_DIR/hardware/ril/ + patch -p1 < $PRJ_PATH/patches/4g_patch/hardware_ril.patch + + cd $SDK_DIR/frameworks/opt/telephony/ + patch -p1 < $PRJ_PATH/patches/4g_patch/frameworks_opt_telephony.patch + + pr_info "copy 4G RIL library..." + + cp -f $FILES_PATCH_4G/ip-* $SDK_DIR/vendor/rockchip/common/phone/etc/ppp/ + cp -f $FILES_PATCH_4G/ql-ril.conf $SDK_DIR/vendor/rockchip/common/phone/etc/ppp/ + cp -f $FILES_PATCH_4G/chat $SDK_DIR/vendor/rockchip/common/phone/bin/ + cp -f $FILES_PATCH_4G/libreference-ril.so $SDK_DIR/vendor/rockchip/common/phone/lib/libreference-ril-em05.so + + pr_info "copy wifi firmware..." + + cp -f $FILES_PATCH_WIFI/mt7601u.bin $SDK_DIR/vendor/rockchip/common/wifi/firmware + + cd + fi +} + +function do_build() +{ + pr_info "Choose your board" + + cd $SDK_DIR + + source build/envsetup.sh + lunch $LUNCH_BOARD + ./build.sh -AUCKu + + pr_info "System image will be installed to $SDK_DIR/rockdev/Image-rk3568_t" + ls ./rockdev/Image-rk3568_t +} + +#+-------------------------+ +#| Shell script body entry | +#+-------------------------+ + +export_env + +pr_warn "start build android sdk for ${BOARD}" + +do_fetch + +do_build -- Gitblit v1.9.1