From 705df3d275a71294406940f48dffbe05d3d5edb9 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Thu, 20 Jun 2024 20:00:33 +0800 Subject: [PATCH] PATCH:IGKBoard-IMX6ULL: Update linux kernel patch for LCD display --- bootloader/build.sh | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 109 insertions(+), 6 deletions(-) diff --git a/bootloader/build.sh b/bootloader/build.sh index 664b894..8548b78 100755 --- a/bootloader/build.sh +++ b/bootloader/build.sh @@ -13,7 +13,10 @@ PRFX_PATH=$PRJ_PATH/install # binaries finally install path if needed -INST_PATH=/tftp +#INST_PATH=/tftp + +# download taballs path +TARBALL_PATH=$PRJ_PATH/tarballs # config file path CONF_FILE=$TOP_PATH/config.json @@ -37,12 +40,61 @@ 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 + ;; + + *.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 +} + # select firmware version by BSP version function export_fmver() { if [[ $BSP_VER =~ 6.1.36 ]] ; then export FMW_IMX=firmware-imx-8.21 + + elif [[ $BSP_VER =~ 5.15.71 ]] ; then + + export FMW_IMX=firmware-imx-8.18 fi @@ -56,7 +108,7 @@ { export BOARD=`jq -r ".bsp.board" $CONF_FILE | tr 'A-Z' 'a-z'` export BSP_VER=`jq -r ".bsp.version" $CONF_FILE | tr 'A-Z' 'a-z'` - export GIT_URL=`jq -r ".bsp.giturl" $CONF_FILE | tr 'A-Z' 'a-z'` + export BSP_URL=`jq -r ".bsp.giturl" $CONF_FILE` export CROSS_COMPILE=`jq -r ".bsp.cortexAtool" $CONF_FILE` export MCORE_COMPILE=`jq -r ".bsp.cortexMtool" $CONF_FILE` @@ -88,6 +140,7 @@ IMXBOOT_TARGETS=flash_ddr4_evk IMXBOOT_DTB=imx8mm-ddr4-evk.dtb MKIMG_BIN_PATH=$PRJ_PATH/imx-mkimage/iMX8M/ + IMXBOOT_ARGS="REV=A2" fi } @@ -104,7 +157,20 @@ fi pr_info "start fetch $src source code" - git clone $GIT_URL/$src.git -b $BRANCH --depth=1 + + if [[ $BSP_URL =~ github.com ]] ; then + git clone $BSP_URL/$src.git -b $BRANCH --depth=1 + else + mkdir -p $TARBALL_PATH + + # Download source code packet + if [ ! -s $TARBALL_PATH/$src.tar.xz ] ; then + wget $BSP_URL/imx/bsp/$BSP_VER/$src.tar.xz -P $TARBALL_PATH + fi + + # decompress source code packet + do_unpack $TARBALL_PATH/$src.tar.xz + fi # do patch if patch file exist patch_file=$PRJ_PATH/patches/$BOARD/$src-$BSP_VER.patch @@ -121,6 +187,35 @@ return ; fi + # Download CortexM FreeRTOS SDK if needed + if [ "$BUILD_MCORE" == "yes" ] ; then + + src=cortexm-sdk + + cd $PRJ_PATH + + if [ -d $src ] ; then + pr_info "$src source code fetched already" + else + pr_info "start fetch $src source code" + + if [[ $BSP_URL =~ github.com ]] ; then + pr_error "INFO: Please download $BOARD CortexM SDK from https://mcuxpresso.nxp.com by manual." + else + pack=cortexm-sdk-${BOARD} + + # Download source code packet + if [ ! -s $TARBALL_PATH/$pack.tar.gz ] ; then + wget $BSP_URL/bsp/$BSP_VER/$pack.tar.gz -P $TARBALL_PATH + fi + + # decompress source code packet + do_unpack $TARBALL_PATH/$pack.tar.gz $PRJ_PATH/$src + fi + fi + fi + + # Download firmware from NXP official URL mkdir -p $FMW_PATH && cd $FMW_PATH for fmw in $FMWS @@ -155,7 +250,7 @@ # Cortex-M SDK download from https://mcuxpresso.nxp.com/ by manual function build_cortexM() { - SRC=mcore-sdk + SRC=cortexm-sdk if [ "$BUILD_MCORE" != "yes" ] ; then pr_warn "Skip build Cortex-M core SDK source code '$SRC'" @@ -279,11 +374,17 @@ pr_info "Copy DDR4 firmware to $MKIMG_BIN_PATH" cp $FMW_PATH/firmware-imx-*/firmware/hdmi/cadence/signed_hdmi_imx8m.bin $MKIMG_BIN_PATH + + # IGKBoard-IMX8MP Board cp $FMW_PATH/firmware-imx-*/firmware/ddr/synopsys/lpddr4_pmu_train_[1-2]d_imem_202006.bin $MKIMG_BIN_PATH cp $FMW_PATH/firmware-imx-*/firmware/ddr/synopsys/lpddr4_pmu_train_[1-2]d_dmem_202006.bin $MKIMG_BIN_PATH + + # STCRBoard-IMX8MM Board + cp $FMW_PATH/firmware-imx-*/firmware/ddr/synopsys/ddr4_imem_[1-2]d*.bin $MKIMG_BIN_PATH + cp $FMW_PATH/firmware-imx-*/firmware/ddr/synopsys/ddr4_dmem_[1-2]d*.bin $MKIMG_BIN_PATH fi - make SOC=$IMX_BOOT_SOC_TARGET $IMXBOOT_TARGETS + make SOC=$IMX_BOOT_SOC_TARGET $IMXBOOT_ARGS $IMXBOOT_TARGETS cp $MKIMG_BIN_PATH/flash.bin u-boot-${BOARD}.imx chmod a+x u-boot-${BOARD}.imx @@ -304,8 +405,8 @@ fi build_atf - build_cortexM build_imxboot + build_cortexM } function do_install() @@ -331,6 +432,8 @@ done rm -rf $PRJ_PATH/firmware + rm -rf $PRJ_PATH/cortexm-sdk + rm -rf $PRJ_PATH/tarballs rm -rf $PRFX_PATH } -- Gitblit v1.9.1