Skip to contentSkip to conversation

cmd: Make bootvx independent of bootelf

PATCH In review Daniel Palmer 3 participants 6 messages Sep 29, 2024 – Oct 12, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: Make bootvx independent of bootelf

There are lots of usecases for running baremetal ELF binaries via bootelf but if you enable bootelf you get bootvx as well and you probably don't want or need it.

Hide bootvx behind it's own configuration option.

---
 cmd/Kconfig | 11 +++++++++--
 cmd/elf.c   |  6 ++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
cmd/Kconfig +9 -2
index 978f44eda426..262c4118f7f6 100644
@@ -491,11 +491,18 @@ config CMD_CEDIT
 	  loading and saving of configuration as well as showing an editor.
 
 config CMD_ELF
-	bool "bootelf, bootvx"
+	bool "bootelf"
 	default y
 	select LIB_ELF
 	help
-	  Boot an ELF/vxWorks image from the memory.
+	  Boot an ELF image from memory.
+
+config CMD_ELF_BOOTVX
+	bool "bootvx"
+	default y
+	depends on CMD_ELF
+	help
+	  Boot a vxWorks image from memory
 
 config CMD_ELF_FDT_SETUP
 	bool "Flattened Device Tree setup in bootelf cmd"
cmd/elf.c +6 -0
index 673c6c30511c..fe7f06ef74eb 100644
@@ -10,8 +10,10 @@
 #include <env.h>
 #include <image.h>
 #include <log.h>
+#ifdef CONFIG_CMD_ELF_BOOTVX
 #include <net.h>
 #include <vxworks.h>
+#endif
 #ifdef CONFIG_X86
 #include <vesa.h>
 #include <asm/cache.h>
@@ -100,6 +102,7 @@ int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 	return rcode;
 }
 
+#ifdef CONFIG_CMD_ELF_BOOTVX
 /*
  * Interpreter command to boot VxWorks from a memory image.  The image can
  * be either an ELF image or a raw binary.  Will attempt to setup the
@@ -307,6 +310,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 
 	return 1;
 }
+#endif
 
 U_BOOT_CMD(
 	bootelf, CONFIG_SYS_MAXARGS, 0, do_bootelf,
@@ -323,8 +327,10 @@ U_BOOT_CMD(
 #endif
 );
 
+#ifdef CONFIG_CMD_ELF_BOOTVX
 U_BOOT_CMD(
 	bootvx, 2, 0, do_bootvx,
 	"Boot vxWorks from an ELF image",
 	" [address] - load address of vxWorks ELF image."
 );
+#endif
Signature · 1 line
2.43.0
#1 lore raw

Hi Daniel,

Quoted 44 lines · Daniel Palmer

There are lots of usecases for running baremetal ELF binaries via bootelf but if you enable bootelf you get bootvx as well and you probably don't want or need it.

Hide bootvx behind it's own configuration option.

---
 cmd/Kconfig | 11 +++++++++--
 cmd/elf.c   |  6 ++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
cmd/Kconfig +9 -2
index 978f44eda426..262c4118f7f6 100644
@@ -491,11 +491,18 @@ config CMD_CEDIT
          loading and saving of configuration as well as showing an editor.
 
 config CMD_ELF
-       bool "bootelf, bootvx"
+       bool "bootelf"
        default y
        select LIB_ELF
        help
-         Boot an ELF/vxWorks image from the memory.
+         Boot an ELF image from memory.
+
+config CMD_ELF_BOOTVX
+       bool "bootvx"
+       default y
+       depends on CMD_ELF
+       help
+         Boot a vxWorks image from memory
 
 config CMD_ELF_FDT_SETUP
        bool "Flattened Device Tree setup in bootelf cmd"
cmd/elf.c +0 -0
index 673c6c30511c..fe7f06ef74eb 100644

cmd/elf.c line 16

Quoted 7 lines
cmd/elf.c +2 -0
@@ -10,8 +10,10 @@
 #include <env.h>
 #include <image.h>
 #include <log.h>
+#ifdef CONFIG_CMD_ELF_BOOTVX
 #include <net.h>
 #include <vxworks.h>
+#endif

No need to #idef headers files. Just include them always.

Quoted 20 lines
cmd/elf.c +2 -0
 #ifdef CONFIG_X86
 #include <vesa.h>
 #include <asm/cache.h>
@@ -100,6 +102,7 @@ int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
        return rcode;
 }
 
+#ifdef CONFIG_CMD_ELF_BOOTVX
 /*
  * Interpreter command to boot VxWorks from a memory image.  The image can
  * be either an ELF image or a raw binary.  Will attempt to setup the
@@ -307,6 +310,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 
        return 1;
 }
+#endif
 
 U_BOOT_CMD(
        bootelf, CONFIG_SYS_MAXARGS, 0, do_bootelf,

cmd/elf.c U_BOOT_CMD( · line 335

Quoted 9 lines
cmd/elf.c +1 -0
@@ -323,8 +327,10 @@ U_BOOT_CMD(
 #endif
 );
 
+#ifdef CONFIG_CMD_ELF_BOOTVX
 U_BOOT_CMD(
        bootvx, 2, 0, do_bootvx,
        "Boot vxWorks from an ELF image",
        " [address] - load address of vxWorks ELF image."
 );

This needs a doc/usage/cmd update

I'm not sure if it is possible to test it in CI?

Quoted 4 lines
cmd/elf.c +1 -1
+#endif
--

2.43.0

Regards,
Simon

#2 lore raw
In reply to Daniel Palmer
Quoted 8 lines · Daniel Palmer

There are lots of usecases for running baremetal ELF binaries via bootelf but if you enable bootelf you get bootvx as well and you probably don't want or need it.

Hide bootvx behind it's own configuration option.

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
#3 lore raw

Hi,

Quoted 8 lines · Tom Rini
Quoted 5 lines · Daniel Palmer

There are lots of usecases for running baremetal ELF binaries via bootelf but if you enable bootelf you get bootvx as well and you probably don't want or need it.

Quoted 5 lines
Quoted 3 lines

Hide bootvx behind it's own configuration option.

[...]

Applied to u-boot/master, thanks!

It looks like my review here was missed?

Regards,
SImon

#4 lore raw
Quoted 11 lines · Simon Glass

Hi,

Quoted 8 lines · Tom Rini
Quoted 5 lines · Daniel Palmer

There are lots of usecases for running baremetal ELF binaries via bootelf but if you enable bootelf you get bootvx as well and you probably don't want or need it.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Hide bootvx behind it's own configuration option.

[...]

Applied to u-boot/master, thanks!

It looks like my review here was missed?

I guess you sent it in between when I b4'd it and then pushed it.

Signature · 1 line
Tom
#5 lore raw

Hi Tom, Simon,

Quoted 8 lines · Tom Rini
Quoted 3 lines
Quoted 1 line

Applied to u-boot/master, thanks!

It looks like my review here was missed?

I guess you sent it in between when I b4'd it and then pushed it.

--
Tom

I'll make the changes requested by Simon and send a follow up patch when I get a bit of time.

Thanks,

Daniel