From a2b5ba41fed282f50b34f80e72e1a3d6c8ee3b4d Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Fri, 16 Apr 2021 13:36:20 -0700 Subject: Add LOAD_CMD parsing to disk_image Signed-off-by: Stefano Stabellini Reviewed-by: Brian Woods --- README.md | 7 ++++++- scripts/disk_image | 25 +++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c9a9850..4adb9dc 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,8 @@ script, disk_image is run as follows: ``` $ sudo bash ./scripts/disk_image -c /path/to/config-file -d . \ -w /path/to/tmp/dir \ - -o /path/to/output/disk.img + -o /path/to/output/disk.img \ + -t "sd" ``` Where:\ @@ -140,3 +141,7 @@ Where:\ -w specifies the temporary working directory that the script uses for building the disk image, and if not set, one is created in /tmp\ -o specifies the output disk image file name\ +-t specifies the u-boot command to load the binaries. "tftp", "sd" and + "scsi" are shorthands for "tftpb", "load mmc 0:1" and + "load scsi 0:1", but actually any arbitrary command can be used, for + instance -t "fatload" is valid. diff --git a/scripts/disk_image b/scripts/disk_image index 0f43165..eeb888f 100755 --- a/scripts/disk_image +++ b/scripts/disk_image @@ -69,11 +69,16 @@ function write_rootfs() function print_help { echo "usage:" - echo " $0 -c CONFIG_FILE -d UBOOT_DIRECTORY <-w WORK_DIRECTORY> -o IMG_FILE" + echo " $0 -c CONFIG_FILE -d UBOOT_DIRECTORY -t UBOOT_TYPE <-w WORK_DIRECTORY> -o IMG_FILE" echo " $0 -h" echo "where:" echo " -c CONFIG_FILE - configuration file" echo " -d UBOOT_DIRECTORY - root directory for the paths specified in CONFIG_FILE" + echo " -t UBOOT_TYPE can be:" + 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 " -w WORK_DIRECTORY - work directory used when building the image" echo " -o IMG_FILE - the output img file " echo "Example:" @@ -87,9 +92,25 @@ then exit 1 fi -while getopts ":w:d:c:o:h" opt +while getopts ":w:d:c:t:o:h" opt do case ${opt} in + t ) + case $OPTARG in + scsi ) + LOAD_CMD="load scsi 0:1" + ;; + sd ) + LOAD_CMD="load mmc 0:1" + ;; + tftp ) + LOAD_CMD="tftpb" + ;; + * ) + LOAD_CMD="$OPTARG" + ;; + esac + ;; w ) DESTDIR=$OPTARG ;; -- cgit v1.2.3