[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ImageBuilder][PATCH v2 3/4] uboot-script-gen: Enable appending extra commands to boot script


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Andrei Cherechesu (OSS)" <andrei.cherechesu@xxxxxxxxxxx>
  • Date: Thu, 30 Jun 2022 17:00:28 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=slRq7QSM4ixKn2x0tNbd2VGZDBfK2EupasNiNNU+x2c=; b=nkBLdNbmNoyQ3V0LM2eNHDA8otlqnWNCEGLxyU09082a7HtXThmCqyQTilYT+WarAbuJbupVsN1yqDGSeg83bvJAinKmxm1XeIkJgp9Gv4buU4EMWFMANG8bHNiodEPpU3nJZT7oUPAKaqzFQ63dlbJbqm3bZkYpuaCQtQ2ZI2VU3zHaRZx9ffW69VbL1EXR4xb4sK9h3pJ+4nMxcLAATF3+OF3Iu+84eTIhyCJYSyoL9rUW4V38hgQV/rqB0zHUVQQFXCn+0i7uD5o7qBRwRVeDg2QxuA6UJ5dv8xQNX6hgMmUy5VGRHSwnRXsCsWuTcXvZ5vDOj0XGeLBR/eqTeA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N28HQzeyfEkoXNgIyh6g3bG4X1wzaLamMZwAcohnVXQ76Q/PKm2TxVyE8p9EpQPr3hhSudVf2+RWX9J1U7cZ96DSdVO21i5R8Jc19xbTBGZvmaTL4qJK/pbNMC1YfxyDHTKDdCyNsqu5oWpqp8OeWNz33V5b0L+olVnT+3o0eHc1DrP2aGopaU2NzL6DA9xmq7QAYTcLLPWho/QU6gaZmBdsDhHZfMolcIywrZefEGbqsAzGbv69NaWZBLzgQRDhixk/HpKWZRZUc8xndf1L+KsX6L3LKaoi/7bKLJbCmlrZF1l7GSdkHzJz9ARXi7p0O//TRFAeYV4DbZshQAhgiA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com;
  • Cc: viryaos-discuss@xxxxxxxxxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, Andrei Cherechesu <andrei.cherechesu@xxxxxxx>
  • Delivery-date: Thu, 30 Jun 2022 14:05:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>

Added the "-a" parameter which stands for APPEND_EXTRA_CMDS option,
which enables the user to specify the path to a text file that contains,
on each line, u-boot commands that will be added to the generated script as
"fixups", before the boot command.

The file specified via the "-a" parameter will be copied as-is in the
generated script.

Signed-off-by: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>
---
 scripts/uboot-script-gen | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index f8d2fb0..444c65a 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -416,6 +416,10 @@ function check_file_type()
     elif [ "$type" = "Device Tree Blob" ]
     then
         type="Device Tree Blob\|data"
+
+    elif [ "$type" = "text" ]
+    then
+        type="ASCII text"
     fi
 
     file -L $filename | grep "$type" &> /dev/null
@@ -973,7 +977,7 @@ function print_help
 {
     script=`basename "$0"`
     echo "usage:"
-    echo "     $script -c CONFIG_FILE -d DIRECTORY [-t LOAD_CMD] [-o FILE] [-k 
KEY_DIR/HINT [-u U-BOOT_DTB]] [-e] [-f] [-p PREPEND_PATH] [-s]"
+    echo "     $script -c CONFIG_FILE -d DIRECTORY [-t LOAD_CMD] [-o FILE] [-k 
KEY_DIR/HINT [-u U-BOOT_DTB]] [-e] [-f] [-p PREPEND_PATH] [-s] [-a 
APPEND_EXTRA_CMDS]"
     echo "     $script -h"
     echo "where:"
     echo "     CONFIG_FILE - configuration file"
@@ -991,6 +995,7 @@ function print_help
     echo "     -f - enable generating a FIT image"
     echo "     PREPEND_PATH - path to be appended before file names to match 
deploy location within rootfs"
     echo "     -s - enable dynamic loading of binaries by storing their 
addresses and sizes u-boot env variables"
+    echo "     APPEND_EXTRA_CMDS - absolute path to file containing extra 
u-boot cmds (fixups) to be run before booting"
     echo "     -h - prints out the help message and exits "
     echo "Defaults:"
     echo "     CONFIG_FILE=$cfg_file, UBOOT_TYPE=\"LOAD_CMD\" env var, 
DIRECTORY=$uboot_dir"
@@ -998,7 +1003,7 @@ function print_help
     echo "     $script -c ../config -d ./build42 -t \"scsi load 1:1\""
 }
 
-while getopts ":c:t:d:ho:k:u:fp:s" opt; do
+while getopts ":c:t:d:ho:k:u:fp:sa:" opt; do
     case ${opt} in
     t )
         case $OPTARG in
@@ -1043,6 +1048,9 @@ while getopts ":c:t:d:ho:k:u:fp:s" opt; do
     s )
         dynamic_loading_opt=y
         ;;
+    a )
+        extra_cmds_file=$OPTARG
+        ;;
     h )
         print_help
         exit 0
@@ -1235,6 +1243,13 @@ load_file $DEVICE_TREE "host_fdt"
 bitstream_load_and_config  # bitstream is loaded last but used first
 device_tree_editing $device_tree_addr
 
+# append extra u-boot commands (fixups) to script before boot command
+if test "$extra_cmds_file"
+then
+    check_file_type "$extra_cmds_file" "text"
+    cat $extra_cmds_file >> $UBOOT_SOURCE
+fi
+
 # disable device tree reloation
 echo "setenv fdt_high 0xffffffffffffffff" >> $UBOOT_SOURCE
 
-- 
2.35.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.