| | |
| | | # binaries finally install path if needed |
| | | #INST_PATH=/tftp |
| | | |
| | | # compress system image or not |
| | | COMPRESS=yes |
| | | |
| | | # download taballs path |
| | | TARBALL_PATH=$PRJ_PATH/tarballs |
| | | |
| | |
| | | |
| | | # shell script will exit once get command error |
| | | set -e |
| | | set -u |
| | | |
| | | #+-------------------------+ |
| | | #| Shell script functions | |
| | |
| | | export UBOOT_BINPATH=$TOP_PATH/bootloader/install/ |
| | | export KERNEL_BINPATH=$TOP_PATH/kernel/install/ |
| | | export ROOTFS_YCTPATH=$TOP_PATH/yocto/install/ |
| | | export IMAGE_NAME=${DIS_TYPE}-${DIS_VER}-${BOARD}.img |
| | | export KERNEL_IMAGE=Image |
| | | |
| | | if [[ $BOARD =~ mx8ulp ]] || [[ $BOARD =~ mx8mq ]] || [[ $BOARD =~ mx8mm ]] ; then |
| | | export UBOOT_OFFSET_SECTOR=66 |
| | |
| | | export UBOOT_OFFSET_SECTOR=64 |
| | | elif [[ $BOARD =~ mx6 ]] || [[ $BOARD =~ mx7 ]] ; then |
| | | export UBOOT_OFFSET_SECTOR=2 |
| | | export KERNEL_IMAGE=zImage |
| | | fi |
| | | } |
| | | |
| | |
| | | # Decompress the rootfs form Yocto build install path |
| | | if [[ $DIS_TYPE == yocto ]] ; then |
| | | |
| | | for tarball in $ROOTFS_YCTPATH/*$BOARD*.${TAR_TYPE} |
| | | for tarball in $ROOTFS_YCTPATH/*.${TAR_TYPE} |
| | | do |
| | | if [ -s $tarball ] ; then |
| | | pr_warn "Decompress $ROOTFS from yocto install path" |
| | |
| | | |
| | | # Download source code packet |
| | | if [ ! -s $TARBALL_PATH/$tarball ] ; then |
| | | wget $BSP_URL/${BOARD}/rootfs/$tarball -P $TARBALL_PATH |
| | | wget $BSP_URL/imx/${BOARD}/rootfs/$tarball -P $TARBALL_PATH |
| | | fi |
| | | |
| | | # decompress source code packet |
| | |
| | | |
| | | function build_image() |
| | | { |
| | | export IMAGE_NAME=$BOARD-$DIS_VER.img |
| | | |
| | | # Uboot size set be 10MB and deployed in 64th sector on eMMC/TFCard |
| | | UBOOT_SIZE=10 |
| | | |
| | |
| | | |
| | | pr_info "start install linux kernel images" |
| | | mount -t vfat /dev/mapper/${LOOP_DEV}p1 ${MNT_POINT} |
| | | cp -rf $KERNEL_BINPATH/Image ${MNT_POINT}/ |
| | | cp -rf $PRJ_PATH/patches/config-${BOARD}.txt ${MNT_POINT}/config.txt |
| | | cp -rf $KERNEL_BINPATH/$KERNEL_IMAGE ${MNT_POINT}/ |
| | | cp -rf $KERNEL_BINPATH/${BOARD}.dtb ${MNT_POINT}/ |
| | | if [ -d $KERNEL_BINPATH/overlays ] ; then |
| | | cp -rf $KERNEL_BINPATH/overlays ${MNT_POINT}/ |
| | | fi |
| | | |
| | | sync && umount ${MNT_POINT} |
| | | |
| | |
| | | cp -af $ROOTFS/* ${MNT_POINT} |
| | | sync && umount ${MNT_POINT} |
| | | |
| | | pr_warn "Build $BOARD-$BSP_VER-$DIS_VER system image done" |
| | | pr_warn "Build system image $IMAGE_NAME done" |
| | | } |
| | | |
| | | function exit_handler() |
| | |
| | | { |
| | | cd $PRJ_PATH |
| | | |
| | | if [[ `echo $COMPRESS | tr 'A-Z' 'a-z'` == "yes" ]] ; then |
| | | pr_info "Start bzip2 compress $IMAGE_NAME" |
| | | rm -f $IMAGE_NAME.bz2 |
| | | bzip2 $IMAGE_NAME |
| | | fi |
| | | |
| | | mkdir -p $PRFX_PATH |
| | | mv $IMAGE_NAME* $PRFX_PATH |
| | | cp $UBOOT_BINPATH/u-boot-${BOARD}.imx $PRFX_PATH |
| | | mv $IMAGE_NAME $PRFX_PATH |
| | | |
| | | if [[ -n "$INST_PATH" && -w $INST_PATH ]] ; then |
| | | pr_info "install bootloader and system image to '$INST_PATH'" |
| | | cp $PRFX_PATH/u-boot-${BOARD}.imx $INST_PATH |
| | | cp $PRFX_PATH/$IMAGE_NAME $INST_PATH |
| | | cp $PRFX_PATH/$IMAGE_NAME* $INST_PATH |
| | | fi |
| | | } |
| | | |
| | | |
| | | function do_clean() |
| | | { |
| | |
| | | exit; |
| | | fi |
| | | |
| | | pr_warn "Build $BOARD-$BSP_VER-$DIS_VER system image" |
| | | pr_warn "Build system image $IMAGE_NAME" |
| | | |
| | | trap 'exit_handler' EXIT |
| | | |