| | |
| | | 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 |
| | |
| | | { |
| | | 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 BSP_URL=`jq -r ".bsp.giturl" $CONF_FILE` |
| | | export DIS_TYPE=`jq -r ".system.distro" $CONF_FILE | tr 'A-Z' 'a-z'` |
| | | export DIS_VER=`jq -r ".system.version" $CONF_FILE | tr 'A-Z' 'a-z'` |
| | | export IMAGE_SIZE=`jq -r ".system.imgsize" $CONF_FILE | tr 'A-Z' 'a-z'` |
| | | export BOOT_SIZE=`jq -r ".system.bootsize" $CONF_FILE | tr 'A-Z' 'a-z'` |
| | |
| | | export ROOTFS=rootfs-${DIS_VER} |
| | | export UBOOT_BINPATH=$TOP_PATH/bootloader/install/ |
| | | export KERNEL_BINPATH=$TOP_PATH/kernel/install/ |
| | | export ROOTFS_TARPATH=$TOP_PATH/images/tarballs/ |
| | | export ROOTFS_YCTPATH=$TOP_PATH/yocto/install/ |
| | | |
| | | if [[ $BOARD =~ mx8ulp ]] || [[ $BOARD =~ mx8mq ]] || [[ $BOARD =~ mx8mm ]] ; then |
| | |
| | | { |
| | | cd $PRJ_PATH |
| | | |
| | | SRCS=$ROOTFS |
| | | |
| | | for src in $SRCS |
| | | do |
| | | if [ -d $ROOTFS/bin ] ; then |
| | | pr_info "$src fetched already" |
| | | continue |
| | | pr_info "$ROOTFS fetched already" |
| | | return ; |
| | | fi |
| | | |
| | | for tarball in $ROOTFS_TARPATH/rootfs*${DIS_VER}.tar.* |
| | | do |
| | | if [ -s $tarball ] ; then |
| | | pr_warn "Decompress $ROOTFS from tarballs" |
| | | mkdir -p $ROOTFS |
| | | do_unpack $tarball $ROOTFS |
| | | break; |
| | | if [[ $DIS_TYPE == yocto ]] ; then |
| | | TAR_TYPE=tar.zst |
| | | else |
| | | TAR_TYPE=tar.xz |
| | | fi |
| | | done |
| | | |
| | | for tarball in $ROOTFS_YCTPATH/rootfs.tar.* |
| | | # Decompress the rootfs form Yocto build install path |
| | | if [[ $DIS_TYPE == yocto ]] ; then |
| | | |
| | | for tarball in $ROOTFS_YCTPATH/*$BOARD*.${TAR_TYPE} |
| | | do |
| | | if [ -s $tarball ] ; then |
| | | pr_warn "Decompress $ROOTFS from yocto install path" |
| | | mkdir -p $ROOTFS |
| | | do_unpack $tarball $ROOTFS |
| | | break; |
| | | return ; |
| | | fi |
| | | done |
| | | fi |
| | | |
| | | done |
| | | tarball=rootfs-${DIS_TYPE}-${DIS_VER}.${TAR_TYPE} |
| | | |
| | | if [ ! -d $ROOTFS ] ; then |
| | | if [[ $BSP_URL =~ github.com ]] ; then |
| | | |
| | | pr_error "INFO: Please download $tarball and decompress it to folder '$PRJ_PATH/$ROOTFS'" |
| | | |
| | | else |
| | | |
| | | pr_info "INFO: download $tarball form $BSP_URL" |
| | | |
| | | mkdir -p $TARBALL_PATH |
| | | |
| | | # Download source code packet |
| | | if [ ! -s $TARBALL_PATH/$tarball ] ; then |
| | | wget $BSP_URL/${BOARD}/rootfs/$tarball -P $TARBALL_PATH |
| | | fi |
| | | |
| | | # decompress source code packet |
| | | do_unpack $TARBALL_PATH/$tarball $ROOTFS |
| | | fi |
| | | |
| | | if [ ! -d $ROOTFS/bin ] ; then |
| | | pr_error "Fetch rootfs $ROOTFS failed" |
| | | exit ; |
| | | fi |
| | |
| | | rm -rf $PRJ_PATH/$d |
| | | done |
| | | |
| | | rm -rf $PRJ_PATH/tarballs |
| | | rm -rf $PRFX_PATH |
| | | rm -f *.img |
| | | } |