| | |
| | | TOP_PATH=$(realpath $PRJ_PATH/..) |
| | | |
| | | # SDK build workspace |
| | | SDK_DIR=/work/android_build |
| | | SDK_DIR=android_build |
| | | |
| | | # binaries build prefix install path |
| | | PRFX_PATH=$PRJ_PATH/install |
| | |
| | | CONF_FILE=$TOP_PATH/config.json |
| | | |
| | | #4g files path |
| | | FILES_PATCH_4G=$PRJ_PATH/apps/Quectel_RILv3.6.24 |
| | | FILES_PATCH_4G=$PRJ_PATH/patches/Quectel_RILv3.6.24 |
| | | |
| | | #wifi firmware path |
| | | FILES_PATCH_WIFI=$PRJ_PATH/apps |
| | | FILES_PATCH_WIFI=$PRJ_PATH/patches/wifi/ |
| | | |
| | | # shell script will exit once get command error |
| | | set -e |
| | | |
| | |
| | | |
| | | function do_fetch() |
| | | { |
| | | SDK_TAR=$SDK_PATH/$SDK_VER.tar.bz2 |
| | | SDK_FPATH=$SDK_PATH/$SDK_VER |
| | | |
| | | SDK_FLAG=$SDK_DIR/kernel-5.10/Makefile |
| | | |
| | | cd $PRJ_PATH |
| | | |
| | | if [ -e $SDK_FLAG ] ; then |
| | | pr_warn "INFO: SDK source code fetched already, skip do fetch" |
| | |
| | | |
| | | if [ ! -d $SDK_DIR/.repo ] ; then |
| | | |
| | | if [ ! -e $SDK_TAR ] ; then |
| | | pr_error "ERROR: SDK package '$SDK_TAR' doesn't exist!" |
| | | if [ ! -d $SDK_FPATH ] ; then |
| | | pr_error "ERROR: SDK package folder '$SDK_FPATH' doesn't exist!" |
| | | exit |
| | | fi |
| | | |
| | | pr_info "decompress SDK tarball $SDK_TAR..." |
| | | do_unpack $SDK_TAR $SDK_DIR |
| | | SDK_FILE=`ls $SDK_FPATH/*.tar.bz2 | head -n 1` |
| | | |
| | | pr_info "decompress SDK tarball $SDK_FILE..." |
| | | do_unpack $SDK_FILE $SDK_DIR |
| | | fi |
| | | |
| | | cd $SDK_DIR |
| | | |
| | | if [ ! -e $SDK_FLAG ] ; then |
| | | pr_info "repo sync to checkout source code..." |
| | | cd $SDK_DIR |
| | | ./.repo/repo/repo sync -l |
| | | fi |
| | | } |
| | |
| | | { |
| | | PATCH_FLAG="$SDK_DIR/kernel-5.10/arch/arm64/configs/rockchip_defconfig" |
| | | |
| | | cd $SDK_DIR |
| | | cd $PRJ_PATH |
| | | |
| | | if grep -q '^CONFIG_CAN=y' $PATCH_FLAG ; then |
| | | if grep -q '^CONFIG_CAN=y' $PATCH_FLAG > /dev/null 2>&1 ; then |
| | | pr_warn "INFO: Patch for Android SDK already" |
| | | return ; |
| | | fi |
| | | |
| | | pr_info "do patch for android source code" |
| | | cd kernel-5.10 |
| | | cd $SDK_DIR/kernel-5.10 |
| | | patch -p1 < $PRJ_PATH/patches/kernel.patch |
| | | cd - |
| | | |
| | | cd ../vendor/rockchip/common/ |
| | | cd $SDK_DIR/vendor/rockchip/common/ |
| | | patch -p1 < $PRJ_PATH/patches/4g_patch/vendor.patch |
| | | cd - |
| | | |
| | | cd $SDK_DIR/device/rockchip/common/ |
| | | patch -p1 < $PRJ_PATH/patches/4g_patch/device_rockchip.patch |
| | | cd - |
| | | |
| | | cd $SDK_DIR/device/google/atv/ |
| | | patch -p1 < $PRJ_PATH/patches/4g_patch/device_google.patch |
| | | cd - |
| | | |
| | | cd $SDK_DIR/hardware/interfaces/ |
| | | patch -p1 < $PRJ_PATH/patches/4g_patch/hardware_interfaces.patch |
| | | cd - |
| | | |
| | | cd $SDK_DIR/hardware/ril/ |
| | | patch -p1 < $PRJ_PATH/patches/4g_patch/hardware_ril.patch |
| | | cd - |
| | | |
| | | cd $SDK_DIR/frameworks/opt/telephony/ |
| | | patch -p1 < $PRJ_PATH/patches/4g_patch/frameworks_opt_telephony.patch |
| | | cd - |
| | | |
| | | pr_info "copy 4G RIL library..." |
| | | |
| | |
| | | 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 |
| | | } |
| | | |
| | | function do_build() |
| | | { |
| | | cd $SDK_DIR |
| | | cd $PRJ_PATH |
| | | |
| | | pr_info "start build $LAUNCH_BOARD..." |
| | | |
| | | cd $SDK_DIR |
| | | source build/envsetup.sh |
| | | lunch $LAUNCH_BOARD |
| | | ./build.sh -AUCKu |