Skip to contentSkip to conversation

cmd: add a fetch utility

PATCH In review Caleb Connolly 2 participants 2 messages Nov 15, 2024 – Nov 30, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 cmd: add a fetch utility

Add a small utility for displaying some information about U-Boot and the hardware it's running on in a similar fashion to the popular neofetch tool for Linux [1].

While the output is meant to be useful, it should also be pleasing to look at and perhaps entertaining. The ufetch command aims to bring this to U-Boot, featuring a colorful ASCII art version of the U-Boot logo.

[1]: https://en.wikipedia.org/wiki/Neofetch

---
For additional background/context see v1 thread.

I've enabled this for sandbox so it at least gets build-tested in CI as Simon originally suggested in v1.

Changes since v3:
* Fix typo when getting ipaddr from env
* V3: [email protected]

Changes since v2:
* Fix building on 32-bit ARM
* Enable for sandbox to avoid build regressions
* Remove unused Devices line
* Use blk_get_uclass_name()
* Add TODO/ideas comment
* Avoid printing blank lines at the end when running with -n
* V2: https://lore.kernel.org/u-boot/[email protected]

Changes since v1:
* Rework storage info to be more dynamic
* use print_size() helper everywhere
* manually walk RAM banks to report memory size correctly
* minor formatting changes and fixes
* MAINTAINERS entry
* V1: https://lore.kernel.org/u-boot/[email protected]

---
 MAINTAINERS               |   5 +
 cmd/Kconfig               |   7 ++
 cmd/Makefile              |   1 +
 cmd/ufetch.c              | 229 ++++++++++++++++++++++++++++++++++++++
 configs/sandbox_defconfig |   1 +
 5 files changed, 243 insertions(+)
 create mode 100644 cmd/ufetch.c
MAINTAINERS +5 -0
index 0399ed1dbf64..1d81bdecc7c3 100644
@@ -1732,8 +1732,13 @@ M:	Heiko Schocher <[email protected]>
 S:	Maintained
 T:	git https://source.denx.de/u-boot/custodians/u-boot-ubi.git
 F:	drivers/mtd/ubi/
 
+UFETCH
+M:	Caleb Connolly <[email protected]>
+S:	Maintained
+F:	cmd/ufetch.c
+
 UFS
 M:	Neil Armstrong <[email protected]>
 M:	Bhupesh Sharma <[email protected]>
 M:	Neha Malcom Francis <[email protected]>
cmd/Kconfig +7 -0
index 636833646f6e..253fbdfe1dd1 100644
@@ -175,8 +175,15 @@ config CMD_CPU
 	  number of CPUs, type (e.g. manufacturer, architecture, product or
 	  internal name) and clock frequency. Other information may be
 	  available depending on the CPU driver.
 
+config CMD_UFETCH
+	bool "U-Boot fetch"
+	depends on BLK
+	help
+	  Fetch utility for U-Boot (akin to neofetch). Prints information
+	  about U-Boot and the board it is running on in a pleasing format.
+
 config CMD_FWU_METADATA
 	bool "fwu metadata read"
 	depends on FWU_MULTI_BANK_UPDATE
 	help
cmd/Makefile +1 -0
index d1f369deec0a..1e6d3128c8ca 100644
@@ -52,8 +52,9 @@ obj-$(CONFIG_CMD_CONSOLE) += console.o
 obj-$(CONFIG_CMD_CPU) += cpu.o
 obj-$(CONFIG_CMD_DATE) += date.o
 obj-$(CONFIG_CMD_DEMO) += demo.o
 obj-$(CONFIG_CMD_DM) += dm.o
+obj-$(CONFIG_CMD_UFETCH) += ufetch.o
 obj-$(CONFIG_CMD_SOUND) += sound.o
 ifdef CONFIG_POST
 obj-$(CONFIG_CMD_DIAG) += diag.o
 endif
cmd/ufetch.c new file +229 -0

229 lines not on this page · raw message

configs/sandbox_defconfig +1 -0
index d111858082d5..fb2b5ff54f4a 100644
@@ -50,8 +50,9 @@ CONFIG_LOG_DEFAULT_LEVEL=6
 CONFIG_LOGF_FUNC=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_STACKPROTECTOR=y
 CONFIG_CMD_CPU=y
+CONFIG_CMD_UFETCH=y
 CONFIG_CMD_LICENSE=y
 CONFIG_CMD_SMBIOS=y
 CONFIG_CMD_BOOTM_PRE_LOAD=y
 CONFIG_CMD_BOOTZ=y
Signature · 1 line
2.47.0
#1 lore raw
Quoted 9 lines · Caleb Connolly

Add a small utility for displaying some information about U-Boot and the hardware it's running on in a similar fashion to the popular neofetch tool for Linux [1].

While the output is meant to be useful, it should also be pleasing to look at and perhaps entertaining. The ufetch command aims to bring this to U-Boot, featuring a colorful ASCII art version of the U-Boot logo.

[...]

Applied to u-boot/next, thanks!

Signature · 1 line
Tom