aboutsummaryrefslogtreecommitdiff
path: root/scripts/uboot-script-gen
diff options
context:
space:
mode:
authorBrian Woods2021-01-28 19:28:15 -0800
committerStefano Stabellini2021-02-01 13:15:02 -0800
commit6f1950c30cfec0fee35a6c977166148274f037dd (patch)
treedaea72f2c16166aa47c2014fbf85e4a1c14b055a /scripts/uboot-script-gen
parent04f503477ced16176f7db24f363e6378c2ac528b (diff)
Add/fix support for SCSI/SD aliases for load cmds
With the -t option, the "sd" was an alias for the "load scsi 0:1" load command. Change that to a "load mmc 0:1" alias and then add a "scsi" alias which is "load scsi 0:1". To make sure these aliases and manually setting the load command works, a parsing the command and setting the correct partition and devs was also added. Signed-off-by: Brian Woods <brian.woods@xilinx.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Diffstat (limited to 'scripts/uboot-script-gen')
-rwxr-xr-xscripts/uboot-script-gen38
1 files changed, 35 insertions, 3 deletions
diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index ef26da1..bc41d1f 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -196,7 +196,8 @@ function print_help
echo "where:"
echo " CONFIG_FILE - configuration file"
echo " UBOOT_TYPE can be:"
- echo " sd - alias for \"scsi load 0:1\" for uboot load commands"
+ echo " sd - alias for \"mmc load 0:1\" for uboot load commands"
+ echo " scsi - alias for \"scsi load 0:1\" for uboot load commands"
echo " tftp - alias for \"tftpb\" for uboot load cammnds"
echo " < > - used for uboot load commands"
echo " DIRECTORY - root directory where the files of CONFIG_FILE are located"
@@ -212,9 +213,12 @@ while getopts ":c:t:d:ho:" opt; do
case ${opt} in
t )
case $OPTARG in
- sd )
+ scsi )
LOAD_CMD="load scsi 0:1"
;;
+ sd )
+ LOAD_CMD="load mmc 0:1"
+ ;;
tftp )
LOAD_CMD="tftpb"
;;
@@ -276,7 +280,35 @@ then
then
DOM0_CMD="$DOM0_CMD root=/dev/ram0"
else
- DOM0_CMD="$DOM0_CMD root=/dev/sda2"
+ DEV=${LOAD_CMD%:*}
+ DEV=${DEV##* }
+ PAR=${LOAD_CMD#*:}
+
+ if [ -z "$DEV" ] || [ -z "$PAR" ]
+ then
+ echo "Could not parse device and partition."
+ echo "Please make sure the load command is correct or manually set DOM0_CMD in the config file."
+ exit 1
+ fi
+
+ PAR=$((PAR + 1))
+
+ if [[ $LOAD_CMD =~ mmc ]]
+ then
+ DOM0_CMD="$DOM0_CMD root=/dev/mmcblk${DEV}p${PAR}"
+ elif [[ $LOAD_CMD =~ scsi ]]
+ then
+ # converts number to a scsi device character
+ DEV=$((DEV + 97))
+ DEV=$(printf %x $DEV)
+ DEV=$(printf "\x$DEV")
+
+ DOM0_CMD="$DOM0_CMD root=/dev/sd${DEV}${PAR}"
+ else
+ echo "Only mmc and scsi are supported for automatically setting the root partition."
+ echo "Manually set DOM0_CMD with the root device in the config file to bypass this."
+ exit 1
+ fi
fi
fi
i=0