Skip to content
Permalink
Browse files

u-boot: Add SPL support

- 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.

- Adjust scripts for SPL

Signed-off-by: Eran Matityahu <eran.m@variscite.com>
  • Loading branch information...
eranmati committed Mar 14, 2018
1 parent c47a735 commit e9a2b313a2a8a69562c3a84c2bd1e9d45b518e08
Showing with 37 additions and 13 deletions.
  1. +14 −7 make_var_som_mx7_debian.sh
  2. +8 −2 variscite/debian-emmc.sh
  3. +15 −4 variscite/debian-nand.sh
@@ -51,11 +51,13 @@ readonly G_LINUX_DTB='imx7d-var-som-emmc.dtb imx7d-var-som-emmc-m4.dtb imx7d-var
## uboot
readonly G_UBOOT_SRC_DIR="${DEF_SRC_DIR}/uboot"
readonly G_UBOOT_GIT="https://github.com/varigit/uboot-imx.git"
readonly G_UBOOT_BRANCH="imx_v2015.04_4.1.15_1.1.0_ga_var03"
readonly G_UBOOT_REV="4f1603cd366f5ed0e8d7634f1b5ad07473d94c5a"
readonly G_UBOOT_BRANCH="imx_v2017.03_4.9.11_1.0.0_ga_var01"
readonly G_UBOOT_REV="3b5f889cb501c9fbe44c750c657dcd9ea4875176"
readonly G_UBOOT_DEF_CONFIG_MMC='mx7dvar_som_defconfig'
readonly G_UBOOT_DEF_CONFIG_NAND='mx7dvar_som_nand_defconfig'
readonly G_SPL_NAME_FOR_EMMC='SPL.mmc'
readonly G_UBOOT_NAME_FOR_EMMC='u-boot.img.mmc'
readonly G_SPL_NAME_FOR_NAND='SPL.nand'
readonly G_UBOOT_NAME_FOR_NAND='u-boot.img.nand'

## Broadcom BT/WIFI firmware ##
@@ -604,7 +606,8 @@ function make_uboot() {
make ARCH=arm -C ${1} CROSS_COMPILE=${G_CROSS_COMPILEER_PATH}/${G_CROSS_COMPILEER_PREFFIX} ${G_CROSS_COMPILEER_JOPTION}

# copy images
cp ${1}/u-boot.imx ${2}/${G_UBOOT_NAME_FOR_EMMC}
cp ${1}/SPL ${2}/${G_SPL_NAME_FOR_EMMC}
cp ${1}/u-boot.img ${2}/${G_UBOOT_NAME_FOR_EMMC}

### make nand uboot ###
pr_info "Make SPL & u-boot: ${G_UBOOT_DEF_CONFIG_NAND}"
@@ -618,7 +621,8 @@ function make_uboot() {
make ARCH=arm -C ${1} CROSS_COMPILE=${G_CROSS_COMPILEER_PATH}/${G_CROSS_COMPILEER_PREFFIX} ${G_CROSS_COMPILEER_JOPTION}

# copy images
cp ${1}/u-boot.imx ${2}/${G_UBOOT_NAME_FOR_NAND}
cp ${1}/SPL ${2}/${G_SPL_NAME_FOR_NAND}
cp ${1}/u-boot.img ${2}/${G_UBOOT_NAME_FOR_NAND}

return 0;
}
@@ -773,7 +777,8 @@ function make_sdcard() {
function flash_u-boot
{
pr_info "Flashing U-Boot"
dd if=${LPARAM_OUTPUT_DIR}/${G_UBOOT_NAME_FOR_EMMC} of=${LPARAM_BLOCK_DEVICE} bs=1K seek=1; sync
dd if=${LPARAM_OUTPUT_DIR}/${G_SPL_NAME_FOR_EMMC} of=${LPARAM_BLOCK_DEVICE} bs=1K seek=1; sync
dd if=${LPARAM_OUTPUT_DIR}/${G_UBOOT_NAME_FOR_EMMC} of=${LPARAM_BLOCK_DEVICE} bs=1K seek=69; sync
}

function flash_sdcard
@@ -799,10 +804,12 @@ function make_sdcard() {
cp ${LPARAM_OUTPUT_DIR}/*.dtb ${P2_MOUNT_DIR}/${DEBIAN_IMAGES_TO_ROOTFS_POINT}/

pr_info "Copying NAND U-Boot to /${DEBIAN_IMAGES_TO_ROOTFS_POINT}"
cp ${LPARAM_OUTPUT_DIR}/${G_UBOOT_NAME_FOR_NAND} ${P2_MOUNT_DIR}/${DEBIAN_IMAGES_TO_ROOTFS_POINT}/u-boot.img.nand
cp ${LPARAM_OUTPUT_DIR}/${G_SPL_NAME_FOR_NAND} ${P2_MOUNT_DIR}/${DEBIAN_IMAGES_TO_ROOTFS_POINT}/
cp ${LPARAM_OUTPUT_DIR}/${G_UBOOT_NAME_FOR_NAND} ${P2_MOUNT_DIR}/${DEBIAN_IMAGES_TO_ROOTFS_POINT}/

pr_info "Copying MMC U-Boot to /${DEBIAN_IMAGES_TO_ROOTFS_POINT}"
cp ${LPARAM_OUTPUT_DIR}/${G_UBOOT_NAME_FOR_EMMC} ${P2_MOUNT_DIR}/${DEBIAN_IMAGES_TO_ROOTFS_POINT}/u-boot.img.mmc
cp ${LPARAM_OUTPUT_DIR}/${G_SPL_NAME_FOR_EMMC} ${P2_MOUNT_DIR}/${DEBIAN_IMAGES_TO_ROOTFS_POINT}/
cp ${LPARAM_OUTPUT_DIR}/${G_UBOOT_NAME_FOR_EMMC} ${P2_MOUNT_DIR}/${DEBIAN_IMAGES_TO_ROOTFS_POINT}/

return 0;
}
@@ -14,11 +14,16 @@ echo " Installing Debian to eMMC"
echo "================================"

cd /opt/images/Debian
if [ ! -f SPL.mmc ]
then
echo "SPL does not exist! exit."
exit 1
fi
if [ ! -f u-boot.img.mmc ]
then
echo "u-boot.img does not exist! exit."
exit 1
fi
fi


help() {
@@ -67,7 +72,8 @@ function flash_yocto
echo "==============="

echo "Flashing U-Boot"
dd if=u-boot.img.mmc of=${node} bs=1K seek=1; sync
dd if=SPL.mmc of=${node} bs=1K seek=1; sync
dd if=u-boot.img.mmc of=${node} bs=1K seek=69; sync

echo "Flashing Debian BOOT partition"
mkdir -p /tmp/media/mmcblk2p1
@@ -4,6 +4,7 @@
#

#### global constants ####
readonly SPL_IMAGE='SPL.nand'
readonly UBOOT_IMAGE='u-boot.img.nand'
readonly KERNEL_IMAGE='zImage'
KERNEL_DTB='imx7d-var-som-nand.dtb'
@@ -53,15 +54,25 @@ echo "============================================"

function install_bootloader()
{
[ ! -f ${IMAGES_PATH}/$SPL_IMAGE ] && {
echo "\"${IMAGES_PATH}/$SPL_IMAGE\"" does not exist! exit.
exit 1
};

[ ! -f ${IMAGES_PATH}/$UBOOT_IMAGE ] && {
echo "\"${IMAGES_PATH}/$UBOOT_IMAGE\"" does not exist! exit.
exit 1
};

echo
echo "Installing U-BOOT from \"${IMAGES_PATH}/$UBOOT_IMAGE\"..."
echo "Installing SPL from \"${IMAGES_PATH}/$SPL_IMAGE\"... "
flash_erase /dev/mtd0 0 0 2>/dev/null
kobs-ng init -x ${IMAGES_PATH}/$UBOOT_IMAGE --search_exponent=1 -v > /dev/null
kobs-ng init -x ${IMAGES_PATH}/$SPL_IMAGE --search_exponent=1 -v > /dev/null

echo
echo "Installing U-BOOT from \"${IMAGES_PATH}/$UBOOT_IMAGE\"..."
flash_erase /dev/mtd1 0 0 2>/dev/null
nandwrite -p /dev/mtd1 ${IMAGES_PATH}/$UBOOT_IMAGE; sync

# delete uboot env
flash_erase /dev/mtd2 0 0 2>/dev/null
@@ -98,8 +109,8 @@ function install_rootfs()

#Creating 5 MTD partitions on "gpmi-nand":
#0x000000000000-0x000000200000 : "spl"
#0x000000200000-0x000000400000 : "uboot"
#0x000000400000-0x000000600000 : "uboot-env"
#0x000000200000-0x000000400000 : "u-boot"
#0x000000400000-0x000000600000 : "u-boot_env"
#0x000000600000-0x000000e00000 : "kernel"
#0x000000e00000-0x000040000000 : "rootfs"

0 comments on commit e9a2b31

Please sign in to comment.
You can’t perform that action at this time.