guowenxue
2024-01-20 21b5a7e28820ae6c3599f8adff0c3cf7c227a278
bootloader/build.sh
@@ -57,13 +57,18 @@
    export CROSS_COMPILE=`jq -r ".bsp.cortexAtool" $CONF_FILE | tr 'A-Z' 'a-z'`
    export MCORE_COMPILE=`jq -r ".bsp.cortexMtool" $CONF_FILE | tr 'A-Z' 'a-z'`
    export SRCS="imx-atf uboot-imx imx-mkimage"
    export BRANCH=$BSP_VER
    export JOBS=`cat /proc/cpuinfo | grep processor | wc -l`
    export ARCH=arm
    # i.MX6ULL only need uboot-imx
    if [[ $BOARD =~ mx6ull ]] ; then
        export SRCS="uboot-imx"
        return ;
    fi
    export SRCS="uboot-imx imx-atf imx-mkimage"
    export_fmver
    export SRCS="imx-atf uboot-imx imx-mkimage"
    if [[ $BOARD =~ mx8mp ]] ; then
@@ -99,16 +104,19 @@
        git clone $GIT_URL/$src.git -b $BRANCH --depth=1
        # do patch if patch file exist
        PATCH_FILE=$PRJ_PATH/patches/$BOARD/$src-$BSP_VER.patch
        if [ -s $PATCH_FILE ] ; then
        patch_file=$PRJ_PATH/patches/$BOARD/$src-$BSP_VER.patch
        if [ -s $patch_file ] ; then
            pr_warn "do patch for $src now..."
            cd $src
            patch -p1 < $PATCH_FILE
            patch -p1 < $patch_file
            cd -
        fi
    done
    # i.MX6ULL only need uboot-imx
    if [[ $BOARD =~ mx6ull ]] ; then
        return ;
    fi
    mkdir -p $FMW_PATH && cd $FMW_PATH
@@ -178,15 +186,32 @@
function build_uboot()
{
    SRC=uboot-imx
    patch_file=$PRJ_PATH/patches/$BOARD/$SRC-$BSP_VER.patch
    defconfig=${BOARD}_defconfig
    pr_warn "start build $SRC"
    cd $PRJ_PATH/${SRC}
    # do patch if not patched
    if [ ! -s configs/$defconfig -a -s $patch_file ] ; then
        pr_warn "do patch for $SRC now..."
        patch -p1 < $patch_file
    fi
    if [ ! -f .config ] ; then
        make ARCH=arm ${BOARD}_defconfig
    fi
    make -j${JOBS} CROSS_COMPILE=${CROSS_COMPILE} ARCH=arm
    # i.MX6ULL only need uboot-imx
    if [[ $BOARD =~ mx6ull ]] ; then
        cp u-boot-dtb.imx u-boot-${BOARD}.imx
        chmod a+x u-boot-${BOARD}.imx
        set -x
        cp u-boot-${BOARD}.imx $PRFX_PATH
        set +x
        return ;
    fi
    set -x
    cp u-boot.bin $MKIMG_BIN_PATH
@@ -264,10 +289,16 @@
    cd $PRJ_PATH
    mkdir -p $PRFX_PATH
    build_atf
    #build_cortexM
    build_uboot
    # i.MX6ULL only need uboot-imx
    if [[ ${BOARD} =~ mx6ull ]] ; then
        return ;
    fi
    build_atf
    build_imxboot
    #build_cortexM
}
function do_install()
@@ -281,6 +312,7 @@
    if [[ -n "$INST_PATH" && -w $INST_PATH ]] ; then
        pr_info "install bootloader to '$INST_PATH'"
        cp $PRFX_PATH/u-boot-${BOARD}.imx $INST_PATH
        #sz $PRFX_PATH/u-boot-${BOARD}.imx
    fi
}