| | |
| | | TOP_PATH=$(realpath $PRJ_PATH/..) |
| | | |
| | | # SDK build workspace |
| | | SDK_DIR=/work/sdk_build |
| | | SDK_DIR=/work/android_build |
| | | |
| | | # binaries build prefix install path |
| | | PRFX_PATH=$PRJ_PATH/install |
| | |
| | | export ARCH=arm64 |
| | | |
| | | if [[ $BOARD =~ igkboard-rk3568 ]] ; then |
| | | LUNCH_BOARD=rk3568_t-userdebug |
| | | LAUNCH_BOARD=rk3568_t-userdebug |
| | | fi |
| | | |
| | | PYTHON_VERSION=$(python --version 2>&1 | awk '{print $2}' | cut -d. -f1) |
| | |
| | | |
| | | function do_fetch() |
| | | { |
| | | SDK_FPATH=$SDK_PATH/$SDK_VER |
| | | SDK_TAR=$SDK_PATH/$SDK_VER.tar.bz2 |
| | | SDK_FLAG=$SDK_DIR/kernel-5.10/Makefile |
| | | |
| | | 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" |
| | | if [ -e $SDK_FLAG ] ; then |
| | | pr_warn "INFO: 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!" |
| | | if [ ! -e $SDK_TAR ] ; then |
| | | pr_error "ERROR: SDK package '$SDK_TAR' doesn't exist!" |
| | | exit |
| | | fi |
| | | |
| | | pr_info "decompress SDK tarball $SDK_FILE..." |
| | | |
| | | do_unpack $SDK_FILE $SDK_DIR |
| | | pr_info "decompress SDK tarball $SDK_TAR..." |
| | | do_unpack $SDK_TAR $SDK_DIR |
| | | fi |
| | | |
| | | cd $SDK_DIR |
| | | |
| | | if [ ! -e $PATCH_FLAG ] ; then |
| | | if [ ! -e $SDK_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..." |
| | | function do_patch() |
| | | { |
| | | PATCH_FLAG="$SDK_DIR/kernel-5.10/arch/arm64/configs/rockchip_defconfig" |
| | | |
| | | cd $SDK_DIR |
| | | |
| | | if grep -q '^CONFIG_CAN=y' $PATCH_FLAG ; then |
| | | pr_warn "INFO: Patch for Android SDK already" |
| | | return ; |
| | | fi |
| | | |
| | | pr_info "do patch for android source code" |
| | | cd kernel-5.10 |
| | | patch -p1 < $PRJ_PATH/patches/kernel.patch |
| | | |
| | |
| | | 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 |
| | | |
| | | pr_info "start build $LAUNCH_BOARD..." |
| | | |
| | | source build/envsetup.sh |
| | | lunch $LUNCH_BOARD |
| | | lunch $LAUNCH_BOARD |
| | | ./build.sh -AUCKu |
| | | |
| | | pr_info "System image will be installed to $SDK_DIR/rockdev/Image-rk3568_t" |
| | |
| | | |
| | | do_fetch |
| | | |
| | | do_patch |
| | | |
| | | do_build |