keystone: utilize UART boot
cover keystone: utilize UART boot
For keystone EVMs, there is no MMC interface, so U-Boot cannot be updated by simply flashing an SD card. U-Boot is updated by using a another instance of U-Boot to flash the board. Howver, a board may or may not have U-Boot flashed, and if it is, it is unmanageable to support all possible versions of U-Boot and the various default environments.
Therefore these patches automate using UART boot to boot an instance of the packaged version of U-Boot which is used to flash and configure the board. In this way, only the packaged version of U-Boot needs to be supported.
Jacob Stiffler (8):
setup-uboot-env-keystone.sh: add prompt_feedback function setup-uboot-env-keystone.sh: enhance do_expect function setup-uboot-env-keystone.sh: add detection of BMC port setup-uboot-env-keystone.sh: make updating ubifs an independent option setup-uboot-env-keystone.sh: create minicom script to update board
add-to-group: require user to logout for group change
setup-package-install: Add screen and lrzsz packages
setup-uboot-env-keystone: use UART boot to boot latest version of
U-Boot
add-to-group.sh | 2 + setup-package-install.sh | 2 +- setup-uboot-env-keystone.sh | 379 ++++++++++++++++++++++++++------------------ 3 files changed, 225 insertions(+), 158 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/8 setup-uboot-env-keystone.sh: add prompt_feedback function
The prompt_feedback function abstracts many commonalities when requesting user feedback.
* Echoing the query string
* providing a default value
* listing valid options
* capturing user input to a specified variable
--- setup-uboot-env-keystone.sh | 137 +++++++++++++++++++------------------------- 1 file changed, 60 insertions(+), 77 deletions(-)
setup-uboot-env-keystone.sh +60 -77
@@ -46,6 +46,50 @@ do_expect() { echo >> $3 } +prompt_feedback() { + # Usage: prompt_feedback <prompt> [variable] [default_value] [valid_opt1] [valid_opt2]... + local prompt="$1" + local var="" + local default="" + + local opt_str="" + + local response="" + local good_response="" + + shift + [ $# -eq 0 ] || var="$1" + shift + [ $# -eq 0 ] || default="$1" + shift + + if [ $# -gt 0 ] + then + opt_str="($1" + shift + + while [ $# -gt 0 ] + do + opt_str="${opt_str}/$1" + shift + done + opt_str="${opt_str})" + fi + + echo "$prompt $opt_str" + if [ ! -z "$default" ] + then + read -p "[ $default ] " response + else + read response + fi + echo + + [ ! -z "$response" ] || response="$default" + + [ -z "$var" ] || eval $var=\"$response\" +} + copy_to_tftproot() { files="$1" for file in $files
@@ -53,8 +97,7 @@ copy_to_tftproot() { if [ -f $tftproot/$file ]; then echo echo "$tftproot/$file already exists. The existing installed file can be renamed and saved under the new name." - echo "(o) overwrite (s) skip copy " - read -p "[o] " exists + prompt_feedback "(o) overwrite (s) skip copy" exists o case "$exists" in s) echo "Skipping copy of $file, existing version will be used" ;;
@@ -84,36 +127,18 @@ platform=`grep PLATFORM= $cwd/../Rules.make | cut -d= -f2` # Configure prompt for U-Boot 2016.05 prompt="=>" -echo "Autodetected the following ip address of your host, correct it if necessary" -read -p "[ $ipdefault ] " ip -echo - -if [ ! -n "$ip" ]; then - ip=$ipdefault -fi +prompt_feedback "Autodetected the following ip address of your host, correct it if necessary" ip "$(echo $ipdefault | sed -e 's| .*||')" $ipdefault if [ -f $cwd/../.tftproot ]; then tftproot=`cat $cwd/../.tftproot` else - echo "Where is your tftp root directory?" - read -p "[ /tftpboot ]" tftproot - - if [ ! -n "$tftproot" ]; then - tftproot="/tftpboot" - fi - echo + prompt_feedback "Where is your tftp root directory?" tftproot "/tftpboot" fi if [ -f $cwd/../.targetfs ]; then rootpath=`cat $cwd/../.targetfs` else - echo "Where is your target filesystem extracted?" - read -p "[ ${HOME}/targetNFS ]" rootpath - - if [ ! -n "$rootpath" ]; then - rootpath="${HOME}/targetNFS" - fi - echo + prompt_feedback "Where is your target filesystem extracted?" rootpath "${HOME}/targetNFS" fi
@@ -133,24 +158,13 @@ copy_to_tftproot "$ubifsimages" echo "--------------------------------------------------------------------------------" -echo "Would you like to update U-boot on the board (y/n)?" -read -p "[ y ] " ubootupdate -echo - -if [ ! -n "$ubootupdate" ]; then - ubootupdate="y" -fi +prompt_feedback "Would you like to update U-boot on the board?" ubootupdate y y n echo "Select secondary boot:" echo " 1: NFS" echo " 2: UBI" -echo -read -p "[ 1 ] " secondary_boot - -if [ ! -n "$secondary_boot" ]; then - secondary_boot="1" -fi +prompt_feedback "" secondary_boot 1 if [ "$secondary_boot" -eq "1" ]; then
@@ -161,12 +175,7 @@ if [ "$secondary_boot" -eq "1" ]; then echo " $basefile" done echo - echo "Which kernel image do you want to boot from TFTP?" - read -p "[ $kernelimagedefault ] " kernelimage - - if [ ! -n "$kernelimage" ]; then - kernelimage=$kernelimagedefault - fi + prompt_feedback "Which kernel image do you want to boot from TFTP?" kernelimage $kernelimagedefault else echo echo "Available ubi images in $tftproot:"
@@ -175,12 +184,7 @@ else echo " $basefile" done echo - echo "Which ubi image do you want to boot?" - read -p "[ $ubifsimagedefault ] " ubifsimage - - if [ ! -n "$ubifsimage" ]; then - ubifsimage=$ubifsimagedefault - fi + prompt_feedback "Which ubi image do you want to boot?" ubifsimage $ubifsimagedefault kernelimage=zImage fi
@@ -302,13 +306,7 @@ __EOF__ #echo "! killall -s SIGHUP minicom" >> $cwd/setupBoard.minicom echo "--------------------------------------------------------------------------------" -echo "Would you like to create a minicom script with the above parameters (y/n)?" -read -p "[ y ] " minicom -echo - -if [ ! -n "$minicom" ]; then - minicom="y" -fi +prompt_feedback "Would you like to create a minicom script with the above parameters?" minicom y y n if [ "$minicom" = "y" ]; then
@@ -324,8 +322,7 @@ if [ "$minicom" = "y" ]; then break else echo "" - echo "Board could not be detected. Please connect the board to the PC." - read -p "Press any key to try checking again." temp + prompt_feedback "Board could not be detected. Please connect the board to the PC." temp "Press any key to try checking again" fi done
@@ -360,22 +357,13 @@ if [ "$minicom" = "y" ]; then if [ -n "$port" ]; then echo "${platform} autodetected at /dev/$port" echo - echo "Please verify that this is correct or manually enter the correct port:" - echo - read -p "[/dev/$port] " dev_port - echo + prompt_feedback "Please verify that this is correct or manually enter the correct port:" dev_port "/dev/$port" - if [ ! -n "$dev_port" ] + if [ ! -e "${dev_port}" ] then - dev_port="/dev/$port" - break + echo "ERROR: ${dev_port} does not exist!" else - if [ ! -e "${dev_port}" ] - then - echo "ERROR: ${dev_port} does not exist!" - else - break - fi + break fi fi
@@ -384,8 +372,7 @@ if [ "$minicom" = "y" ]; then echo "" echo "Unable to detect which port the board is connected to." echo "Please reconnect your board." - echo "Press 'y' to attempt to detect your board again or press 'n' to continue..." - read -p "(y/n)" retryBoardDetection + prompt_feedback "Press 'y' to attempt to detect your board again or press 'n' to continue..." retryBoardDetection y fi #if they choose not to retry, ask user to reboot manually and exit
@@ -411,12 +398,8 @@ if [ "$minicom" = "y" ]; then echo "able to connect to it by executing 'minicom -w' or if you prefer a windows host" echo "you can set up Tera Term as explained in the Software Developer's Guide." echo "If you connect minicom or Tera Term and power cycle the board Linux will boot." - echo - read -p "[ y ] " minicomsetup - if [ ! -n "$minicomsetup" ]; then - minicomsetup="y" - fi + prompt_feedback "" minicomsetup y if [ "$minicomsetup" = "y" ]; then cd $cwd
Signature · 1 line
1.9.1
PATCH 2/8 setup-uboot-env-keystone.sh: enhance do_expect function
In reply to Jacob Stiffler* allow writing minicom runscript commands to multiple files
--- setup-uboot-env-keystone.sh | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-)
setup-uboot-env-keystone.sh +20 -10
@@ -34,16 +34,26 @@ cwd=`dirname $0` . $cwd/common.sh do_expect() { - echo "expect {" >> $3 - check_status - echo " $1" >> $3 - check_status - echo " timeout 600 goto end" >> $3 - echo "}" >> $3 - check_status - echo $2 >> $3 - check_status - echo >> $3 + local expect_str="$1" + local command="$2" + + shift; shift + + while [ $# -gt 0 ] + do + echo "expect {" >> "$1" + check_status + echo " $expect_str" >> "$1" + check_status + echo " timeout 600 goto end" >> "$1" + echo "}" >> "$1" + check_status + echo $command >> "$1" + check_status + echo >> "$1" + + shift + done } prompt_feedback() {
Signature · 1 line
1.9.1
PATCH 3/8 setup-uboot-env-keystone.sh: add detection of BMC port
In reply to Jacob Stiffler* add the ability to auto-detect the BMC port
* The BMC may be used to reboot and configure the bootmode.
--- setup-uboot-env-keystone.sh | 51 ++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 14 deletions(-)
setup-uboot-env-keystone.sh +37 -14
@@ -210,7 +210,8 @@ check_for_board() { board_vendor="0403" board_product="6010" num_port="2" - uart_port="1" + uart_port_idx="1" + bmc_port_idx="2" fi ;;
@@ -223,7 +224,8 @@ check_for_board() { board_vendor="10c4" board_product="ea70" num_port="2" - uart_port="1" + uart_port_idx="1" + bmc_port_idx="2" fi ;; esac
@@ -333,6 +335,9 @@ if [ "$minicom" = "y" ]; then else echo "" prompt_feedback "Board could not be detected. Please connect the board to the PC." temp "Press any key to try checking again" + + # Set to default board to allow user to specify the correct ports. + board=k2evm fi done
@@ -352,33 +357,51 @@ if [ "$minicom" = "y" ]; then echo -n "Detecting connection to board... " loopCount=0 usb_id=`dmesg | grep "idVendor=${board_vendor}" | grep "idProduct=${board_product}" | tail -1 | sed -e 's|.*usb \(.*\):.*|\1|'` - port=`dmesg | grep "usb $usb_id" | grep "tty" | tail -${num_port} | head -${uart_port} | tail -1 | grep "attached" | awk '{ print $NF }'` - while [ -z "$port" ] && [ "$loopCount" -ne "10" ] + uart_port=`dmesg | grep "usb $usb_id" | grep "tty" | tail -${num_port} | head -${uart_port_idx} | tail -1 | grep "attached" | awk '{ print $NF }'` + bmc_port=`dmesg | grep "usb $usb_id" | grep "tty" | tail -${num_port} | head -${bmc_port_idx} | tail -1 | grep "attached" | awk '{ print $NF }'` + while [ -z "$uart_port" ] && [ "$loopCount" -ne "10" ] do #count to 10 and timeout if no connection is found loopCount=$((loopCount+1)) sleep 1 usb_id=`dmesg | grep "idVendor=${board_vendor}" | grep "idProduct=${board_product}" | tail -1 | sed -e 's|.*usb \(.*\):.*|\1|'` - port=`dmesg | grep "usb $usb_id" | grep "tty" | tail -${num_port} | head -${uart_port} | tail -1 | grep "attached" | awk '{ print $NF }'` + uart_port=`dmesg | grep "usb $usb_id" | grep "tty" | tail -${num_port} | head -${uart_port_idx} | tail -1 | grep "attached" | awk '{ print $NF }'` + bmc_port=`dmesg | grep "usb $usb_id" | grep "tty" | tail -${num_port} | head -${bmc_port_idx} | tail -1 | grep "attached" | awk '{ print $NF }'` done #check to see if we actually found a port - if [ -n "$port" ]; then - echo "${platform} autodetected at /dev/$port" + if [ -n "$uart_port" ]; then + echo "${platform} (UART) autodetected at /dev/$uart_port" + echo + prompt_feedback "Please verify that this is correct or manually enter the correct port:" dev_uart_port "/dev/$uart_port" + + echo "${platform} (BMC) autodetected at /dev/$bmc_port" echo - prompt_feedback "Please verify that this is correct or manually enter the correct port:" dev_port "/dev/$port" + prompt_feedback "Please verify that this is correct or manually enter the correct port:" dev_bmc_port "/dev/$bmc_port" + + if [ ! -e "${dev_uart_port}" ]; then + echo; echo "ERROR: ${dev_uart_port} does not exist!" + dev_uart_port="" + fi + + if [ ! -e "${dev_bmc_port}" ]; then + echo; echo "ERROR: ${dev_bmc_port} does not exist!" + dev_bmc_port="" + fi + + if [ "$dev_uart_port" = "$dev_bmc_port" ]; then + echo; echo "ERROR: UART and BMC cannot be the same port: $dev_uart_port!" + dev_uart_port="" + fi - if [ ! -e "${dev_port}" ] - then - echo "ERROR: ${dev_port} does not exist!" - else + if [ -n "$dev_uart_port" ] && [ -n "$dev_bmc_port" ]; then break fi fi #if we didn't find a port and reached the timeout limit then ask to reconnect - if [ -z "$port" ] && [ "$loopCount" = "10" ]; then + if [ -z "$uart_port" ] && [ "$loopCount" = "10" ]; then echo "" echo "Unable to detect which port the board is connected to." echo "Please reconnect your board."
@@ -393,7 +416,7 @@ if [ "$minicom" = "y" ]; then fi done - sed -i -e "s|^pu port.*$|pu port $dev_port|g" ${HOME}/.minirc.dfl + sed -i -e "s|^pu port.*$|pu port $dev_uart_port|g" ${HOME}/.minirc.dfl fi echo
Signature · 1 line
1.9.1
PATCH 4/8 setup-uboot-env-keystone.sh: make updating ubifs an independent option
In reply to Jacob Stiffler--- setup-uboot-env-keystone.sh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
setup-uboot-env-keystone.sh +20 -14
@@ -170,6 +170,17 @@ copy_to_tftproot "$ubifsimages" echo "--------------------------------------------------------------------------------" prompt_feedback "Would you like to update U-boot on the board?" ubootupdate y y n +prompt_feedback "Would you like to update the UBI filesystem on the board?" ubifsupdate y y n + +if [ "$ubifsupdate" = "y" ]; then + echo "Available ubi images in $tftproot:" + for file in $tftproot/*-${platform}.ubi; do + basefile=`basename $file` + echo " $basefile" + done + echo + prompt_feedback "Which ubi image do you want to boot?" ubifsimage $ubifsimagedefault +fi echo "Select secondary boot:" echo " 1: NFS"
@@ -187,14 +198,6 @@ if [ "$secondary_boot" -eq "1" ]; then echo prompt_feedback "Which kernel image do you want to boot from TFTP?" kernelimage $kernelimagedefault else - echo - echo "Available ubi images in $tftproot:" - for file in $tftproot/*-${platform}.ubi; do - basefile=`basename $file` - echo " $basefile" - done - echo - prompt_feedback "Which ubi image do you want to boot?" ubifsimage $ubifsimagedefault kernelimage=zImage fi
@@ -296,14 +299,17 @@ do_expect "\"$prompt\"" "send \"setenv name_ubi $ubifsimage\"" $cwd/setupBoard.m do_expect "\"$prompt\"" "send \"setenv name_kern $kernelimage\"" $cwd/setupBoard.minicom do_expect "\"$prompt\"" "send \"saveenv\"" $cwd/setupBoard.minicom +if [ "$ubifsupdate" = "y" ]; then + do_expect "\"$prompt\"" "send \"run get_ubi_net\"" $cwd/setupBoard.minicom + do_expect "\"$prompt\"" "send \"run burn_ubi\"" $cwd/setupBoard.minicom +fi + if [ "$secondary_boot" -eq "1" ]; then - #TFTP and NFS Boot - do_expect "\"$prompt\"" "send \"setenv boot net\"" $cwd/setupBoard.minicom + #TFTP and NFS Boot + do_expect "\"$prompt\"" "send \"setenv boot net\"" $cwd/setupBoard.minicom else - #SD and NFS Boot - do_expect "\"$prompt\"" "send \"run get_ubi_net\"" $cwd/setupBoard.minicom - do_expect "\"$prompt\"" "send \"run burn_ubi\"" $cwd/setupBoard.minicom - do_expect "\"$prompt\"" "send \"setenv boot ubi\"" $cwd/setupBoard.minicom + #UBI Boot + do_expect "\"$prompt\"" "send \"setenv boot ubi\"" $cwd/setupBoard.minicom fi do_expect "\"$prompt\"" "send \"saveenv\"" $cwd/setupBoard.minicom
Signature · 1 line
1.9.1
PATCH 5/8 setup-uboot-env-keystone.sh: create minicom script to update board
In reply to Jacob Stiffler* Create an additional minicom script to update/flash NAND (ubifs) and NOR (uboot) on the board.
* Retain the old setup script so that users may manually pass this to minicom to setup the board.
--- setup-uboot-env-keystone.sh | 100 ++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 55 deletions(-)
setup-uboot-env-keystone.sh +45 -55
@@ -235,13 +235,14 @@ check_for_board() { } echo "timeout 1800" > $cwd/setupBoard.minicom +echo "timeout 1800" > $cwd/updateBoard.minicom echo "verbose on" >> $cwd/setupBoard.minicom -do_expect "\"stop autoboot:\"" "send \" \"" $cwd/setupBoard.minicom +echo "verbose on" >> $cwd/updateBoard.minicom + +do_expect "\"stop autoboot:\"" "send \" \"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom -# Disable upgrading major U-boot versions -#if [ "$ubootupdate" != "y" ]; then - # If not updating U-Boot, refure to procede if running an old MCSDK version. - cat >> $cwd/setupBoard.minicom << __EOF__ +# If U-Boot was not updated, refuse to proceed. +cat >> $cwd/setupBoard.minicom << __EOF__ expect { "$prompt" "# " goto uboot_update_required
@@ -249,76 +250,65 @@ expect { } send " " __EOF__ -#fi # Reset to the default environment -do_expect "\"$prompt\"" "send \"env default -f -a\"" $cwd/setupBoard.minicom +do_expect "\"$prompt\"" "send \"env default -f -a\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom + do_expect "\"$prompt\"" "send \"saveenv\"" $cwd/setupBoard.minicom # Reset incase any variables are set when u-boot initializes do_expect "\"$prompt\"" "send \"reset\"" $cwd/setupBoard.minicom do_expect "\"stop autoboot:\"" "send \" \"" $cwd/setupBoard.minicom -# Set vars required to flash u-boot -do_expect "\"$prompt\"" "send \"setenv serverip $ip\"" $cwd/setupBoard.minicom -do_expect "\"$prompt\"" "send \"setenv tftp_root '$tftproot'\"" $cwd/setupBoard.minicom -do_expect "\"$prompt\"" "send \"setenv name_uboot $ubootimage\"" $cwd/setupBoard.minicom - -if [ "$ubootupdate" = "y" ]; then - # Use common "burn_uboot" command - do_expect "\"$prompt\"" "send \"if test -n \$burn_uboot_spi; then setenv burn_uboot \$burn_uboot_spi; fi\"" $cwd/setupBoard.minicom - - # Create command to print a known message if u-boot update succeeds - update_uboot_success="U-Boot successfully updated" +# Set up the U-Boot environment +do_expect "\"$prompt\"" "send \"setenv serverip $ip\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom +do_expect "\"$prompt\"" "send \"setenv tftp_root '$tftproot'\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom +do_expect "\"$prompt\"" "send \"setenv name_uboot $ubootimage\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom +do_expect "\"$prompt\"" "send \"setenv nfs_root '$rootpath'\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom +do_expect "\"$prompt\"" "send \"setenv name_ubi $ubifsimage\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom +do_expect "\"$prompt\"" "send \"setenv name_kern $kernelimage\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom - # Create command to fetch and flash u-boot - do_expect "\"$prompt\"" "send \"setenv update_uboot 'if run get_uboot_net burn_uboot; then echo $update_uboot_success; else echo U-boot update failed!; fi'\"" $cwd/setupBoard.minicom - do_expect "\"$prompt\"" "send \"run update_uboot\"" $cwd/setupBoard.minicom - - do_expect "\"$update_uboot_success\"" "send \"reset\"" $cwd/setupBoard.minicom - - # Reset once to get new u-boot - do_expect "\"stop autoboot:\"" "send \" \"" $cwd/setupBoard.minicom - - # Reset environment to the new U-Boot's defaults - do_expect "\"$prompt\"" "send \"env default -f -a\"" $cwd/setupBoard.minicom - do_expect "\"$prompt\"" "send \"saveenv\"" $cwd/setupBoard.minicom +# Create command to fetch and flash u-boot and ubi +# +# TBD: Save minicom output to a log and use these strings to determine the +# update status on the host machine. +# +update_uboot_status="U-Boot update:" +update_ubi_status="UBI update:" - # Reset a second time incase any variables are set when u-boot initializes - do_expect "\"$prompt\"" "send \"reset\"" $cwd/setupBoard.minicom - do_expect "\"stop autoboot:\"" "send \" \"" $cwd/setupBoard.minicom +do_expect "\"$prompt\"" "send \"setenv update_uboot 'if run get_uboot_net burn_uboot_spi; then echo $update_uboot_status SUCCESS; else echo $update_uboot_status FAILED; fi'\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom +do_expect "\"$prompt\"" "send \"setenv update_ubi 'if run get_ubi_net burn_ubi; then echo $update_ubi_status SUCCESS; else echo $update_ubi_status FAILED; fi'\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom - # Reinitialize any variables previously set - do_expect "\"$prompt\"" "send \"setenv serverip $ip\"" $cwd/setupBoard.minicom - do_expect "\"$prompt\"" "send setenv tftp_root '$tftproot'" $cwd/setupBoard.minicom - do_expect "\"$prompt\"" "send \"setenv name_uboot $ubootimage\"" $cwd/setupBoard.minicom +if [ "$secondary_boot" -eq "1" ]; then + #TFTP and NFS Boot + do_expect "\"$prompt\"" "send \"setenv boot net\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom +else + #SD and NFS Boot + do_expect "\"$prompt\"" "send \"setenv boot ubi\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom fi -do_expect "\"$prompt\"" "send setenv nfs_root '$rootpath'" $cwd/setupBoard.minicom -do_expect "\"$prompt\"" "send \"setenv name_ubi $ubifsimage\"" $cwd/setupBoard.minicom -do_expect "\"$prompt\"" "send \"setenv name_kern $kernelimage\"" $cwd/setupBoard.minicom -do_expect "\"$prompt\"" "send \"saveenv\"" $cwd/setupBoard.minicom +do_expect "\"$prompt\"" "send \"saveenv\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom +if [ "$ubootupdate" = "y" ]; then + do_expect "\"$prompt\"" "send \"run update_uboot\"" $cwd/updateBoard.minicom +fi if [ "$ubifsupdate" = "y" ]; then - do_expect "\"$prompt\"" "send \"run get_ubi_net\"" $cwd/setupBoard.minicom - do_expect "\"$prompt\"" "send \"run burn_ubi\"" $cwd/setupBoard.minicom + do_expect "\"$prompt\"" "send \"run update_ubi\"" $cwd/updateBoard.minicom fi -if [ "$secondary_boot" -eq "1" ]; then - #TFTP and NFS Boot - do_expect "\"$prompt\"" "send \"setenv boot net\"" $cwd/setupBoard.minicom -else - #UBI Boot - do_expect "\"$prompt\"" "send \"setenv boot ubi\"" $cwd/setupBoard.minicom -fi - -do_expect "\"$prompt\"" "send \"saveenv\"" $cwd/setupBoard.minicom -do_expect "\"$prompt\"" "send \"boot\"" $cwd/setupBoard.minicom +do_expect "\"$prompt\"" "send \"boot\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom cat >> $cwd/setupBoard.minicom << __EOF__ goto end uboot_update_required: -send echo; echo "*** U-boot is require to be updated before proceding!"; echo "*** The automatic upgrade of U-boot is currently disabled."; echo "*** Please follow the wiki instructions to manually upgrade U-boot."; echo +send echo; echo "*** U-boot is require to be updated before proceeding!"; echo "*** The automatic upgrade of this version of U-boot is currently disabled."; echo "*** Please follow the wiki instructions to manually upgrade U-boot."; echo +end: +__EOF__ + +cat >> $cwd/updateBoard.minicom << __EOF__ +goto end +uboot_update_required: +send echo; echo "*** U-boot is require to be updated before proceeding!"; echo "*** The automatic upgrade of this version of U-boot is currently disabled."; echo "*** Please follow the wiki instructions to manually upgrade U-boot."; echo end: __EOF__ #echo "! killall -s SIGHUP minicom" >> $cwd/setupBoard.minicom
@@ -442,7 +432,7 @@ if [ "$minicom" = "y" ]; then if [ "$minicomsetup" = "y" ]; then cd $cwd - sudo minicom -w -S setupBoard.minicom + sudo minicom -w -S updateBoard.minicom cd - fi
Signature · 1 line
1.9.1
PATCH 6/8 add-to-group: require user to logout for group change
In reply to Jacob Stiffler--- add-to-group.sh | 2 ++ 1 file changed, 2 insertions(+)
add-to-group.sh +2 -0
@@ -90,8 +90,10 @@ if [ "$host_upper" -gt "$min_ver_upper" -o "$host_upper" -eq "$min_ver_upper" ]; fi echo "Until then you will be required to use sudo when accessing a serial device." + echo "Please logout now and log back in so that the group changes are in effect." echo read -p "Press return to continue" REPLY + exit 0 else echo "User '$username' is already apart of the 'dialout' group"
Signature · 1 line
1.9.1
PATCH 7/8 setup-package-install: Add screen and lrzsz packages
In reply to Jacob Stiffler* screen is used by these scripts to background processes which require a terminal connection (e.g. minicom).
* lrzsz provides an XMODEM implmentation which is used for UART boot.
--- setup-package-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
setup-package-install.sh +1 -1
@@ -56,7 +56,7 @@ cwd=`dirname $0` entry_header -packages_to_install="xinetd tftpd nfs-kernel-server minicom build-essential libncurses5-dev autoconf automake dos2unix" +packages_to_install="xinetd tftpd nfs-kernel-server minicom build-essential libncurses5-dev autoconf automake dos2unix screen lrzsz" get_host_type host
Signature · 1 line
1.9.1
PATCH 8/8 setup-uboot-env-keystone: use UART boot to boot latest version of U-Boot
In reply to Jacob Stiffler* Configure keystone boards to boot the packaged version of U-Boot over UART
* During the UART boot, configure the U-Boot environment and optionally update the U-Boot version flashed to NOR and/or the UBI filesystem flashed to NAND.
--- setup-uboot-env-keystone.sh | 67 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 7 deletions(-)
setup-uboot-env-keystone.sh +60 -7
@@ -126,6 +126,29 @@ copy_to_tftproot() { done } +# Create the BMC scripts. These require no configuration from the user. +create_bmc_scripts() { + ( echo "timeout 300"; echo; ) > $cwd/bmcUartBoot.minicom + ( echo "timeout 300"; echo; ) > $cwd/bmcSpiBoot.minicom + + # Allow time for XMODEM transfer to begin + echo "! sleep 1" >> $cwd/bmcUartBoot.minicom + + ( echo "send \" \""; echo; ) >> $cwd/bmcUartBoot.minicom + ( echo "send \" \""; echo; ) >> $cwd/bmcSpiBoot.minicom + + do_expect "\"BMC>\"" "send \"bootmode #4\"" $cwd/bmcUartBoot.minicom + do_expect "\"BMC>\"" "send \"bootmode #2\"" $cwd/bmcSpiBoot.minicom + + do_expect "\"BMC>\"" "send \"reboot\"" $cwd/bmcUartBoot.minicom $cwd/bmcSpiBoot.minicom + + echo "end:" >> $cwd/bmcUartBoot.minicom + echo "end:" >> $cwd/bmcSpiBoot.minicom + + # bmcUartboot.minicom will be killed by the updateUboot.minicom script + echo "! killall -s SIGHUP minicom" >> $cwd/bmcSpiBoot.minicom +} + echo echo "--------------------------------------------------------------------------------" echo "This step will set up the u-boot variables for booting the EVM."
@@ -156,7 +179,10 @@ kernelimage="zImage-""$platform"".bin" kernelimagesrc=`ls -1 $cwd/../board-support/prebuilt-images/$kernelimage` kernelimagedefault=`basename $kernelimagesrc` -ubootimage="u-boot-spi-${platform}.gph" +ubootimage="u-boot-${platform}.img" +ubootimagesrc=`readlink -m $cwd/../board-support/prebuilt-images/$ubootimage` + +ubootspiimage="u-boot-spi-${platform}.gph" ubifsimage="tisdk-server-rootfs-image-${platform}.ubi" ubifsimagesrc=`ls -1 $cwd/../filesystem/$ubifsimage`
@@ -263,7 +289,7 @@ do_expect "\"stop autoboot:\"" "send \" \"" $cwd/setupBoard.minicom # Set up the U-Boot environment do_expect "\"$prompt\"" "send \"setenv serverip $ip\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom do_expect "\"$prompt\"" "send \"setenv tftp_root '$tftproot'\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom -do_expect "\"$prompt\"" "send \"setenv name_uboot $ubootimage\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom +do_expect "\"$prompt\"" "send \"setenv name_uboot $ubootspiimage\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom do_expect "\"$prompt\"" "send \"setenv nfs_root '$rootpath'\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom do_expect "\"$prompt\"" "send \"setenv name_ubi $ubifsimage\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom do_expect "\"$prompt\"" "send \"setenv name_kern $kernelimage\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom
@@ -296,7 +322,8 @@ if [ "$ubifsupdate" = "y" ]; then do_expect "\"$prompt\"" "send \"run update_ubi\"" $cwd/updateBoard.minicom fi -do_expect "\"$prompt\"" "send \"boot\"" $cwd/setupBoard.minicom $cwd/updateBoard.minicom +do_expect "\"$prompt\"" "send \" \"" $cwd/updateBoard.minicom +do_expect "\"$prompt\"" "send \"boot\"" $cwd/setupBoard.minicom cat >> $cwd/setupBoard.minicom << __EOF__ goto end
@@ -311,7 +338,7 @@ uboot_update_required: send echo; echo "*** U-boot is require to be updated before proceeding!"; echo "*** The automatic upgrade of this version of U-boot is currently disabled."; echo "*** Please follow the wiki instructions to manually upgrade U-boot."; echo end: __EOF__ -#echo "! killall -s SIGHUP minicom" >> $cwd/setupBoard.minicom +echo "! killall -s SIGHUP minicom" >> $cwd/updateBoard.minicom echo "--------------------------------------------------------------------------------" prompt_feedback "Would you like to create a minicom script with the above parameters?" minicom y y n
@@ -420,8 +447,9 @@ if [ "$minicom" = "y" ]; then echo "Would you like to run the setup script now (y/n)?" echo echo "Please connect the ethernet cable as described in the Quick Start Guide." - echo "Once answering 'y' on the prompt below, you will have 300 seconds to connect" - echo "the board and power cycle it before the setup times out" + echo "Once answering 'y' on the prompt below, the script will proceed with" + echo "automatically booting and configuring the board based on the responses" + echo "provided." echo echo "After successfully executing this script, your EVM will be set up. You will be " echo "able to connect to it by executing 'minicom -w' or if you prefer a windows host"
@@ -431,8 +459,33 @@ if [ "$minicom" = "y" ]; then prompt_feedback "" minicomsetup y if [ "$minicomsetup" = "y" ]; then + create_bmc_scripts + cd $cwd - sudo minicom -w -S updateBoard.minicom + + tmp_fifo="$PWD/uart_boot_fifo" + + rm "$tmp_fifo" + mkfifo "$tmp_fifo" + + # stripping U-Boot img header and piping to fifo + (dd bs=64 count=1 of=/dev/null; dd bs=512k) < "$ubootimagesrc" > "$tmp_fifo" & + + # Configuring bootmode to UART boot via BMC + screen -dmS minicom_${platform}_bmc minicom -D "$dev_bmc_port" -S bmcUartBoot.minicom -C bmcUartBoot.log + + # Transfering uboot.bin using XMODEM protocol + sx -kb "$tmp_fifo" < "$dev_uart_port" > "$dev_uart_port" + + # Configure U-Boot environment and optionally flash board + minicom -D "$dev_uart_port" -S updateBoard.minicom -C updateBoard.log + rm "$tmp_fifo" + + # Configuring bootmode to SPI boot via BMC + minicom -D "$dev_bmc_port" -S bmcSpiBoot.minicom -C bmcSpiBoot.log + + # Running terminal to board (UART) + minicom -w -D "$dev_uart_port" -C bootBoard.log cd - fi
Signature · 1 line
1.9.1
Quoted 11 lines · Jacob Stiffler
For keystone EVMs, there is no MMC interface, so U-Boot cannot be updated by simply flashing an SD card. U-Boot is updated by using a another instance of U-Boot to flash the board. Howver, a board may or may not have U-Boot flashed, and if it is, it is unmanageable to support all possible versions of U-Boot and the various default environments.
Therefore these patches automate using UART boot to boot an instance of the packaged version of U-Boot which is used to flash and configure the board. In this way, only the packaged version of U-Boot needs to be supported.
While I haven't reviewed the code in all the detail, the overall concept seems fine to me. Please merge the patches when ready. Thanks.
Signature · 1 line
Denys
Quoted 23 lines
Jacob Stiffler (8):
setup-uboot-env-keystone.sh: addprompt_feedbackfunctionsetup-uboot-env-keystone.sh: enhancedo_expectfunctionsetup-uboot-env-keystone.sh: add detection of BMC portsetup-uboot-env-keystone.sh: make updating ubifs an independent optionsetup-uboot-env-keystone.sh: create minicom script to update board
add-to-group: require user to logout for group change
setup-package-install: Add screen and lrzsz packages
setup-uboot-env-keystone: use UART boot to boot latest version of
U-Bootadd-to-group.sh | 2 + setup-package-install.sh | 2 +- setup-uboot-env-keystone.sh | 379 ++++++++++++++++++++++++++------------------ 3 files changed, 225 insertions(+), 158 deletions(-)Signature · 6 lines
1.9.1 _______________________________________________ meta-arago mailing list [email protected] http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago