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

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


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Andrei Cherechesu (OSS)" <andrei.cherechesu@xxxxxxxxxxx>
  • Date: Wed, 13 Jul 2022 19:30:43 +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=FmqTgyPFFWr6Cy0aMCwaNL1SgYThtx501TxRMDkfl/c=; b=TRgDIP+2NzxZRMJ3Tu0mcTQiA9GVqPSH88x8BTlKzCM+ZdS2ljP0UM9g9euekpThTLy5DSwjKvvlL/8/5xhzU8WKq6HvtTUXmPHXQmdlGSd5hUjK5v/moCdyuwmtdtXvsevfiSMbr16lyLwitkxa4PDOL9gD1248uH4eseaVznqfM2DX/waWsukOzlneAMEUlydlN1ycN5RrFVYQSkk6WsK8SuGurBqrs9mbDRuDNU3bQBbA/nzAd5J4qEyZ0UCc6/On+LMx2cdkZTrq1d7+o+XDXeIRYbOcsfI33wpzKbk1X5mtJPW2cmymSL5ACB0OC3XMvHGFHol0cxTNTu4BKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HR8xtkUATNFYuRzWZKrnDCi8y/1Do2U5afdZaF6ksnyCcc7I0UHUxmmRC7JvpVZ9etHScboqnIRP7i4JJvcHTM3qOsYlHUJ6q8cztR9SsSbIxmudytC1bGsgdSOlucDL0vjQjBnnI+ct6jg+bYSC/EQLlTeIdXF+P8KmAJABouhPuYodbkU9NXuZZkQiOnaKJbdEV02kLLGETSZ566xhuC3JbvFiq04MLrjeXkjwC3FR7D39UTDg3l9Q20LPWHHpXfyl0OaqLSxV5VsOu1SyfiDL0PeHGs4NctErTImPDBbCh061SHbK4zkwVhj2NKeSwuZ8CiQdi3wVPPqaZ1ZwCg==
  • 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: Wed, 13 Jul 2022 16:31:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>

Added the parsing for APPEND_EXTRA_CMDS variable, 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 by the APPEND_EXTRA_CMDS variable parameter will be
copied as-is in the generated script.

Signed-off-by: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>
---
 README.md                |  5 +++++
 scripts/uboot-script-gen | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/README.md b/README.md
index cb15ca5..3566a6d 100644
--- a/README.md
+++ b/README.md
@@ -64,6 +64,7 @@ BOOT_AUX_FILE[1]="uboot.cfg"
 
 UBOOT_SOURCE="boot.source"
 UBOOT_SCRIPT="boot.scr"
+APPEND_EXTRA_CMDS="extra.txt"
 FDTEDIT="imagebuilder.dtb"
 FIT="boot.fit"
 FIT_ENC_KEY_DIR="dir/key"
@@ -197,6 +198,10 @@ Where:
   as you can pass -o FILENAME to uboot-script-gen as a command line
   parameter
 
+- APPEND_EXTRA_CMDS: is optional and specifies the path to a text file
+  containing extra u-boot commands to be added to the boot script before
+  the boot command. Useful for running custom fixup commands.
+
 - FDTEDIT is an optional and is off by default.  Specifies the output
   modified dtb, used for reference and fdt_std.
 
diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index f8d2fb0..f72551a 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
@@ -1238,6 +1242,13 @@ device_tree_editing $device_tree_addr
 # disable device tree reloation
 echo "setenv fdt_high 0xffffffffffffffff" >> $UBOOT_SOURCE
 
+# append extra u-boot commands (fixups) to script before boot command
+if test "$APPEND_EXTRA_CMDS"
+then
+    check_file_type "$APPEND_EXTRA_CMDS" "text"
+    cat $APPEND_EXTRA_CMDS >> $UBOOT_SOURCE
+fi
+
 if test "$dynamic_loading_opt"
 then
     echo "$BOOT_CMD \${host_kernel_addr} - \${host_fdt_addr}" >> $UBOOT_SOURCE
-- 
2.35.1




 


Rackspace

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