u-boot-dey: improve uuu install script with options

Previously, this script only allowed the U-Boot filename as parameter.
This commit makes use of getopts() to pass the following options to the
script:
  -h, for help
  -i, to pass the dey image name that prefixes the firmware filenames
  -n, to skip the 10 seconds delay that allow you to cancel the process
  -u, to pass the U-Boot filename

The default image name (if none passed) keeps being 'dey-image-qt' but the
new option allows reusing this script to install dey-image-webkit or
dey-image-aws images.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://jira.digi.com/browse/DEL-7385
This commit is contained in:
Hector Palacios 2021-05-18 11:22:18 +02:00
parent 0d1984224b
commit f1f3af5e66
5 changed files with 342 additions and 200 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
#=============================================================================== #===============================================================================
# #
# Copyright (C) 2020 by Digi International Inc. # Copyright (C) 2020-2021 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -13,6 +13,10 @@
# Script to flash Yocto build artifacts over USB to the target. # Script to flash Yocto build artifacts over USB to the target.
#=============================================================================== #===============================================================================
# set -x # set -x
#
# U-Boot script for installing Linux images created by Yocto into the NAND
#
clear clear
# Parse uuu cmd output # Parse uuu cmd output
@ -21,6 +25,21 @@ getenv()
uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p" uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p"
} }
show_usage()
{
echo "Usage: $0 [options]"
echo ""
echo " Options:"
echo " -h Show this help."
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to 'dey-image-qt' if not provided."
echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -u <u-boot-filename> U-Boot filename."
echo " Auto-determined by variant if not provided."
exit 2
}
# Update a NAND partition # Update a NAND partition
# Params: # Params:
# 1. partition # 1. partition
@ -41,28 +60,37 @@ nand_update()
uuu "fb[-t ${3}]:" ucmd update "${1}" ram \${fastboot_buffer} \${fastboot_bytes} uuu "fb[-t ${3}]:" ucmd update "${1}" ram \${fastboot_buffer} \${fastboot_bytes}
} }
# # Command line admits the following parameters:
# U-Boot script for installing Linux images created by Yocto into the NAND # -u <u-boot-filename>
# # -i <image-name>
echo "############################################################" while getopts 'hi:nu:' c
echo "# Linux firmware install through USB OTG #" do
echo "############################################################" case $c in
echo "" h) show_usage ;;
echo " This process will erase your NAND and will install a new" i) IMAGE_NAME=${OPTARG} ;;
echo " U-Boot and Linux firmware images on the NAND." n) NOWAIT=true ;;
echo "" u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
echo " Press CTRL+C now if you wish to abort or wait 10 seconds" esac
echo " to continue." done
sleep 10 if [ ! "${NOWAIT}" = true ]; then
echo "############################################################"
echo "# Linux firmware install through USB OTG #"
echo "############################################################"
echo ""
echo " This process will erase your NAND and will install a new"
echo " U-Boot and Linux firmware images on the NAND."
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
fi
# Enable the redirect support to get u-boot variables values # Enable the redirect support to get u-boot variables values
uuu fb: ucmd setenv stdout serial,fastboot uuu fb: ucmd setenv stdout serial,fastboot
# Get U-Boot file name from cmdline when passed # Determine U-Boot filename if not provided
if [ -n "$1" ]; then if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then
INSTALL_UBOOT_FILENAME="$1"
else
module_variant=$(getenv "module_variant") module_variant=$(getenv "module_variant")
# Determine U-Boot file to program basing on SOM's variant # Determine U-Boot file to program basing on SOM's variant
if [ -n "$module_variant" ]; then if [ -n "$module_variant" ]; then
@ -77,33 +105,33 @@ else
INSTALL_UBOOT_FILENAME="u-boot-ccimx6ulsbc.imx" INSTALL_UBOOT_FILENAME="u-boot-ccimx6ulsbc.imx"
fi fi
fi fi
# u-boot when the checked value is empty.
if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then
true
else
echo ""
echo "[ERROR] Cannot determine U-Boot file for this module!"
echo ""
echo "1. Add U-boot file name, depending on your ConnectCore 8X variant, to script command line:"
echo " - For a SOM with 1GB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh -u u-boot-ccimx6ulsbc1GB.imx"
echo " - For a SOM with 512MB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh -u u-boot-ccimx6ulsbc512MB.imx"
echo " - For a SOM with 256MB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh -u u-boot-ccimx6ulsbc.imx"
echo ""
echo "2. Run the install script again."
echo ""
echo "Aborted"
echo ""
exit
fi
fi fi
# remove redirect # remove redirect
uuu fb: ucmd setenv stdout serial uuu fb: ucmd setenv stdout serial
# u-boot when the checked value is empty.
if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then
true
else
echo ""
echo "[ERROR] Cannot determine U-Boot file for this module!"
echo ""
echo "1. Add U-boot file name, depending on your ConnectCore 8X variant, to script command line:"
echo " - For a SOM with 1GB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh u-boot-ccimx6ulsbc1GB.imx"
echo " - For a SOM with 512MB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh u-boot-ccimx6ulsbc512MB.imx"
echo " - For a SOM with 256MB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh u-boot-ccimx6ulsbc.imx"
echo ""
echo "2. Run the install script again."
echo ""
echo "Aborted"
echo ""
exit
fi
# Set fastboot buffer address to $loadaddr, just in case # Set fastboot buffer address to $loadaddr, just in case
uuu fb: ucmd setenv fastboot_buffer \${loadaddr} uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
@ -134,9 +162,12 @@ uuu fb: ucmd setenv bootcmd "
uuu fb: ucmd saveenv uuu fb: ucmd saveenv
uuu fb: acmd reset uuu fb: acmd reset
INSTALL_LINUX_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6ulsbc.boot.ubifs" if [ -z "${IMAGE_NAME}" ]; then
INSTALL_RECOVERY_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6ulsbc.recovery.ubifs" IMAGE_NAME="dey-image-qt"
INSTALL_ROOTFS_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6ulsbc.ubifs" fi
INSTALL_LINUX_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx6ulsbc.boot.ubifs"
INSTALL_RECOVERY_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx6ulsbc.recovery.ubifs"
INSTALL_ROOTFS_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx6ulsbc.ubifs"
# Wait for the target to reset # Wait for the target to reset
sleep 3 sleep 3

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
#=============================================================================== #===============================================================================
# #
# Copyright (C) 2020 by Digi International Inc. # Copyright (C) 2020-2021 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -13,6 +13,10 @@
# Script to flash Yocto build artifacts over USB to the target. # Script to flash Yocto build artifacts over USB to the target.
#=============================================================================== #===============================================================================
# set -x # set -x
#
# U-Boot script for installing Linux images created by Yocto into the NAND
#
clear clear
# Parse uuu cmd output # Parse uuu cmd output
@ -21,6 +25,21 @@ getenv()
uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p" uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p"
} }
show_usage()
{
echo "Usage: $0 [options]"
echo ""
echo " Options:"
echo " -h Show this help."
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to 'core-image-base' if not provided."
echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -u <u-boot-filename> U-Boot filename."
echo " Auto-determined by variant if not provided."
exit 2
}
# Update a NAND partition # Update a NAND partition
# Params: # Params:
# 1. partition # 1. partition
@ -41,28 +60,37 @@ nand_update()
uuu "fb[-t ${3}]:" ucmd update "${1}" ram \${fastboot_buffer} \${fastboot_bytes} uuu "fb[-t ${3}]:" ucmd update "${1}" ram \${fastboot_buffer} \${fastboot_bytes}
} }
# # Command line admits the following parameters:
# U-Boot script for installing Linux images created by Yocto into the NAND # -u <u-boot-filename>
# # -i <image-name>
echo "############################################################" while getopts 'hi:nu:' c
echo "# Linux firmware install through USB OTG #" do
echo "############################################################" case $c in
echo "" h) show_usage ;;
echo " This process will erase your NAND and will install a new" i) IMAGE_NAME=${OPTARG} ;;
echo " U-Boot and Linux firmware images on the NAND." n) NOWAIT=true ;;
echo "" u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
echo " Press CTRL+C now if you wish to abort or wait 10 seconds" esac
echo " to continue." done
sleep 10 if [ ! "${NOWAIT}" = true ]; then
echo "############################################################"
echo "# Linux firmware install through USB OTG #"
echo "############################################################"
echo ""
echo " This process will erase your NAND and will install a new"
echo " U-Boot and Linux firmware images on the NAND."
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
fi
# Enable the redirect support to get u-boot variables values # Enable the redirect support to get u-boot variables values
uuu fb: ucmd setenv stdout serial,fastboot uuu fb: ucmd setenv stdout serial,fastboot
# Get U-Boot file name from cmdline when passed # Determine U-Boot filename if not provided
if [ -n "$1" ]; then if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then
INSTALL_UBOOT_FILENAME="$1"
else
module_variant=$(getenv "module_variant") module_variant=$(getenv "module_variant")
# Determine U-Boot file to program basing on SOM's variant # Determine U-Boot file to program basing on SOM's variant
if [ -n "$module_variant" ]; then if [ -n "$module_variant" ]; then
@ -77,33 +105,33 @@ else
INSTALL_UBOOT_FILENAME="u-boot-ccimx6ulstarter.imx" INSTALL_UBOOT_FILENAME="u-boot-ccimx6ulstarter.imx"
fi fi
fi fi
# u-boot when the checked value is empty.
if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then
true
else
echo ""
echo "[ERROR] Cannot determine U-Boot file for this module!"
echo ""
echo "1. Add U-boot file name, depending on your ConnectCore 8X variant, to script command line:"
echo " - For a SOM with 1GB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh -u u-boot-ccimx6ulstarter1GB.imx"
echo " - For a SOM with 512MB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh -u u-boot-ccimx6ulstarter512MB.imx"
echo " - For a SOM with 256MB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh -u u-boot-ccimx6ulstarter.imx"
echo ""
echo "2. Run the install script again."
echo ""
echo "Aborted"
echo ""
exit
fi
fi fi
# remove redirect # remove redirect
uuu fb: ucmd setenv stdout serial uuu fb: ucmd setenv stdout serial
# u-boot when the checked value is empty.
if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then
true
else
echo ""
echo "[ERROR] Cannot determine U-Boot file for this module!"
echo ""
echo "1. Add U-boot file name, depending on your ConnectCore 8X variant, to script command line:"
echo " - For a SOM with 1GB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh u-boot-ccimx6ulstarter1GB.imx"
echo " - For a SOM with 512MB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh u-boot-ccimx6ulstarter512MB.imx"
echo " - For a SOM with 256MB DDR3, run:"
echo " => ./install_linux_fs_uuu.sh u-boot-ccimx6ulstarter.imx"
echo ""
echo "2. Run the install script again."
echo ""
echo "Aborted"
echo ""
exit
fi
# Set fastboot buffer address to $loadaddr, just in case # Set fastboot buffer address to $loadaddr, just in case
uuu fb: ucmd setenv fastboot_buffer \${loadaddr} uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
@ -134,9 +162,12 @@ uuu fb: ucmd setenv bootcmd "
uuu fb: ucmd saveenv uuu fb: ucmd saveenv
uuu fb: acmd reset uuu fb: acmd reset
INSTALL_LINUX_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6ulstarter.boot.ubifs" if [ -z "${IMAGE_NAME}" ]; then
INSTALL_RECOVERY_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6ulstarter.recovery.ubifs" IMAGE_NAME="core-image-base"
INSTALL_ROOTFS_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6ulstarter.ubifs" fi
INSTALL_LINUX_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx6ulstarter.boot.ubifs"
INSTALL_RECOVERY_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx6ulstarter.recovery.ubifs"
INSTALL_ROOTFS_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx6ulstarter.ubifs"
# Wait for the target to reset # Wait for the target to reset
sleep 3 sleep 3

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/sh
#=============================================================================== #===============================================================================
# #
# Copyright (C) 2021 by Digi International Inc. # Copyright (C) 2020-2021 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -14,35 +14,58 @@
#=============================================================================== #===============================================================================
# set -x # set -x
#
# U-Boot script for installing Linux images created by Yocto into the eMMC
#
clear clear
# Parse uuu cmd output # Parse uuu cmd output
function getenv() getenv()
{ {
uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p" uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p"
} }
# show_usage()
# U-Boot script for installing Linux images created by Yocto into the eMMC {
# echo "Usage: $0 [options]"
echo ""
echo " Options:"
echo " -h Show this help."
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to 'dey-image-qt' if not provided."
echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -u <u-boot-filename> U-Boot filename."
echo " Auto-determined by variant if not provided."
exit 2
}
echo "############################################################" # Command line admits the following parameters:
echo "# Linux firmware install through USB OTG #" # -u <u-boot-filename>
echo "############################################################" # -i <image-name>
echo "" while getopts 'hi:nu:' c
echo " This process will erase your eMMC and will install a new" do
echo " U-Boot and Linux firmware images on the eMMC." case $c in
echo "" h) show_usage ;;
echo " Press CTRL+C now if you wish to abort or wait 10 seconds" i) IMAGE_NAME=${OPTARG} ;;
echo " to continue." n) NOWAIT=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
esac
done
# Get U-Boot file name from cmdline when passed if [ ! "${NOWAIT}" = true ]; then
if [ -n "$1" ]; then echo "############################################################"
INSTALL_UBOOT_FILENAME="$1" echo "# Linux firmware install through USB OTG #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install a new"
echo " U-Boot and Linux firmware images on the eMMC."
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
fi fi
sleep 10
if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then
INSTALL_UBOOT_FILENAME="imx-boot-ccimx8mm-dvk.bin" INSTALL_UBOOT_FILENAME="imx-boot-ccimx8mm-dvk.bin"
fi fi
@ -91,9 +114,12 @@ uuu fb: ucmd saveenv
uuu fb: acmd reset uuu fb: acmd reset
INSTALL_LINUX_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8mm-dvk.boot.vfat" if [ -z "${IMAGE_NAME}" ]; then
INSTALL_RECOVERY_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8mm-dvk.recovery.vfat" IMAGE_NAME="dey-image-qt"
INSTALL_ROOTFS_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8mm-dvk.ext4" fi
INSTALL_LINUX_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx8mm-dvk.boot.vfat"
INSTALL_RECOVERY_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx8mm-dvk.recovery.vfat"
INSTALL_ROOTFS_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx8mm-dvk.ext4"
# Wait that target returns from reset # Wait that target returns from reset
sleep 3 sleep 3

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/sh
#=============================================================================== #===============================================================================
# #
# Copyright (C) 2020 by Digi International Inc. # Copyright (C) 2020-2021 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -14,35 +14,58 @@
#=============================================================================== #===============================================================================
# set -x # set -x
#
# U-Boot script for installing Linux images created by Yocto into the eMMC
#
clear clear
# Parse uuu cmd output # Parse uuu cmd output
function getenv() getenv()
{ {
uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p" uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p"
} }
# show_usage()
# U-Boot script for installing Linux images created by Yocto into the eMMC {
# echo "Usage: $0 [options]"
echo ""
echo " Options:"
echo " -h Show this help."
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to 'dey-image-qt' if not provided."
echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -u <u-boot-filename> U-Boot filename."
echo " Auto-determined by variant if not provided."
exit 2
}
echo "############################################################" # Command line admits the following parameters:
echo "# Linux firmware install through USB OTG #" # -u <u-boot-filename>
echo "############################################################" # -i <image-name>
echo "" while getopts 'hi:nu:' c
echo " This process will erase your eMMC and will install a new" do
echo " U-Boot and Linux firmware images on the eMMC." case $c in
echo "" h) show_usage ;;
echo " Press CTRL+C now if you wish to abort or wait 10 seconds" i) IMAGE_NAME=${OPTARG} ;;
echo " to continue." n) NOWAIT=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
esac
done
# Get U-Boot file name from cmdline when passed if [ ! "${NOWAIT}" = true ]; then
if [ -n "$1" ]; then echo "############################################################"
INSTALL_UBOOT_FILENAME="$1" echo "# Linux firmware install through USB OTG #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install a new"
echo " U-Boot and Linux firmware images on the eMMC."
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
fi fi
sleep 10
if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then
INSTALL_UBOOT_FILENAME="imx-boot-ccimx8mn-dvk.bin" INSTALL_UBOOT_FILENAME="imx-boot-ccimx8mn-dvk.bin"
fi fi
@ -91,9 +114,12 @@ uuu fb: ucmd saveenv
uuu fb: acmd reset uuu fb: acmd reset
INSTALL_LINUX_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8mn-dvk.boot.vfat" if [ -z "${IMAGE_NAME}" ]; then
INSTALL_RECOVERY_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8mn-dvk.recovery.vfat" IMAGE_NAME="dey-image-qt"
INSTALL_ROOTFS_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8mn-dvk.ext4" fi
INSTALL_LINUX_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx8mn-dvk.boot.vfat"
INSTALL_RECOVERY_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx8mn-dvk.recovery.vfat"
INSTALL_ROOTFS_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx8mn-dvk.ext4"
# Wait that target returns from reset # Wait that target returns from reset
sleep 3 sleep 3

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/sh
#=============================================================================== #===============================================================================
# #
# Copyright (C) 2020 by Digi International Inc. # Copyright (C) 2020-2021 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -14,35 +14,58 @@
#=============================================================================== #===============================================================================
# set -x # set -x
#
# U-Boot script for installing Linux images created by Yocto into the eMMC
#
clear clear
# Parse uuu cmd output # Parse uuu cmd output
function getenv() getenv()
{ {
uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p" uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p"
} }
# show_usage()
# U-Boot script for installing Linux images created by Yocto into the eMMC {
# echo "Usage: $0 [options]"
echo ""
echo " Options:"
echo " -h Show this help."
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to 'dey-image-qt' if not provided."
echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -u <u-boot-filename> U-Boot filename."
echo " Auto-determined by variant if not provided."
exit 2
}
echo "############################################################" # Command line admits the following parameters:
echo "# Linux firmware install through USB OTG #" # -u <u-boot-filename>
echo "############################################################" # -i <image-name>
echo "" while getopts 'hi:nu:' c
echo " This process will erase your eMMC and will install a new" do
echo " U-Boot and Linux firmware images on the eMMC." case $c in
echo "" h) show_usage ;;
echo " Press CTRL+C now if you wish to abort or wait 10 seconds" i) IMAGE_NAME=${OPTARG} ;;
echo " to continue." n) NOWAIT=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
esac
done
# Get U-Boot file name from cmdline when passed if [ ! "${NOWAIT}" = true ]; then
if [ -n "$1" ]; then echo "############################################################"
INSTALL_UBOOT_FILENAME="$1" echo "# Linux firmware install through USB OTG #"
echo "############################################################"
echo ""
echo " This process will erase your eMMC and will install a new"
echo " U-Boot and Linux firmware images on the eMMC."
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
sleep 10
fi fi
sleep 10
# Enable the redirect support to get u-boot variables values # Enable the redirect support to get u-boot variables values
uuu fb: ucmd setenv stdout serial,fastboot uuu fb: ucmd setenv stdout serial,fastboot
@ -54,61 +77,63 @@ if [ -z "${soc_rev}" ]; then
fi fi
# Determine U-Boot file to program basing on SOM's SOC type (linked to bus width) # Determine U-Boot file to program basing on SOM's SOC type (linked to bus width)
bus_width="32bit" if [ -z ${INSTALL_UBOOT_FILENAME} ]; then
bus_width="32bit"
soc_type=$(getenv "soc_type") soc_type=$(getenv "soc_type")
if [ "$soc_type" == "imx8dx" ]; then if [ "$soc_type" = "imx8dx" ]; then
bus_width="16bit" bus_width="16bit"
fi fi
module_ram=$(getenv "module_ram") module_ram=$(getenv "module_ram")
if [ -z "${module_ram}" ]; then if [ -z "${module_ram}" ]; then
module_variant=$(getenv "module_variant") module_variant=$(getenv "module_variant")
# Determine U-Boot file to program basing on SOM's variant # Determine U-Boot file to program basing on SOM's variant
if [ -n "$module_variant" ]; then if [ -n "$module_variant" ]; then
if [ "$module_variant" == "0x01" ] || \ if [ "$module_variant" == "0x01" ] || \
[ "$module_variant" == "0x04" ] || \ [ "$module_variant" == "0x04" ] || \
[ "$module_variant" == "0x05" ]; then [ "$module_variant" == "0x05" ]; then
module_ram="1GB" module_ram="1GB"
elif [ "$module_variant" == "0x02" ] || \ elif [ "$module_variant" == "0x02" ] || \
[ "$module_variant" == "0x03" ]; then [ "$module_variant" == "0x03" ]; then
module_ram="2GB" module_ram="2GB"
else else
module_ram="512MB" module_ram="512MB"
fi
INSTALL_UBOOT_FILENAME="imx-boot-ccimx8x-sbc-pro-${soc_rev}-${module_ram}_${bus_width}.bin"
fi fi
else
INSTALL_UBOOT_FILENAME="imx-boot-ccimx8x-sbc-pro-${soc_rev}-${module_ram}_${bus_width}.bin" INSTALL_UBOOT_FILENAME="imx-boot-ccimx8x-sbc-pro-${soc_rev}-${module_ram}_${bus_width}.bin"
fi fi
else
INSTALL_UBOOT_FILENAME="imx-boot-ccimx8x-sbc-pro-${soc_rev}-${module_ram}_${bus_width}.bin" # U-Boot when the checked value is empty.
if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then
true
else
echo ""
echo "[ERROR] Cannot determine U-Boot file for this module!"
echo ""
echo "1. Add U-boot file name, depending on your ConnectCore 8X variant, to script command line:"
echo " - For a QuadXPlus CPU with 1GB LPDDR4, run:"
echo " => ./install_linux_fs_uuu.sh -u imx-boot-ccimx8x-sbc-pro-${soc_rev}-1GB_32bit.bin"
echo " - For a QuadXPlus CPU with 2GB LPDDR4, run:"
echo " => ./install_linux_fs_uuu.sh -u imx-boot-ccimx8x-sbc-pro-${soc_rev}-2GB_32bit.bin"
echo " - For a DualX CPU with 1GB LPDDR4, run:"
echo " => ./install_linux_fs_uuu.sh -u imx-boot-ccimx8x-sbc-pro-${soc_rev}-1GB_16bit.bin"
echo " - For a DualX CPU with 512MB LPDDR4, run:"
echo " => ./install_linux_fs_uuu.sh -u imx-boot-ccimx8x-sbc-pro-${soc_rev}-512MB_16bit.bin"
echo ""
echo "2. Run the install script again."
echo ""
echo "Aborted"
echo ""
exit
fi
fi fi
# remove redirect # remove redirect
uuu fb: ucmd setenv stdout serial uuu fb: ucmd setenv stdout serial
# u-boot when the checked value is empty.
if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then
true
else
echo ""
echo "[ERROR] Cannot determine U-Boot file for this module!"
echo ""
echo "1. Add U-boot file name, depending on your ConnectCore 8X variant, to script command line:"
echo " - For a QuadXPlus CPU with 1GB LPDDR4, run:"
echo " => ./install_linux_fs_uuu.sh imx-boot-ccimx8x-sbc-pro-${soc_rev}-1GB_32bit.bin"
echo " - For a QuadXPlus CPU with 2GB LPDDR4, run:"
echo " => ./install_linux_fs_uuu.sh imx-boot-ccimx8x-sbc-pro-${soc_rev}-2GB_32bit.bin"
echo " - For a DualX CPU with 1GB LPDDR4, run:"
echo " => ./install_linux_fs_uuu.sh imx-boot-ccimx8x-sbc-pro-${soc_rev}-1GB_16bit.bin"
echo " - For a DualX CPU with 512MB LPDDR4, run:"
echo " => ./install_linux_fs_uuu.sh imx-boot-ccimx8x-sbc-pro-${soc_rev}-512MB_16bit.bin"
echo ""
echo "2. Run the install script again."
echo ""
echo "Aborted"
echo ""
exit
fi
# Skip user confirmation for U-Boot update # Skip user confirmation for U-Boot update
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
@ -153,9 +178,12 @@ uuu fb: ucmd saveenv
uuu fb: acmd reset uuu fb: acmd reset
INSTALL_LINUX_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8x-sbc-pro.boot.vfat" if [ -z "${IMAGE_NAME}" ]; then
INSTALL_RECOVERY_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8x-sbc-pro.recovery.vfat" IMAGE_NAME="dey-image-qt"
INSTALL_ROOTFS_FILENAME="dey-image-qt-##GRAPHICAL_BACKEND##-ccimx8x-sbc-pro.ext4" fi
INSTALL_LINUX_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx8x-sbc-pro.boot.vfat"
INSTALL_RECOVERY_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx8x-sbc-pro.recovery.vfat"
INSTALL_ROOTFS_FILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##-ccimx8x-sbc-pro.ext4"
# Wait that target returns from reset # Wait that target returns from reset
sleep 3 sleep 3