[PATCH 03/18] bootm: qnxelf: Drop passing of arguments

Simon Glass sjg at chromium.org
Mon Dec 4 01:26:19 CET 2023


It isn't clear how useful it is to pass the arguments of bootm to the
OS. For example, if "bootm 1000 2000 3000" is used, the '1000' argument
is passed to QNX. This seems like a strange approach, since the argument
have already been parsed by U-Boot and processed.

Rely instead on the "bootargs" mechanism, which is the standard
approach.

Also make sure that the argument list is NULL-terminated.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 boot/bootm_os.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/boot/bootm_os.c b/boot/bootm_os.c
index 4aa1db848d6c..598671e576c6 100644
--- a/boot/bootm_os.c
+++ b/boot/bootm_os.c
@@ -333,7 +333,7 @@ int do_bootm_vxworks(int flag, int argc, char *const argv[],
 static int do_bootm_qnxelf(int flag, int argc, char *const argv[],
 			   struct bootm_headers *images)
 {
-	char *local_args[2];
+	char *local_args[3];
 	char str[16];
 	int dcache;
 
@@ -348,8 +348,9 @@ static int do_bootm_qnxelf(int flag, int argc, char *const argv[],
 #endif
 
 	sprintf(str, "%lx", images->ep); /* write entry-point into string */
-	local_args[0] = argv[0];
-	local_args[1] = str;	/* and provide it via the arguments */
+	local_args[0] = "qnxelf";
+	local_args[1] = env_get("bootargs");
+	local_args[2] = NULL;
 
 	/*
 	 * QNX images require the data cache is disabled.
@@ -358,7 +359,7 @@ static int do_bootm_qnxelf(int flag, int argc, char *const argv[],
 	if (dcache)
 		dcache_disable();
 
-	do_bootelf(NULL, 0, 2, local_args);
+	do_bootelf(NULL, 0, local_args[1] ? 2 : 1, local_args);
 
 	if (dcache)
 		dcache_enable();
-- 
2.43.0.rc2.451.g8631bc7472-goog



More information about the U-Boot mailing list