Skip to content

Commit

Permalink
imx7-var-som: u-boot: Add SPL support
Browse files Browse the repository at this point in the history
- u-boot: Update to the latest Variscite branch,
imx_v2017.03_4.9.11_1.0.0_ga_var01, which is originally based on
the official NXP release imx_v2017.03_4.9.11_1.0.0_ga (which is
based on U-Boot v2017.03), and has added SPL support for VAR-SOM-MX7.

- u-boot-fw-utils: Update mmc env. offset in config file

- Adjust the machine configuration and scripts for SPL

Signed-off-by: Eran Matityahu <eran.m@variscite.com>
  • Loading branch information
eranmati committed Mar 19, 2018
1 parent e56b425 commit 028d44b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 46 deletions.
3 changes: 2 additions & 1 deletion conf/machine/imx7-var-som.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ PREFERRED_PROVIDER_u-boot_imx7-var-som = "u-boot-variscite"
PREFERRED_PROVIDER_virtual/bootloader_imx7-var-som = "u-boot-variscite"

UBOOT_MAKE_TARGET = ""
UBOOT_SUFFIX = "imx"
SPL_BINARY = "SPL"
UBOOT_SUFFIX = "img"
UBOOT_CONFIG ??= "nand sd "
# The above order matters. The last one will be also called u-boot-${MACHINE} and will be used to create the sdcard.
UBOOT_CONFIG[sd] = "mx7dvar_som_defconfig,sdcard"
Expand Down
4 changes: 3 additions & 1 deletion recipes-bsp/u-boot/u-boot-fw-utils.bb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ SECTION = "bootloader"
DEPENDS = "mtd-utils"

SRCBRANCH = "imx_v2015.04_4.1.15_1.1.0_ga_var03"
SRCBRANCH_imx7-var-som = "imx_v2017.03_4.9.11_1.0.0_ga_var01"
UBOOT_SRC = "git://github.com/varigit/uboot-imx.git;protocol=git"
SRC_URI = "${UBOOT_SRC};branch=${SRCBRANCH}"
SRCREV_var-som-mx6 = "1dad2408add54118dc25f944f33ddbaf0944b993"
SRCREV = "3dcc0ab7cb6f8921442b04a8c2eb9842030c25a7"
SRCREV_imx6ul-var-dart = "3dcc0ab7cb6f8921442b04a8c2eb9842030c25a7"
SRCREV_imx7-var-som = "f7324fd25895bb9e3ea3b45d6a153626e58d9d99"

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/dev/mtd2 0x00000 0x20000 0x20000 1

# Block device example
#/dev/mmcblk0 0x80000 0x2000
#/dev/mmcblk0 0xE0000 0x2000

# VFAT example
#/boot/uboot.env 0x00000 0x4000
4 changes: 3 additions & 1 deletion recipes-bsp/u-boot/u-boot-variscite.bb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ LIC_FILES_CHKSUM = "file://Licenses/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a
PROVIDES += "u-boot"

SRCBRANCH = "imx_v2015.04_4.1.15_1.1.0_ga_var03"
SRCBRANCH_imx7-var-som = "imx_v2017.03_4.9.11_1.0.0_ga_var01"
UBOOT_SRC = "git://github.com/varigit/uboot-imx.git;protocol=git"
SRC_URI = "${UBOOT_SRC};branch=${SRCBRANCH}"
SRCREV_var-som-mx6 = "1dad2408add54118dc25f944f33ddbaf0944b993"
SRCREV = "3dcc0ab7cb6f8921442b04a8c2eb9842030c25a7"
SRCREV_imx6ul-var-dart = "3dcc0ab7cb6f8921442b04a8c2eb9842030c25a7"
SRCREV_imx7-var-som = "f7324fd25895bb9e3ea3b45d6a153626e58d9d99"

S = "${WORKDIR}/git"

Expand Down
22 changes: 6 additions & 16 deletions scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,10 @@ fi

if [ "$MACHINE" == "var-som-mx6" ] ; then
FAT_VOLNAME=BOOT-VARMX6
IS_SPL=true
elif [ "$MACHINE" == "imx6ul-var-dart" ] ; then
FAT_VOLNAME=BOOT-VAR6UL
IS_SPL=true
elif [ "$MACHINE" == "imx7-var-som" ] ; then
FAT_VOLNAME=BOOT-VARMX7
IS_SPL=false
else
help
exit 1
Expand Down Expand Up @@ -231,12 +228,8 @@ function install_bootloader
{
echo
echo "Installing U-Boot"
if [ "$IS_SPL" == "true" ] ; then
dd if=${YOCTO_IMGS_PATH}/SPL-sd of=${node} bs=1K seek=1; sync
dd if=${YOCTO_IMGS_PATH}/u-boot.img-sd of=${node} bs=1K seek=69; sync
else
dd if=${YOCTO_IMGS_PATH}/u-boot.imx-sd of=${node} bs=1K seek=1; sync
fi
dd if=${YOCTO_IMGS_PATH}/SPL-sd of=${node} bs=1K seek=1; sync
dd if=${YOCTO_IMGS_PATH}/u-boot.img-sd of=${node} bs=1K seek=69; sync
}

function mount_parts
Expand Down Expand Up @@ -295,13 +288,10 @@ function copy_images
echo "W:rootfs.ubi file is not present. Installation on \"NAND flash\" will not be supported!"
fi

cp ${YOCTO_RECOVERY_ROOTFS_PATH}/u-boot.im?-nand ${P2_MOUNT_DIR}/opt/images/Yocto/
cp ${YOCTO_RECOVERY_ROOTFS_PATH}/u-boot.im?-sd ${P2_MOUNT_DIR}/opt/images/Yocto/

if [ "$IS_SPL" == "true" ] ; then
cp ${YOCTO_RECOVERY_ROOTFS_PATH}/SPL-nand ${P2_MOUNT_DIR}/opt/images/Yocto/
cp ${YOCTO_RECOVERY_ROOTFS_PATH}/SPL-sd ${P2_MOUNT_DIR}/opt/images/Yocto/
fi
cp ${YOCTO_RECOVERY_ROOTFS_PATH}/SPL-nand ${P2_MOUNT_DIR}/opt/images/Yocto/
cp ${YOCTO_RECOVERY_ROOTFS_PATH}/SPL-sd ${P2_MOUNT_DIR}/opt/images/Yocto/
cp ${YOCTO_RECOVERY_ROOTFS_PATH}/u-boot.img-nand ${P2_MOUNT_DIR}/opt/images/Yocto/
cp ${YOCTO_RECOVERY_ROOTFS_PATH}/u-boot.img-sd ${P2_MOUNT_DIR}/opt/images/Yocto/
}

function copy_scripts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ fi

check_images()
{
if [[ ! -f $IMGS_PATH/$UBOOT_IMAGE ]] ; then
red_bold_echo "ERROR: \"$IMGS_PATH/$UBOOT_IMAGE\" does not exist"
if [[ ! -f $IMGS_PATH/$SPL_IMAGE ]] ; then
red_bold_echo "ERROR: \"$IMGS_PATH/$SPL_IMAGE\" does not exist"
exit 1
fi

if [[ $IS_SPL == "true" && ! -f $IMGS_PATH/$SPL_IMAGE ]] ; then
red_bold_echo "ERROR: \"$IMGS_PATH/$SPL_IMAGE\" does not exist"
if [[ ! -f $IMGS_PATH/$UBOOT_IMAGE ]] ; then
red_bold_echo "ERROR: \"$IMGS_PATH/$UBOOT_IMAGE\" does not exist"
exit 1
fi

Expand All @@ -48,14 +48,10 @@ install_bootloader_to_nand()
blue_underlined_bold_echo "Installing booloader"

flash_erase /dev/mtd0 0 0 2> /dev/null
if [[ $IS_SPL == "true" ]] ; then
kobs-ng init -x $IMGS_PATH/$SPL_IMAGE --search_exponent=1 -v > /dev/null
kobs-ng init -x $IMGS_PATH/$SPL_IMAGE --search_exponent=1 -v > /dev/null

flash_erase /dev/mtd1 0 0 2> /dev/null
nandwrite -p /dev/mtd1 $IMGS_PATH/$UBOOT_IMAGE
else
kobs-ng init -x $IMGS_PATH/$UBOOT_IMAGE --search_exponent=1 -v > /dev/null
fi
flash_erase /dev/mtd1 0 0 2> /dev/null
nandwrite -p /dev/mtd1 $IMGS_PATH/$UBOOT_IMAGE

flash_erase /dev/mtd2 0 0 2> /dev/null
sync
Expand Down Expand Up @@ -134,12 +130,8 @@ install_bootloader_to_emmc()
echo
blue_underlined_bold_echo "Installing booloader"
if [[ $IS_SPL == "true" ]] ; then
dd if=${IMGS_PATH}/${SPL_IMAGE} of=${node} bs=1K seek=1; sync
dd if=${IMGS_PATH}/${UBOOT_IMAGE} of=${node} bs=1K seek=69; sync
else
dd if=${IMGS_PATH}/${UBOOT_IMAGE} of=${node} bs=1K seek=1; sync
fi
dd if=${IMGS_PATH}/${SPL_IMAGE} of=${node} bs=1K seek=1; sync
dd if=${IMGS_PATH}/${UBOOT_IMAGE} of=${node} bs=1K seek=69; sync
}
install_kernel_to_emmc()
Expand Down Expand Up @@ -222,13 +214,10 @@ STR=""
if [[ $BOARD == "mx6ul" ]] ; then
STR="DART-6UL"
IS_SPL=true
elif [[ $BOARD == "mx6ull" ]] ; then
STR="DART-6ULL"
IS_SPL=true
elif [[ $BOARD == "mx7" ]] ; then
STR="VAR-SOM-MX7"
IS_SPL=false
else
usage
exit 1
Expand Down Expand Up @@ -268,9 +257,10 @@ blue_bold_echo $STR
if [[ $STORAGE_DEV == "nand" ]] ; then
SPL_IMAGE=SPL-nand
UBOOT_IMAGE=u-boot.img-nand
if [[ $BOARD == "mx6ul" || $BOARD == "mx6ull" ]] ; then
SPL_IMAGE=SPL-nand
UBOOT_IMAGE=u-boot.img-nand
if [[ $BOARD == "mx6ul" ]] ; then
if [[ $DART6UL_VARIANT == "wifi" ]] ; then
KERNEL_DTB=imx6ul-var-dart-nand_wifi.dtb
Expand All @@ -285,7 +275,6 @@ if [[ $STORAGE_DEV == "nand" ]] ; then
fi
fi
elif [[ $BOARD == "mx7" ]] ; then
UBOOT_IMAGE=u-boot.imx-nand
KERNEL_DTB=imx7d-var-som-nand.dtb
fi
Expand All @@ -303,10 +292,11 @@ if [[ $STORAGE_DEV == "nand" ]] ; then
install_kernel_to_nand
install_rootfs_to_nand
elif [[ $STORAGE_DEV == "emmc" ]] ; then
SPL_IMAGE=SPL-sd
UBOOT_IMAGE=u-boot.img-sd
if [[ $BOARD == "mx6ul" || $BOARD == "mx6ull" ]] ; then
block=mmcblk1
SPL_IMAGE=SPL-sd
UBOOT_IMAGE=u-boot.img-sd
if [[ $BOARD == "mx6ul" ]] ; then
KERNEL_DTBS="imx6ul-var-dart-emmc_wifi.dtb
imx6ul-var-dart-sd_emmc.dtb"
Expand All @@ -318,7 +308,6 @@ elif [[ $STORAGE_DEV == "emmc" ]] ; then
fi
elif [[ $BOARD == "mx7" ]] ; then
block=mmcblk2
UBOOT_IMAGE=u-boot.imx-sd
KERNEL_DTBS=imx7d-var-som-emmc.dtb
FAT_VOLNAME=BOOT-VARMX7
fi
Expand Down

0 comments on commit 028d44b

Please sign in to comment.