* [PATCH v2 00/13] commands: add bfetch/buds of command redirection
@ 2025-08-13 14:33 Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 01/13] common: introduce structured I/O Ahmad Fatoum
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox
See patches for individual changelog.
Ahmad Fatoum (13):
common: introduce structured I/O
ARM: cpuinfo: support structio output
commands: uptime: enable structured I/O
string: implement strv_length helper
ARM: psci: client: add PSCI version/method parameters
net: move netmask_to_prefix into header
optee: add revision info to tee devinfo output
tee: enable structured I/O in devinfo handler
security: blobgen: add easy way to check for existent providers
clk: implement clk_have_nonfixed_providers
commands: introduce bfetch command
configs: enable bfetch in some popular defconfigs
hush: structio: silence missing command error message
arch/arm/configs/multi_v7_defconfig | 1 +
arch/arm/configs/multi_v8_defconfig | 1 +
arch/arm/cpu/cpuinfo.c | 47 +-
arch/arm/cpu/psci-client.c | 17 +-
arch/riscv/configs/rv64i_defconfig | 1 +
arch/riscv/configs/virt32_defconfig | 1 +
arch/sandbox/configs/sandbox_defconfig | 1 +
commands/Kconfig | 11 +
commands/Makefile | 1 +
commands/bfetch.c | 752 +++++++++++++++++++++++++
commands/ip.c | 13 -
commands/uptime.c | 34 +-
common/Kconfig | 4 +
common/Makefile | 1 +
common/hush.c | 3 +-
common/structio.c | 56 ++
drivers/clk/clk-fixed.c | 7 +
drivers/clk/clk-fixed.h | 11 +
drivers/clk/clk.c | 14 +
drivers/tee/optee/smc_abi.c | 17 +-
drivers/tee/tee_core.c | 25 +-
include/blobgen.h | 7 +
include/linux/clk.h | 9 +
include/linux/string_choices.h | 18 +
include/net.h | 13 +
include/param.h | 10 +
include/string.h | 7 +
include/stringlist.h | 6 +
include/structio.h | 44 ++
lib/string.c | 17 +
security/blobgen.c | 18 +-
31 files changed, 1102 insertions(+), 65 deletions(-)
create mode 100644 commands/bfetch.c
create mode 100644 common/structio.c
create mode 100644 drivers/clk/clk-fixed.h
create mode 100644 include/linux/string_choices.h
create mode 100644 include/structio.h
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 01/13] common: introduce structured I/O
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 02/13] ARM: cpuinfo: support structio output Ahmad Fatoum
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Structured I/O is an alternative method for shell commands input and
output. Instead of consuming and producing lines of unstructured
strings, commands receive objects with dedicated attributes.
In the future, once enough commands support this, we could make it
available in the shell as the pipe operator.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- replace wrong select PARAM with select PARAMETER
---
common/Kconfig | 4 ++++
common/Makefile | 1 +
common/structio.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++
include/structio.h | 44 ++++++++++++++++++++++++++++++++++++
4 files changed, 105 insertions(+)
create mode 100644 common/structio.c
create mode 100644 include/structio.h
diff --git a/common/Kconfig b/common/Kconfig
index 67aff85efc9b..b32a7cb2960b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -55,6 +55,10 @@ config BLOCK_STATS
config FILETYPE
bool
+config STRUCTIO
+ bool
+ select PARAMETER
+
config BINFMT
bool
select FILETYPE
diff --git a/common/Makefile b/common/Makefile
index b50b92122293..7a91ef21f79b 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -2,6 +2,7 @@
obj-y += boards/
obj-y += memory.o
+obj-$(CONFIG_STRUCTIO) += structio.o
obj-y += memory_display.o
pbl-$(CONFIG_PBL_CONSOLE) += memory_display.o
obj-y += clock.o
diff --git a/common/structio.c b/common/structio.c
new file mode 100644
index 000000000000..935c4628dd77
--- /dev/null
+++ b/common/structio.c
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <structio.h>
+#include <command.h>
+#include <device.h>
+
+static struct bobject *active_capture;
+
+struct bobject *structio_active(void)
+{
+ return active_capture;
+}
+
+int structio_run_command(struct bobject **bret, const char *cmd)
+{
+ struct bobject *bobj;
+ int ret;
+
+ if (!bret)
+ return run_command(cmd);
+
+ active_capture = bobj = bobject_alloc("capture");
+ bobj->local = true;
+
+ ret = run_command(cmd);
+
+ active_capture = NULL;
+
+ if (ret) {
+ bobject_free(bobj);
+ return ret;
+ }
+
+ *bret = bobj;
+ return 0;
+}
+
+int structio_devinfo(struct bobject **bret, struct device *dev)
+{
+ struct bobject *bobj;
+
+ if (!bret) {
+ devinfo(dev);
+ return 0;
+ }
+
+ active_capture = bobj = bobject_alloc("devinfo");
+ bobj->local = true;
+
+ devinfo(dev);
+
+ active_capture = NULL;
+
+ *bret = bobj;
+ return 0;
+}
diff --git a/include/structio.h b/include/structio.h
new file mode 100644
index 000000000000..1c97b4c29b79
--- /dev/null
+++ b/include/structio.h
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __STRUCTIO_H_
+#define __STRUCTIO_H_
+
+#include <bobject.h>
+
+#ifdef CONFIG_STRUCTIO
+struct bobject *structio_active(void);
+int structio_run_command(struct bobject **, const char *cmd);
+int structio_devinfo(struct bobject **, struct device *dev);
+#else
+#define structio_active() NULL
+static inline int structio_run_command(struct bobject **bobj, const char *cmd)
+{
+ return -ENOSYS;
+}
+
+static inline int structio_devinfo(struct bobject **bobj, struct device *dev)
+{
+ return -ENOSYS;
+}
+#endif
+
+#define stprintf(name, fmt, ...) do { \
+ struct bobject *__bobj = structio_active(); \
+ if (__bobj) \
+ bobject_add_param_fixed(__bobj, name, fmt, ##__VA_ARGS__); \
+ else \
+ printf(name ": " fmt "\n", ##__VA_ARGS__); \
+} while (0)
+
+#define stprintf_prefix(name, prefix, fmt, ...) do { \
+ struct bobject *__bobj = structio_active(); \
+ if (__bobj) \
+ bobject_add_param_fixed(__bobj, name, fmt, ##__VA_ARGS__); \
+ else \
+ printf(prefix fmt "\n", ##__VA_ARGS__); \
+} while (0)
+
+#define stprintf_single(name, fmt...) stprintf_prefix(name, "", fmt)
+
+#define stnoprintf(args...) ({ structio_active() ? 0 : (printf(args), 1); })
+
+#endif
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 02/13] ARM: cpuinfo: support structio output
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 01/13] common: introduce structured I/O Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 03/13] commands: uptime: enable structured I/O Ahmad Fatoum
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The command produces useful information of which we will want to reuse
some in the bfetch command. Support this by supporting structio output.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- no change
---
arch/arm/cpu/cpuinfo.c | 47 ++++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 22 deletions(-)
diff --git a/arch/arm/cpu/cpuinfo.c b/arch/arm/cpu/cpuinfo.c
index 3137b9924fa0..c8435e34fdd8 100644
--- a/arch/arm/cpu/cpuinfo.c
+++ b/arch/arm/cpu/cpuinfo.c
@@ -8,6 +8,7 @@
#include <command.h>
#include <complete.h>
#include <memory.h>
+#include <structio.h>
#include <asm/system.h>
#include <asm/barebox-arm.h>
#include <asm/cputype.h>
@@ -201,8 +202,8 @@ static int do_cpuinfo(int argc, char *argv[])
architecture = "Unknown";
}
- printf("implementer: %s\narchitecture: %s\n",
- implementer, architecture);
+ stprintf("implementer", "%s", implementer);
+ stprintf("architecture", "%s", architecture);
if (cpu_arch >= CPU_ARCH_ARMv7) {
unsigned int major, minor;
@@ -238,36 +239,38 @@ static int do_cpuinfo(int argc, char *argv[])
part = "Cortex-A72";
break;
default:
- printf("core: unknown (0x%08lx) r%up%u\n",
- mainid, major, minor);
+ stprintf("core", "unknown (0x%08lx) r%up%u",
+ mainid, major, minor);
break;
}
if (part)
- printf("core: %s r%up%u\n", part, major, minor);
+ stprintf("core", "%s r%up%u", part, major, minor);
}
#ifdef CONFIG_CPU_64v8
- printf("exception level: %u\n", current_el());
+ stprintf_prefix("exception_level", "Exception level: ", "%u", current_el());
#endif
- if (cache & (1 << 24)) {
- /* separate I/D cache */
- printf("I-cache: ");
- decode_cache(cache & 0xfff);
- printf("D-cache: ");
- decode_cache((cache >> 12) & 0xfff);
- } else {
- /* unified I/D cache */
- printf("cache: ");
- decode_cache(cache & 0xfff);
- }
+ if (!structio_active()) {
+ if (cache & (1 << 24)) {
+ /* separate I/D cache */
+ printf("I-cache: ");
+ decode_cache(cache & 0xfff);
+ printf("D-cache: ");
+ decode_cache((cache >> 12) & 0xfff);
+ } else {
+ /* unified I/D cache */
+ printf("cache: ");
+ decode_cache(cache & 0xfff);
+ }
- printf("Control register: ");
- for (i = 0; i < ARRAY_SIZE(crbits); i++)
- if (cr & (1 << i))
- printf("%s ", crbits[i]);
- printf("\n");
+ printf("Control register: ");
+ for (i = 0; i < ARRAY_SIZE(crbits); i++)
+ if (cr & (1 << i))
+ printf("%s ", crbits[i]);
+ printf("\n");
+ }
return 0;
}
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 03/13] commands: uptime: enable structured I/O
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 01/13] common: introduce structured I/O Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 02/13] ARM: cpuinfo: support structio output Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 04/13] string: implement strv_length helper Ahmad Fatoum
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The uptime command can format the uptime into a human readable time
string. We have no API to capture this output, so let's add one by using
structured I/O.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- no change
---
commands/uptime.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/commands/uptime.c b/commands/uptime.c
index d67538631c8f..7d7d8fa9be70 100644
--- a/commands/uptime.c
+++ b/commands/uptime.c
@@ -4,26 +4,31 @@
#include <command.h>
#include <clock.h>
#include <getopt.h>
+#include <structio.h>
#include <linux/math64.h>
+#define BUFSIZE 128
+
#define NSEC_PER_MINUTE (NSEC_PER_SEC * 60LL)
#define NSEC_PER_HOUR (NSEC_PER_MINUTE * 60LL)
#define NSEC_PER_DAY (NSEC_PER_HOUR * 24LL)
#define NSEC_PER_WEEK (NSEC_PER_DAY * 7LL)
-static bool print_with_unit(u64 val, const char *unit, bool comma)
+static bool print_with_unit(char *buf, u64 val, const char *unit, bool comma)
{
if (!val)
return comma;
- printf("%s%llu %s%s", comma ? ", " : "", val, unit, val > 1 ? "s" : "");
+ snprintf(buf, BUFSIZE,
+ "%s%llu %s%s", comma ? ", " : "", val, unit, val > 1 ? "s" : "");
return true;
}
static int do_uptime(int argc, char *argv[])
{
+ char buf[BUFSIZE];
u64 timestamp, weeks, days, hours, minutes;
- bool comma = false;
+ bool nanoseconds = false, comma = false;
int opt;
timestamp = get_time_ns();
@@ -31,8 +36,8 @@ static int do_uptime(int argc, char *argv[])
while((opt = getopt(argc, argv, "n")) > 0) {
switch(opt) {
case 'n':
- printf("up %lluns\n", timestamp);
- return 0;
+ nanoseconds = true;
+ break;
default:
return COMMAND_ERROR_USAGE;
}
@@ -41,24 +46,29 @@ static int do_uptime(int argc, char *argv[])
if (optind != argc)
return COMMAND_ERROR_USAGE;
- printf("up ");
+ stnoprintf("up ");
+
+ if (nanoseconds) {
+ stprintf_single("uptime", "%lluns", timestamp);
+ return 0;
+ }
weeks = div64_u64_rem(timestamp, NSEC_PER_WEEK, ×tamp);
days = div64_u64_rem(timestamp, NSEC_PER_DAY, ×tamp);
hours = div64_u64_rem(timestamp, NSEC_PER_HOUR, ×tamp);
minutes = div64_u64_rem(timestamp, NSEC_PER_MINUTE, ×tamp);
- comma = print_with_unit(weeks, "week", false);
- comma = print_with_unit(days, "day", comma);
- comma = print_with_unit(hours, "hour", comma);
- comma = print_with_unit(minutes, "minute", comma);
+ comma = print_with_unit(buf, weeks, "week", false);
+ comma = print_with_unit(buf, days, "day", comma);
+ comma = print_with_unit(buf, hours, "hour", comma);
+ comma = print_with_unit(buf, minutes, "minute", comma);
if (!comma) {
u64 seconds = div64_u64_rem(timestamp, NSEC_PER_SEC, ×tamp);
- print_with_unit(seconds, "second", false);
+ print_with_unit(buf, seconds, "second", false);
}
- printf("\n");
+ stprintf_single("uptime", "%s", buf);
return 0;
}
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 04/13] string: implement strv_length helper
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (2 preceding siblings ...)
2025-08-13 14:33 ` [PATCH v2 03/13] commands: uptime: enable structured I/O Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 05/13] ARM: psci: client: add PSCI version/method parameters Ahmad Fatoum
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
For calculating the length of an array of strings with a NULL sentinel,
introduce a strv_length helper.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- no change
---
include/string.h | 7 +++++++
lib/string.c | 17 +++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/include/string.h b/include/string.h
index b54a8fc3f38a..71affe48b640 100644
--- a/include/string.h
+++ b/include/string.h
@@ -57,4 +57,11 @@ static inline bool is_nul_terminated(const char *val, size_t len)
return strnlen(val, len) != len;
}
+typedef union {
+ char * const *sl;
+ const char * const *sl_const;
+} strv_t __attribute__((transparent_union));
+
+size_t strv_length(strv_t) __pure;
+
#endif /* __STRING_H */
diff --git a/lib/string.c b/lib/string.c
index 96eac6d1daf6..73637cd9710a 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -1137,3 +1137,20 @@ char *strreplace(char *str, char old, char new)
return str;
}
EXPORT_SYMBOL(strreplace);
+
+/**
+ * strv_length - calculate length of string vector
+ * @strv: NULL-terminated array of string
+ *
+ * Return: size of the vector
+ */
+size_t strv_length(const char * const *l)
+{
+ size_t n = 0;
+
+ for (const char *const *s, *const *i = (l); (s = i) && *i; i++)
+ n++;
+
+ return n;
+}
+EXPORT_SYMBOL(strv_length);
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 05/13] ARM: psci: client: add PSCI version/method parameters
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (3 preceding siblings ...)
2025-08-13 14:33 ` [PATCH v2 04/13] string: implement strv_length helper Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 06/13] net: move netmask_to_prefix into header Ahmad Fatoum
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Populate device parameters with this information, so the bfetch command
can make use of it.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- use IS_ERR_OR_NULL to guard param getting
- use new get_param_value helper
---
arch/arm/cpu/psci-client.c | 17 +++++++++++++----
include/param.h | 10 ++++++++++
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/arch/arm/cpu/psci-client.c b/arch/arm/cpu/psci-client.c
index 4c26beacb9bb..75cc3f59e0c1 100644
--- a/arch/arm/cpu/psci-client.c
+++ b/arch/arm/cpu/psci-client.c
@@ -117,6 +117,7 @@ static int of_psci_do_fixup(struct device_node *root, void *method)
static int __init psci_probe(struct device *dev)
{
+ struct param_d *param;
const char *method;
ulong of_version, actual_version;
int ret;
@@ -154,8 +155,12 @@ static int __init psci_probe(struct device *dev)
psci_invoke(ARM_PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0, &actual_version);
version = actual_version;
- dev_info(dev, "detected version %u.%u\n",
- version >> 16, version & 0xffff);
+ param = dev_add_param_fixed(dev, "version", "%u.%u",
+ version >> 16, version & 0xffff);
+ if (!IS_ERR_OR_NULL(param))
+ dev_info(dev, "detected version %s\n", get_param_value(param));
+
+ dev_add_param_fixed(dev, "method", "%s", method);
if (actual_version != of_version)
of_register_fixup(of_psci_do_fixup, (void *)method);
@@ -170,11 +175,15 @@ static int __init psci_probe(struct device *dev)
restart.priority = 400;
ret = restart_handler_register(&restart);
- if (ret)
+ if (ret) {
dev_warn(dev, "error registering restart handler: %pe\n",
ERR_PTR(ret));
+ return ret;
+ }
- return ret;
+ dev_add_alias(dev, "psci");
+
+ return 0;
}
static __maybe_unused struct of_device_id psci_dt_ids[] = {
diff --git a/include/param.h b/include/param.h
index 1bf04015f266..c12151134752 100644
--- a/include/param.h
+++ b/include/param.h
@@ -253,6 +253,16 @@ static inline int bobject_param_set_generic(bobject_t bobj, struct param_d *p,
}
#endif
+static inline const char *get_param_value(struct param_d *param)
+{
+ if (!IS_ENABLED(CONFIG_PARAMETER))
+ return NULL;
+ if (IS_ERR_OR_NULL(param))
+ return ERR_CAST(param);
+
+ return param->get(param->bobj, param);
+}
+
int param_set_readonly(struct param_d *p, void *priv);
/*
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 06/13] net: move netmask_to_prefix into header
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (4 preceding siblings ...)
2025-08-13 14:33 ` [PATCH v2 05/13] ARM: psci: client: add PSCI version/method parameters Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 07/13] optee: add revision info to tee devinfo output Ahmad Fatoum
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This function will become useful for the bfetch command, so move it into
the header.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- no change
---
commands/ip.c | 13 -------------
include/net.h | 13 +++++++++++++
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/commands/ip.c b/commands/ip.c
index fc46b6c857a2..08848cfbe739 100644
--- a/commands/ip.c
+++ b/commands/ip.c
@@ -7,19 +7,6 @@
#include <linux/list.h>
#include <complete.h>
-/* Function to calculate CIDR prefix from netmask */
-static int netmask_to_prefix(IPaddr_t netmask)
-{
- int prefix = 0;
-
- while (netmask) {
- prefix += netmask & 1;
- netmask >>= 1;
- }
-
- return prefix;
-}
-
/* Function to display network links (`ip l`) */
static int do_ip_link(int argc, char *argv[])
{
diff --git a/include/net.h b/include/net.h
index 8858dc34d4ea..43d718353a76 100644
--- a/include/net.h
+++ b/include/net.h
@@ -623,4 +623,17 @@ struct eth_ethaddr {
extern struct list_head ethaddr_list;
+/* Function to calculate CIDR prefix from netmask */
+static inline int netmask_to_prefix(IPaddr_t netmask)
+{
+ int prefix = 0;
+
+ while (netmask) {
+ prefix += netmask & 1;
+ netmask >>= 1;
+ }
+
+ return prefix;
+}
+
#endif /* __NET_H__ */
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 07/13] optee: add revision info to tee devinfo output
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (5 preceding siblings ...)
2025-08-13 14:33 ` [PATCH v2 06/13] net: move netmask_to_prefix into header Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 08/13] tee: enable structured I/O in devinfo handler Ahmad Fatoum
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We currently only report an implementation ID when doing devinfo on the
tee device. Improve upon that by translating the ID to a string and
printing the OP-TEE revision if possible.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- use IS_ERR_OR_NULL to guard param getting
- use new get_param_value helper
---
drivers/tee/optee/smc_abi.c | 17 ++++++++++++-----
drivers/tee/tee_core.c | 20 +++++++++++++++++++-
2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
index aab8ebb186ed..56af3b1b2b29 100644
--- a/drivers/tee/optee/smc_abi.c
+++ b/drivers/tee/optee/smc_abi.c
@@ -549,8 +549,10 @@ static bool optee_msg_api_uid_is_optee_api(optee_invoke_fn *invoke_fn)
return false;
}
-static void optee_msg_get_os_revision(optee_invoke_fn *invoke_fn)
+static void optee_msg_get_os_revision(struct device *dev,
+ optee_invoke_fn *invoke_fn)
{
+ struct param_d *param;
union {
struct arm_smccc_res smccc;
struct optee_smc_call_get_os_revision_result result;
@@ -564,10 +566,15 @@ static void optee_msg_get_os_revision(optee_invoke_fn *invoke_fn)
&res.smccc);
if (res.result.build_id)
- pr_info("revision %lu.%lu (%08lx)\n", res.result.major,
- res.result.minor, res.result.build_id);
+ param = dev_add_param_fixed(dev, "revision", "%lu.%lu (%08lx)",
+ res.result.major, res.result.minor,
+ res.result.build_id);
else
- pr_info("revision %lu.%lu\n", res.result.major, res.result.minor);
+ param = dev_add_param_fixed(dev, "revision", "%lu.%lu",
+ res.result.major, res.result.minor);
+
+ if (!IS_ERR_OR_NULL(param))
+ pr_info("revision %s\n", get_param_value(param));
}
static bool optee_msg_api_revision_is_compatible(optee_invoke_fn *invoke_fn)
@@ -662,7 +669,7 @@ static int optee_probe(struct device *dev)
return -EINVAL;
}
- optee_msg_get_os_revision(invoke_fn);
+ optee_msg_get_os_revision(dev, invoke_fn);
if (!optee_msg_api_revision_is_compatible(invoke_fn)) {
pr_warn("api revision mismatch\n");
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index 653b04ff06af..a4bb9af46933 100644
--- a/drivers/tee/tee_core.c
+++ b/drivers/tee/tee_core.c
@@ -487,9 +487,27 @@ static void tee_devinfo(struct device *dev)
{
struct tee_device *teedev = dev->priv;
struct tee_ioctl_version_data vers;
+ const char *impl = NULL, *rev;
teedev->desc->ops->get_version(teedev, &vers);
- printf("Implementation ID: %d\n", vers.impl_id);
+
+ switch (vers.impl_id) {
+ case TEE_IMPL_ID_OPTEE:
+ impl = "optee";
+ break;
+ case TEE_IMPL_ID_AMDTEE:
+ impl = "amdtee";
+ break;
+ }
+
+ printf("Implementation ID: %d%s%s%s\n", vers.impl_id,
+ impl ? " ( " : "", impl, impl ? ")" : "");
+ if (!dev->parent)
+ return;
+
+ rev = dev_get_param(dev->parent, "revision");
+ if (rev)
+ printf("Revision: %s\n", rev);
}
/**
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 08/13] tee: enable structured I/O in devinfo handler
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (6 preceding siblings ...)
2025-08-13 14:33 ` [PATCH v2 07/13] optee: add revision info to tee devinfo output Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 09/13] security: blobgen: add easy way to check for existent providers Ahmad Fatoum
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
To make it easier to consume the devinfo output without directly
printing it to the console, switch over the handler to use structured
I/O.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- no change
---
drivers/tee/tee_core.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index a4bb9af46933..151f8eb70e00 100644
--- a/drivers/tee/tee_core.c
+++ b/drivers/tee/tee_core.c
@@ -10,6 +10,7 @@
#include <linux/tee_drv.h>
#include <linux/uaccess.h>
#include <linux/printk.h>
+#include <structio.h>
#include "tee_private.h"
#define TEE_NUM_DEVICES 32
@@ -500,14 +501,18 @@ static void tee_devinfo(struct device *dev)
break;
}
- printf("Implementation ID: %d%s%s%s\n", vers.impl_id,
- impl ? " ( " : "", impl, impl ? ")" : "");
- if (!dev->parent)
- return;
+ if (structio_active()) {
+ stprintf("impl.id", "%d", vers.impl_id);
+ if (impl)
+ stprintf("impl.name", "%s", impl);
+ } else {
+ printf("Implementation ID: %d%s%s%s\n", vers.impl_id,
+ impl ? " ( " : "", impl, impl ? ")" : "");
+ }
rev = dev_get_param(dev->parent, "revision");
if (rev)
- printf("Revision: %s\n", rev);
+ stprintf_prefix("impl.rev", "Revision: ", "%s", rev);
}
/**
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 09/13] security: blobgen: add easy way to check for existent providers
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (7 preceding siblings ...)
2025-08-13 14:33 ` [PATCH v2 08/13] tee: enable structured I/O in devinfo handler Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 10/13] clk: implement clk_have_nonfixed_providers Ahmad Fatoum
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
blobgen_get() expects the user to name the blobgen instance to be used.
For general informational purposes, it would be nice to just check if
any provider is registered at all, so make that possible by accepting a
NULL filter argument.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- no change
---
include/blobgen.h | 7 +++++++
security/blobgen.c | 18 +++++++++++-------
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/include/blobgen.h b/include/blobgen.h
index 9f8876cee045..00674ef40f73 100644
--- a/include/blobgen.h
+++ b/include/blobgen.h
@@ -44,7 +44,14 @@ struct blobgen {
int blob_gen_register(struct device *dev, struct blobgen *bg);
+#ifdef CONFIG_BLOBGEN
struct blobgen *blobgen_get(const char *name);
+#else
+static inline struct blobgen *blobgen_get(const char *name)
+{
+ return NULL;
+}
+#endif
int blob_encrypt(struct blobgen *blg, const char *modifier, const void *plain,
int plainsize, void **blob, int *blobsize);
diff --git a/security/blobgen.c b/security/blobgen.c
index 0a4e192a271f..df42c8f6f1bc 100644
--- a/security/blobgen.c
+++ b/security/blobgen.c
@@ -50,24 +50,28 @@ int blob_gen_register(struct device *dev, struct blobgen *bg)
/**
* blobgen_get - get a blob generator of given name
- * @name: The name of the blob generator to look for
+ * @name: The name of the blob generator to look for or NULL
*
- * Finds a blob generator by name and returns it. Returns NULL if none is found.
+ * Finds a blob generator by name and returns it.
+ * If name is NULL, returns the first blob generator encountered.
+ * Returns NULL if none is found.
*/
struct blobgen *blobgen_get(const char *name)
{
- struct device *dev;
+ struct device *dev = NULL;
struct blobgen *bg;
if (!name)
return bg_default;
- dev = get_device_by_name(name);
- if (!dev)
- return NULL;
+ if (name) {
+ dev = get_device_by_name(name);
+ if (!dev)
+ return NULL;
+ }
list_for_each_entry(bg, &blobs, list) {
- if (dev == &bg->dev)
+ if (!dev || dev == &bg->dev)
return bg;
}
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 10/13] clk: implement clk_have_nonfixed_providers
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (8 preceding siblings ...)
2025-08-13 14:33 ` [PATCH v2 09/13] security: blobgen: add easy way to check for existent providers Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 11/13] commands: introduce bfetch command Ahmad Fatoum
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This function will be called from the upcoming bfetch command to
determine whether the running barebox has a CCF clock tree that goes
beyond fixed clocks for board-level oscillators.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- fix typo in commit message s/regulators/clocks/
---
drivers/clk/clk-fixed.c | 7 +++++++
drivers/clk/clk-fixed.h | 11 +++++++++++
drivers/clk/clk.c | 14 ++++++++++++++
include/linux/clk.h | 9 +++++++++
4 files changed, 41 insertions(+)
create mode 100644 drivers/clk/clk-fixed.h
diff --git a/drivers/clk/clk-fixed.c b/drivers/clk/clk-fixed.c
index 6ec2feb84f9e..ea081d0f22de 100644
--- a/drivers/clk/clk-fixed.c
+++ b/drivers/clk/clk-fixed.c
@@ -9,6 +9,8 @@
#include <linux/clk.h>
#include <linux/err.h>
+#include "clk-fixed.h"
+
struct clk_fixed {
struct clk_hw hw;
unsigned long rate;
@@ -27,6 +29,11 @@ static struct clk_ops clk_fixed_ops = {
.is_enabled = clk_is_enabled_always,
};
+bool clk_is_fixed(struct clk *clk)
+{
+ return clk->ops == &clk_fixed_ops;
+}
+
struct clk *clk_register_fixed_rate(const char *name,
const char *parent_name, unsigned long flags,
unsigned long rate)
diff --git a/drivers/clk/clk-fixed.h b/drivers/clk/clk-fixed.h
new file mode 100644
index 000000000000..d7f7a12cb60d
--- /dev/null
+++ b/drivers/clk/clk-fixed.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _CLK_FIXED_H
+#define _CLK_FIXED_H
+
+#include <linux/types.h>
+
+struct clk;
+
+bool clk_is_fixed(struct clk *clk);
+
+#endif
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 1fa9027bc6cd..89a007a12c5b 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -14,8 +14,22 @@
#include <linux/clk/clk-conf.h>
#include <pinctrl.h>
+#include "clk-fixed.h"
+
static LIST_HEAD(clks);
+bool clk_have_nonfixed_providers(void)
+{
+ struct clk *c;
+
+ list_for_each_entry(c, &clks, list) {
+ if (!clk_is_fixed(c))
+ return true;
+ }
+
+ return false;
+}
+
static int clk_parent_enable(struct clk *clk)
{
struct clk *parent = clk_get_parent(clk);
diff --git a/include/linux/clk.h b/include/linux/clk.h
index f893d9071371..526641927754 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -11,6 +11,7 @@
#define __LINUX_CLK_H
#include <linux/err.h>
+#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/stringify.h>
#include <linux/string.h>
@@ -971,6 +972,9 @@ static inline void clk_hw_unregister(struct clk_hw *hw)
#ifdef CONFIG_COMMON_CLK
+bool clk_have_nonfixed_providers(void);
+
+
/**
* clk_bulk_get - lookup and obtain a number of references to clock producer.
* @dev: device for clock "consumer"
@@ -1085,6 +1089,11 @@ int __must_check clk_bulk_enable(int num_clks,
void clk_bulk_disable(int num_clks, const struct clk_bulk_data *clks);
#else
+static inline bool clk_have_nonfixed_providers(void)
+{
+ return false;
+}
+
static inline int __must_check clk_bulk_get(struct device *dev, int num_clks,
struct clk_bulk_data *clks)
{
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 11/13] commands: introduce bfetch command
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (9 preceding siblings ...)
2025-08-13 14:33 ` [PATCH v2 10/13] clk: implement clk_have_nonfixed_providers Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 12/13] configs: enable bfetch in some popular defconfigs Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 13/13] hush: structio: silence missing command error message Ahmad Fatoum
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Inspired by U-Boot's addition of the ufetch command and the neofetch
utility for Linux[1], add a similar command to barebox.
The command is meant to simplify showing off a barebox port with some
colored ASCII art. The usual alternative is a screenshot of a barebox
boot up and prompt, which for a fresh port usually will contain some
>= warning messages, which is not as pleasant to look at compared to:
:##: :##: none@virt64
-%%: =#####. :%%- -----------
#@@@@@. Kernel: barebox 2025.07.0-<snip>
*@@@@@. Model: ARM QEMU virt64 (linux,dummy-virt)
*@@@@@. Config: arm64 multi_v8_defconfig
*@@@@@. :=##=. CPU: Cortex-A57 r1p0 at EL1
*@@@@@. :+%@@@@@@#+: Memory: 1 GiB
*@@@@@:-*@@@@@@@@@@@@@%*-. Uptime: 1 second
*@@@@@@@@@@@@@@%%@@@@@@@@@#=. Shell: Hush with 155 commands and 8 aliases
*@@@@@@@@@@@%**+=+*%@@@@@@@@@%+. Consoles: input0 cs0 netconsole-1
*@@@@@@@%#*++++++===+*#%@@@@@@@+ Features: FW_CFG HWRNG PCI VIRTIO
*@@@@@#*+++++++++++++===+#@@@@@+ barebox: /dev 9P BTHREAD DEEP RATP W^X
*@@@@@*+++++++++++++++++=*@@@@@+ Network: 1 interface, 1 up
*@@@@@*+++++++++++++++++=*@@@@@+ eth0: 0.0.0.0/0
*@@@@@*+++++++++++++++++=*@@@@@+ Hardening: init-stack
*@@@@@*+++++++++++++++++=*@@@@@+ Devices: 85 with 17 bound
*@@@@@*++++++++++++++++==*@@@@@+ Drivers: 220 drivers across 16 busses
*@@@@@%#*+++++++++++===+*%@@@@@+ Storage: 1x MTD (128 MiB)
*@@@@@@@@%#*++++===+*#%@@@@@@@@+ Environment: 28 bytes
-*%@@@@@@@@@%*++*%@@@@@@@@@%+: Firmware:
:+#@@@@@@@@@@@@@@@@@@#=: PSCI: v1.1 over hvc
.=*@@@@@@@@@@@%*-.
-+%@@@@%+:
-@@- :==. :@@-
:**. .**:
[1]: https://en.wikipedia.org/wiki/Neofetch
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- drop extra new lines in SCMI and UEFI output
---
commands/Kconfig | 11 +
commands/Makefile | 1 +
commands/bfetch.c | 752 +++++++++++++++++++++++++++++++++
include/linux/string_choices.h | 18 +
include/stringlist.h | 6 +
5 files changed, 788 insertions(+)
create mode 100644 commands/bfetch.c
create mode 100644 include/linux/string_choices.h
diff --git a/commands/Kconfig b/commands/Kconfig
index 16b995cb3b7c..02b45d8cbe09 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -308,6 +308,17 @@ config CMD_VERSION
barebox 2014.05.0-00142-gb289373 #177 Mon May 12 20:35:55 CEST 2014
+config CMD_BFETCH
+ tristate
+ depends on BANNER
+ select STRUCTIO
+ imply CMD_UPTIME
+ imply CMD_ARM_CPUINFO if ARM
+ imply CMD_DEVINFO
+ prompt "bfetch"
+ help
+ Print system information from barebox point of view. Fancily.
+
config CMD_MMC
tristate
prompt "mmc command allowing to set enhanced area"
diff --git a/commands/Makefile b/commands/Makefile
index 9247287ed53a..fadf9e7cc7e0 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -63,6 +63,7 @@ obj-$(CONFIG_CMD_TRUE) += true.o
obj-$(CONFIG_CMD_FALSE) += false.o
obj-$(CONFIG_CMD_VARINFO) += varinfo.o
obj-$(CONFIG_CMD_VERSION) += version.o
+obj-$(CONFIG_CMD_BFETCH) += bfetch.o
obj-$(CONFIG_CMD_HELP) += help.o
obj-$(CONFIG_CMD_LSMOD) += lsmod.o
obj-$(CONFIG_CMD_INSMOD) += insmod.o
diff --git a/commands/bfetch.c b/commands/bfetch.c
new file mode 100644
index 000000000000..c201c66b09ea
--- /dev/null
+++ b/commands/bfetch.c
@@ -0,0 +1,752 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <barebox-info.h>
+#include <bbu.h>
+#include <blobgen.h>
+#include <block.h>
+#include <command.h>
+#include <complete.h>
+#include <dsa.h>
+#include <envfs.h>
+#include <environment.h>
+#include <fb.h>
+#include <featctrl.h>
+#include <firmware.h>
+#include <getopt.h>
+#include <globalvar.h>
+#include <machine_id.h>
+#include <memory.h>
+#include <net.h>
+#include <pm_domain.h>
+#include <sound.h>
+#include <stdio.h>
+#include <structio.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <watchdog.h>
+
+#include <efi/efi-mode.h>
+#include <efi/efi-device.h>
+
+#include <generated/utsrelease.h>
+#include <linux/clk.h>
+#include <linux/device/bus.h>
+#include <linux/hw_random.h>
+#include <linux/kasan.h>
+#include <linux/kernel.h>
+#include <linux/mtd/mtd.h>
+#include <linux/nvmem-consumer.h>
+#include <linux/pci.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/pstore.h>
+#include <linux/reboot-mode.h>
+#include <linux/rtc.h>
+#include <linux/scmi_protocol.h>
+#include <linux/string_choices.h>
+#include <linux/tee_drv.h>
+#include <linux/usb/usb.h>
+
+#define BFETCH_TMP_ENV "/tmp/.bfetch.env.tmp"
+
+#define LINE_WIDTH 40
+#define WHITE "\033[1;37m"
+#define YELLOW "\033[33m"
+#define BOLD "\033[1m"
+#define RED "\033[31m"
+#define LIGHT_RED "\033[1;91m"
+#define DARK_RED "\033[0;31m"
+#define PURPLE "\033[35m"
+#define RESET "\033[0m"
+#define BOLD_RESET RESET BOLD
+
+#define LOGO_WIDTH 44
+#define LOGO_HEIGHT 25
+
+static const char logo_lines[LOGO_HEIGHT][LOGO_WIDTH] = {
+ ":##: :##:",
+ "-%%: =#####. :%%-",
+ " #@@@@@. ",
+ " *@@@@@. ",
+ " *@@@@@. ",
+ " *@@@@@. :=##=. ",
+ " *@@@@@. :+%@@@@@@#+: ",
+ " *@@@@@:-*@@@@@@@@@@@@@%*-. ",
+ " *@@@@@@@@@@@@@@%%@@@@@@@@@#=. ",
+ " *@@@@@@@@@@@%**+=+*%@@@@@@@@@%+. ",
+ " *@@@@@@@%#*++++++===+*#%@@@@@@@+ ",
+ " *@@@@@#*+++++++++++++===+#@@@@@+ ",
+ " *@@@@@*+++++++++++++++++=*@@@@@+ ",
+ " *@@@@@*+++++++++++++++++=*@@@@@+ ",
+ " *@@@@@*+++++++++++++++++=*@@@@@+ ",
+ " *@@@@@*+++++++++++++++++=*@@@@@+ ",
+ " *@@@@@*++++++++++++++++==*@@@@@+ ",
+ " *@@@@@%#*+++++++++++===+*%@@@@@+ ",
+ " *@@@@@@@@%#*++++===+*#%@@@@@@@@+ ",
+ " -*%@@@@@@@@@%*++*%@@@@@@@@@%+: ",
+ " :+#@@@@@@@@@@@@@@@@@@#=: ",
+ " .=*@@@@@@@@@@@%*-. ",
+ " -+%@@@@%+: ",
+ "-@@- :==. :@@-",
+ ":**. .**:",
+};
+
+static const char style_lines[LOGO_HEIGHT][LOGO_WIDTH] = {
+ "*@@* *@@*",
+ "*@@* ******* *@@*",
+ " *@@@@@* ",
+ " *@@@@@* ",
+ " *@@@@@* ",
+ " *@@@@@* ****** ",
+ " *@@@@@* ***@@@@@@*** ",
+ " *@@@@@***@@@@@@@@@@@@@**** ",
+ " *@@@@@@@@@@@@@@rR@@@@@@@@@*** ",
+ " *@@@@@@@@@@@rrrrRRRR@@@@@@@@@*** ",
+ " *@@@@@@@rrrrrrrrRRRRRRRR@@@@@@@* ",
+ " *@@@@@rrrrrrrrrrRRRRRRRRRR@@@@@* ",
+ " *@@@@@rrrrrrrrrrRRRRRRRRRR@@@@@* ",
+ " *@@@@@rrrrrrrrrrRRRRRRRRRR@@@@@* ",
+ " *@@@@@rrrrrrrrrrRRRRRRRRRR@@@@@* ",
+ " *@@@@@rrrrrrrrrrRRRRRRRRRR@@@@@* ",
+ " *@@@@@rrrrrrrrrrRRRRRRRRRR@@@@@* ",
+ " *@@@@@rrrrrrrrrrRRRRRRRRRR@@@@@* ",
+ " *@@@@@@@@rrrrrrrRRRRRRR@@@@@@@@* ",
+ " ***@@@@@@@@@rrrRRR@@@@@@@@@*** ",
+ " ***@@@@@@@@@@@@@@@@@@*** ",
+ " ***@@@@@@@@@@@**** ",
+ " ***@@@@*** ",
+ "*@@* **** *@@*",
+ "*@@* *@@*",
+};
+
+static_assert(sizeof(logo_lines) == sizeof(style_lines));
+
+static bool skip_logo;
+
+static bool logo(unsigned *lineidx)
+{
+ const char *c, *s;
+ char last_style = '\0';
+
+ if (skip_logo)
+ return false;
+
+ if (*lineidx >= LOGO_HEIGHT) {
+ printf("%*s" " ", LOGO_WIDTH, "");
+ return false;
+ }
+
+ c = logo_lines[*lineidx];
+ s = style_lines[*lineidx];
+
+ while (*c) {
+ if (last_style != *s) {
+ switch (*s) {
+ case '*': puts(RESET); break;
+ case '@': puts(RESET BOLD); break;
+ case 'r': puts(LIGHT_RED); break;
+ case 'R': puts(DARK_RED); break;
+ case ' ': break;
+ default: BUG();
+ }
+
+ last_style = *s;
+ }
+
+ putchar(*c);
+
+ c++;
+ s++;
+ }
+
+ printf(RESET " ");
+ ++*lineidx;
+ return true;
+}
+
+#define print_line(key, fmt, ...) do { \
+ logo(line); printf(DARK_RED "%s" RESET ": " fmt "\n", key, ##__VA_ARGS__); \
+} while (0)
+
+static inline bool __print_string_list(unsigned *line, const char *key,
+ struct string_list *sl,
+ const char *joinstr)
+{
+ if (string_list_empty(sl))
+ return false;
+ print_line(key, "%s", string_list_join(sl, joinstr));
+ return true;
+}
+#define print_string_list(k, sl, js) __print_string_list(line, k, sl, js)
+
+static inline bool bus_has_devices(const char *name)
+{
+ struct bus_type *bus;
+ struct device *dev;
+
+ bus = get_bus_by_name("virtio");
+ if (!bus)
+ return false;
+
+ bus_for_each_device(bus, dev)
+ return true;
+
+ return false;
+}
+
+static void print_header(unsigned *line)
+{
+ int size = 0;
+
+ if (!IS_ENABLED(CONFIG_GLOBALVAR))
+ return;
+
+ logo(line);
+ printf(DARK_RED "%s" RESET "@" DARK_RED "%s" RESET "\n",
+ globalvar_get("user"), globalvar_get("hostname"));
+ size += strlen(globalvar_get("user") ?: "");
+ size++;
+ size += strlen(globalvar_get("hostname") ?: "");
+ logo(line);
+
+ for (int i = 0; i < size; i++)
+ putchar('-');
+ putchar('\n');
+}
+
+static void print_barebox_info(unsigned *line)
+{
+ const char *compat = NULL, *model;
+
+ print_line("Kernel", "barebox " UTS_RELEASE);
+
+ model = globalvar_get("model");
+ of_property_read_string(of_get_root_node(), "compatible", &compat);
+ if (compat)
+ print_line("Model", "%s (%s)", model, compat);
+ else if (model)
+ print_line("Model", "%s", model);
+
+ if (*CONFIG_NAME)
+ print_line("Config", "%s %s", CONFIG_ARCH_LINUX_NAME, CONFIG_NAME);
+ else
+ print_line("Architecture", "%s", CONFIG_ARCH_LINUX_NAME);
+}
+
+static void print_cpu_mem_info(unsigned *line)
+{
+ struct bobject *bret;
+ struct memory_bank *mem;
+ unsigned long memsize = 0;
+ int nbanks = 0;
+ int ret;
+
+ /* TODO: show info for other arches, e.g. RISC-V S-Mode/M-Mode */
+ if (IS_ENABLED(CONFIG_ARM)) {
+ ret = structio_run_command(&bret, "cpuinfo");
+ if (!ret) {
+ if (IS_ENABLED(CONFIG_ARM64))
+ print_line("CPU", "%s at EL%s",
+ bobject_get_param(bret, "core"),
+ bobject_get_param(bret, "exception_level"));
+ else if (IS_ENABLED(CONFIG_ARM32))
+ print_line("CPU", "%s", bobject_get_param(bret, "core"));
+
+ bobject_free(bret);
+ }
+ } else if (IS_ENABLED(CONFIG_GLOBALVAR)) {
+ print_line("CPU", "%s-endian", globalvar_get("endianness"));
+ }
+
+ for_each_memory_bank(mem) {
+ memsize += mem->size;
+ nbanks++;
+ }
+
+ if (nbanks > 1)
+ print_line("Memory", "%s across %u banks",
+ size_human_readable(memsize), nbanks);
+ else if (nbanks == 1)
+ print_line("Memory", "%s",
+ size_human_readable(memsize));
+}
+
+static void print_shell_console(unsigned *line)
+{
+ const char *shell;
+ struct command *cmd;
+ struct string_list sl;
+ struct console_device *console;
+
+ if (IS_ENABLED(CONFIG_SHELL_HUSH))
+ shell = "Hush";
+ else if (IS_ENABLED(CONFIG_SHELL_SIMPLE))
+ shell = "Simple";
+ else
+ shell = "None";
+
+ if (IS_ENABLED(CONFIG_COMMAND_SUPPORT)) {
+ int ncmds = 0, naliases = 0;
+
+ for_each_command(cmd) {
+ ncmds++;
+ naliases += strv_length(cmd->aliases);
+ }
+
+ print_line("Shell", "%s with %u commands and %u aliases",
+ shell, ncmds, naliases);
+ } else {
+ print_line("Shell", "%s", shell);
+ }
+
+ string_list_init(&sl);
+
+ for_each_console(console)
+ string_list_add(&sl, console->devfs.name);
+ if (!string_list_empty(&sl))
+ print_line("Consoles", "%s", string_list_join(&sl, " "));
+
+ string_list_free(&sl);
+}
+
+static void print_framebuffers(unsigned *line)
+{
+ struct string_list sl;
+ struct fb_info *info;
+
+ if (!IS_ENABLED(CONFIG_VIDEO))
+ return;
+
+ string_list_init(&sl);
+
+ class_for_each_container_of_device(&fb_class, info, dev) {
+ string_list_add_asprintf(&sl, "%s: %ux%ux%u",
+ dev_name(&info->dev),
+ info->xres, info->yres,
+ info->bits_per_pixel);
+ }
+
+ if (!string_list_empty(&sl))
+ print_line("Framebuffers", "%s", string_list_join(&sl, ", "));
+
+ string_list_free(&sl);
+}
+
+static void print_features(unsigned *line)
+{
+ struct stat st;
+ struct string_list sl;
+ bool features = false;
+ size_t tmp;
+
+ string_list_init(&sl);
+
+ if (blobgen_get(NULL))
+ string_list_add(&sl, "BLOBGEN");
+ if (clk_have_nonfixed_providers())
+ string_list_add(&sl, "CLK");
+ if (IS_ENABLED(CONFIG_DSA) && !list_empty(&dsa_switch_list))
+ string_list_add(&sl, "DSA");
+ if (IS_ENABLED(CONFIG_FEATURE_CONTROLLER) &&
+ !list_empty(&of_feature_controllers))
+ string_list_add(&sl, "FEATCTL");
+ if (!stat("/dev/fw_cfg", &st))
+ string_list_add(&sl, "FW_CFG");
+ if (firmwaremgr_find_by_node(NULL))
+ string_list_add(&sl, "FWMGR");
+ if (genpd_is_active())
+ string_list_add(&sl, "GENPD");
+ if (hwrng_get_first())
+ string_list_add(&sl, "HWRNG");
+ if (machine_id_get_hashable(&tmp))
+ string_list_add(&sl, "MACHINE-ID");
+ if (IS_ENABLED(CONFIG_MCI_TUNING)) {
+ string_list_add(&sl, "MCI-TUNING");
+ // TODO: check that loaded driver supports it
+ }
+ if (IS_ENABLED(CONFIG_PCI) && !list_empty(&pci_root_buses))
+ string_list_add(&sl, "PCI");
+ if (IS_ENABLED(CONFIG_PINCTRL) && !list_empty(&pinctrl_list))
+ string_list_add(&sl, "PINCTRL");
+ if (pstore_is_ready())
+ string_list_add(&sl, "PSTORE");
+ if (reboot_mode_get())
+ string_list_add(&sl, "REBOOT-MODE");
+ if (IS_ENABLED(CONFIG_RTC) && !list_empty(&rtc_class.list))
+ string_list_add(&sl, "RTC");
+ if (IS_ENABLED(CONFIG_SOUND) && sound_card_get_default())
+ string_list_add(&sl, "SOUND");
+ if (IS_ENABLED(CONFIG_SDL))
+ string_list_add(&sl, "USB");
+ if (bus_has_devices("virtio"))
+ string_list_add(&sl, "VIRTIO");
+ if (watchdog_get_default())
+ string_list_add(&sl, "WDOG");
+
+ if (print_string_list("Features", &sl, " "))
+ features = true;
+
+ string_list_reinit(&sl);
+
+ if (IS_ENABLED(CONFIG_FS_DEVFS))
+ string_list_add(&sl, "/dev");
+ if (IS_ENABLED(CONFIG_9P_FS))
+ string_list_add(&sl, "9P");
+ if (efi_is_loader())
+ string_list_add(&sl, "EFI");
+ if (bbu_handlers_available())
+ string_list_add(&sl, "BBU");
+ if (IS_ENABLED(CONFIG_BTHREAD))
+ string_list_add(&sl, "BTHREAD");
+ if (deep_probe_is_supported())
+ string_list_add(&sl, "DEEP");
+ if (IS_ENABLED(CONFIG_GCOV))
+ string_list_add(&sl, "GCOV");
+ if (IS_ENABLED(CONFIG_RISCV_ICACHE))
+ string_list_add(&sl, "I$");
+ if (IS_ENABLED(CONFIG_JWT))
+ string_list_add(&sl, "JWT");
+ if (IS_ENABLED(CONFIG_RATP))
+ string_list_add(&sl, "RATP");
+ if (IS_ENABLED(CONFIG_CRYPTO_RSA))
+ string_list_add(&sl, "RSA");
+ if (IS_ENABLED(CONFIG_CRYPTO_ECDSA))
+ string_list_add(&sl, "ECDSA");
+ if (IS_ENABLED(CONFIG_SDL))
+ string_list_add(&sl, "SDL");
+ if (IS_ENABLED(CONFIG_ARM_MMU_PERMISSIONS))
+ string_list_add(&sl, "W^X");
+
+ if (IS_ENABLED(CONFIG_FS_UBOOTVARFS) && !stat("/dev/ubootvar", &st))
+ string_list_add(&sl, "UBOOTVARFS");
+
+ /* TODO: detect semihosting */
+
+ print_string_list(features ? " barebox" : "Features", &sl, " ");
+
+ string_list_free(&sl);
+}
+
+static void print_netdevs(unsigned *line)
+{
+ struct eth_device *edev;
+ int nif = 0, nifup = 0;
+
+ if (!IS_ENABLED(CONFIG_NET))
+ return;
+
+ for_each_netdev(edev) {
+ nif++;
+ if (edev->active)
+ nifup++;
+ }
+
+ print_line("Network", "%u interface%s, %u up",
+ nif, str_plural(nif), nifup);
+ if (nifup) {
+ for_each_netdev(edev) {
+ IPaddr_t ipaddr;
+
+ if (!edev->active)
+ continue;
+
+ ipaddr = net_get_ip(edev);
+
+ logo(line);
+ printf(DARK_RED " %s" RESET ": %pI4/%u\n",
+ eth_name(edev), &ipaddr,
+ netmask_to_prefix(edev->netmask));
+ }
+ }
+}
+
+static void print_hardening(unsigned *line)
+{
+ struct string_list sl;
+
+ string_list_init(&sl);
+
+ if (kasan_enabled())
+ string_list_add(&sl, IS_ENABLED(CONFIG_KASAN) ? "KASAN" : "ASAN");
+ if (IS_ENABLED(CONFIG_UBSAN))
+ string_list_add(&sl, "UBSAN");
+ if (IS_ENABLED(CONFIG_DMA_API_DEBUG))
+ string_list_add(&sl, "DMA-API");
+
+ print_string_list("Debugging", &sl, " ");
+
+ string_list_reinit(&sl);
+
+ if (!IS_ENABLED(CONFIG_INIT_STACK_NONE) &&
+ IS_ENABLED(CONFIG_INIT_ON_ALLOC_DEFAULT_ON) &&
+ IS_ENABLED(CONFIG_INIT_ON_FREE_DEFAULT_ON) &&
+ IS_ENABLED(CONFIG_ZERO_CALL_USED_REGS)) {
+ string_list_add(&sl, "init-all");
+ } else {
+ if (!IS_ENABLED(CONFIG_INIT_STACK_NONE))
+ string_list_add(&sl, "init-stack");
+ if (IS_ENABLED(CONFIG_INIT_ON_ALLOC_DEFAULT_ON))
+ string_list_add(&sl, "init-alloc");
+ if (IS_ENABLED(CONFIG_INIT_ON_FREE_DEFAULT_ON))
+ string_list_add(&sl, "init-free");
+ if (IS_ENABLED(CONFIG_ZERO_CALL_USED_REGS))
+ string_list_add(&sl, "init-regs");
+ }
+ if (IS_ENABLED(CONFIG_FORTIFY_SOURCE))
+ string_list_add(&sl, "fortify");
+ if (IS_ENABLED(CONFIG_STACK_GUARD_PAGE))
+ string_list_add(&sl, "stack-guard");
+ if (!IS_ENABLED(CONFIG_STACKPROTECTOR_NONE))
+ string_list_add(&sl, "stack-prot");
+ if (!IS_ENABLED(CONFIG_PBL_STACKPROTECTOR_NONE))
+ string_list_add(&sl, "stack-prot-pbl");
+
+ print_string_list("Hardening", &sl, " ");
+
+ string_list_free(&sl);
+}
+
+static void print_devices_drivers(unsigned *line)
+{
+ struct bus_type *bus;
+ struct device *dev;
+ int nbusses = 0, ndevs = 0, ndrvs = 0, nbound = 0;
+
+ for_each_device(dev) {
+ ndevs++;
+ if (dev->driver)
+ nbound++;
+ }
+
+ print_line("Devices", "%u with %u bound", ndevs, nbound);
+
+ for_each_bus(bus) {
+ struct driver *drv;
+ bool has_drivers = false;
+
+ bus_for_each_driver(bus, drv) {
+ has_drivers = true;
+ ndrvs++;
+ }
+
+ nbusses++;
+ }
+
+ print_line("Drivers", "%u drivers across %u busses", ndrvs, nbusses);
+}
+
+static void print_storage(unsigned *line)
+{
+ const char *other_key;
+ unsigned nmtds = 0, nnvmem =0;
+ struct block_device *blk;
+ unsigned nblkdevs[BLK_TYPE_COUNT] = {};
+ unsigned blkdev_sizes[BLK_TYPE_COUNT] = {};
+ struct mtd_info *mtd;
+ size_t mtd_size = 0, nvmem_size = 0;
+ struct string_list sl;
+ struct device *dev;
+
+ if (IS_ENABLED(CONFIG_BLOCK)) {
+ for_each_block_device(blk) {
+ if (blk->type >= BLK_TYPE_COUNT)
+ continue;
+
+ nblkdevs[blk->type]++;
+ blkdev_sizes[blk->type] += blk->num_blocks * BLOCKSIZE(blk);
+ }
+ }
+
+ string_list_init(&sl);
+
+ for (int i = 0; i < BLK_TYPE_COUNT; i++) {
+ if (!nblkdevs[i])
+ continue;
+
+ string_list_add_asprintf(&sl, "%ux %s (%s)", nblkdevs[i],
+ blk_type_str(i),
+ size_human_readable(blkdev_sizes[i]));
+ }
+
+ if (print_string_list("Block devices", &sl, ", "))
+ other_key = "Other storage";
+ else
+ other_key = "Storage";
+
+ string_list_reinit(&sl);
+
+ if (IS_ENABLED(CONFIG_MTD)) {
+ class_for_each_container_of_device(&mtd_class, mtd, dev) {
+ if (mtd->parent)
+ continue;
+
+ nmtds++;
+ mtd_size += mtd->size;
+ }
+
+ if (nmtds)
+ string_list_add_asprintf(&sl, "%ux MTD (%s)", nmtds,
+ size_human_readable(mtd_size));
+ }
+
+ if (IS_ENABLED(CONFIG_NVMEM)) {
+ class_for_each_device(&nvmem_class, dev) {
+ nnvmem++;
+ nvmem_size += nvmem_device_size(nvmem_from_device(dev));
+ }
+
+ if (nnvmem)
+ string_list_add_asprintf(&sl, "%ux NVMEM (%s)", nnvmem,
+ size_human_readable(nvmem_size));
+ }
+
+ print_string_list(other_key, &sl, ", ");
+
+ string_list_free(&sl);
+}
+
+static void print_env(unsigned *line)
+{
+ int ret;
+
+ if (!IS_ENABLED(CONFIG_ENV_HANDLING))
+ return;
+
+ ret = envfs_save(BFETCH_TMP_ENV, NULL, 0);
+ if (!ret) {
+ struct stat st;
+
+ if (!stat(BFETCH_TMP_ENV, &st))
+ print_line("Environment", "%llu bytes", st.st_size);
+
+ unlink(BFETCH_TMP_ENV);
+ }
+}
+
+static int tee_devinfo(struct bobject **bret)
+{
+ struct device *dev;
+
+ if (!IS_ENABLED(CONFIG_TEE))
+ return -ENOSYS;
+
+ bus_for_each_device(&tee_bus_type, dev)
+ return structio_devinfo(bret, dev);
+
+ return -ENODEV;
+}
+
+static void print_firmware(unsigned *line)
+{
+ const char *psci_version;
+ struct bobject *bret;
+ bool have_scmi = false, have_tee = false;
+
+ psci_version = getenv("psci.version");
+
+ if (IS_ENABLED(CONFIG_ARM_SCMI_PROTOCOL) && !list_empty(&scmi_list))
+ have_scmi = true;
+ if (tee_devinfo(&bret) == 0)
+ have_tee = true;
+
+ if (!psci_version && !have_scmi && !have_tee && !efi_is_payload())
+ return;
+
+ print_line("Firmware", "");
+
+ if (psci_version)
+ print_line(" PSCI", "v%s over %s",
+ psci_version, getenv("psci.method"));
+
+ if (have_scmi)
+ print_line(" SCMI", "yes");
+
+ /* TODO: RISC-V SBI version */
+
+ if (have_tee) {
+ const char *name = bobject_get_param(bret, "impl.name");
+ if (name)
+ print_line(" TEE", "%s rev. %s",
+ name, bobject_get_param(bret, "impl.rev"));
+ else
+ print_line(" TEE", "impementation ID %s",
+ bobject_get_param(bret, "impl.id"));
+ bobject_free(bret);
+ }
+
+ if (efi_is_payload()) {
+ print_line(" UEFI", "v%s.%s by %s v%s",
+ dev_get_param(&efi_bus.dev, "major"),
+ dev_get_param(&efi_bus.dev, "minor"),
+ dev_get_param(&efi_bus.dev, "fw_vendor"),
+ dev_get_param(&efi_bus.dev, "fw_revision"));
+ }
+}
+
+static int do_bfetch(int argc, char *argv[])
+{
+ struct bobject *bret;
+ unsigned _line, *line = &_line;
+ int opt;
+ int ret;
+
+ skip_logo = false;
+ while((opt = getopt(argc, argv, "n")) > 0) {
+ switch(opt) {
+ case 'n':
+ skip_logo = true;
+ break;
+ default:
+ return COMMAND_ERROR_USAGE;
+ }
+ }
+
+ print_header(line);
+
+ print_barebox_info(line);
+ print_cpu_mem_info(line);
+
+ ret = structio_run_command(&bret, "uptime");
+ if (!ret) {
+ print_line("Uptime", "%s", bobject_get_param(bret, "uptime"));
+ bobject_free(bret);
+ }
+
+ print_shell_console(line);
+ print_framebuffers(line);
+ print_features(line);
+ print_netdevs(line);
+
+ /* print_line("Compiled by", "TODO"); */
+
+ if (*buildsystem_version_string)
+ print_line("Buildsystem Version", "%s", buildsystem_version_string);
+
+ print_hardening(line);
+ print_devices_drivers(line);
+ print_storage(line);
+ print_env(line);
+ print_firmware(line);
+
+ while (logo(line))
+ putchar('\n');
+
+ if (!skip_logo)
+ printf(RESET "\n\n");
+
+ return 0;
+}
+
+BAREBOX_CMD_HELP_START(bfetch)
+BAREBOX_CMD_HELP_TEXT("Print system information from barebox point of view")
+BAREBOX_CMD_HELP_TEXT("")
+BAREBOX_CMD_HELP_TEXT("Options:")
+BAREBOX_CMD_HELP_OPT ("-n", "Don't print the ASCII logo")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(bfetch)
+ .cmd = do_bfetch,
+ BAREBOX_CMD_DESC("Print device info")
+ BAREBOX_CMD_OPTS("[-n]")
+ BAREBOX_CMD_GROUP(CMD_GRP_INFO)
+ BAREBOX_CMD_COMPLETE(empty_complete)
+BAREBOX_CMD_END
diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
new file mode 100644
index 000000000000..265573343f54
--- /dev/null
+++ b/include/linux/string_choices.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_STRING_CHOICES_H_
+#define _LINUX_STRING_CHOICES_H_
+
+#include <linux/types.h>
+
+/**
+ * str_plural - Return the simple pluralization based on English counts
+ * @num: Number used for deciding pluralization
+ *
+ * If @num is 1, returns empty string, otherwise returns "s".
+ */
+static inline const char *str_plural(size_t num)
+{
+ return num == 1 ? "" : "s";
+}
+
+#endif
diff --git a/include/stringlist.h b/include/stringlist.h
index 9a982f2ad685..707a776d919c 100644
--- a/include/stringlist.h
+++ b/include/stringlist.h
@@ -46,6 +46,12 @@ static inline void string_list_free(struct string_list *sl)
}
}
+static inline void string_list_reinit(struct string_list *sl)
+{
+ string_list_free(sl);
+ string_list_init(sl);
+}
+
#define string_list_for_each_entry(entry, sl) \
list_for_each_entry(entry, &(sl)->list, list)
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 12/13] configs: enable bfetch in some popular defconfigs
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (10 preceding siblings ...)
2025-08-13 14:33 ` [PATCH v2 11/13] commands: introduce bfetch command Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 13/13] hush: structio: silence missing command error message Ahmad Fatoum
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The bfetch command currently adds 5189 bytes to multi_v8_defconfig's
barebox-dt-2nd.img, but this is expected to grow as we add more structio
support.
Therefore the command is not enabled by default, but let's enable it for
the more popular defconfigs.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- no change
---
arch/arm/configs/multi_v7_defconfig | 1 +
arch/arm/configs/multi_v8_defconfig | 1 +
arch/riscv/configs/rv64i_defconfig | 1 +
arch/riscv/configs/virt32_defconfig | 1 +
arch/sandbox/configs/sandbox_defconfig | 1 +
5 files changed, 5 insertions(+)
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 58f3a7a9754d..f198a1ddac72 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -133,6 +133,7 @@ CONFIG_CMD_IMD=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_ARM_MMUINFO=y
CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_BFETCH=y
CONFIG_CMD_MMC=y
CONFIG_CMD_MMC_EXTCSD=y
CONFIG_CMD_FCB=y
diff --git a/arch/arm/configs/multi_v8_defconfig b/arch/arm/configs/multi_v8_defconfig
index f107a92b908b..314f06ce23ec 100644
--- a/arch/arm/configs/multi_v8_defconfig
+++ b/arch/arm/configs/multi_v8_defconfig
@@ -77,6 +77,7 @@ CONFIG_CMD_IMD=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_ARM_MMUINFO=y
CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_BFETCH=y
CONFIG_CMD_MMC_EXTCSD=y
CONFIG_CMD_POLLER=y
CONFIG_CMD_SLICE=y
diff --git a/arch/riscv/configs/rv64i_defconfig b/arch/riscv/configs/rv64i_defconfig
index 68cb86676a08..12ced940c5c4 100644
--- a/arch/riscv/configs/rv64i_defconfig
+++ b/arch/riscv/configs/rv64i_defconfig
@@ -40,6 +40,7 @@ CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_IMD=y
CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_BFETCH=y
CONFIG_CMD_POLLER=y
CONFIG_CMD_SLICE=y
CONFIG_CMD_GO=y
diff --git a/arch/riscv/configs/virt32_defconfig b/arch/riscv/configs/virt32_defconfig
index c12adc67739c..ac2eb1c94305 100644
--- a/arch/riscv/configs/virt32_defconfig
+++ b/arch/riscv/configs/virt32_defconfig
@@ -30,6 +30,7 @@ CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_IMD=y
CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_BFETCH=y
CONFIG_CMD_POLLER=y
CONFIG_CMD_SLICE=y
CONFIG_CMD_GO=y
diff --git a/arch/sandbox/configs/sandbox_defconfig b/arch/sandbox/configs/sandbox_defconfig
index 921999e001bc..5b2cfdd51507 100644
--- a/arch/sandbox/configs/sandbox_defconfig
+++ b/arch/sandbox/configs/sandbox_defconfig
@@ -20,6 +20,7 @@ CONFIG_CMD_IOMEM=y
CONFIG_CMD_IMD=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_NVMEM=y
+CONFIG_CMD_BFETCH=y
CONFIG_CMD_POLLER=y
CONFIG_CMD_SLICE=y
CONFIG_CMD_GO=y
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 13/13] hush: structio: silence missing command error message
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (11 preceding siblings ...)
2025-08-13 14:33 ` [PATCH v2 12/13] configs: enable bfetch in some popular defconfigs Ahmad Fatoum
@ 2025-08-13 14:33 ` Ahmad Fatoum
12 siblings, 0 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2025-08-13 14:33 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v1 -> v2:
- new patch
---
common/hush.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/common/hush.c b/common/hush.c
index 552e7327de92..21348c4b7510 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -113,6 +113,7 @@
#include <getopt.h>
#include <libfile.h>
#include <magicvar.h>
+#include <structio.h>
#include <linux/list.h>
#include <binfmt.h>
#include <init.h>
@@ -853,7 +854,7 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
} else {
ret = execute_binfmt(globbuf.gl_pathc, globbuf.gl_pathv);
if (ret < 0) {
- printf("%s: %pe\n", globbuf.gl_pathv[0], ERR_PTR(ret));
+ stnoprintf("%s: %pe\n", globbuf.gl_pathv[0], ERR_PTR(ret));
ret = 127;
}
}
--
2.39.5
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-08-13 14:51 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-13 14:33 [PATCH v2 00/13] commands: add bfetch/buds of command redirection Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 01/13] common: introduce structured I/O Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 02/13] ARM: cpuinfo: support structio output Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 03/13] commands: uptime: enable structured I/O Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 04/13] string: implement strv_length helper Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 05/13] ARM: psci: client: add PSCI version/method parameters Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 06/13] net: move netmask_to_prefix into header Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 07/13] optee: add revision info to tee devinfo output Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 08/13] tee: enable structured I/O in devinfo handler Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 09/13] security: blobgen: add easy way to check for existent providers Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 10/13] clk: implement clk_have_nonfixed_providers Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 11/13] commands: introduce bfetch command Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 12/13] configs: enable bfetch in some popular defconfigs Ahmad Fatoum
2025-08-13 14:33 ` [PATCH v2 13/13] hush: structio: silence missing command error message Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox