* [PATCH 00/44] commands: add bfetch/buds of command redirection
@ 2025-08-11 12:27 Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 01/44] driver: move device name definition into device.h Ahmad Fatoum
` (45 more replies)
0 siblings, 46 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox
Inspired by U-Boot's addition of the ufetch command and the neofetch
utility for Linux, add a similar command to barebox.
The command is meant to fancily show off a barebox port with some
colored ASCII art. The usual alternative is a screenshot of a barebox
boot up and prompt, which doesn't look fancy, because a first port nearly
always contains some warning/error messages (e.g. because there is no
bootsource available and net boot is unconfigured). Example:
https://raw.githubusercontent.com/a3f/a3f.github.io/refs/heads/master/img/bfetch.png
This series also includes an abnormal amount of Yakshaving.
Understandably, we need to export a lot of helpers and lists for bfetch
to be able to enumerate what features are available at runtime.
For some things like what CPU we are running on, what uptime we have or
what's the TEE's implementation ID, we readily have code that prints
to stdout, but it is not reusable because we do not buffer console
output streams and thus no command output capture or piping support.
But even if we had piping, we would need to manipulate strings to split
lines into key/value pairs.
Instead, let's rethink the problem: We have commands like cpuinfo, which
format a table with key/value pairs and print it to out. Then the UNIX
way would be to use awk/grep/sed/perl or whatever to separate them out
again.
Why not skip that and have commands directly return an object
with key/value pairs (attributes) or more complex data structures
like PowerShell is able to do?
This series does exactly that. Device parameters are now associated
with a struct bobject and that bobject can be returned and consumed
by commands without requiring association with a device.
This mechanism should be able to bring support for the pipe operator
to barebox' shell once the critical commands are adapted to use it and
there exists a way for commands to report whether they support
structured I/O or not. As I am still figuring out how to do that,
I did not include a command that captures structured output to
a variable, but that would follow in future.
Ahmad Fatoum (44):
driver: move device name definition into device.h
driver: introduce common struct bobject
lib: param: rename dev_remove_param to param_remove
param: implement dev_remove_parameters using param_remove
lib: param: add dev_for_each_param helpers
driver: initialize device parameters as part of bobject
param: operate on bobjects instead of full devices
commands: version: print value of CONFIG_NAME
treewide: populate CONFIG_NAME for all configs in-tree
test: py: change barebox_config from set to dict
test: add heuristic for guessing labgrid environment YAML
usb: drop dead iSerialNumber parameter addition
drivers: use dev_add_param_uint32_fixed for IDs
param: make bobject_add_param_fixed variadic
param: handle NULL gracefully in bobject_get_param
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
stringlist: implement string_list_empty
optee: add revision info to tee devinfo output
tee: enable structured I/O in devinfo handler
mtd: add devices to new mtd class
nvmem: add devices to new nvmem class
nvmem: export functions to query NVMEM size
video: add devices to new fb class
security: blobgen: add easy way to check for existent providers
pmdomain: add easy way to check for provider support
bbu: add easy way to check for existent providers
firmware: add easy way to check for existent providers
rtc: export rtc_class in header
driver: featctrl: export of_feature_controllers
net: dsa: export dsa_switch_list
usb: export usb_host_list
pstore: export pstore_is_ready
pinctrl: export pinctrl_list
clk: implement clk_have_nonfixed_providers
driver: bus: export get_bus_by_name
fimware: arm_scmi: export scmi_list
block: define BLK_TYPE_COUNT as last enum blk_type value
commands: introduce bfetch command
configs: enable bfetch in some popular defconfigs
arch/arm/boards/animeo_ip/init.c | 4 +-
arch/arm/boards/at91sam9m10ihd/hw_version.c | 10 +-
arch/arm/boards/at91sam9x5ek/hw_version.c | 10 +-
arch/arm/configs/am335x_mlo_defconfig | 1 +
.../arm/configs/am35xx_pfc200_xload_defconfig | 1 +
arch/arm/configs/animeo_ip_defconfig | 1 +
arch/arm/configs/at91_multi_defconfig | 1 +
arch/arm/configs/at91rm9200ek_defconfig | 1 +
arch/arm/configs/at91sam9260ek_defconfig | 1 +
.../configs/at91sam9261ek_bootstrap_defconfig | 1 +
arch/arm/configs/at91sam9261ek_defconfig | 1 +
arch/arm/configs/at91sam9g10ek_defconfig | 1 +
arch/arm/configs/at91sam9g20ek_defconfig | 1 +
arch/arm/configs/at91sam9m10g45ek_defconfig | 1 +
arch/arm/configs/at91sam9m10ihd_defconfig | 1 +
arch/arm/configs/at91sam9n12ek_defconfig | 1 +
arch/arm/configs/clps711x_defconfig | 1 +
arch/arm/configs/dss11_defconfig | 1 +
arch/arm/configs/haba_knx_lite_defconfig | 1 +
arch/arm/configs/imx23_defconfig | 1 +
arch/arm/configs/imx28_defconfig | 1 +
arch/arm/configs/imx_v7_defconfig | 1 +
arch/arm/configs/imx_v8_defconfig | 1 +
arch/arm/configs/k3-r5_defconfig | 1 +
arch/arm/configs/kindle-mx50_defconfig | 1 +
arch/arm/configs/layerscape_defconfig | 1 +
arch/arm/configs/layerscape_v7_defconfig | 1 +
arch/arm/configs/multi_v5_v6_defconfig | 1 +
arch/arm/configs/multi_v7_defconfig | 2 +
arch/arm/configs/multi_v8_defconfig | 2 +
arch/arm/configs/mvebu_defconfig | 1 +
arch/arm/configs/omap_defconfig | 1 +
arch/arm/configs/pm9261_defconfig | 1 +
arch/arm/configs/pm9263_defconfig | 1 +
arch/arm/configs/pm9g45_defconfig | 1 +
arch/arm/configs/qil_a9260_defconfig | 1 +
arch/arm/configs/qil_a9g20_defconfig | 1 +
arch/arm/configs/rockchip_v7a_defconfig | 1 +
arch/arm/configs/rockchip_v8_defconfig | 1 +
arch/arm/configs/rpi_defconfig | 1 +
arch/arm/configs/rpi_v8a_defconfig | 1 +
arch/arm/configs/socfpga-arria10_defconfig | 1 +
arch/arm/configs/socfpga-xload_defconfig | 1 +
arch/arm/configs/socfpga_defconfig | 1 +
arch/arm/configs/stm32mp_defconfig | 1 +
arch/arm/configs/tegra_v7_defconfig | 1 +
arch/arm/configs/telit_evk_pro3_defconfig | 1 +
arch/arm/configs/tny_a9260_defconfig | 1 +
.../arm/configs/tny_a9263_bootstrap_defconfig | 1 +
arch/arm/configs/tny_a9263_defconfig | 1 +
arch/arm/configs/tny_a9g20_defconfig | 1 +
arch/arm/configs/usb_a9260_defconfig | 1 +
.../arm/configs/usb_a9263_bootstrap_defconfig | 1 +
arch/arm/configs/usb_a9263_defconfig | 1 +
arch/arm/configs/usb_a9g20_defconfig | 1 +
arch/arm/configs/zii_vf610_dev_defconfig | 1 +
arch/arm/configs/zynq_defconfig | 1 +
arch/arm/configs/zynqmp_defconfig | 1 +
arch/arm/cpu/cpuinfo.c | 47 +-
arch/arm/cpu/psci-client.c | 17 +-
arch/kvx/configs/generic_defconfig | 1 +
arch/mips/configs/ath79_defconfig | 1 +
arch/mips/configs/bcm47xx_defconfig | 1 +
arch/mips/configs/gxemul-malta_defconfig | 1 +
arch/mips/configs/loongson-ls1b_defconfig | 1 +
arch/mips/configs/qemu-malta_defconfig | 1 +
arch/mips/configs/xburst_defconfig | 1 +
arch/openrisc/configs/generic_defconfig | 1 +
arch/powerpc/configs/owc_da923rc_defconfig | 1 +
arch/powerpc/configs/p1010rdb_defconfig | 1 +
arch/powerpc/configs/p1022ds_defconfig | 1 +
arch/powerpc/configs/p2020rdb_defconfig | 1 +
arch/powerpc/configs/pcm030_defconfig | 1 +
arch/riscv/configs/erizo_generic_defconfig | 1 +
arch/riscv/configs/litex_linux_defconfig | 1 +
arch/riscv/configs/rv64i_defconfig | 2 +
arch/riscv/configs/virt32_defconfig | 2 +
arch/sandbox/configs/hosttools_defconfig | 1 +
arch/sandbox/configs/sandbox_defconfig | 2 +
arch/sandbox/configs/targettools_defconfig | 1 +
arch/x86/configs/efi_defconfig | 1 +
commands/Kconfig | 11 +
commands/Makefile | 1 +
commands/bfetch.c | 752 ++++++++++++++++++
commands/devinfo.c | 2 +-
commands/ip.c | 13 -
commands/uptime.c | 34 +-
commands/varinfo.c | 2 +-
commands/version.c | 5 +-
common/Kconfig | 16 +
common/Makefile | 1 +
common/bbu.c | 8 +
common/complete.c | 2 +-
common/console.c | 11 +-
common/firmware.c | 8 +-
common/globalvar.c | 22 +-
common/partitions/dos.c | 2 +-
common/partitions/efi.c | 2 +-
common/structio.c | 56 ++
conftest.py | 47 ++
drivers/base/bus.c | 3 +-
drivers/base/driver.c | 37 +-
drivers/base/featctrl.c | 2 +-
drivers/base/power.c | 5 +
drivers/clk/clk-fixed.c | 7 +
drivers/clk/clk-fixed.h | 11 +
drivers/clk/clk.c | 14 +
drivers/efi/efi-device.c | 4 +-
drivers/firmware/arm_scmi/driver.c | 2 +-
drivers/mfd/superio.c | 7 +-
drivers/mtd/core.c | 4 +
drivers/net/dsa.c | 4 +
drivers/nvmem/core.c | 22 +-
drivers/pci/bus.c | 16 +-
drivers/pinctrl/pinctrl.c | 2 +-
drivers/tee/optee/smc_abi.c | 16 +-
drivers/tee/tee_core.c | 25 +-
drivers/usb/core/usb.c | 16 +-
drivers/video/fb.c | 4 +
drivers/w1/w1.c | 10 +-
fs/fs.c | 3 +-
fs/pstore/platform.c | 5 +
include/bbu.h | 7 +
include/blobgen.h | 7 +
include/block.h | 1 +
include/bobject.h | 48 ++
include/device.h | 39 +-
include/driver.h | 20 -
include/dsa.h | 4 +
include/fb.h | 2 +
include/featctrl.h | 2 +
include/linux/clk.h | 9 +
include/linux/device/bus.h | 1 +
include/linux/mtd/mtd.h | 2 +
include/linux/nvmem-consumer.h | 18 +-
include/linux/pinctrl/consumer.h | 3 +
include/linux/pstore.h | 5 +
include/linux/rtc.h | 3 +
include/linux/scmi_protocol.h | 2 +
include/linux/string_choices.h | 18 +
include/linux/usb/usb.h | 1 +
include/net.h | 13 +
include/param.h | 210 +++--
include/pm_domain.h | 6 +
include/string.h | 7 +
include/stringlist.h | 11 +
include/structio.h | 44 +
lib/Makefile | 1 +
lib/bobject.c | 74 ++
lib/parameter.c | 214 ++---
lib/string.c | 17 +
security/blobgen.c | 18 +-
test/py/helper.py | 46 +-
153 files changed, 1834 insertions(+), 402 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/bobject.h
create mode 100644 include/linux/string_choices.h
create mode 100644 include/structio.h
create mode 100644 lib/bobject.c
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 01/44] driver: move device name definition into device.h
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 02/44] driver: introduce common struct bobject Ahmad Fatoum
` (44 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
These definitions are not tied to the driver support, so move them into
the better matching device.h header.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
include/device.h | 21 +++++++++++++++++++++
include/driver.h | 20 --------------------
2 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/include/device.h b/include/device.h
index 965251e55240..7ef807f7d6b1 100644
--- a/include/device.h
+++ b/include/device.h
@@ -168,6 +168,27 @@ static inline struct device_node *dev_of_node(struct device *dev)
return IS_ENABLED(CONFIG_OFDEVICE) ? dev->of_node : NULL;
}
+/* dynamically assign the next free id */
+#define DEVICE_ID_DYNAMIC -2
+/* do not use an id (only one device available) */
+#define DEVICE_ID_SINGLE -1
+
+static inline const char *dev_id(const struct device *dev)
+{
+ if (!dev)
+ return NULL;
+ return (dev->id != DEVICE_ID_SINGLE) ? dev->unique_name : dev->name;
+}
+
+static inline const char *dev_name(const struct device *dev)
+{
+ if (!dev)
+ return NULL;
+ return dev_id(dev) ?: dev->name;
+}
+
+int dev_set_name(struct device *dev, const char *fmt, ...) __printf(2, 3);
+
static inline bool dev_is_dma_coherent(struct device *dev)
{
if (dev) {
diff --git a/include/driver.h b/include/driver.h
index e1493177e435..c130a3cd63fd 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -60,11 +60,6 @@ struct driver {
#define device_d device
#define driver_d driver
-/* dynamically assign the next free id */
-#define DEVICE_ID_DYNAMIC -2
-/* do not use an id (only one device available) */
-#define DEVICE_ID_SINGLE -1
-
/* Register devices and drivers.
*/
int register_driver(struct driver *);
@@ -131,21 +126,6 @@ struct device *find_device(const char *str);
*/
int get_free_deviceid(const char *name_template);
-static inline const char *dev_id(const struct device *dev)
-{
- if (!dev)
- return NULL;
- return (dev->id != DEVICE_ID_SINGLE) ? dev->unique_name : dev->name;
-}
-
-static inline const char *dev_name(const struct device *dev)
-{
- if (!dev)
- return NULL;
- return dev_id(dev) ?: dev->name;
-}
-
-int dev_set_name(struct device *dev, const char *fmt, ...) __printf(2, 3);
int dev_add_alias(struct device *dev, const char *fmt, ...) __printf(2, 3);
/*
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 02/44] driver: introduce common struct bobject
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 01/44] driver: move device name definition into device.h Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 03/44] lib: param: rename dev_remove_param to param_remove Ahmad Fatoum
` (43 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We do not have Linux kobject with attributes in barebox, but we do
have something roughly equivalent: struct device and device parameters,
which enables us to do things like eth0.mode=dhcp on the shell.
The parameter API is fairly expressive and would be very useful for
transferring data between commands. In preparation for doing that,
introduce struct bobject, which will allow device-less parameters in
the future. We keep it in a union with the name, so we do not have to
patch all instances of dev->name across the tree.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/base/driver.c | 32 --------------------------------
include/bobject.h | 26 ++++++++++++++++++++++++++
include/device.h | 9 +++++++--
lib/Makefile | 1 +
lib/bobject.c | 36 ++++++++++++++++++++++++++++++++++++
5 files changed, 70 insertions(+), 34 deletions(-)
create mode 100644 include/bobject.h
create mode 100644 lib/bobject.c
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 21bf88a74e50..4f3ae4909e07 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -621,38 +621,6 @@ int generic_memmap_ro(struct cdev *cdev, void **map, int flags)
return generic_memmap_rw(cdev, map, flags);
}
-/**
- * dev_set_name - set a device name
- * @dev: device
- * @fmt: format string for the device's name
- *
- * NOTE: This function expects dev->name to be free()-able, so extra
- * precautions needs to be taken when mixing its usage with manual
- * assignement of device.name.
- */
-int dev_set_name(struct device *dev, const char *fmt, ...)
-{
- va_list vargs;
- int err;
- /*
- * Save old pointer in case we are overriding already set name
- */
- char *oldname = dev->name;
-
- va_start(vargs, fmt);
- err = vasprintf(&dev->name, fmt, vargs);
- va_end(vargs);
-
- /*
- * Free old pointer, we do this after vasprintf call in case
- * old device name was in one of vargs
- */
- free(oldname);
-
- return WARN_ON(err < 0) ? err : 0;
-}
-EXPORT_SYMBOL_GPL(dev_set_name);
-
/**
* dev_add_alias - add alias for device
* @dev: device
diff --git a/include/bobject.h b/include/bobject.h
new file mode 100644
index 000000000000..783ab64569dc
--- /dev/null
+++ b/include/bobject.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __BOBJECT_H_
+#define __BOBJECT_H_
+
+#include <linux/compiler.h>
+
+/**
+ * struct bobject - barebox object
+ * @name: name of object (must be first member)
+ */
+struct bobject {
+ char *name;
+};
+
+struct device;
+
+typedef union {
+ struct bobject *bobj;
+ struct device *dev;
+} bobject_t __attribute__((transparent_union));
+
+
+__printf(2, 3) int bobject_set_name(bobject_t bobj, const char *name, ...);
+
+#endif
diff --git a/include/device.h b/include/device.h
index 7ef807f7d6b1..8b65693d9672 100644
--- a/include/device.h
+++ b/include/device.h
@@ -9,6 +9,7 @@
#include <linux/types.h>
#include <linux/list.h>
#include <init.h>
+#include <bobject.h>
enum dev_dma_coherence {
DEV_DMA_COHERENCE_DEFAULT = 0,
@@ -26,6 +27,7 @@ struct of_device_id;
/**
* struct device - The basic device structure
+ * @bobject: base class barebox object
* @name: This member is used to match with a driver. This is a
* descriptive name and could be MPC5XXX_ether or imx_serial.
* Unless absolutely necessary, should not be modified
@@ -63,7 +65,10 @@ struct of_device_id;
* @deferred_probe_reason: If a driver probe is deferred, this stores the last error.
*/
struct device {
- char *name;
+ union {
+ struct bobject bobject;
+ char *name;
+ };
char *unique_name;
int id;
@@ -187,7 +192,7 @@ static inline const char *dev_name(const struct device *dev)
return dev_id(dev) ?: dev->name;
}
-int dev_set_name(struct device *dev, const char *fmt, ...) __printf(2, 3);
+#define dev_set_name bobject_set_name
static inline bool dev_is_dma_coherent(struct device *dev)
{
diff --git a/lib/Makefile b/lib/Makefile
index 9592ccb68312..13f1de142008 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
+obj-y += bobject.o
obj-y += bcd.o
obj-y += term.o
obj-$(CONFIG_BOOTSTRAP) += bootstrap/
diff --git a/lib/bobject.c b/lib/bobject.c
new file mode 100644
index 000000000000..a770993b90bd
--- /dev/null
+++ b/lib/bobject.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <bobject.h>
+#include <stdio.h>
+
+/**
+ * bobject_set_name - set a barebox object's name
+ * @bobj: barebox object or device
+ * @fmt: format string for the object's name
+ *
+ * NOTE: This function expects bobj->name to be free()-able, so extra
+ * precautions needs to be taken when mixing its usage with manual
+ * assignement of bobject.name.
+ */
+int bobject_set_name(bobject_t bobj, const char *fmt, ...)
+{
+ va_list vargs;
+ int err;
+ /*
+ * Save old pointer in case we are overriding already set name
+ */
+ char *oldname = bobj.bobj->name;
+
+ va_start(vargs, fmt);
+ err = vasprintf(&bobj.bobj->name, fmt, vargs);
+ va_end(vargs);
+
+ /*
+ * Free old pointer, we do this after vasprintf call in case
+ * old device name was in one of vargs
+ */
+ free(oldname);
+
+ return WARN_ON(err < 0) ? err : 0;
+}
+EXPORT_SYMBOL_GPL(bobject_set_name);
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 03/44] lib: param: rename dev_remove_param to param_remove
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 01/44] driver: move device name definition into device.h Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 02/44] driver: introduce common struct bobject Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 04/44] param: implement dev_remove_parameters using param_remove Ahmad Fatoum
` (42 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The function doesn't take a device argument, so rename it to reflect
that.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
common/globalvar.c | 6 +++---
common/partitions/dos.c | 2 +-
common/partitions/efi.c | 2 +-
include/param.h | 4 ++--
lib/parameter.c | 5 ++---
5 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/common/globalvar.c b/common/globalvar.c
index 31b24d594c6d..1ef98f44bc67 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -39,7 +39,7 @@ void globalvar_remove(const char *name)
if (fnmatch(name, p->name, 0))
continue;
- dev_remove_param(p);
+ param_remove(p);
}
}
@@ -282,7 +282,7 @@ int nvvar_remove(const char *name)
fname = basprintf("/env/nv/%s", p->name);
- dev_remove_param(p);
+ param_remove(p);
unlink(fname);
free(fname);
@@ -510,7 +510,7 @@ static int globalvar_remove_unqualified(const char *name)
if (!(p->flags & PARAM_GLOBALVAR_UNQUALIFIED))
return -EEXIST;
- dev_remove_param(p);
+ param_remove(p);
return 0;
}
diff --git a/common/partitions/dos.c b/common/partitions/dos.c
index 6204fdabc81f..ce2e21357d52 100644
--- a/common/partitions/dos.c
+++ b/common/partitions/dos.c
@@ -311,7 +311,7 @@ static void dos_partition_free(struct partition_desc *pd)
free(dpart);
}
- dev_remove_param(dpd->disksig.param);
+ param_remove(dpd->disksig.param);
free(pd);
}
diff --git a/common/partitions/efi.c b/common/partitions/efi.c
index d237f734df50..88d8a2d739c4 100644
--- a/common/partitions/efi.c
+++ b/common/partitions/efi.c
@@ -573,7 +573,7 @@ static void efi_partition_free(struct partition_desc *pd)
free(epart);
}
- dev_remove_param(epd->param_guid);
+ param_remove(epd->param_guid);
free(epd->ptes);
free(epd->gpt);
free(epd);
diff --git a/include/param.h b/include/param.h
index 1b0315999e39..856f7a52e1b8 100644
--- a/include/param.h
+++ b/include/param.h
@@ -105,7 +105,7 @@ struct param_d *dev_add_param_file_list(struct device *dev, const char *name,
struct param_d *dev_add_param_fixed(struct device *dev, const char *name,
const char *value);
-void dev_remove_param(struct param_d *p);
+void param_remove(struct param_d *p);
void dev_remove_parameters(struct device *dev);
@@ -232,7 +232,7 @@ static inline struct param_d *dev_add_param_fixed(struct device *dev,
return NULL;
}
-static inline void dev_remove_param(struct param_d *p) {}
+static inline void param_remove(struct param_d *p) {}
static inline void dev_remove_parameters(struct device *dev) {}
diff --git a/lib/parameter.c b/lib/parameter.c
index 39a245242337..b51cee3d0e08 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -1006,11 +1006,10 @@ struct param_d *dev_add_param_file_list(struct device *dev, const char *name,
/**
- * dev_remove_param - remove a parameter from a device and free its
- * memory
+ * param_remove - remove a parameter and free its memory
* @param p The parameter
*/
-void dev_remove_param(struct param_d *p)
+void param_remove(struct param_d *p)
{
p->set(p->dev, p, NULL);
list_del(&p->list);
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 04/44] param: implement dev_remove_parameters using param_remove
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (2 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 03/44] lib: param: rename dev_remove_param to param_remove Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 05/44] lib: param: add dev_for_each_param helpers Ahmad Fatoum
` (41 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Cut down on the duplication by using param_remove.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
lib/parameter.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/lib/parameter.c b/lib/parameter.c
index b51cee3d0e08..584876bbc24b 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -1026,12 +1026,8 @@ void dev_remove_parameters(struct device *dev)
{
struct param_d *p, *n;
- list_for_each_entry_safe(p, n, &dev->parameters, list) {
- p->set(dev, p, NULL);
- list_del(&p->list);
- free_const(p->name);
- free(p);
- }
+ list_for_each_entry_safe(p, n, &dev->parameters, list)
+ param_remove(p);
}
/** @page dev_params Device parameters
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 05/44] lib: param: add dev_for_each_param helpers
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (3 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 04/44] param: implement dev_remove_parameters using param_remove Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 06/44] driver: initialize device parameters as part of bobject Ahmad Fatoum
` (40 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Instead of open-coding the linked list iterations, let's define some
macros to wrap them. This will come in handy when we associate the
parameters with the bobject instead of the device as we will only have
to adjust the macro definitions.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
commands/devinfo.c | 2 +-
commands/varinfo.c | 2 +-
common/complete.c | 2 +-
common/globalvar.c | 16 ++++++++--------
include/device.h | 5 +++++
lib/parameter.c | 2 +-
6 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/commands/devinfo.c b/commands/devinfo.c
index 3c791e4464ac..cff4dbb92e31 100644
--- a/commands/devinfo.c
+++ b/commands/devinfo.c
@@ -88,7 +88,7 @@ static int do_devinfo(int argc, char *argv[])
printf("Parent: %s\n", dev_name(dev->parent));
first = true;
- list_for_each_entry(param, &dev->parameters, list) {
+ dev_for_each_param(dev, param) {
if (first) {
printf("Parameters:\n");
first = false;
diff --git a/commands/varinfo.c b/commands/varinfo.c
index 5965c60159ca..eff7bf423cce 100644
--- a/commands/varinfo.c
+++ b/commands/varinfo.c
@@ -56,7 +56,7 @@ static int do_varinfo(int argc, char *argv[])
if (!dev)
return -ENODEV;
- list_for_each_entry(param, &dev->parameters, list) {
+ dev_for_each_param(dev, param) {
if (prefix && !strstarts(param->name, prefix))
continue;
diff --git a/common/complete.c b/common/complete.c
index 5327944ca93b..a01ce9b47163 100644
--- a/common/complete.c
+++ b/common/complete.c
@@ -179,7 +179,7 @@ static int device_param_complete(struct device *dev, const char *devname,
{
struct param_d *param;
- list_for_each_entry(param, &dev->parameters, list) {
+ dev_for_each_param(dev, param) {
if (!strstarts_escaped(param->name, instr))
continue;
diff --git a/common/globalvar.c b/common/globalvar.c
index 1ef98f44bc67..cca1ac9b39f5 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -35,7 +35,7 @@ void globalvar_remove(const char *name)
{
struct param_d *p, *tmp;
- list_for_each_entry_safe(p, tmp, &global_device.parameters, list) {
+ dev_for_each_param_safe(&global_device, p, tmp) {
if (fnmatch(name, p->name, 0))
continue;
@@ -276,7 +276,7 @@ int nvvar_remove(const char *name)
if (!IS_ENABLED(CONFIG_NVVAR))
return -ENOSYS;
- list_for_each_entry_safe(p, tmp, &nv_device.parameters, list) {
+ dev_for_each_param_safe(&nv_device, p, tmp) {
if (fnmatch(name, p->name, 0))
continue;
@@ -382,7 +382,7 @@ static void device_param_print(struct device *dev)
{
struct param_d *param;
- list_for_each_entry(param, &dev->parameters, list) {
+ dev_for_each_param(dev, param) {
const char *p = dev_get_param(dev, param->name);
const char *nv = NULL;
@@ -420,7 +420,7 @@ char *globalvar_get_match(const char *match, const char *separator)
char *val = NULL;
struct param_d *param;
- list_for_each_entry(param, &global_device.parameters, list) {
+ dev_for_each_param(&global_device, param) {
if (!strncmp(match, param->name, strlen(match))) {
const char *p = dev_get_param(&global_device, param->name);
if (val) {
@@ -444,7 +444,7 @@ void globalvar_set_match(const char *match, const char *val)
{
struct param_d *param;
- list_for_each_entry(param, &global_device.parameters, list) {
+ dev_for_each_param(&global_device, param) {
if (!strncmp(match, param->name, strlen(match)))
dev_set_param(&global_device, param->name, val);
}
@@ -723,7 +723,7 @@ int nvvar_save(void)
envfs_load(env, TMPDIR, 0);
unlink_recursive(TMPDIR "/nv", NULL);
- list_for_each_entry(param, &nv_device.parameters, list) {
+ dev_for_each_param(&nv_device, param) {
ret = __nv_save(TMPDIR "/nv", param->name,
dev_get_param(&nv_device, param->name));
if (ret) {
@@ -760,7 +760,7 @@ static int nv_global_param_complete(struct device *dev,
len = strlen(instr);
- list_for_each_entry(param, &dev->parameters, list) {
+ dev_for_each_param(dev, param) {
if (strncmp(instr, param->name, len))
continue;
@@ -790,7 +790,7 @@ int nv_complete(struct string_list *sl, char *instr)
if (dev == &global_device || dev == &nv_device)
continue;
- list_for_each_entry(param, &dev->parameters, list) {
+ dev_for_each_param(dev, param) {
str = basprintf("dev.%s.%s=", dev_name(dev), param->name);
if (strncmp(instr, str, len))
free(str);
diff --git a/include/device.h b/include/device.h
index 8b65693d9672..1158ec59b5e8 100644
--- a/include/device.h
+++ b/include/device.h
@@ -162,6 +162,11 @@ extern struct list_head class_list;
#define class_for_each(class) list_for_each_entry((class), &class_list, list)
+#define dev_for_each_param(dev, param) \
+ list_for_each_entry((param), &(dev)->parameters, list)
+#define dev_for_each_param_safe(dev, param, tmp) \
+ list_for_each_entry_safe((param), (tmp), &(dev)->parameters, list)
+
struct device_alias {
struct device *dev;
struct list_head list;
diff --git a/lib/parameter.c b/lib/parameter.c
index 584876bbc24b..c550de050db0 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -1026,7 +1026,7 @@ void dev_remove_parameters(struct device *dev)
{
struct param_d *p, *n;
- list_for_each_entry_safe(p, n, &dev->parameters, list)
+ dev_for_each_param_safe(dev, p, n)
param_remove(p);
}
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 06/44] driver: initialize device parameters as part of bobject
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (4 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 05/44] lib: param: add dev_for_each_param helpers Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 07/44] param: operate on bobjects instead of full devices Ahmad Fatoum
` (39 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
By moving the parameters to the bobjects, we pave the way for building
an OOP system that doesn't require each object to be a device.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/base/driver.c | 5 +++--
include/bobject.h | 20 ++++++++++++++++++++
include/device.h | 8 ++------
include/param.h | 4 ----
lib/bobject.c | 38 ++++++++++++++++++++++++++++++++++++++
lib/parameter.c | 17 ++---------------
6 files changed, 65 insertions(+), 27 deletions(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 4f3ae4909e07..61118385f1df 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -262,11 +262,12 @@ int register_device(struct device *new_device)
list_add_tail(&new_device->list, &device_list);
INIT_LIST_HEAD(&new_device->children);
INIT_LIST_HEAD(&new_device->cdevs);
- INIT_LIST_HEAD(&new_device->parameters);
INIT_LIST_HEAD(&new_device->active);
INIT_LIST_HEAD(&new_device->bus_list);
INIT_LIST_HEAD(&new_device->class_list);
+ bobject_init(&new_device->bobject);
+
if (new_device->bus) {
if (!new_device->parent)
new_device->parent = &new_device->bus->dev;
@@ -295,7 +296,7 @@ int unregister_device(struct device *old_dev)
dev_dbg(old_dev, "unregister\n");
- dev_remove_parameters(old_dev);
+ bobject_del(&old_dev->bobject);
if (old_dev->driver)
device_remove(old_dev);
diff --git a/include/bobject.h b/include/bobject.h
index 783ab64569dc..b159ac875f0c 100644
--- a/include/bobject.h
+++ b/include/bobject.h
@@ -3,14 +3,17 @@
#ifndef __BOBJECT_H_
#define __BOBJECT_H_
+#include <linux/list.h>
#include <linux/compiler.h>
/**
* struct bobject - barebox object
* @name: name of object (must be first member)
+ * @parameters: list of struct param_d parameters
*/
struct bobject {
char *name;
+ struct list_head parameters;
};
struct device;
@@ -23,4 +26,21 @@ typedef union {
__printf(2, 3) int bobject_set_name(bobject_t bobj, const char *name, ...);
+static inline void bobject_init(struct bobject *bobj)
+{
+ /* We have code that iterates over parameters unconditionally,
+ * so initialize it even if !IS_ENABLED(CONFIG_PARAMETER)
+ */
+ INIT_LIST_HEAD(&bobj->parameters);
+}
+
+struct bobject *bobject_alloc(const char *name);
+void bobject_free(struct bobject *bobj);
+
+#ifdef CONFIG_PARAMETER
+void bobject_del(struct bobject *bobj);
+#else
+static inline void bobject_del(struct bobject *bobj) { }
+#endif
+
#endif
diff --git a/include/device.h b/include/device.h
index 1158ec59b5e8..5bb5a28619a2 100644
--- a/include/device.h
+++ b/include/device.h
@@ -55,8 +55,6 @@ struct of_device_id;
* If parent is NULL, the device is a top-level device.
* @pm_domain: Attached power domain.
* @bus: Type of bus device is on.
- * @parameters: The parameters for this device. This is used to carry information
- * of board specific data from the board code to the device driver
* @dma_mask: DMA mask.
* @dma_offset: DMA offset.
* @detect: For devices which take longer to probe, this is called when the driver
@@ -101,8 +99,6 @@ struct device {
struct bus_type *bus;
- struct list_head parameters;
-
struct list_head cdevs;
struct list_head class_list;
@@ -163,9 +159,9 @@ extern struct list_head class_list;
#define class_for_each(class) list_for_each_entry((class), &class_list, list)
#define dev_for_each_param(dev, param) \
- list_for_each_entry((param), &(dev)->parameters, list)
+ list_for_each_entry((param), &(dev)->bobject.parameters, list)
#define dev_for_each_param_safe(dev, param, tmp) \
- list_for_each_entry_safe((param), (tmp), &(dev)->parameters, list)
+ list_for_each_entry_safe((param), (tmp), &(dev)->bobject.parameters, list)
struct device_alias {
struct device *dev;
diff --git a/include/param.h b/include/param.h
index 856f7a52e1b8..bb90d0240828 100644
--- a/include/param.h
+++ b/include/param.h
@@ -107,8 +107,6 @@ struct param_d *dev_add_param_fixed(struct device *dev, const char *name,
void param_remove(struct param_d *p);
-void dev_remove_parameters(struct device *dev);
-
int dev_param_set_generic(struct device *dev, struct param_d *p,
const char *val);
@@ -234,8 +232,6 @@ static inline struct param_d *dev_add_param_fixed(struct device *dev,
static inline void param_remove(struct param_d *p) {}
-static inline void dev_remove_parameters(struct device *dev) {}
-
static inline int dev_param_set_generic(struct device *dev, struct param_d *p,
const char *val)
{
diff --git a/lib/bobject.c b/lib/bobject.c
index a770993b90bd..eb140b90a2d5 100644
--- a/lib/bobject.c
+++ b/lib/bobject.c
@@ -34,3 +34,41 @@ int bobject_set_name(bobject_t bobj, const char *fmt, ...)
return WARN_ON(err < 0) ? err : 0;
}
EXPORT_SYMBOL_GPL(bobject_set_name);
+
+struct bobject *bobject_alloc(const char *name)
+{
+ struct bobject *bobj = xzalloc(sizeof(*bobj));
+
+ bobject_init(bobj);
+ bobject_set_name(bobj, "%s", name);
+
+ return bobj;
+}
+EXPORT_SYMBOL_GPL(bobject_alloc);
+
+void bobject_free(struct bobject *bobj)
+{
+ if (!bobj)
+ return;
+
+ free(bobj->name);
+ bobject_del(bobj);
+ free(bobj);
+}
+EXPORT_SYMBOL_GPL(bobject_free);
+
+#ifdef CONFIG_PARAMETER
+/**
+ * bobject_remove_parameters - remove all parameters from a bobject and free their
+ * memory
+ * @param bobject The barebox object
+ */
+void bobject_del(struct bobject *bobj)
+{
+ struct param_d *p, *n;
+
+ list_for_each_entry_safe(p, n, &bobj->parameters, list)
+ param_remove(p);
+}
+EXPORT_SYMBOL(bobject_del);
+#endif
diff --git a/lib/parameter.c b/lib/parameter.c
index c550de050db0..7f89ac53e0d2 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -53,7 +53,7 @@ struct param_d *get_param_by_name(struct device *dev, const char *name)
{
struct param_d *p;
- list_for_each_entry(p, &dev->parameters, list) {
+ list_for_each_entry(p, &dev->bobject.parameters, list) {
if (!strcmp(p->name, name))
return p;
}
@@ -168,7 +168,7 @@ static int __dev_add_param(struct param_d *param, struct device *dev,
param->flags = flags;
param->dev = dev;
- list_add_sort(¶m->list, &dev->parameters, compare);
+ list_add_sort(¶m->list, &dev->bobject.parameters, compare);
dev_param_init_from_nv(dev, name);
@@ -1017,19 +1017,6 @@ void param_remove(struct param_d *p)
free(p);
}
-/**
- * dev_remove_parameters - remove all parameters from a device and free their
- * memory
- * @param dev The device
- */
-void dev_remove_parameters(struct device *dev)
-{
- struct param_d *p, *n;
-
- dev_for_each_param_safe(dev, p, n)
- param_remove(p);
-}
-
/** @page dev_params Device parameters
@section params_devices Devices can have several parameters.
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 07/44] param: operate on bobjects instead of full devices
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (5 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 06/44] driver: initialize device parameters as part of bobject Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 08/44] commands: version: print value of CONFIG_NAME Ahmad Fatoum
` (38 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Previous commit associated the parameters with the bobject inside the
device. Double down and provide bobject API for creation and use of
parameters and use them to implement the device parameter API.
As each device starts with a bobject, let's make use of GCC's
transparent union feature (typedeffed as bobject_t) to have the compiler
automatically convert pointers.
This way the dev_ param functions become simple aliases to the bobject_
API, but the main upside is that we do not need to adjust callbacks
across the tree as they will just continue to work without type errors.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
include/bobject.h | 2 +
include/device.h | 2 +
include/param.h | 187 ++++++++++++++++++++++++++++------------------
lib/parameter.c | 161 +++++++++++++++++++++------------------
4 files changed, 207 insertions(+), 145 deletions(-)
diff --git a/include/bobject.h b/include/bobject.h
index b159ac875f0c..34cf9d62bc6e 100644
--- a/include/bobject.h
+++ b/include/bobject.h
@@ -10,10 +10,12 @@
* struct bobject - barebox object
* @name: name of object (must be first member)
* @parameters: list of struct param_d parameters
+ * @local: name of bobject is not unique across the system
*/
struct bobject {
char *name;
struct list_head parameters;
+ u32 local:1;
};
struct device;
diff --git a/include/device.h b/include/device.h
index 5bb5a28619a2..7abeed9c460f 100644
--- a/include/device.h
+++ b/include/device.h
@@ -124,6 +124,8 @@ struct device {
char *deferred_probe_reason;
};
+#define bobj_to_dev(__bobj) container_of_const(__bobj, struct device, bobject)
+
struct class {
const char *name;
struct list_head devices;
diff --git a/include/param.h b/include/param.h
index bb90d0240828..5f4f87f67c73 100644
--- a/include/param.h
+++ b/include/param.h
@@ -5,6 +5,7 @@
#include <linux/err.h>
#include <linux/types.h>
#include <linux/list.h>
+#include <bobject.h>
#define PARAM_FLAG_RO (1 << 0)
#define PARAM_GLOBALVAR_UNQUALIFIED (1 << 1)
@@ -28,13 +29,13 @@ enum param_type {
};
struct param_d {
- const char* (*get)(struct device *, struct param_d *param);
- int (*set)(struct device *, struct param_d *param, const char *val);
+ const char* (*get)(bobject_t, struct param_d *param);
+ int (*set)(bobject_t, struct param_d *param, const char *val);
void (*info)(struct param_d *param);
unsigned int flags;
const char *name;
char *value;
- struct device *dev;
+ struct bobject *bobj;
void *driver_priv;
struct list_head list;
enum param_type type;
@@ -44,98 +45,98 @@ enum param_tristate { PARAM_TRISTATE_UNKNOWN, PARAM_TRISTATE_TRUE, PARAM_TRISTAT
#ifdef CONFIG_PARAMETER
const char *get_param_type(struct param_d *param);
-const char *dev_get_param(struct device *dev, const char *name);
-int dev_set_param(struct device *dev, const char *name, const char *val);
-struct param_d *get_param_by_name(struct device *dev, const char *name);
+const char *bobject_get_param(bobject_t bobj, const char *name);
+int bobject_set_param(bobject_t bobj, const char *name, const char *val);
+struct param_d *get_param_by_name(bobject_t bobj, const char *name);
-struct param_d *dev_add_param(struct device *dev, const char *name,
- int (*set)(struct device *dev, struct param_d *p, const char *val),
- const char *(*get)(struct device *, struct param_d *p),
+struct param_d *bobject_add_param(bobject_t bobj, const char *name,
+ int (*set)(bobject_t bobj, struct param_d *p, const char *val),
+ const char *(*get)(bobject_t, struct param_d *p),
unsigned long flags);
-struct param_d *dev_add_param_string(struct device *dev, const char *name,
+struct param_d *bobject_add_param_string(bobject_t bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
char **value, void *priv);
-struct param_d *__dev_add_param_int(struct device *dev, const char *name,
+struct param_d *__bobject_add_param_int(bobject_t bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
void *value, enum param_type type,
const char *format, void *priv);
-struct param_d *dev_add_param_enum(struct device *dev, const char *name,
+struct param_d *bobject_add_param_enum(bobject_t bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
int *value, const char * const *names,
int num_names, void *priv);
-struct param_d *dev_add_param_tristate(struct device *dev, const char *name,
+struct param_d *bobject_add_param_tristate(bobject_t bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
int *value, void *priv);
-struct param_d *dev_add_param_tristate_ro(struct device *dev,
+struct param_d *bobject_add_param_tristate_ro(bobject_t bobj,
const char *name,
int *value);
-struct param_d *dev_add_param_bitmask(struct device *dev, const char *name,
+struct param_d *bobject_add_param_bitmask(bobject_t bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
unsigned long *value,
const char * const *names, int num_names,
void *priv);
-struct param_d *dev_add_param_ip(struct device *dev, const char *name,
+struct param_d *bobject_add_param_ip(bobject_t bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
IPaddr_t *ip, void *priv);
-struct param_d *dev_add_param_mac(struct device *dev, const char *name,
+struct param_d *bobject_add_param_mac(bobject_t bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
u8 *mac, void *priv);
-struct param_d *dev_add_param_file_list(struct device *dev, const char *name,
+struct param_d *bobject_add_param_file_list(bobject_t bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
struct file_list **file_list,
void *priv);
-struct param_d *dev_add_param_fixed(struct device *dev, const char *name,
+struct param_d *bobject_add_param_fixed(bobject_t bobj, const char *name,
const char *value);
void param_remove(struct param_d *p);
-int dev_param_set_generic(struct device *dev, struct param_d *p,
+int bobject_param_set_generic(bobject_t bobj, struct param_d *p,
const char *val);
#else
-static inline const char *dev_get_param(struct device *dev, const char *name)
+static inline const char *bobject_get_param(bobject_t bobj, const char *name)
{
return NULL;
}
-static inline int dev_set_param(struct device *dev, const char *name,
+static inline int bobject_set_param(bobject_t bobj, const char *name,
const char *val)
{
return 0;
}
-static inline struct param_d *get_param_by_name(struct device *dev,
+static inline struct param_d *get_param_by_name(bobject_t bobj,
const char *name)
{
return NULL;
}
-static inline struct param_d *dev_add_param(struct device *dev,
+static inline struct param_d *bobject_add_param(bobject_t bobj,
const char *name,
- int (*set)(struct device *dev, struct param_d *p, const char *val),
- const char *(*get)(struct device *, struct param_d *p),
+ int (*set)(bobject_t bobj, struct param_d *p, const char *val),
+ const char *(*get)(bobject_t, struct param_d *p),
unsigned long flags)
{
return NULL;
}
-static inline struct param_d *dev_add_param_string(struct device *dev,
+static inline struct param_d *bobject_add_param_string(bobject_t bobj,
const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
@@ -144,7 +145,7 @@ static inline struct param_d *dev_add_param_string(struct device *dev,
return NULL;
}
-static inline struct param_d *__dev_add_param_int(struct device *dev,
+static inline struct param_d *__bobject_add_param_int(bobject_t bobj,
const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
@@ -156,7 +157,7 @@ static inline struct param_d *__dev_add_param_int(struct device *dev,
return NULL;
}
-static inline struct param_d *dev_add_param_enum(struct device *dev,
+static inline struct param_d *bobject_add_param_enum(bobject_t bobj,
const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
@@ -168,7 +169,7 @@ static inline struct param_d *dev_add_param_enum(struct device *dev,
return NULL;
}
-static inline struct param_d *dev_add_param_bitmask(struct device *dev,
+static inline struct param_d *bobject_add_param_bitmask(bobject_t bobj,
const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
@@ -179,7 +180,7 @@ static inline struct param_d *dev_add_param_bitmask(struct device *dev,
return NULL;
}
-static inline struct param_d *dev_add_param_tristate(struct device *dev,
+static inline struct param_d *bobject_add_param_tristate(bobject_t bobj,
const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
@@ -188,14 +189,14 @@ static inline struct param_d *dev_add_param_tristate(struct device *dev,
return NULL;
}
-static inline struct param_d *dev_add_param_tristate_ro(struct device *dev,
+static inline struct param_d *bobject_add_param_tristate_ro(bobject_t bobj,
const char *name,
int *value)
{
return NULL;
}
-static inline struct param_d *dev_add_param_ip(struct device *dev,
+static inline struct param_d *bobject_add_param_ip(bobject_t bobj,
const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
@@ -204,7 +205,7 @@ static inline struct param_d *dev_add_param_ip(struct device *dev,
return NULL;
}
-static inline struct param_d *dev_add_param_mac(struct device *dev,
+static inline struct param_d *bobject_add_param_mac(bobject_t bobj,
const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
@@ -213,7 +214,7 @@ static inline struct param_d *dev_add_param_mac(struct device *dev,
return NULL;
}
-static inline struct param_d *dev_add_param_file_list(struct device *dev,
+static inline struct param_d *bobject_add_param_file_list(bobject_t bobj,
const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
@@ -223,7 +224,7 @@ static inline struct param_d *dev_add_param_file_list(struct device *dev,
return NULL;
}
-static inline struct param_d *dev_add_param_fixed(struct device *dev,
+static inline struct param_d *bobject_add_param_fixed(bobject_t bobj,
const char *name,
const char *value)
{
@@ -232,7 +233,7 @@ static inline struct param_d *dev_add_param_fixed(struct device *dev,
static inline void param_remove(struct param_d *p) {}
-static inline int dev_param_set_generic(struct device *dev, struct param_d *p,
+static inline int bobject_param_set_generic(bobject_t bobj, struct param_d *p,
const char *val)
{
return 0;
@@ -242,19 +243,19 @@ static inline int dev_param_set_generic(struct device *dev, struct param_d *p,
int param_set_readonly(struct param_d *p, void *priv);
/*
- * dev_add_param_int
- * dev_add_param_int32
- * dev_add_param_uint32
- * dev_add_param_int64
- * dev_add_param_uint64
+ * bobject_add_param_int
+ * bobject_add_param_int32
+ * bobject_add_param_uint32
+ * bobject_add_param_int64
+ * bobject_add_param_uint64
*/
#define DECLARE_PARAM_INT(intname, inttype, paramtype) \
- static inline struct param_d *dev_add_param_##intname(struct device *dev, const char *name, \
+ static inline struct param_d *bobject_add_param_##intname(bobject_t bobj, const char *name, \
int (*set)(struct param_d *p, void *priv), \
int (*get)(struct param_d *p, void *priv), \
inttype *value, const char *format, void *priv) \
{ \
- return __dev_add_param_int(dev, name, set, get, value, paramtype, format, priv); \
+ return __bobject_add_param_int(bobj, name, set, get, value, paramtype, format, priv); \
}
DECLARE_PARAM_INT(int, int, PARAM_TYPE_INT32)
@@ -264,17 +265,17 @@ DECLARE_PARAM_INT(int64, int64_t, PARAM_TYPE_INT64)
DECLARE_PARAM_INT(uint64, uint64_t, PARAM_TYPE_UINT64)
/*
- * dev_add_param_int_fixed
- * dev_add_param_int32_fixed
- * dev_add_param_uint32_fixed
- * dev_add_param_int64_fixed
- * dev_add_param_uint64_fixed
+ * bobject_add_param_int_fixed
+ * bobject_add_param_int32_fixed
+ * bobject_add_param_uint32_fixed
+ * bobject_add_param_int64_fixed
+ * bobject_add_param_uint64_fixed
*/
#define DECLARE_PARAM_INT_FIXED(intname, inttype, paramtype) \
- static inline struct param_d *dev_add_param_##intname##_fixed(struct device *dev, const char *name, \
+ static inline struct param_d *bobject_add_param_##intname##_fixed(bobject_t bobj, const char *name, \
inttype value, const char *format) \
{ \
- return __dev_add_param_int(dev, name, ERR_PTR(-EROFS), NULL, &value, paramtype, format, NULL); \
+ return __bobject_add_param_int(bobj, name, ERR_PTR(-EROFS), NULL, &value, paramtype, format, NULL); \
}
DECLARE_PARAM_INT_FIXED(int, int, PARAM_TYPE_INT32)
@@ -284,17 +285,17 @@ DECLARE_PARAM_INT_FIXED(int64, int64_t, PARAM_TYPE_INT64)
DECLARE_PARAM_INT_FIXED(uint64, uint64_t, PARAM_TYPE_UINT64)
/*
- * dev_add_param_int_ro
- * dev_add_param_int32_ro
- * dev_add_param_uint32_ro
- * dev_add_param_int64_ro
- * dev_add_param_uint64_ro
+ * bobject_add_param_int_ro
+ * bobject_add_param_int32_ro
+ * bobject_add_param_uint32_ro
+ * bobject_add_param_int64_ro
+ * bobject_add_param_uint64_ro
*/
#define DECLARE_PARAM_INT_RO(intname, inttype, paramtype) \
- static inline struct param_d *dev_add_param_##intname##_ro(struct device *dev, const char *name, \
+ static inline struct param_d *bobject_add_param_##intname##_ro(bobject_t bobj, const char *name, \
inttype *value, const char *format) \
{ \
- return __dev_add_param_int(dev, name, param_set_readonly, NULL, value, paramtype, format, NULL); \
+ return __bobject_add_param_int(bobj, name, param_set_readonly, NULL, value, paramtype, format, NULL); \
}
DECLARE_PARAM_INT_RO(int, int, PARAM_TYPE_INT32)
@@ -303,65 +304,107 @@ DECLARE_PARAM_INT_RO(uint32, uint32_t, PARAM_TYPE_UINT32)
DECLARE_PARAM_INT_RO(int64, int64_t, PARAM_TYPE_INT64)
DECLARE_PARAM_INT_RO(uint64, uint64_t, PARAM_TYPE_UINT64)
-static inline struct param_d *dev_add_param_bool(struct device *dev,
+static inline struct param_d *bobject_add_param_bool(bobject_t bobj,
const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
uint32_t *value, void *priv)
{
- return __dev_add_param_int(dev, name, set, get, value, PARAM_TYPE_BOOL, "%u", priv);
+ return __bobject_add_param_int(bobj, name, set, get, value, PARAM_TYPE_BOOL, "%u", priv);
}
-static inline struct param_d *dev_add_param_bool_fixed(struct device *dev,
+static inline struct param_d *bobject_add_param_bool_fixed(bobject_t bobj,
const char *name,
uint32_t value)
{
- return __dev_add_param_int(dev, name, ERR_PTR(-EROFS), NULL, &value, PARAM_TYPE_BOOL,
+ return __bobject_add_param_int(bobj, name, ERR_PTR(-EROFS), NULL, &value, PARAM_TYPE_BOOL,
"%u", NULL);
}
-static inline struct param_d *dev_add_param_bool_ro(struct device *dev,
+static inline struct param_d *bobject_add_param_bool_ro(bobject_t bobj,
const char *name,
uint32_t *value)
{
- return __dev_add_param_int(dev, name, param_set_readonly, NULL, value, PARAM_TYPE_BOOL,
+ return __bobject_add_param_int(bobj, name, param_set_readonly, NULL, value, PARAM_TYPE_BOOL,
"%u", NULL);
}
-static inline struct param_d *dev_add_param_string_ro(struct device *dev,
+static inline struct param_d *bobject_add_param_string_ro(bobject_t bobj,
const char *name,
char **value)
{
- return dev_add_param_string(dev, name, param_set_readonly, NULL, value, NULL);
+ return bobject_add_param_string(bobj, name, param_set_readonly, NULL, value, NULL);
}
-static inline struct param_d *dev_add_param_string_fixed(struct device *dev,
+static inline struct param_d *bobject_add_param_string_fixed(bobject_t bobj,
const char *name,
const char *value)
{
- return dev_add_param_fixed(dev, name, value);
+ return bobject_add_param_fixed(bobj, name, value);
}
-static inline struct param_d *dev_add_param_enum_ro(struct device *dev,
+static inline struct param_d *bobject_add_param_enum_ro(bobject_t bobj,
const char *name,
int *value,
const char * const *names,
int num_names)
{
- return dev_add_param_enum(dev, name, param_set_readonly, NULL,
+ return bobject_add_param_enum(bobj, name, param_set_readonly, NULL,
value, names, num_names, NULL);
}
-static inline struct param_d *dev_add_param_bitmask_ro(struct device *dev,
+static inline struct param_d *bobject_add_param_bitmask_ro(bobject_t bobj,
const char *name,
unsigned long *value,
const char * const *names,
int num_names)
{
- return dev_add_param_bitmask(dev, name, param_set_readonly, NULL,
+ return bobject_add_param_bitmask(bobj, name, param_set_readonly, NULL,
value, names, num_names, NULL);
}
+#define dev_get_param bobject_get_param
+#define dev_set_param bobject_set_param
+#define dev_add_param bobject_add_param
+#define dev_add_param_string bobject_add_param_string
+#define __dev_add_param_int __bobject_add_param_int
+#define dev_add_param_enum bobject_add_param_enum
+#define dev_add_param_tristate bobject_add_param_tristate
+#define dev_add_param_tristate_ro bobject_add_param_tristate_ro
+#define dev_add_param_bitmask bobject_add_param_bitmask
+#define dev_add_param_ip bobject_add_param_ip
+#define dev_add_param_mac bobject_add_param_mac
+#define dev_add_param_file_list bobject_add_param_file_list
+#define dev_add_param_fixed bobject_add_param_fixed
+#define dev_param_set_generic bobject_param_set_generic
+
+#define dev_add_param_int bobject_add_param_int
+#define dev_add_param_int32 bobject_add_param_int32
+#define dev_add_param_uint32 bobject_add_param_uint32
+#define dev_add_param_int64 bobject_add_param_int64
+#define dev_add_param_uint64 bobject_add_param_uint64
+
+#define dev_add_param_int_fixed bobject_add_param_int_fixed
+#define dev_add_param_int32_fixed bobject_add_param_int32_fixed
+#define dev_add_param_uint32_fixed bobject_add_param_uint32_fixed
+#define dev_add_param_int64_fixed bobject_add_param_int64_fixed
+#define dev_add_param_uint64_fixed bobject_add_param_uint64_fixed
+
+
+#define dev_add_param_int_ro bobject_add_param_int_ro
+#define dev_add_param_int32_ro bobject_add_param_int32_ro
+#define dev_add_param_uint32_ro bobject_add_param_uint32_ro
+#define dev_add_param_int64_ro bobject_add_param_int64_ro
+#define dev_add_param_uint64_ro bobject_add_param_uint64_ro
+
+#define dev_add_param_bool bobject_add_param_bool
+#define dev_add_param_bool_fixed bobject_add_param_bool_fixed
+#define dev_add_param_bool_ro bobject_add_param_bool_ro
+#define dev_add_param_string_ro bobject_add_param_string_ro
+#define dev_add_param_string_fixed bobject_add_param_string_fixed
+#define dev_add_param_enum_ro bobject_add_param_enum_ro
+#define dev_add_param_bitmask_ro bobject_add_param_bitmask_ro
+
/*
* unimplemented:
* dev_add_param_enum_fixed
diff --git a/lib/parameter.c b/lib/parameter.c
index 7f89ac53e0d2..ef578d790856 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -1,5 +1,5 @@
/*
- * parameter.c - device parameters
+ * parameter.c - barebox object parameters
*
* Copyright (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
*
@@ -16,7 +16,7 @@
/**
* @file
- * @brief Handling device specific parameters
+ * @brief Handling barebox-object specific parameters
*/
#include <common.h>
#include <param.h>
@@ -49,11 +49,12 @@ const char *get_param_type(struct param_d *param)
return param_type_string[param->type];
}
-struct param_d *get_param_by_name(struct device *dev, const char *name)
+struct param_d *get_param_by_name(bobject_t _bobj, const char *name)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_d *p;
- list_for_each_entry(p, &dev->bobject.parameters, list) {
+ list_for_each_entry(p, &bobj->parameters, list) {
if (!strcmp(p->name, name))
return p;
}
@@ -62,38 +63,40 @@ struct param_d *get_param_by_name(struct device *dev, const char *name)
}
/**
- * dev_get_param - get the value of a parameter
- * @param dev The device
+ * bobject_get_param - get the value of a parameter
+ * @param bobj The barebox object
* @param name The name of the parameter
* @return The value
*/
-const char *dev_get_param(struct device *dev, const char *name)
+const char *bobject_get_param(bobject_t _bobj, const char *name)
{
- struct param_d *param = get_param_by_name(dev, name);
+ struct bobject *bobj = _bobj.bobj;
+ struct param_d *param = get_param_by_name(bobj, name);
if (!param) {
errno = EINVAL;
return NULL;
}
- return param->get(dev, param);
+ return param->get(bobj, param);
}
/**
- * dev_set_param - set a parameter of a device to a new value
- * @param dev The device
+ * bobject_set_param - set a parameter of a barebox object to a new value
+ * @param bobj The barebox object
* @param name The name of the parameter
* @param val The new value of the parameter
*/
-int dev_set_param(struct device *dev, const char *name, const char *val)
+int bobject_set_param(bobject_t _bobj, const char *name, const char *val)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_d *param;
int ret;
- if (!dev)
+ if (!bobj)
return errno_set(-ENODEV);
- param = get_param_by_name(dev, name);
+ param = get_param_by_name(bobj, name);
if (!param)
return errno_set(-EINVAL);
@@ -101,7 +104,7 @@ int dev_set_param(struct device *dev, const char *name, const char *val)
if (param->flags & PARAM_FLAG_RO)
return errno_set(-EACCES);
- ret = param->set(dev, param, val);
+ ret = param->set(bobj, param, val);
if (ret)
return errno_set(ret);
@@ -109,8 +112,8 @@ int dev_set_param(struct device *dev, const char *name, const char *val)
}
/**
- * dev_param_set_generic - generic setter function for a parameter
- * @param dev The device
+ * bobject_param_set_generic - generic setter function for a parameter
+ * @param bobj The barebox object
* @param p the parameter
* @param val The new value
*
@@ -119,7 +122,7 @@ int dev_set_param(struct device *dev, const char *name, const char *val)
* used during deregistration of the parameter to free the alloctated
* memory.
*/
-int dev_param_set_generic(struct device *dev, struct param_d *p,
+int bobject_param_set_generic(bobject_t _bobj, struct param_d *p,
const char *val)
{
free(p->value);
@@ -131,7 +134,7 @@ int dev_param_set_generic(struct device *dev, struct param_d *p,
return p->value ? 0 : -ENOMEM;
}
-static const char *param_get_generic(struct device *dev, struct param_d *p)
+static const char *param_get_generic(struct bobject *bobj, struct param_d *p)
{
return p->value ? p->value : "";
}
@@ -144,13 +147,13 @@ static int compare(struct list_head *a, struct list_head *b)
return strcmp(na, nb);
}
-static int __dev_add_param(struct param_d *param, struct device *dev,
+static int __bobject_add_param(struct param_d *param, struct bobject *bobj,
const char *name,
- int (*set)(struct device *dev, struct param_d *p, const char *val),
- const char *(*get)(struct device *dev, struct param_d *p),
+ int (*set)(bobject_t _bobj, struct param_d *p, const char *val),
+ const char *(*get)(bobject_t _bobj, struct param_d *p),
unsigned long flags)
{
- if (get_param_by_name(dev, name))
+ if (get_param_by_name(bobj, name))
return -EEXIST;
param->name = strdup_const(name);
@@ -160,45 +163,47 @@ static int __dev_add_param(struct param_d *param, struct device *dev,
if (set)
param->set = set;
else
- param->set = dev_param_set_generic;
+ param->set = bobject_param_set_generic;
if (get)
param->get = get;
else
param->get = param_get_generic;
param->flags = flags;
- param->dev = dev;
- list_add_sort(¶m->list, &dev->bobject.parameters, compare);
+ param->bobj = bobj;
+ list_add_sort(¶m->list, &bobj->parameters, compare);
- dev_param_init_from_nv(dev, name);
+ if (!bobj->local)
+ dev_param_init_from_nv(bobj_to_dev(bobj), name);
return 0;
}
/**
- * dev_add_param - add a parameter to a device
- * @param dev The device
+ * bobject_add_param - add a parameter to a barebox object
+ * @param bobj The barebox object
* @param name The name of the parameter
* @param set setter function for the parameter
* @param get getter function for the parameter
* @param flags
*
- * This function adds a new parameter to a device. The get/set functions can
+ * This function adds a new parameter to a barebox object. The get/set functions can
* be zero in which case the generic functions are used. The generic functions
* expect the parameter value to be a string which can be freed with free(). Do
* not use static arrays when using the generic functions.
*/
-struct param_d *dev_add_param(struct device *dev, const char *name,
- int (*set)(struct device *dev, struct param_d *p, const char *val),
- const char *(*get)(struct device *dev, struct param_d *param),
+struct param_d *bobject_add_param(bobject_t _bobj, const char *name,
+ int (*set)(bobject_t _bobj, struct param_d *p, const char *val),
+ const char *(*get)(bobject_t _bobj, struct param_d *param),
unsigned long flags)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_d *param;
int ret;
param = xzalloc(sizeof(*param));
- ret = __dev_add_param(param, dev, name, set, get, flags);
+ ret = __bobject_add_param(param, bobj, name, set, get, flags);
if (ret) {
free(param);
return ERR_PTR(ret);
@@ -208,20 +213,21 @@ struct param_d *dev_add_param(struct device *dev, const char *name,
}
/**
- * dev_add_param_fixed - add a readonly parameter to a device
- * @param dev The device
+ * bobject_add_param_fixed - add a readonly parameter to a barebox object
+ * @param bobj The barebox object
* @param name The name of the parameter
* @param value The value of the parameter
*/
-struct param_d *dev_add_param_fixed(struct device *dev, const char *name,
+struct param_d *bobject_add_param_fixed(bobject_t _bobj, const char *name,
const char *value)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_d *param;
int ret;
param = xzalloc(sizeof(*param));
- ret = __dev_add_param(param, dev, name, NULL, NULL, PARAM_FLAG_RO);
+ ret = __bobject_add_param(param, bobj, name, NULL, NULL, PARAM_FLAG_RO);
if (ret) {
free(param);
return ERR_PTR(ret);
@@ -244,7 +250,7 @@ static inline struct param_string *to_param_string(struct param_d *p)
return container_of(p, struct param_string, param);
}
-static int param_string_set(struct device *dev, struct param_d *p,
+static int param_string_set(struct bobject *bobj, struct param_d *p,
const char *val)
{
struct param_string *ps = to_param_string(p);
@@ -275,7 +281,7 @@ static int param_string_set(struct device *dev, struct param_d *p,
return ret;
}
-static const char *param_string_get(struct device *dev, struct param_d *p)
+static const char *param_string_get(struct bobject *bobj, struct param_d *p)
{
struct param_string *ps = to_param_string(p);
int ret;
@@ -289,11 +295,12 @@ static const char *param_string_get(struct device *dev, struct param_d *p)
return *ps->value;
}
-struct param_d *dev_add_param_string(struct device *dev, const char *name,
+struct param_d *bobject_add_param_string(bobject_t _bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
char **value, void *priv)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_string *ps;
struct param_d *p;
int ret;
@@ -306,7 +313,7 @@ struct param_d *dev_add_param_string(struct device *dev, const char *name,
p->driver_priv = priv;
p->type = PARAM_TYPE_STRING;
- ret = __dev_add_param(p, dev, name, param_string_set, param_string_get, 0);
+ ret = __bobject_add_param(p, bobj, name, param_string_set, param_string_get, 0);
if (ret) {
free(ps);
return ERR_PTR(ret);
@@ -329,7 +336,7 @@ static inline struct param_int *to_param_int(struct param_d *p)
return container_of(p, struct param_int, param);
}
-static int param_int_set(struct device *dev, struct param_d *p,
+static int param_int_set(struct bobject *bobj, struct param_d *p,
const char *val)
{
struct param_int *pi = to_param_int(p);
@@ -371,7 +378,7 @@ static int param_int_set(struct device *dev, struct param_d *p,
return ret;
}
-static const char *param_int_get(struct device *dev, struct param_d *p)
+static const char *param_int_get(struct bobject *bobj, struct param_d *p)
{
struct param_int *pi = to_param_int(p);
int ret;
@@ -406,8 +413,8 @@ int param_set_readonly(struct param_d *p, void *priv)
}
/**
- * dev_add_param_int - add an integer parameter to a device
- * @param dev The device
+ * bobject_add_param_int - add an integer parameter to a barebox object
+ * @param bobj The barebox object
* @param name The name of the parameter
* @param set set function
* @param get get function
@@ -421,12 +428,13 @@ int param_set_readonly(struct param_d *p, void *priv)
* The set function can be used as a notifer when the variable is about
* to be written. Can also be used to limit the value.
*/
-struct param_d *__dev_add_param_int(struct device *dev, const char *name,
+struct param_d *__bobject_add_param_int(bobject_t _bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
void *value, enum param_type type,
const char *format, void *priv)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_int *pi;
struct param_d *p;
int ret, dsize;
@@ -468,7 +476,7 @@ struct param_d *__dev_add_param_int(struct device *dev, const char *name,
p->driver_priv = priv;
p->type = type;
- ret = __dev_add_param(p, dev, name, param_int_set, param_int_get, 0);
+ ret = __bobject_add_param(p, bobj, name, param_int_set, param_int_get, 0);
if (ret) {
free(pi);
return ERR_PTR(ret);
@@ -491,7 +499,7 @@ static inline struct param_enum *to_param_enum(struct param_d *p)
return container_of(p, struct param_enum, param);
}
-static int param_enum_set(struct device *dev, struct param_d *p,
+static int param_enum_set(struct bobject *bobj, struct param_d *p,
const char *val)
{
struct param_enum *pe = to_param_enum(p);
@@ -520,7 +528,7 @@ static int param_enum_set(struct device *dev, struct param_d *p,
return ret;
}
-static const char *param_enum_get(struct device *dev, struct param_d *p)
+static const char *param_enum_get(struct bobject *bobj, struct param_d *p)
{
struct param_enum *pe = to_param_enum(p);
int ret;
@@ -559,12 +567,13 @@ static void param_enum_info(struct param_d *p)
}
}
-struct param_d *dev_add_param_enum(struct device *dev, const char *name,
+struct param_d *bobject_add_param_enum(bobject_t _bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
int *value, const char * const *names,
int num_names, void *priv)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_enum *pe;
struct param_d *p;
int ret;
@@ -580,7 +589,7 @@ struct param_d *dev_add_param_enum(struct device *dev, const char *name,
p->driver_priv = priv;
p->type = PARAM_TYPE_ENUM;
- ret = __dev_add_param(p, dev, name, param_enum_set, param_enum_get, 0);
+ ret = __bobject_add_param(p, bobj, name, param_enum_set, param_enum_get, 0);
if (ret) {
free(pe);
return ERR_PTR(ret);
@@ -597,20 +606,22 @@ static const char *const tristate_names[] = {
[PARAM_TRISTATE_FALSE] = "0",
};
-struct param_d *dev_add_param_tristate(struct device *dev, const char *name,
+struct param_d *bobject_add_param_tristate(bobject_t _bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
int *value, void *priv)
{
- return dev_add_param_enum(dev, name, set, get, value, tristate_names,
+ struct bobject *bobj = _bobj.bobj;
+ return bobject_add_param_enum(bobj, name, set, get, value, tristate_names,
ARRAY_SIZE(tristate_names), priv);
}
-struct param_d *dev_add_param_tristate_ro(struct device *dev,
+struct param_d *bobject_add_param_tristate_ro(bobject_t _bobj,
const char *name,
int *value)
{
- return dev_add_param_enum_ro(dev, name, value, tristate_names,
+ struct bobject *bobj = _bobj.bobj;
+ return bobject_add_param_enum_ro(bobj, name, value, tristate_names,
ARRAY_SIZE(tristate_names));
}
@@ -628,7 +639,7 @@ static inline struct param_bitmask *to_param_bitmask(struct param_d *p)
return container_of(p, struct param_bitmask, param);
}
-static int param_bitmask_set(struct device *dev, struct param_d *p,
+static int param_bitmask_set(struct bobject *bobj, struct param_d *p,
const char *val)
{
struct param_bitmask *pb = to_param_bitmask(p);
@@ -675,7 +686,7 @@ static int param_bitmask_set(struct device *dev, struct param_d *p,
return ret;
}
-static const char *param_bitmask_get(struct device *dev, struct param_d *p)
+static const char *param_bitmask_get(struct bobject *bobj, struct param_d *p)
{
struct param_bitmask *pb = to_param_bitmask(p);
int ret, bit;
@@ -714,13 +725,14 @@ static void param_bitmask_info(struct param_d *p)
}
}
-struct param_d *dev_add_param_bitmask(struct device *dev, const char *name,
+struct param_d *bobject_add_param_bitmask(bobject_t _bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
unsigned long *value,
const char * const *names, int num_names,
void *priv)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_bitmask *pb;
struct param_d *p;
int ret, i, len = 0;
@@ -742,7 +754,7 @@ struct param_d *dev_add_param_bitmask(struct device *dev, const char *name,
p->value = xzalloc(len);
- ret = __dev_add_param(p, dev, name, param_bitmask_set, param_bitmask_get, 0);
+ ret = __bobject_add_param(p, bobj, name, param_bitmask_set, param_bitmask_get, 0);
if (ret) {
free(pb);
return ERR_PTR(ret);
@@ -765,7 +777,7 @@ static inline struct param_ip *to_param_ip(struct param_d *p)
return container_of(p, struct param_ip, param);
}
-static int param_ip_set(struct device *dev, struct param_d *p,
+static int param_ip_set(struct bobject *bobj, struct param_d *p,
const char *val)
{
struct param_ip *pi = to_param_ip(p);
@@ -789,7 +801,7 @@ static int param_ip_set(struct device *dev, struct param_d *p,
return ret;
}
-static const char *param_ip_get(struct device *dev, struct param_d *p)
+static const char *param_ip_get(struct bobject *bobj, struct param_d *p)
{
struct param_ip *pi = to_param_ip(p);
int ret;
@@ -806,11 +818,12 @@ static const char *param_ip_get(struct device *dev, struct param_d *p)
return p->value;
}
-struct param_d *dev_add_param_ip(struct device *dev, const char *name,
+struct param_d *bobject_add_param_ip(bobject_t _bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
IPaddr_t *ip, void *priv)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_ip *pi;
int ret;
@@ -821,7 +834,7 @@ struct param_d *dev_add_param_ip(struct device *dev, const char *name,
pi->param.driver_priv = priv;
pi->param.type = PARAM_TYPE_IPV4;
- ret = __dev_add_param(&pi->param, dev, name,
+ ret = __bobject_add_param(&pi->param, bobj, name,
param_ip_set, param_ip_get, 0);
if (ret) {
free(pi);
@@ -846,7 +859,7 @@ static inline struct param_mac *to_param_mac(struct param_d *p)
return container_of(p, struct param_mac, param);
}
-static int param_mac_set(struct device *dev, struct param_d *p,
+static int param_mac_set(struct bobject *bobj, struct param_d *p,
const char *val)
{
struct param_mac *pm = to_param_mac(p);
@@ -876,7 +889,7 @@ static int param_mac_set(struct device *dev, struct param_d *p,
return ret;
}
-static const char *param_mac_get(struct device *dev, struct param_d *p)
+static const char *param_mac_get(struct bobject *bobj, struct param_d *p)
{
struct param_mac *pm = to_param_mac(p);
int ret;
@@ -892,11 +905,12 @@ static const char *param_mac_get(struct device *dev, struct param_d *p)
return p->value;
}
-struct param_d *dev_add_param_mac(struct device *dev, const char *name,
+struct param_d *bobject_add_param_mac(bobject_t _bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
u8 *mac, void *priv)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_mac *pm;
int ret;
@@ -908,7 +922,7 @@ struct param_d *dev_add_param_mac(struct device *dev, const char *name,
pm->param.value = pm->mac_str;
pm->param.type = PARAM_TYPE_MAC;
- ret = __dev_add_param(&pm->param, dev, name,
+ ret = __bobject_add_param(&pm->param, bobj, name,
param_mac_set, param_mac_get, 0);
if (ret) {
free(pm);
@@ -931,7 +945,7 @@ static inline struct param_file_list *to_param_file_list(struct param_d *p)
return container_of(p, struct param_file_list, param);
}
-static int param_file_list_set(struct device *dev, struct param_d *p,
+static int param_file_list_set(struct bobject *bobj, struct param_d *p,
const char *val)
{
struct param_file_list *pfl = to_param_file_list(p);
@@ -962,7 +976,7 @@ static int param_file_list_set(struct device *dev, struct param_d *p,
return ret;
}
-static const char *param_file_list_get(struct device *dev, struct param_d *p)
+static const char *param_file_list_get(struct bobject *bobj, struct param_d *p)
{
struct param_file_list *pfl = to_param_file_list(p);
int ret;
@@ -978,12 +992,13 @@ static const char *param_file_list_get(struct device *dev, struct param_d *p)
return p->value;
}
-struct param_d *dev_add_param_file_list(struct device *dev, const char *name,
+struct param_d *bobject_add_param_file_list(bobject_t _bobj, const char *name,
int (*set)(struct param_d *p, void *priv),
int (*get)(struct param_d *p, void *priv),
struct file_list **file_list,
void *priv)
{
+ struct bobject *bobj = _bobj.bobj;
struct param_file_list *pfl;
int ret;
@@ -994,7 +1009,7 @@ struct param_d *dev_add_param_file_list(struct device *dev, const char *name,
pfl->param.driver_priv = priv;
pfl->param.type = PARAM_TYPE_FILE_LIST;
- ret = __dev_add_param(&pfl->param, dev, name,
+ ret = __bobject_add_param(&pfl->param, bobj, name,
param_file_list_set, param_file_list_get, 0);
if (ret) {
free(pfl);
@@ -1011,7 +1026,7 @@ struct param_d *dev_add_param_file_list(struct device *dev, const char *name,
*/
void param_remove(struct param_d *p)
{
- p->set(p->dev, p, NULL);
+ p->set(p->bobj, p, NULL);
list_del(&p->list);
free_const(p->name);
free(p);
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 08/44] commands: version: print value of CONFIG_NAME
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (6 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 07/44] param: operate on bobjects instead of full devices Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 09/44] treewide: populate CONFIG_NAME for all configs in-tree Ahmad Fatoum
` (37 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
A project may contain multiple barebox configurations, e.g. for first
stage and second stage or for development and release.
Make it possible to encode that information directly into the config via
a name CONFIG_NAME option.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
commands/version.c | 5 ++++-
common/Kconfig | 8 ++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/commands/version.c b/commands/version.c
index 0ad8e587de87..d6da1bba6e31 100644
--- a/commands/version.c
+++ b/commands/version.c
@@ -7,7 +7,10 @@
static int do_version(int argc, char *argv[])
{
- printf ("\n%s\n\n", version_string);
+ printf ("\n%s", version_string);
+ if (*CONFIG_NAME)
+ printf (" (%s)", CONFIG_NAME);
+ printf ("\n\n");
return 0;
}
diff --git a/common/Kconfig b/common/Kconfig
index a8e62600c4ee..159cd271d748 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -112,6 +112,14 @@ config FASTBOOT_BASE
menu "General Settings"
+config NAME
+ string "Informational config name to include in binary"
+ help
+ Unless left empty, this compiles into barebox an informational
+ string describing the config used. This is reproduced by the
+ version command, but does not influence any runtime or
+ compile-time behavior.
+
config LOCALVERSION
string "Local version - append to the version string"
help
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 09/44] treewide: populate CONFIG_NAME for all configs in-tree
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (7 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 08/44] commands: version: print value of CONFIG_NAME Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 10/44] test: py: change barebox_config from set to dict Ahmad Fatoum
` (36 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
For print out by the version command and for use by pytest, let's
populate the CONFIG_NAME option for all configs we have in-tree.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
arch/arm/configs/am335x_mlo_defconfig | 1 +
arch/arm/configs/am35xx_pfc200_xload_defconfig | 1 +
arch/arm/configs/animeo_ip_defconfig | 1 +
arch/arm/configs/at91_multi_defconfig | 1 +
arch/arm/configs/at91rm9200ek_defconfig | 1 +
arch/arm/configs/at91sam9260ek_defconfig | 1 +
arch/arm/configs/at91sam9261ek_bootstrap_defconfig | 1 +
arch/arm/configs/at91sam9261ek_defconfig | 1 +
arch/arm/configs/at91sam9g10ek_defconfig | 1 +
arch/arm/configs/at91sam9g20ek_defconfig | 1 +
arch/arm/configs/at91sam9m10g45ek_defconfig | 1 +
arch/arm/configs/at91sam9m10ihd_defconfig | 1 +
arch/arm/configs/at91sam9n12ek_defconfig | 1 +
arch/arm/configs/clps711x_defconfig | 1 +
arch/arm/configs/dss11_defconfig | 1 +
arch/arm/configs/haba_knx_lite_defconfig | 1 +
arch/arm/configs/imx23_defconfig | 1 +
arch/arm/configs/imx28_defconfig | 1 +
arch/arm/configs/imx_v7_defconfig | 1 +
arch/arm/configs/imx_v8_defconfig | 1 +
arch/arm/configs/k3-r5_defconfig | 1 +
arch/arm/configs/kindle-mx50_defconfig | 1 +
arch/arm/configs/layerscape_defconfig | 1 +
arch/arm/configs/layerscape_v7_defconfig | 1 +
arch/arm/configs/multi_v5_v6_defconfig | 1 +
arch/arm/configs/multi_v7_defconfig | 1 +
arch/arm/configs/multi_v8_defconfig | 1 +
arch/arm/configs/mvebu_defconfig | 1 +
arch/arm/configs/omap_defconfig | 1 +
arch/arm/configs/pm9261_defconfig | 1 +
arch/arm/configs/pm9263_defconfig | 1 +
arch/arm/configs/pm9g45_defconfig | 1 +
arch/arm/configs/qil_a9260_defconfig | 1 +
arch/arm/configs/qil_a9g20_defconfig | 1 +
arch/arm/configs/rockchip_v7a_defconfig | 1 +
arch/arm/configs/rockchip_v8_defconfig | 1 +
arch/arm/configs/rpi_defconfig | 1 +
arch/arm/configs/rpi_v8a_defconfig | 1 +
arch/arm/configs/socfpga-arria10_defconfig | 1 +
arch/arm/configs/socfpga-xload_defconfig | 1 +
arch/arm/configs/socfpga_defconfig | 1 +
arch/arm/configs/stm32mp_defconfig | 1 +
arch/arm/configs/tegra_v7_defconfig | 1 +
arch/arm/configs/telit_evk_pro3_defconfig | 1 +
arch/arm/configs/tny_a9260_defconfig | 1 +
arch/arm/configs/tny_a9263_bootstrap_defconfig | 1 +
arch/arm/configs/tny_a9263_defconfig | 1 +
arch/arm/configs/tny_a9g20_defconfig | 1 +
arch/arm/configs/usb_a9260_defconfig | 1 +
arch/arm/configs/usb_a9263_bootstrap_defconfig | 1 +
arch/arm/configs/usb_a9263_defconfig | 1 +
arch/arm/configs/usb_a9g20_defconfig | 1 +
arch/arm/configs/zii_vf610_dev_defconfig | 1 +
arch/arm/configs/zynq_defconfig | 1 +
arch/arm/configs/zynqmp_defconfig | 1 +
arch/kvx/configs/generic_defconfig | 1 +
arch/mips/configs/ath79_defconfig | 1 +
arch/mips/configs/bcm47xx_defconfig | 1 +
arch/mips/configs/gxemul-malta_defconfig | 1 +
arch/mips/configs/loongson-ls1b_defconfig | 1 +
arch/mips/configs/qemu-malta_defconfig | 1 +
arch/mips/configs/xburst_defconfig | 1 +
arch/openrisc/configs/generic_defconfig | 1 +
arch/powerpc/configs/owc_da923rc_defconfig | 1 +
arch/powerpc/configs/p1010rdb_defconfig | 1 +
arch/powerpc/configs/p1022ds_defconfig | 1 +
arch/powerpc/configs/p2020rdb_defconfig | 1 +
arch/powerpc/configs/pcm030_defconfig | 1 +
arch/riscv/configs/erizo_generic_defconfig | 1 +
arch/riscv/configs/litex_linux_defconfig | 1 +
arch/riscv/configs/rv64i_defconfig | 1 +
arch/riscv/configs/virt32_defconfig | 1 +
arch/sandbox/configs/hosttools_defconfig | 1 +
arch/sandbox/configs/sandbox_defconfig | 1 +
arch/sandbox/configs/targettools_defconfig | 1 +
arch/x86/configs/efi_defconfig | 1 +
76 files changed, 76 insertions(+)
diff --git a/arch/arm/configs/am335x_mlo_defconfig b/arch/arm/configs/am335x_mlo_defconfig
index e9d9f93edf5b..89cadeda2f6f 100644
--- a/arch/arm/configs/am335x_mlo_defconfig
+++ b/arch/arm/configs/am335x_mlo_defconfig
@@ -7,6 +7,7 @@ CONFIG_MACH_MYIRTECH_X335X=y
CONFIG_MACH_PHYTEC_SOM_AM335X=y
CONFIG_THUMB2_BAREBOX=y
# CONFIG_BOARD_GENERIC_DT is not set
+CONFIG_NAME="am335x_mlo_defconfig"
# CONFIG_BANNER is not set
# CONFIG_MEMINFO is not set
CONFIG_IMAGE_COMPRESSION_XZKERN=y
diff --git a/arch/arm/configs/am35xx_pfc200_xload_defconfig b/arch/arm/configs/am35xx_pfc200_xload_defconfig
index 999f7de5d96f..26fc4296f870 100644
--- a/arch/arm/configs/am35xx_pfc200_xload_defconfig
+++ b/arch/arm/configs/am35xx_pfc200_xload_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_WAGO_PFC_AM35XX=y
CONFIG_THUMB2_BAREBOX=y
# CONFIG_ARM_EXCEPTIONS is not set
# CONFIG_MEMINFO is not set
+CONFIG_NAME="am35xx_pfc200_xload_defconfig"
CONFIG_MMU=y
CONFIG_STACK_SIZE=0xc00
CONFIG_MALLOC_SIZE=0x0
diff --git a/arch/arm/configs/animeo_ip_defconfig b/arch/arm/configs/animeo_ip_defconfig
index 864721be93b2..ed3540c20d5b 100644
--- a/arch/arm/configs/animeo_ip_defconfig
+++ b/arch/arm/configs/animeo_ip_defconfig
@@ -3,6 +3,7 @@ CONFIG_ARCH_AT91SAM9260=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="animeo_ip_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/at91_multi_defconfig b/arch/arm/configs/at91_multi_defconfig
index 20afbe92395f..60452f802feb 100644
--- a/arch/arm/configs/at91_multi_defconfig
+++ b/arch/arm/configs/at91_multi_defconfig
@@ -13,6 +13,7 @@ CONFIG_MACH_SAMA5D4_WIFX=y
CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="at91_multi_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/at91rm9200ek_defconfig b/arch/arm/configs/at91rm9200ek_defconfig
index 665b5b80ef8e..8d7f38fe9111 100644
--- a/arch/arm/configs/at91rm9200ek_defconfig
+++ b/arch/arm/configs/at91rm9200ek_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARCH_AT91=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="at91rm9200ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index 1ea33a116065..ad9d73d518fc 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_AT91SAM9260EK=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="at91sam9260ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/at91sam9261ek_bootstrap_defconfig b/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
index 09cc5b23ed47..bf6fe8075c71 100644
--- a/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
+++ b/arch/arm/configs/at91sam9261ek_bootstrap_defconfig
@@ -4,6 +4,7 @@ CONFIG_AT91_BOOTSTRAP=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="at91sam9261ek_bootstrap_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x27000
CONFIG_MALLOC_DUMMY=y
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index ad37108b31f2..66542e943003 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -3,6 +3,7 @@ CONFIG_ARCH_AT91SAM9261=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="at91sam9261ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/at91sam9g10ek_defconfig b/arch/arm/configs/at91sam9g10ek_defconfig
index d92047683a4c..6f66545885ca 100644
--- a/arch/arm/configs/at91sam9g10ek_defconfig
+++ b/arch/arm/configs/at91sam9g10ek_defconfig
@@ -3,6 +3,7 @@ CONFIG_ARCH_AT91SAM9G10=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="at91sam9g10ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/at91sam9g20ek_defconfig b/arch/arm/configs/at91sam9g20ek_defconfig
index 7200f7a5b8ce..811326459bcd 100644
--- a/arch/arm/configs/at91sam9g20ek_defconfig
+++ b/arch/arm/configs/at91sam9g20ek_defconfig
@@ -4,6 +4,7 @@ CONFIG_AT91_HAVE_2MMC=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="at91sam9g20ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/at91sam9m10g45ek_defconfig b/arch/arm/configs/at91sam9m10g45ek_defconfig
index d4988e58284d..3163602331f3 100644
--- a/arch/arm/configs/at91sam9m10g45ek_defconfig
+++ b/arch/arm/configs/at91sam9m10g45ek_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_AT91SAM9M10G45EK=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="at91sam9m10g45ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_MALLOC_SIZE=0x800000
diff --git a/arch/arm/configs/at91sam9m10ihd_defconfig b/arch/arm/configs/at91sam9m10ihd_defconfig
index f50025375f45..02516ee96000 100644
--- a/arch/arm/configs/at91sam9m10ihd_defconfig
+++ b/arch/arm/configs/at91sam9m10ihd_defconfig
@@ -3,6 +3,7 @@ CONFIG_ARCH_AT91SAM9G45=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="at91sam9m10ihd_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_MALLOC_SIZE=0xa00000
diff --git a/arch/arm/configs/at91sam9n12ek_defconfig b/arch/arm/configs/at91sam9n12ek_defconfig
index 4ef07dba2c94..75e0bfb35458 100644
--- a/arch/arm/configs/at91sam9n12ek_defconfig
+++ b/arch/arm/configs/at91sam9n12ek_defconfig
@@ -5,6 +5,7 @@ CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_IMAGE_COMPRESSION_XZKERN=y
+CONFIG_NAME="at91sam9n12ek_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_MALLOC_SIZE=0xa00000
diff --git a/arch/arm/configs/clps711x_defconfig b/arch/arm/configs/clps711x_defconfig
index 3a2d8b5a0503..0fa34b5fc5d4 100644
--- a/arch/arm/configs/clps711x_defconfig
+++ b/arch/arm/configs/clps711x_defconfig
@@ -3,6 +3,7 @@ CONFIG_CLPS711X_RAISE_CPUFREQ=y
CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
# CONFIG_MEMINFO is not set
+CONFIG_NAME="clps711x_defconfig"
CONFIG_MMU=y
CONFIG_EXPERIMENTAL=y
CONFIG_BAUDRATE=57600
diff --git a/arch/arm/configs/dss11_defconfig b/arch/arm/configs/dss11_defconfig
index af37fc0681a8..c06a73414a67 100644
--- a/arch/arm/configs/dss11_defconfig
+++ b/arch/arm/configs/dss11_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARCH_AT91=y
CONFIG_ARCH_AT91SAM9G20=y
CONFIG_MACH_DSS11=y
+CONFIG_NAME="dss11_defconfig"
CONFIG_BOOT_ATAGS=y
CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/haba_knx_lite_defconfig b/arch/arm/configs/haba_knx_lite_defconfig
index 7d0201b3481a..5d03c1ee6f33 100644
--- a/arch/arm/configs/haba_knx_lite_defconfig
+++ b/arch/arm/configs/haba_knx_lite_defconfig
@@ -5,6 +5,7 @@ CONFIG_MACH_HABA_KNX_LITE=y
CONFIG_BOOT_ATAGS=y
CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="haba_knx_lite_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/imx23_defconfig b/arch/arm/configs/imx23_defconfig
index aa47c6089ffc..3df9dcbd97f7 100644
--- a/arch/arm/configs/imx23_defconfig
+++ b/arch/arm/configs/imx23_defconfig
@@ -7,6 +7,7 @@ CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="imx23_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/imx28_defconfig b/arch/arm/configs/imx28_defconfig
index a864c05b20d6..0586cfe93e96 100644
--- a/arch/arm/configs/imx28_defconfig
+++ b/arch/arm/configs/imx28_defconfig
@@ -8,6 +8,7 @@ CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="imx28_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
index eaddb98319a2..310c0b8dc391 100644
--- a/arch/arm/configs/imx_v7_defconfig
+++ b/arch/arm/configs/imx_v7_defconfig
@@ -59,6 +59,7 @@ CONFIG_THUMB2_BAREBOX=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_ARM_PSCI=y
+CONFIG_NAME="imx_v7_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/imx_v8_defconfig b/arch/arm/configs/imx_v8_defconfig
index aae1bd6e8ccb..19beacdefd0e 100644
--- a/arch/arm/configs/imx_v8_defconfig
+++ b/arch/arm/configs/imx_v8_defconfig
@@ -18,6 +18,7 @@ CONFIG_64BIT=y
CONFIG_MACH_TQMA93XX=y
CONFIG_MACH_PHYTEC_PHYCORE_IMX93=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="imx_v8_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/k3-r5_defconfig b/arch/arm/configs/k3-r5_defconfig
index df66bdef5a60..ece3d0094787 100644
--- a/arch/arm/configs/k3-r5_defconfig
+++ b/arch/arm/configs/k3-r5_defconfig
@@ -5,6 +5,7 @@ CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
# CONFIG_BOARD_GENERIC_DT is not set
# CONFIG_MEMINFO is not set
+CONFIG_NAME="k3-r5_defconfig"
CONFIG_ENVIRONMENT_VARIABLES=y
CONFIG_IMAGE_COMPRESSION_XZKERN=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x10000000
diff --git a/arch/arm/configs/kindle-mx50_defconfig b/arch/arm/configs/kindle-mx50_defconfig
index 4694514f549f..331e0eae6d12 100644
--- a/arch/arm/configs/kindle-mx50_defconfig
+++ b/arch/arm/configs/kindle-mx50_defconfig
@@ -5,6 +5,7 @@ CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_IMAGE_COMPRESSION_XZKERN=y
+CONFIG_NAME="kindle-mx50_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/layerscape_defconfig b/arch/arm/configs/layerscape_defconfig
index 8103da322619..95a86ccc07d9 100644
--- a/arch/arm/configs/layerscape_defconfig
+++ b/arch/arm/configs/layerscape_defconfig
@@ -5,6 +5,7 @@ CONFIG_MACH_LS1046ARDB=y
CONFIG_MACH_TQMLS1046A=y
CONFIG_64BIT=y
CONFIG_ARM_PSCI_CLIENT=y
+CONFIG_NAME="layerscape_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/layerscape_v7_defconfig b/arch/arm/configs/layerscape_v7_defconfig
index 792e9274b272..5127a5252275 100644
--- a/arch/arm/configs/layerscape_v7_defconfig
+++ b/arch/arm/configs/layerscape_v7_defconfig
@@ -1,5 +1,6 @@
CONFIG_ARCH_LAYERSCAPE=y
CONFIG_MACH_LS1021AIOT=y
+CONFIG_NAME="layerscape_v7_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/multi_v5_v6_defconfig b/arch/arm/configs/multi_v5_v6_defconfig
index 91d3a63e85ab..581c04f89c3c 100644
--- a/arch/arm/configs/multi_v5_v6_defconfig
+++ b/arch/arm/configs/multi_v5_v6_defconfig
@@ -13,6 +13,7 @@ CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="multi_v5_v6_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 726afe8ce6c5..bb4f487de976 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -92,6 +92,7 @@ CONFIG_THUMB2_BAREBOX=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_ARM_PSCI=y
+CONFIG_NAME="multi_v7_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/multi_v8_defconfig b/arch/arm/configs/multi_v8_defconfig
index a487d331d04e..550b9b07f491 100644
--- a/arch/arm/configs/multi_v8_defconfig
+++ b/arch/arm/configs/multi_v8_defconfig
@@ -48,6 +48,7 @@ CONFIG_MACH_XILINX_ZCU106=y
CONFIG_64BIT=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_PSCI_CLIENT=y
+CONFIG_NAME="multi_v8_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index f446d4b65989..91dd23e1c8b9 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -14,6 +14,7 @@ CONFIG_MACH_USI_TOPKICK=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="mvebu_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/omap_defconfig b/arch/arm/configs/omap_defconfig
index 04284dbfb7e7..007986e02eb9 100644
--- a/arch/arm/configs/omap_defconfig
+++ b/arch/arm/configs/omap_defconfig
@@ -14,6 +14,7 @@ CONFIG_BOOT_ATAGS=y
CONFIG_ARM_BOARD_APPEND_ATAG=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="omap_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/pm9261_defconfig b/arch/arm/configs/pm9261_defconfig
index f3660b052798..eb86463f8288 100644
--- a/arch/arm/configs/pm9261_defconfig
+++ b/arch/arm/configs/pm9261_defconfig
@@ -3,6 +3,7 @@ CONFIG_ARCH_AT91SAM9261=y
CONFIG_MACH_PM9261=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="pm9261_defconfig"
CONFIG_PROMPT="PM9261:"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/arm/configs/pm9263_defconfig b/arch/arm/configs/pm9263_defconfig
index 2b0e971e9c52..776ef3d245fa 100644
--- a/arch/arm/configs/pm9263_defconfig
+++ b/arch/arm/configs/pm9263_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARCH_AT91=y
CONFIG_ARCH_AT91SAM9263=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="pm9263_defconfig"
CONFIG_PROMPT_HUSH_PS2="y"
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/arm/configs/pm9g45_defconfig b/arch/arm/configs/pm9g45_defconfig
index 061ea0e70c1b..f7cdb8f1f693 100644
--- a/arch/arm/configs/pm9g45_defconfig
+++ b/arch/arm/configs/pm9g45_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_PM9G45=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="pm9g45_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/qil_a9260_defconfig b/arch/arm/configs/qil_a9260_defconfig
index 9949a1c785d0..e58b168c4b35 100644
--- a/arch/arm/configs/qil_a9260_defconfig
+++ b/arch/arm/configs/qil_a9260_defconfig
@@ -5,6 +5,7 @@ CONFIG_CALAO_MB_QIL_A9260=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="qil_a9260_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/qil_a9g20_defconfig b/arch/arm/configs/qil_a9g20_defconfig
index 0eef133d877e..de8d21442446 100644
--- a/arch/arm/configs/qil_a9g20_defconfig
+++ b/arch/arm/configs/qil_a9g20_defconfig
@@ -5,6 +5,7 @@ CONFIG_CALAO_MB_QIL_A9260=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="qil_a9g20_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/rockchip_v7a_defconfig b/arch/arm/configs/rockchip_v7a_defconfig
index f69320715695..17d463179e87 100644
--- a/arch/arm/configs/rockchip_v7a_defconfig
+++ b/arch/arm/configs/rockchip_v7a_defconfig
@@ -8,6 +8,7 @@ CONFIG_BOOT_ATAGS=y
CONFIG_ARM_BOARD_APPEND_ATAG=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="rockchip_v7a_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/rockchip_v8_defconfig b/arch/arm/configs/rockchip_v8_defconfig
index 0239f857aa3e..d76210a81305 100644
--- a/arch/arm/configs/rockchip_v8_defconfig
+++ b/arch/arm/configs/rockchip_v8_defconfig
@@ -10,6 +10,7 @@ CONFIG_MACH_RADXA_CM3=y
CONFIG_64BIT=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_PSCI_CLIENT=y
+CONFIG_NAME="rockchip_v8_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index b280704ff187..ed583f80a0d7 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -8,6 +8,7 @@ CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_IMAGE_COMPRESSION_NONE=y
+CONFIG_NAME="rpi_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/rpi_v8a_defconfig b/arch/arm/configs/rpi_v8a_defconfig
index 39754f025efa..734f02e7f2bf 100644
--- a/arch/arm/configs/rpi_v8a_defconfig
+++ b/arch/arm/configs/rpi_v8a_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_RPI_CM3=y
CONFIG_MACH_RPI4=y
CONFIG_64BIT=y
CONFIG_IMAGE_COMPRESSION_NONE=y
+CONFIG_NAME="rpi_v8a_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/socfpga-arria10_defconfig b/arch/arm/configs/socfpga-arria10_defconfig
index 8c19b48450fc..f3c9993dcf06 100644
--- a/arch/arm/configs/socfpga-arria10_defconfig
+++ b/arch/arm/configs/socfpga-arria10_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_SOCFPGA_REFLEX_ACHILLES=y
CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="socfpga-arria10_defconfig"
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
diff --git a/arch/arm/configs/socfpga-xload_defconfig b/arch/arm/configs/socfpga-xload_defconfig
index 37e9ecec7187..892f1d24cb26 100644
--- a/arch/arm/configs/socfpga-xload_defconfig
+++ b/arch/arm/configs/socfpga-xload_defconfig
@@ -9,6 +9,7 @@ CONFIG_THUMB2_BAREBOX=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
# CONFIG_ARM_EXCEPTIONS is not set
# CONFIG_MEMINFO is not set
+CONFIG_NAME="socfpga-xload_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_DUMMY=y
diff --git a/arch/arm/configs/socfpga_defconfig b/arch/arm/configs/socfpga_defconfig
index 0050dd2e4f4e..a24934cd8bda 100644
--- a/arch/arm/configs/socfpga_defconfig
+++ b/arch/arm/configs/socfpga_defconfig
@@ -9,6 +9,7 @@ CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT=y
CONFIG_THUMB2_BAREBOX=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="socfpga_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/stm32mp_defconfig b/arch/arm/configs/stm32mp_defconfig
index 20955b3f6b80..4df7b371f379 100644
--- a/arch/arm/configs/stm32mp_defconfig
+++ b/arch/arm/configs/stm32mp_defconfig
@@ -13,6 +13,7 @@ CONFIG_THUMB2_BAREBOX=y
CONFIG_ARM_BOARD_APPEND_ATAG=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="stm32mp_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_KALLSYMS=y
diff --git a/arch/arm/configs/tegra_v7_defconfig b/arch/arm/configs/tegra_v7_defconfig
index 65b9807b80d4..0d980009b030 100644
--- a/arch/arm/configs/tegra_v7_defconfig
+++ b/arch/arm/configs/tegra_v7_defconfig
@@ -6,6 +6,7 @@ CONFIG_MACH_NVIDIA_JETSON=y
CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="tegra_v7_defconfig"
CONFIG_MMU=y
CONFIG_STACK_SIZE=0x10000
CONFIG_MALLOC_SIZE=0x0
diff --git a/arch/arm/configs/telit_evk_pro3_defconfig b/arch/arm/configs/telit_evk_pro3_defconfig
index ead5c5826929..07868c47ffa1 100644
--- a/arch/arm/configs/telit_evk_pro3_defconfig
+++ b/arch/arm/configs/telit_evk_pro3_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_GE863=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="telit_evk_pro3_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/tny_a9260_defconfig b/arch/arm/configs/tny_a9260_defconfig
index e7be7ee912f4..adf200f256af 100644
--- a/arch/arm/configs/tny_a9260_defconfig
+++ b/arch/arm/configs/tny_a9260_defconfig
@@ -5,6 +5,7 @@ CONFIG_CALAO_MOB_TNY_MD2=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="tny_a9260_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/tny_a9263_bootstrap_defconfig b/arch/arm/configs/tny_a9263_bootstrap_defconfig
index 76c0bd33a0b9..9c5f656ffa41 100644
--- a/arch/arm/configs/tny_a9263_bootstrap_defconfig
+++ b/arch/arm/configs/tny_a9263_bootstrap_defconfig
@@ -5,6 +5,7 @@ CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ENVIRONMENT_VARIABLES=y
+CONFIG_NAME="tny_a9263_bootstrap_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x12000
CONFIG_MALLOC_DUMMY=y
diff --git a/arch/arm/configs/tny_a9263_defconfig b/arch/arm/configs/tny_a9263_defconfig
index f33d08c331d9..218f128f67b0 100644
--- a/arch/arm/configs/tny_a9263_defconfig
+++ b/arch/arm/configs/tny_a9263_defconfig
@@ -5,6 +5,7 @@ CONFIG_CALAO_MOB_TNY_MD2=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="tny_a9263_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/tny_a9g20_defconfig b/arch/arm/configs/tny_a9g20_defconfig
index d404b12b3d93..0549b54731da 100644
--- a/arch/arm/configs/tny_a9g20_defconfig
+++ b/arch/arm/configs/tny_a9g20_defconfig
@@ -5,6 +5,7 @@ CONFIG_CALAO_MOB_TNY_MD2=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="tny_a9g20_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/usb_a9260_defconfig b/arch/arm/configs/usb_a9260_defconfig
index fddced5ef0e7..c797b080554b 100644
--- a/arch/arm/configs/usb_a9260_defconfig
+++ b/arch/arm/configs/usb_a9260_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_USB_A9260=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="usb_a9260_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/usb_a9263_bootstrap_defconfig b/arch/arm/configs/usb_a9263_bootstrap_defconfig
index 9df009d65b8e..007c7261d201 100644
--- a/arch/arm/configs/usb_a9263_bootstrap_defconfig
+++ b/arch/arm/configs/usb_a9263_bootstrap_defconfig
@@ -6,6 +6,7 @@ CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ENVIRONMENT_VARIABLES=y
+CONFIG_NAME="usb_a9263_bootstrap_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x12000
CONFIG_MALLOC_DUMMY=y
diff --git a/arch/arm/configs/usb_a9263_defconfig b/arch/arm/configs/usb_a9263_defconfig
index 1656ff4176b6..1c228c61932d 100644
--- a/arch/arm/configs/usb_a9263_defconfig
+++ b/arch/arm/configs/usb_a9263_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_USB_A9263=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="usb_a9263_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/arm/configs/usb_a9g20_defconfig b/arch/arm/configs/usb_a9g20_defconfig
index 36c5203d5162..bea0e00455d6 100644
--- a/arch/arm/configs/usb_a9g20_defconfig
+++ b/arch/arm/configs/usb_a9g20_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_USB_A9G20=y
CONFIG_AEABI=y
CONFIG_BOOT_ATAGS=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_NAME="usb_a9g20_defconfig"
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x40000
CONFIG_MALLOC_SIZE=0x800000
diff --git a/arch/arm/configs/zii_vf610_dev_defconfig b/arch/arm/configs/zii_vf610_dev_defconfig
index 5e9fca65e6b2..24fa40ade974 100644
--- a/arch/arm/configs/zii_vf610_dev_defconfig
+++ b/arch/arm/configs/zii_vf610_dev_defconfig
@@ -3,6 +3,7 @@ CONFIG_MACH_ZII_VF610_DEV=y
CONFIG_THUMB2_BAREBOX=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
+CONFIG_NAME="zii_vf610_dev_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/arm/configs/zynq_defconfig b/arch/arm/configs/zynq_defconfig
index c474a60de2f0..76c73639d6a0 100644
--- a/arch/arm/configs/zynq_defconfig
+++ b/arch/arm/configs/zynq_defconfig
@@ -4,6 +4,7 @@ CONFIG_FIRMWARE_ZYNQ7000_FPGA=y
CONFIG_AEABI=y
CONFIG_ARM_UNWIND=y
CONFIG_IMAGE_COMPRESSION_XZKERN=y
+CONFIG_NAME="zynq_defconfig"
CONFIG_MMU=y
CONFIG_STACK_SIZE=0xf000
CONFIG_MALLOC_SIZE=0x8000000
diff --git a/arch/arm/configs/zynqmp_defconfig b/arch/arm/configs/zynqmp_defconfig
index 7af6b2301ad8..5a71536ba69e 100644
--- a/arch/arm/configs/zynqmp_defconfig
+++ b/arch/arm/configs/zynqmp_defconfig
@@ -4,6 +4,7 @@ CONFIG_MACH_XILINX_ZCU104=y
CONFIG_MACH_XILINX_ZCU106=y
CONFIG_64BIT=y
CONFIG_ARM_PSCI_CLIENT=y
+CONFIG_NAME="zynqmp_defconfig"
CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
diff --git a/arch/kvx/configs/generic_defconfig b/arch/kvx/configs/generic_defconfig
index 0d971ff3d5dd..787f0ef1bc80 100644
--- a/arch/kvx/configs/generic_defconfig
+++ b/arch/kvx/configs/generic_defconfig
@@ -1,3 +1,4 @@
+CONFIG_NAME="generic_defconfig"
CONFIG_AUTO_COMPLETE=y
CONFIG_CONSOLE_RATP=y
CONFIG_CMD_BOOT=y
diff --git a/arch/mips/configs/ath79_defconfig b/arch/mips/configs/ath79_defconfig
index 520743fb29dc..64f08945c68b 100644
--- a/arch/mips/configs/ath79_defconfig
+++ b/arch/mips/configs/ath79_defconfig
@@ -7,6 +7,7 @@ CONFIG_BOARD_TPLINK_MR3020=y
CONFIG_BOARD_TPLINK_WDR4300=y
CONFIG_BOARD_BLACK_SWIFT=y
CONFIG_IMAGE_COMPRESSION_XZKERN=y
+CONFIG_NAME="ath79_defconfig"
CONFIG_MMU=y
CONFIG_TEXT_BASE=0x81000000
CONFIG_MALLOC_SIZE=0x800000
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
index 66a72973ca36..d0f3614ae744 100644
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -1,5 +1,6 @@
CONFIG_MACH_MIPS_BCM47XX=y
CONFIG_IMAGE_COMPRESSION_XZKERN=y
+CONFIG_NAME="bcm47xx_defconfig"
CONFIG_STACK_SIZE=0x7000
CONFIG_EXPERIMENTAL=y
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/mips/configs/gxemul-malta_defconfig b/arch/mips/configs/gxemul-malta_defconfig
index 61e4e2901631..9b617daa0f71 100644
--- a/arch/mips/configs/gxemul-malta_defconfig
+++ b/arch/mips/configs/gxemul-malta_defconfig
@@ -2,6 +2,7 @@ CONFIG_BUILTIN_DTB=y
CONFIG_BUILTIN_DTB_NAME="qemu-malta"
CONFIG_CPU_LITTLE_ENDIAN=y
CONFIG_CPU_MIPS32_R1=y
+CONFIG_NAME="gxemul-malta_defconfig"
CONFIG_STACK_SIZE=0x7000
CONFIG_EXPERIMENTAL=y
CONFIG_BAUDRATE=38400
diff --git a/arch/mips/configs/loongson-ls1b_defconfig b/arch/mips/configs/loongson-ls1b_defconfig
index 92824e0f0f74..5937816e529d 100644
--- a/arch/mips/configs/loongson-ls1b_defconfig
+++ b/arch/mips/configs/loongson-ls1b_defconfig
@@ -1,6 +1,7 @@
CONFIG_BUILTIN_DTB=y
CONFIG_BUILTIN_DTB_NAME="loongson-ls1b"
CONFIG_MACH_MIPS_LOONGSON=y
+CONFIG_NAME="loongson-ls1b_defconfig"
CONFIG_STACK_SIZE=0x7000
CONFIG_EXPERIMENTAL=y
CONFIG_MALLOC_TLSF=y
diff --git a/arch/mips/configs/qemu-malta_defconfig b/arch/mips/configs/qemu-malta_defconfig
index 68766908d278..5f2b4470b817 100644
--- a/arch/mips/configs/qemu-malta_defconfig
+++ b/arch/mips/configs/qemu-malta_defconfig
@@ -1,5 +1,6 @@
CONFIG_BOARD_QEMU_MALTA=y
CONFIG_IMAGE_COMPRESSION_XZKERN=y
+CONFIG_NAME="qemu-malta_defconfig"
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x400000
CONFIG_STACK_SIZE=0x7000
CONFIG_EXPERIMENTAL=y
diff --git a/arch/mips/configs/xburst_defconfig b/arch/mips/configs/xburst_defconfig
index 4305afc58651..864acdef2f6a 100644
--- a/arch/mips/configs/xburst_defconfig
+++ b/arch/mips/configs/xburst_defconfig
@@ -2,6 +2,7 @@ CONFIG_MACH_MIPS_XBURST=y
CONFIG_BOARD_RZX50=y
CONFIG_BOARD_CI20=y
CONFIG_CPU_MIPS32_R1=y
+CONFIG_NAME="xburst_defconfig"
CONFIG_BAUDRATE=57600
CONFIG_GLOB=y
CONFIG_HUSH_FANCY_PROMPT=y
diff --git a/arch/openrisc/configs/generic_defconfig b/arch/openrisc/configs/generic_defconfig
index 417ae4db3650..646466e1a09e 100644
--- a/arch/openrisc/configs/generic_defconfig
+++ b/arch/openrisc/configs/generic_defconfig
@@ -1,5 +1,6 @@
CONFIG_BUILTIN_DTB=y
CONFIG_BUILTIN_DTB_NAME="or1ksim"
+CONFIG_NAME="generic_defconfig"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/powerpc/configs/owc_da923rc_defconfig b/arch/powerpc/configs/owc_da923rc_defconfig
index 183ddb15f918..2af0f3cace37 100644
--- a/arch/powerpc/configs/owc_da923rc_defconfig
+++ b/arch/powerpc/configs/owc_da923rc_defconfig
@@ -3,6 +3,7 @@ CONFIG_DA923RC=y
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x80000
CONFIG_MALLOC_SIZE=0x4000000
CONFIG_RELOCATABLE=y
+CONFIG_NAME="owc_da923rc_defconfig"
CONFIG_PROMPT="OWBOOT> "
CONFIG_BAUDRATE=9600
CONFIG_GLOB=y
diff --git a/arch/powerpc/configs/p1010rdb_defconfig b/arch/powerpc/configs/p1010rdb_defconfig
index 73c02c2e7f40..27eb13f29eec 100644
--- a/arch/powerpc/configs/p1010rdb_defconfig
+++ b/arch/powerpc/configs/p1010rdb_defconfig
@@ -1,6 +1,7 @@
CONFIG_ARCH_MPC85XX=y
CONFIG_MALLOC_SIZE=0x4000000
CONFIG_RELOCATABLE=y
+CONFIG_NAME="p1010rdb_defconfig"
CONFIG_GLOB=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/powerpc/configs/p1022ds_defconfig b/arch/powerpc/configs/p1022ds_defconfig
index fce3eabaf904..2974c0854aee 100644
--- a/arch/powerpc/configs/p1022ds_defconfig
+++ b/arch/powerpc/configs/p1022ds_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARCH_MPC85XX=y
CONFIG_P1022DS=y
CONFIG_MALLOC_SIZE=0x4000000
CONFIG_RELOCATABLE=y
+CONFIG_NAME="p1022ds_defconfig"
CONFIG_GLOB=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/powerpc/configs/p2020rdb_defconfig b/arch/powerpc/configs/p2020rdb_defconfig
index 6cc032872781..276c5d41ff78 100644
--- a/arch/powerpc/configs/p2020rdb_defconfig
+++ b/arch/powerpc/configs/p2020rdb_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARCH_MPC85XX=y
CONFIG_P2020RDB=y
CONFIG_MALLOC_SIZE=0x2800000
CONFIG_RELOCATABLE=y
+CONFIG_NAME="p2020rdb_defconfig"
CONFIG_GLOB=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/powerpc/configs/pcm030_defconfig b/arch/powerpc/configs/pcm030_defconfig
index b97a8d5d0cb4..8c618832280a 100644
--- a/arch/powerpc/configs/pcm030_defconfig
+++ b/arch/powerpc/configs/pcm030_defconfig
@@ -1,5 +1,6 @@
CONFIG_TEXT_BASE=0x3e00000
CONFIG_MALLOC_SIZE=0x1000000
+CONFIG_NAME="pcm030_defconfig"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/riscv/configs/erizo_generic_defconfig b/arch/riscv/configs/erizo_generic_defconfig
index 247a17913048..31c147c483a9 100644
--- a/arch/riscv/configs/erizo_generic_defconfig
+++ b/arch/riscv/configs/erizo_generic_defconfig
@@ -1,4 +1,5 @@
CONFIG_SOC_ERIZO=y
+CONFIG_NAME="erizo_generic_defconfig"
# CONFIG_GLOBALVAR is not set
CONFIG_STACK_SIZE=0x20000
CONFIG_MALLOC_SIZE=0x100000
diff --git a/arch/riscv/configs/litex_linux_defconfig b/arch/riscv/configs/litex_linux_defconfig
index 07c840938ad5..e96086a87acd 100644
--- a/arch/riscv/configs/litex_linux_defconfig
+++ b/arch/riscv/configs/litex_linux_defconfig
@@ -1,4 +1,5 @@
CONFIG_SOC_LITEX=y
+CONFIG_NAME="litex_linux_defconfig"
CONFIG_STACK_SIZE=0x20000
CONFIG_MALLOC_SIZE=0xf00000
CONFIG_MALLOC_TLSF=y
diff --git a/arch/riscv/configs/rv64i_defconfig b/arch/riscv/configs/rv64i_defconfig
index bedb2727a552..68cb86676a08 100644
--- a/arch/riscv/configs/rv64i_defconfig
+++ b/arch/riscv/configs/rv64i_defconfig
@@ -14,6 +14,7 @@ CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
+CONFIG_NAME="rv64i_defconfig"
CONFIG_PANIC_HANG=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/riscv/configs/virt32_defconfig b/arch/riscv/configs/virt32_defconfig
index 8020604ada9d..c12adc67739c 100644
--- a/arch/riscv/configs/virt32_defconfig
+++ b/arch/riscv/configs/virt32_defconfig
@@ -6,6 +6,7 @@ CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
CONFIG_PANIC_HANG=y
+CONFIG_NAME="virt32_defconfig"
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/sandbox/configs/hosttools_defconfig b/arch/sandbox/configs/hosttools_defconfig
index 0b62b648c744..22b50ab08a74 100644
--- a/arch/sandbox/configs/hosttools_defconfig
+++ b/arch/sandbox/configs/hosttools_defconfig
@@ -1,3 +1,4 @@
+CONFIG_NAME="hosttools_defconfig"
CONFIG_IMD=y
CONFIG_COMPILE_HOST_TOOLS=y
CONFIG_ARCH_IMX_USBLOADER=y
diff --git a/arch/sandbox/configs/sandbox_defconfig b/arch/sandbox/configs/sandbox_defconfig
index 691b5da0edff..921999e001bc 100644
--- a/arch/sandbox/configs/sandbox_defconfig
+++ b/arch/sandbox/configs/sandbox_defconfig
@@ -1,3 +1,4 @@
+CONFIG_NAME="sandbox_defconfig"
CONFIG_MALLOC_SIZE=0x1000000
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
diff --git a/arch/sandbox/configs/targettools_defconfig b/arch/sandbox/configs/targettools_defconfig
index 22845def617c..340d908f4889 100644
--- a/arch/sandbox/configs/targettools_defconfig
+++ b/arch/sandbox/configs/targettools_defconfig
@@ -1,3 +1,4 @@
+CONFIG_NAME="targettools_defconfig"
CONFIG_IMD=y
CONFIG_IMD_TARGET=y
CONFIG_KERNEL_INSTALL_TARGET=y
diff --git a/arch/x86/configs/efi_defconfig b/arch/x86/configs/efi_defconfig
index c7bdbcd5640c..1dd823af40ea 100644
--- a/arch/x86/configs/efi_defconfig
+++ b/arch/x86/configs/efi_defconfig
@@ -1,4 +1,5 @@
CONFIG_MMU=y
+CONFIG_NAME="efi_defconfig"
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_HUSH_FANCY_PROMPT=y
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 10/44] test: py: change barebox_config from set to dict
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (8 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 09/44] treewide: populate CONFIG_NAME for all configs in-tree Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 11/44] test: add heuristic for guessing labgrid environment YAML Ahmad Fatoum
` (35 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The use of a set to collect enabled config options means that we can't
make use of options of non-boolean type. Switch over to a dict to
support arbitrary types.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
test/py/helper.py | 46 ++++++++++++++++++++++++++++++++++------------
1 file changed, 34 insertions(+), 12 deletions(-)
diff --git a/test/py/helper.py b/test/py/helper.py
index 191af47a7f14..d4949acb63a0 100644
--- a/test/py/helper.py
+++ b/test/py/helper.py
@@ -3,7 +3,36 @@ import pytest
import os
import re
import shlex
-from itertools import filterfalse
+
+
+def parse_config(lines):
+ options = {}
+ for line in lines:
+ if line and line.startswith("CONFIG_"):
+ key, val = line.split("=", 1)
+ key = key.strip()
+ val = val.strip()
+
+ if val == "y":
+ options[key] = True
+ elif val == "m":
+ options[key] = False
+ elif val == "n":
+ options[key] = None
+ elif val.startswith('"') and val.endswith('"'):
+ options[key] = val[1:-1]
+ else:
+ options[key] = int(val, base=0)
+
+ return options
+
+
+def open_config_file(path):
+ try:
+ with open(path) as f:
+ return f.read().splitlines()
+ except OSError:
+ return []
def get_config(command):
@@ -19,17 +48,10 @@ def get_config(command):
out, err, returncode = command.run("cat /env/data/config")
if returncode != 0:
- try:
- with open(os.environ['LG_BUILDDIR'] + "/.config") as f:
- out = f.read().splitlines()
- except OSError:
- return set()
+ out = open_config_file(os.environ['LG_BUILDDIR'] + "/.config")
+
+ return parse_config(out)
- options = set()
- for line in out:
- if line and line.startswith("CONFIG_"):
- options.add(line.split('=')[0])
- return options
def devinfo(barebox, device):
info = {}
@@ -107,7 +129,7 @@ def of_get_property(barebox, path):
def skip_disabled(config, *options):
if bool(config):
- undefined = list(filterfalse(config.__contains__, options))
+ undefined = [opt for opt in options if opt not in config]
if bool(undefined):
pytest.skip("skipping test due to disabled " + (",".join(undefined)) + " dependency")
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 11/44] test: add heuristic for guessing labgrid environment YAML
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (9 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 10/44] test: py: change barebox_config from set to dict Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 12/44] usb: drop dead iSerialNumber parameter addition Ahmad Fatoum
` (34 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Now that each defconfig in barebox has its name carried into the build
.config, we can teach pytest to query that and find out what labgrid
environment YAML to use if none was specified by the user.
That means when building e.g., multi_v8_defconfig, it's enough to just
run pytest without arguments.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
common/Kconfig | 4 ++++
conftest.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+)
diff --git a/common/Kconfig b/common/Kconfig
index 159cd271d748..21ce2ef97f2c 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -120,6 +120,10 @@ config NAME
version command, but does not influence any runtime or
compile-time behavior.
+ For testing, pytest will use this option to determine, which
+ Labgrid environment YAML to use if none was specified by the
+ user.
+
config LOCALVERSION
string "Local version - append to the version string"
help
diff --git a/conftest.py b/conftest.py
index e8de5952efb4..06321c938dba 100644
--- a/conftest.py
+++ b/conftest.py
@@ -26,6 +26,45 @@ def barebox_config(request, strategy, target):
command = target.get_driver("BareboxDriver")
return helper.get_config(command)
+
+def get_enabled_arch(config):
+ # Get the absolute path to the directory containing this script
+ base_dir = os.path.dirname(os.path.abspath(__file__))
+
+ # Path to the 'arch' directory relative to this script
+ arch_dir = os.path.join(base_dir, "arch")
+
+ if not os.path.isdir(arch_dir):
+ return None
+
+ # Optional mapping from directory names to config key suffixes
+ arch_map = {"powerpc": "ppc"}
+
+ for entry in os.listdir(arch_dir):
+ path = os.path.join(arch_dir, entry)
+ if os.path.isdir(path):
+ key_suffix = arch_map.get(entry, entry).upper()
+ config_key = f"CONFIG_{key_suffix}"
+ if config.get(config_key):
+ return entry
+
+ return None
+
+
+def guess_lg_env():
+ config_file = helper.open_config_file(os.environ['LG_BUILDDIR'] + "/.config")
+ config = helper.parse_config(config_file)
+ if not config or not config.get('CONFIG_NAME'):
+ return None
+ arch = get_enabled_arch(config)
+ if not arch:
+ return None
+ filename = os.path.join("test", arch, f"{config['CONFIG_NAME']}.yaml")
+ if os.path.exists(filename):
+ return filename
+ return None
+
+
def pytest_configure(config):
if 'LG_BUILDDIR' not in os.environ:
if 'KBUILD_OUTPUT' in os.environ:
@@ -38,6 +77,14 @@ def pytest_configure(config):
if os.environ['LG_BUILDDIR'] is not None:
os.environ['LG_BUILDDIR'] = os.path.realpath(os.environ['LG_BUILDDIR'])
+ lg_env = config.option.lg_env
+ if lg_env is None:
+ lg_env = os.environ.get('LG_ENV')
+ if lg_env is None:
+ if lg_env := guess_lg_env():
+ os.environ['LG_ENV'] = lg_env
+
+
def pytest_addoption(parser):
def assignment(arg):
return arg.split('=', 1)
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 12/44] usb: drop dead iSerialNumber parameter addition
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (10 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 11/44] test: add heuristic for guessing labgrid environment YAML Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 13/44] drivers: use dev_add_param_uint32_fixed for IDs Ahmad Fatoum
` (33 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
iSerialNumber is already added for this device in the line before, so
this line is expected to fail. That's a good thing, because str is
uninitialized. Let's just drop this superfluous line then.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/usb/core/usb.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index f59b525f6276..ec487107584c 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -454,7 +454,6 @@ int usb_new_device(struct usb_device *dev)
void *buf;
struct usb_host *host = dev->host;
struct usb_device *parent = dev->parent;
- char str[16];
if (parent)
dev_set_name(&dev->dev, "%s-%d", parent->dev.name,
@@ -559,7 +558,6 @@ int usb_new_device(struct usb_device *dev)
dev->descriptor->iProduct, "%u");
dev_add_param_uint32_fixed(&dev->dev, "iSerialNumber",
dev->descriptor->iSerialNumber, "%u");
- dev_add_param_fixed(&dev->dev, "iSerialNumber", str);
dev_add_param_fixed(&dev->dev, "Manufacturer", dev->mf);
dev_add_param_fixed(&dev->dev, "Product", dev->prod);
dev_add_param_fixed(&dev->dev, "SerialNumber", dev->serial);
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 13/44] drivers: use dev_add_param_uint32_fixed for IDs
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (11 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 12/44] usb: drop dead iSerialNumber parameter addition Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 14/44] param: make bobject_add_param_fixed variadic Ahmad Fatoum
` (32 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Cut down on the use of temporary buffers for formatting integers in
fixed parameters by using the dev_add_param_uint32_fixed that's
especially meant for this.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/mfd/superio.c | 7 ++-----
drivers/pci/bus.c | 16 +++++-----------
drivers/w1/w1.c | 10 +++-------
3 files changed, 10 insertions(+), 23 deletions(-)
diff --git a/drivers/mfd/superio.c b/drivers/mfd/superio.c
index 891c8ace52e2..9917c0ff9a59 100644
--- a/drivers/mfd/superio.c
+++ b/drivers/mfd/superio.c
@@ -68,7 +68,6 @@ void superio_chip_add(struct superio_chip *siochip)
{
struct regmap *regmap;
char *chipname;
- char str[5];
int ret;
chipname = xasprintf("superio-%04x:%04x@%02x",
@@ -79,10 +78,8 @@ void superio_chip_add(struct superio_chip *siochip)
siochip->dev->priv = siochip;
- sprintf(str, "%04x", siochip->vid);
- dev_add_param_fixed(siochip->dev, "vendor", str);
- sprintf(str, "%04x", siochip->devid);
- dev_add_param_fixed(siochip->dev, "device", str);
+ dev_add_param_uint32_fixed(siochip->dev, "vendor", siochip->vid, "%04x");
+ dev_add_param_uint32_fixed(siochip->dev, "device", siochip->devid, "%04x");
regmap = regmap_init(siochip->dev, &superio_regmap_bus, siochip,
&superio_regmap_config);
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index c8f5b592428d..a5da84d282b4 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -133,7 +133,6 @@ int pci_register_driver(struct pci_driver *pdrv)
int pci_register_device(struct pci_dev *pdev)
{
- char str[6];
struct device *dev = &pdev->dev;
int ret;
@@ -149,16 +148,11 @@ int pci_register_device(struct pci_dev *pdev)
if (ret)
return ret;
- sprintf(str, "%02x", pdev->devfn);
- dev_add_param_fixed(dev, "devfn", str);
- sprintf(str, "%04x", (pdev->class >> 8) & 0xffff);
- dev_add_param_fixed(dev, "class", str);
- sprintf(str, "%04x", pdev->vendor);
- dev_add_param_fixed(dev, "vendor", str);
- sprintf(str, "%04x", pdev->device);
- dev_add_param_fixed(dev, "device", str);
- sprintf(str, "%04x", pdev->revision);
- dev_add_param_fixed(dev, "revision", str);
+ dev_add_param_uint32_fixed(dev, "devfn", pdev->devfn, "%02x");
+ dev_add_param_uint32_fixed(dev, "class", (pdev->class >> 8) & 0xffff, "%04x");
+ dev_add_param_uint32_fixed(dev, "vendor", pdev->vendor, "%04x");
+ dev_add_param_uint32_fixed(dev, "device", pdev->device, "%04x");
+ dev_add_param_uint32_fixed(dev, "revision", pdev->revision, "%04x");
return 0;
}
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 61f21ff446b8..3944c4676ee8 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -411,7 +411,6 @@ static bool w1_is_registered(struct w1_bus *bus, u64 rn)
static int w1_device_register(struct w1_bus *bus, struct w1_device *dev)
{
- char str[18];
int ret;
dev_set_name(&dev->dev, "w1-%x-", dev->fid);
@@ -425,12 +424,9 @@ static int w1_device_register(struct w1_bus *bus, struct w1_device *dev)
if (ret)
return ret;
- sprintf(str, "0x%x", dev->fid);
- dev_add_param_fixed(&dev->dev, "fid", str);
- sprintf(str, "0x%llx", dev->id);
- dev_add_param_fixed(&dev->dev, "id", str);
- sprintf(str, "0x%llx", dev->reg_num);
- dev_add_param_fixed(&dev->dev, "reg_num", str);
+ dev_add_param_uint32_fixed(&dev->dev, "fid", dev->fid, "0x%x");
+ dev_add_param_uint64_fixed(&dev->dev, "id", dev->id, "0x%llx");
+ dev_add_param_uint64_fixed(&dev->dev, "reg_num", dev->reg_num, "0x%llx");
return ret;
}
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 14/44] param: make bobject_add_param_fixed variadic
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (12 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 13/44] drivers: use dev_add_param_uint32_fixed for IDs Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 15/44] param: handle NULL gracefully in bobject_get_param Ahmad Fatoum
` (31 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The upcoming structured I/O support will make heavy use of
bobject_add_param_fixed, so prepare for that by making it receive a
format string and variadic arguments.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
arch/arm/boards/animeo_ip/init.c | 4 +--
arch/arm/boards/at91sam9m10ihd/hw_version.c | 10 ++-----
arch/arm/boards/at91sam9x5ek/hw_version.c | 10 ++-----
common/console.c | 11 ++------
drivers/efi/efi-device.c | 4 +--
drivers/usb/core/usb.c | 6 ++--
fs/fs.c | 3 +-
include/param.h | 25 +++++++++++++----
lib/parameter.c | 31 +++++++++++++++++----
9 files changed, 62 insertions(+), 42 deletions(-)
diff --git a/arch/arm/boards/animeo_ip/init.c b/arch/arm/boards/animeo_ip/init.c
index a0a2007d521d..e46ede939aba 100644
--- a/arch/arm/boards/animeo_ip/init.c
+++ b/arch/arm/boards/animeo_ip/init.c
@@ -82,8 +82,8 @@ static void animeo_ip_detect_version(void)
version = "IO";
}
- dev_add_param_fixed(dev, "model", model);
- dev_add_param_fixed(dev, "version", version);
+ dev_add_param_fixed(dev, "model", "%s", model);
+ dev_add_param_fixed(dev, "version", "%s", version);
}
static struct atmel_nand_data nand_pdata = {
diff --git a/arch/arm/boards/at91sam9m10ihd/hw_version.c b/arch/arm/boards/at91sam9m10ihd/hw_version.c
index 9ae4ccb77c75..b7b231fd0a09 100644
--- a/arch/arm/boards/at91sam9m10ihd/hw_version.c
+++ b/arch/arm/boards/at91sam9m10ihd/hw_version.c
@@ -134,7 +134,6 @@ static void at91sam9m10ihd_devices_detect_one(const char *name)
struct board_info* binfo;
struct vendor_info* vinfo;
struct device *dev = NULL;
- char str[16];
u8 vendor_id = 0;
if (at91sam9m10ihd_read_w1(name, &info))
@@ -180,14 +179,11 @@ static void at91sam9m10ihd_devices_detect_one(const char *name)
dev_add_param_fixed(dev, "vendor", info.vendor_name);
dev_add_param_fixed(dev, "board", info.board_name);
- sprintf(str, "%.2s", info.vendor_country);
- dev_add_param_fixed(dev, "country", str);
+ dev_add_param_fixed(dev, "country", "%.2s", info.vendor_country);
dev_add_param_uint32_fixed(dev, "year", info.year, "%u");
dev_add_param_uint32_fixed(dev, "week", info.week, "%u");
- sprintf(str, "%c", info.revision_code);
- dev_add_param_fixed(dev, "revision_code", str);
- sprintf(str, "%c", info.revision_id);
- dev_add_param_fixed(dev, "revision_id", str);
+ dev_add_param_fixed(dev, "revision_code", "%c", info.revision_code);
+ dev_add_param_fixed(dev, "revision_id", "%c", info.revision_id);
}
void at91sam9m10ihd_devices_detect_hw(void)
diff --git a/arch/arm/boards/at91sam9x5ek/hw_version.c b/arch/arm/boards/at91sam9x5ek/hw_version.c
index 9c6bd6866098..55ce409dfdad 100644
--- a/arch/arm/boards/at91sam9x5ek/hw_version.c
+++ b/arch/arm/boards/at91sam9x5ek/hw_version.c
@@ -150,7 +150,6 @@ static void at91sam9x5ek_devices_detect_one(const char *name)
struct board_info* binfo;
struct vendor_info* vinfo;
struct device *dev = NULL;
- char str[16];
u8 vendor_id = 0;
if (at91sam9x5ek_read_w1(name, &info))
@@ -206,14 +205,11 @@ static void at91sam9x5ek_devices_detect_one(const char *name)
dev_add_param_fixed(dev, "vendor", info.vendor_name);
dev_add_param_fixed(dev, "board", info.board_name);
- sprintf(str, "%.2s", info.vendor_country);
- dev_add_param_fixed(dev, "country", str);
+ dev_add_param_fixed(dev, "country", "%.2s", info.vendor_country);
dev_add_param_uint32_fixed(dev, "year", info.year, "%u");
dev_add_param_uint32_fixed(dev, "week", info.week, "%u");
- sprintf(str, "%c", info.revision_code);
- dev_add_param_fixed(dev, "revision_code", str);
- sprintf(str, "%c", info.revision_id);
- dev_add_param_fixed(dev, "revision_id", str);
+ dev_add_param_fixed(dev, "revision_code", "%c", info.revision_code);
+ dev_add_param_fixed(dev, "revision_id", "%c", info.revision_id);
}
#define NODE_NAME_LEN 128
diff --git a/common/console.c b/common/console.c
index 393183a72514..dc552e4c5dac 100644
--- a/common/console.c
+++ b/common/console.c
@@ -222,17 +222,12 @@ static void console_init_early(void)
static void console_add_earlycon_param(struct console_device *cdev, unsigned baudrate)
{
- char *str;
-
if (!cdev->linux_earlycon_name)
return;
- str = basprintf("earlycon=%s,0x%lx", cdev->linux_earlycon_name,
- (ulong)cdev->phys_base);
-
- dev_add_param_fixed(&cdev->class_dev, "linux.bootargs.earlycon", str);
-
- free(str);
+ dev_add_param_fixed(&cdev->class_dev, "linux.bootargs.earlycon",
+ "earlycon=%s,0x%lx", cdev->linux_earlycon_name,
+ (ulong)cdev->phys_base);
}
void console_set_stdoutpath(struct console_device *cdev, unsigned baudrate)
diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c
index 0e6f75659f62..15884646dc18 100644
--- a/drivers/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -197,7 +197,7 @@ static int efi_register_device(struct efi_device *efidev)
dev_path_str = device_path_to_str(efidev->devpath);
if (dev_path_str) {
- dev_add_param_fixed(&efidev->dev, "devpath", dev_path_str);
+ dev_add_param_fixed(&efidev->dev, "devpath", "%s", dev_path_str);
free(dev_path_str);
}
@@ -421,7 +421,7 @@ static int efi_init_devices(void)
bus_register(&efi_bus);
- dev_add_param_fixed(&efi_bus.dev, "fw_vendor", fw_vendor);
+ dev_add_param_fixed(&efi_bus.dev, "fw_vendor", "%s", fw_vendor);
free(fw_vendor);
dev_add_param_uint32_fixed(&efi_bus.dev, "major", sys_major, "%u");
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index ec487107584c..d144e9840916 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -558,9 +558,9 @@ int usb_new_device(struct usb_device *dev)
dev->descriptor->iProduct, "%u");
dev_add_param_uint32_fixed(&dev->dev, "iSerialNumber",
dev->descriptor->iSerialNumber, "%u");
- dev_add_param_fixed(&dev->dev, "Manufacturer", dev->mf);
- dev_add_param_fixed(&dev->dev, "Product", dev->prod);
- dev_add_param_fixed(&dev->dev, "SerialNumber", dev->serial);
+ dev_add_param_fixed(&dev->dev, "Manufacturer", "%s", dev->mf);
+ dev_add_param_fixed(&dev->dev, "Product", "%s", dev->prod);
+ dev_add_param_fixed(&dev->dev, "SerialNumber", "%s", dev->serial);
dev_add_param_uint32_fixed(&dev->dev, "idVendor",
dev->descriptor->idVendor, "%04x");
dev_add_param_uint32_fixed(&dev->dev, "idProduct",
diff --git a/fs/fs.c b/fs/fs.c
index 24c14a590a11..54bd35786857 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1224,7 +1224,8 @@ void fsdev_set_linux_rootarg(struct fs_device *fsdev, const char *str)
{
fsdev->linux_rootarg = xstrdup(str);
- dev_add_param_fixed(&fsdev->dev, "linux.bootargs", fsdev->linux_rootarg);
+ dev_add_param_fixed(&fsdev->dev, "linux.bootargs",
+ "%s", fsdev->linux_rootarg);
}
/**
diff --git a/include/param.h b/include/param.h
index 5f4f87f67c73..1bf04015f266 100644
--- a/include/param.h
+++ b/include/param.h
@@ -6,6 +6,7 @@
#include <linux/types.h>
#include <linux/list.h>
#include <bobject.h>
+#include <stdarg.h>
#define PARAM_FLAG_RO (1 << 0)
#define PARAM_GLOBALVAR_UNQUALIFIED (1 << 1)
@@ -103,8 +104,12 @@ struct param_d *bobject_add_param_file_list(bobject_t bobj, const char *name,
struct file_list **file_list,
void *priv);
+struct param_d *vbobject_add_param_fixed(struct bobject *bobj, const char *name,
+ const char *fmt, va_list ap);
+
struct param_d *bobject_add_param_fixed(bobject_t bobj, const char *name,
- const char *value);
+ const char *fmt, ...)
+ __printf(3, 4);
void param_remove(struct param_d *p);
@@ -224,9 +229,17 @@ static inline struct param_d *bobject_add_param_file_list(bobject_t bobj,
return NULL;
}
-static inline struct param_d *bobject_add_param_fixed(bobject_t bobj,
- const char *name,
- const char *value)
+static inline
+struct param_d *vbobject_add_param_fixed(struct bobject *bobj, const char *name,
+ const char *fmt, va_list ap)
+{
+ return NULL;
+}
+
+static inline __printf(3, 4)
+struct param_d *bobject_add_param_fixed(bobject_t bobj,
+ const char *name,
+ const char *fmt, ...)
{
return NULL;
}
@@ -340,7 +353,7 @@ static inline struct param_d *bobject_add_param_string_fixed(bobject_t bobj,
const char *name,
const char *value)
{
- return bobject_add_param_fixed(bobj, name, value);
+ return bobject_add_param_fixed(bobj, name, "%s", value);
}
static inline struct param_d *bobject_add_param_enum_ro(bobject_t bobj,
@@ -367,6 +380,7 @@ static inline struct param_d *bobject_add_param_bitmask_ro(bobject_t bobj,
#define dev_set_param bobject_set_param
#define dev_add_param bobject_add_param
#define dev_add_param_string bobject_add_param_string
+#define dev_add_param_fixed bobject_add_param_fixed
#define __dev_add_param_int __bobject_add_param_int
#define dev_add_param_enum bobject_add_param_enum
#define dev_add_param_tristate bobject_add_param_tristate
@@ -375,7 +389,6 @@ static inline struct param_d *bobject_add_param_bitmask_ro(bobject_t bobj,
#define dev_add_param_ip bobject_add_param_ip
#define dev_add_param_mac bobject_add_param_mac
#define dev_add_param_file_list bobject_add_param_file_list
-#define dev_add_param_fixed bobject_add_param_fixed
#define dev_param_set_generic bobject_param_set_generic
#define dev_add_param_int bobject_add_param_int
diff --git a/lib/parameter.c b/lib/parameter.c
index ef578d790856..73cc3701b938 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -213,15 +213,14 @@ struct param_d *bobject_add_param(bobject_t _bobj, const char *name,
}
/**
- * bobject_add_param_fixed - add a readonly parameter to a barebox object
+ * vbobject_add_param_fixed - add a readonly parameter to a barebox object
* @param bobj The barebox object
* @param name The name of the parameter
- * @param value The value of the parameter
+ * @param fmt Format string
*/
-struct param_d *bobject_add_param_fixed(bobject_t _bobj, const char *name,
- const char *value)
+struct param_d *vbobject_add_param_fixed(struct bobject *bobj, const char *name,
+ const char *fmt, va_list ap)
{
- struct bobject *bobj = _bobj.bobj;
struct param_d *param;
int ret;
@@ -233,7 +232,27 @@ struct param_d *bobject_add_param_fixed(bobject_t _bobj, const char *name,
return ERR_PTR(ret);
}
- param->value = strdup(value);
+ param->value = fmt ? bvasprintf(fmt, ap) : NULL;
+
+ return param;
+}
+
+/**
+ * bobject_add_param_fixed - add a readonly parameter to a barebox object
+ * @param bobj The barebox object
+ * @param name The name of the parameter
+ * @param fmt Format string
+ */
+struct param_d *bobject_add_param_fixed(bobject_t _bobj, const char *name,
+ const char *fmt, ...)
+{
+ struct bobject *bobj = _bobj.bobj;
+ struct param_d *param;
+ va_list ap;
+
+ va_start(ap, fmt);
+ param = vbobject_add_param_fixed(bobj, name, fmt, ap);
+ va_end(ap);
return param;
}
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 15/44] param: handle NULL gracefully in bobject_get_param
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (13 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 14/44] param: make bobject_add_param_fixed variadic Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 16/44] common: introduce structured I/O Ahmad Fatoum
` (30 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This allows using bobject_get_param with non-existent parameter names
without risking a crash inside bobject_get_param().
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
lib/parameter.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/parameter.c b/lib/parameter.c
index 73cc3701b938..0f9164386c6d 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -71,8 +71,14 @@ struct param_d *get_param_by_name(bobject_t _bobj, const char *name)
const char *bobject_get_param(bobject_t _bobj, const char *name)
{
struct bobject *bobj = _bobj.bobj;
- struct param_d *param = get_param_by_name(bobj, name);
+ struct param_d *param;
+ if (!bobj) {
+ errno = ENODEV;
+ return NULL;
+ }
+
+ param = get_param_by_name(bobj, name);
if (!param) {
errno = EINVAL;
return NULL;
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 16/44] common: introduce structured I/O
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (14 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 15/44] param: handle NULL gracefully in bobject_get_param Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 17/44] ARM: cpuinfo: support structio output Ahmad Fatoum
` (29 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 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>
---
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 21ce2ef97f2c..b4de85f356c9 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -55,6 +55,10 @@ config BLOCK_STATS
config FILETYPE
bool
+config STRUCTIO
+ bool
+ select PARAM
+
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] 53+ messages in thread
* [PATCH 17/44] ARM: cpuinfo: support structio output
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (15 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 16/44] common: introduce structured I/O Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 18/44] commands: uptime: enable structured I/O Ahmad Fatoum
` (28 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 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>
---
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] 53+ messages in thread
* [PATCH 18/44] commands: uptime: enable structured I/O
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (16 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 17/44] ARM: cpuinfo: support structio output Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 19/44] string: implement strv_length helper Ahmad Fatoum
` (27 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 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>
---
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] 53+ messages in thread
* [PATCH 19/44] string: implement strv_length helper
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (17 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 18/44] commands: uptime: enable structured I/O Ahmad Fatoum
@ 2025-08-11 12:27 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 20/44] ARM: psci: client: add PSCI version/method parameters Ahmad Fatoum
` (26 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:27 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>
---
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] 53+ messages in thread
* [PATCH 20/44] ARM: psci: client: add PSCI version/method parameters
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (18 preceding siblings ...)
2025-08-11 12:27 ` [PATCH 19/44] string: implement strv_length helper Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 21/44] net: move netmask_to_prefix into header Ahmad Fatoum
` (25 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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>
---
arch/arm/cpu/psci-client.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/arch/arm/cpu/psci-client.c b/arch/arm/cpu/psci-client.c
index 4c26beacb9bb..1284a408d118 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(param))
+ dev_info(dev, "detected version %s\n", param->get(dev, 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[] = {
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 21/44] net: move netmask_to_prefix into header
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (19 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 20/44] ARM: psci: client: add PSCI version/method parameters Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 22/44] stringlist: implement string_list_empty Ahmad Fatoum
` (24 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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>
---
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] 53+ messages in thread
* [PATCH 22/44] stringlist: implement string_list_empty
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (20 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 21/44] net: move netmask_to_prefix into header Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 23/44] optee: add revision info to tee devinfo output Ahmad Fatoum
` (23 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We already have string_list_count, but it needs to walk fully the linked
list, even if we are only interested in knowing if the list is empty or
not. Add a helper for this situation.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
include/stringlist.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/stringlist.h b/include/stringlist.h
index 03711ad9c7ff..9a982f2ad685 100644
--- a/include/stringlist.h
+++ b/include/stringlist.h
@@ -26,6 +26,11 @@ static inline void string_list_init(struct string_list *sl)
sl->str = NULL;
}
+static inline size_t string_list_empty(struct string_list *sl)
+{
+ return list_empty(&sl->list);
+}
+
static inline size_t string_list_count(struct string_list *sl)
{
return list_count_nodes(&sl->list);
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 23/44] optee: add revision info to tee devinfo output
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (21 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 22/44] stringlist: implement string_list_empty Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-12 9:35 ` Sascha Hauer
2025-08-11 12:28 ` [PATCH 24/44] tee: enable structured I/O in devinfo handler Ahmad Fatoum
` (22 subsequent siblings)
45 siblings, 1 reply; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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>
---
drivers/tee/optee/smc_abi.c | 16 +++++++++++-----
drivers/tee/tee_core.c | 20 +++++++++++++++++++-
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
index aab8ebb186ed..0b8d581cf19b 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,14 @@ 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);
+
+ pr_info("revision %s\n", param->get(dev, param));
}
static bool optee_msg_api_revision_is_compatible(optee_invoke_fn *invoke_fn)
@@ -662,7 +668,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] 53+ messages in thread
* [PATCH 24/44] tee: enable structured I/O in devinfo handler
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (22 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 23/44] optee: add revision info to tee devinfo output Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 25/44] mtd: add devices to new mtd class Ahmad Fatoum
` (21 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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>
---
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] 53+ messages in thread
* [PATCH 25/44] mtd: add devices to new mtd class
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (23 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 24/44] tee: enable structured I/O in devinfo handler Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 26/44] nvmem: add devices to new nvmem class Ahmad Fatoum
` (20 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We maintain no global list of MTD masters, but it's a useful thing to
have if only for informational purposes. Add a struct class for this use
case.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/mtd/core.c | 4 ++++
include/linux/mtd/mtd.h | 2 ++
2 files changed, 6 insertions(+)
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 2ca16c614dee..6162ec450fc1 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -25,6 +25,8 @@
static LIST_HEAD(mtd_register_hooks);
+DEFINE_DEV_CLASS(mtd_class, "mtd");
+
/**
* mtd_buf_all_ff - check if buffer contains only 0xff
* @buf: buffer to check
@@ -681,6 +683,8 @@ int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id)
if (ret)
return ret;
+ class_add_device(&mtd_class, &mtd->dev);
+
mtd->cdev.ops = &mtd_ops;
mtd->cdev.size = mtd->size;
if (device_id == DEVICE_ID_SINGLE)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 8d99dff27fe7..f85c7e783243 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -339,6 +339,8 @@ static inline uint32_t mtd_div_by_wb(uint64_t sz, struct mtd_info *mtd)
extern int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id);
extern int del_mtd_device (struct mtd_info *mtd);
+extern struct class mtd_class;
+
extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
extern struct mtd_info *get_mtd_device_nm(const char *name);
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 26/44] nvmem: add devices to new nvmem class
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (24 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 25/44] mtd: add devices to new mtd class Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 27/44] nvmem: export functions to query NVMEM size Ahmad Fatoum
` (19 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We already link all nvmem devices into a linked list, but we don't
export it for outside iteration.
Turn it into a class before exporting it.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/nvmem/core.c | 10 ++++------
include/linux/nvmem-consumer.h | 5 ++++-
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 68cb27093227..253c00575d88 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -16,7 +16,6 @@
struct nvmem_device {
const char *name;
struct device dev;
- struct list_head node;
int stride;
int word_size;
int ncells;
@@ -46,15 +45,14 @@ struct nvmem_cell {
};
static LIST_HEAD(nvmem_cells);
-static LIST_HEAD(nvmem_devs);
+DEFINE_DEV_CLASS(nvmem_class, "nvmem");
void nvmem_devices_print(void)
{
struct nvmem_device *dev;
- list_for_each_entry(dev, &nvmem_devs, node) {
+ class_for_each_container_of_device(&nvmem_class, dev, dev)
printf("%s\n", dev_name(&dev->dev));
- }
}
static ssize_t nvmem_cdev_read(struct cdev *cdev, void *buf, size_t count,
@@ -154,7 +152,7 @@ static struct nvmem_device *of_nvmem_find(struct device_node *nvmem_np)
if (!nvmem_np)
return NULL;
- list_for_each_entry(dev, &nvmem_devs, node)
+ class_for_each_container_of_device(&nvmem_class, dev, dev)
if (dev->dev.of_node == nvmem_np)
return dev;
@@ -266,7 +264,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
}
}
- list_add_tail(&nvmem->node, &nvmem_devs);
+ class_add_device(&nvmem_class, &nvmem->dev);
return nvmem;
}
diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
index 397c4c29dafd..c711b63aeeb0 100644
--- a/include/linux/nvmem-consumer.h
+++ b/include/linux/nvmem-consumer.h
@@ -12,7 +12,8 @@
#ifndef _LINUX_NVMEM_CONSUMER_H
#define _LINUX_NVMEM_CONSUMER_H
-struct device;
+#include <device.h>
+
struct device_node;
/* consumer cookie */
struct nvmem_cell;
@@ -26,6 +27,8 @@ struct nvmem_cell_info {
unsigned int nbits;
};
+extern struct class nvmem_class;
+
#if IS_ENABLED(CONFIG_NVMEM)
/* Cell based interface */
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 27/44] nvmem: export functions to query NVMEM size
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (25 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 26/44] nvmem: add devices to new nvmem class Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 28/44] video: add devices to new fb class Ahmad Fatoum
` (18 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Allow users to query how much bytes are in a NVMEM device given a struct
device that was retrieved by iterating the NVMEM class.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/nvmem/core.c | 12 ++++++++++++
include/linux/nvmem-consumer.h | 13 ++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 253c00575d88..1e701426c9ad 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -374,6 +374,12 @@ struct nvmem_device *nvmem_device_get(struct device *dev,
}
EXPORT_SYMBOL_GPL(nvmem_device_get);
+struct nvmem_device *nvmem_from_device(struct device *dev)
+{
+ return container_of_safe(dev, struct nvmem_device, dev);
+}
+EXPORT_SYMBOL_GPL(nvmem_from_device);
+
/**
* nvmem_device_put() - put alredy got nvmem device
*
@@ -829,6 +835,12 @@ int nvmem_device_write(struct nvmem_device *nvmem,
}
EXPORT_SYMBOL_GPL(nvmem_device_write);
+ssize_t nvmem_device_size(struct nvmem_device *nvmem)
+{
+ return nvmem->size;
+}
+EXPORT_SYMBOL_GPL(nvmem_device_size);
+
void *nvmem_cell_get_and_read(struct device_node *np, const char *cell_name,
size_t bytes)
{
diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
index c711b63aeeb0..25591d166a02 100644
--- a/include/linux/nvmem-consumer.h
+++ b/include/linux/nvmem-consumer.h
@@ -44,6 +44,7 @@ int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len);
/* direct nvmem device read/write interface */
struct nvmem_device *nvmem_device_get(struct device *dev, const char *name);
+struct nvmem_device *nvmem_from_device(struct device *dev);
void nvmem_device_put(struct nvmem_device *nvmem);
int nvmem_device_read(struct nvmem_device *nvmem, unsigned int offset,
size_t bytes, void *buf);
@@ -53,7 +54,7 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem,
struct nvmem_cell_info *info, void *buf);
int nvmem_device_cell_write(struct nvmem_device *nvmem,
struct nvmem_cell_info *info, void *buf);
-
+ssize_t nvmem_device_size(struct nvmem_device *nvmem);
void nvmem_devices_print(void);
#else
@@ -99,6 +100,11 @@ static inline struct nvmem_device *nvmem_device_get(struct device *dev,
return ERR_PTR(-EOPNOTSUPP);
}
+static inline struct nvmem_device *nvmem_from_device(struct device *dev)
+{
+ return IS_ERR(dev) ? ERR_CAST(dev) : ERR_PTR(-EOPNOTSUPP);
+}
+
static inline void nvmem_device_put(struct nvmem_device *nvmem)
{
}
@@ -131,6 +137,11 @@ static inline int nvmem_device_write(struct nvmem_device *nvmem,
return -EOPNOTSUPP;
}
+static inline ssize_t nvmem_device_size(struct nvmem_device *nvmem)
+{
+ return -EOPNOTSUPP;
+}
+
#endif /* CONFIG_NVMEM */
#if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OFTREE)
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 28/44] video: add devices to new fb class
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (26 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 27/44] nvmem: export functions to query NVMEM size Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 29/44] security: blobgen: add easy way to check for existent providers Ahmad Fatoum
` (17 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
We maintain no global list of framebuffers, but it's a useful thing to
have if only for informational purposes. Add a struct class for this use
case.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/video/fb.c | 4 ++++
include/fb.h | 2 ++
2 files changed, 6 insertions(+)
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 2ff5bbcfe290..939368a0de68 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -9,6 +9,8 @@
#include <fs.h>
#include <init.h>
+DEFINE_DEV_CLASS(fb_class, "fb");
+
static int fb_ioctl(struct cdev* cdev, unsigned int req, void *data)
{
struct fb_info *info = cdev->priv;
@@ -346,6 +348,8 @@ int register_framebuffer(struct fb_info *info)
if (ret)
goto err_free;
+ class_add_device(&fb_class, &info->dev);
+
dev_add_param_bool(dev, "enable", fb_enable_set, fb_enable_get,
&info->p_enable, info);
diff --git a/include/fb.h b/include/fb.h
index 01c5ce0bf377..1e3b330ab725 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -225,4 +225,6 @@ void fb_of_reserve_add_fixup(struct fb_info *info);
int register_fbconsole(struct fb_info *fb);
void *fb_get_screen_base(struct fb_info *info);
+extern struct class fb_class;
+
#endif /* __FB_H */
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 29/44] security: blobgen: add easy way to check for existent providers
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (27 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 28/44] video: add devices to new fb class Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 30/44] pmdomain: add easy way to check for provider support Ahmad Fatoum
` (16 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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>
---
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] 53+ messages in thread
* [PATCH 30/44] pmdomain: add easy way to check for provider support
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (28 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 29/44] security: blobgen: add easy way to check for existent providers Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 31/44] bbu: add easy way to check for existent providers Ahmad Fatoum
` (15 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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 GENPD support.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/base/power.c | 5 +++++
include/pm_domain.h | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/drivers/base/power.c b/drivers/base/power.c
index f7629f554a72..d60a00f5735e 100644
--- a/drivers/base/power.c
+++ b/drivers/base/power.c
@@ -349,6 +349,11 @@ void genpd_activate(void)
have_genpd_providers = true;
}
+bool genpd_is_active(void)
+{
+ return have_genpd_providers && !list_empty(&gpd_list);
+}
+
static struct bus_type genpd_bus_type = {
.name = "genpd",
};
diff --git a/include/pm_domain.h b/include/pm_domain.h
index 4b7b07b0e43d..3678deb9a76c 100644
--- a/include/pm_domain.h
+++ b/include/pm_domain.h
@@ -28,6 +28,7 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
#ifdef CONFIG_PM_GENERIC_DOMAINS
void genpd_activate(void);
+bool genpd_is_active(void);
int genpd_dev_pm_attach(struct device *dev);
struct device *genpd_dev_pm_attach_by_id(struct device *dev,
@@ -63,6 +64,11 @@ static inline void genpd_activate(void)
{
}
+static inline bool genpd_is_active(void)
+{
+ return false;
+}
+
static inline int pm_genpd_init(struct generic_pm_domain *genpd,
void *gov, bool is_off)
{
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 31/44] bbu: add easy way to check for existent providers
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (29 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 30/44] pmdomain: add easy way to check for provider support Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 32/44] firmware: " Ahmad Fatoum
` (14 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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 barebox update handlers
registered.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
common/bbu.c | 8 ++++++++
include/bbu.h | 7 +++++++
2 files changed, 15 insertions(+)
diff --git a/common/bbu.c b/common/bbu.c
index 0dc32e45ea2f..03261583fe0b 100644
--- a/common/bbu.c
+++ b/common/bbu.c
@@ -289,6 +289,14 @@ int barebox_update(struct bbu_data *data, struct bbu_handler *handler)
return 0;
}
+/*
+ * report whether any update handlers have been registered so far
+ */
+bool bbu_handlers_available(void)
+{
+ return !list_empty(&bbu_image_handlers);
+}
+
/*
* print a list of all registered update handlers
*/
diff --git a/include/bbu.h b/include/bbu.h
index bce138d95b37..94006563c90e 100644
--- a/include/bbu.h
+++ b/include/bbu.h
@@ -58,6 +58,8 @@ int bbu_std_file_handler(struct bbu_handler *handler,
#ifdef CONFIG_BAREBOX_UPDATE
+bool bbu_handlers_available(void);
+
int bbu_register_handler(struct bbu_handler *);
int bbu_register_std_file_update(const char *name, unsigned long flags,
@@ -71,6 +73,11 @@ int bbu_mmcboot_register_handler(const char *name,
#else
+static inline bool bbu_handlers_available(void)
+{
+ return false;
+}
+
static inline int bbu_register_handler(struct bbu_handler *unused)
{
return -EINVAL;
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 32/44] firmware: add easy way to check for existent providers
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (30 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 31/44] bbu: add easy way to check for existent providers Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 33/44] rtc: export rtc_class in header Ahmad Fatoum
` (13 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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 any firmware managers
at all registered.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
common/firmware.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/firmware.c b/common/firmware.c
index 3c7960581f6f..264fc9d66dcc 100644
--- a/common/firmware.c
+++ b/common/firmware.c
@@ -63,18 +63,18 @@ struct firmware_mgr *firmwaremgr_find(const char *id)
*
* Find a firmware device handler using the device node of the firmware
* handler. This allows to retrieve the firmware handler with a phandle from
- * the device tree.
+ * the device tree. If np is NULL, returns the first instance encountered.
*/
struct firmware_mgr *firmwaremgr_find_by_node(struct device_node *np)
{
struct firmware_mgr *mgr;
- char *na, *nb;
+ char *na;
na = of_get_reproducible_name(np);
list_for_each_entry(mgr, &firmwaremgr_list, list) {
- nb = of_get_reproducible_name(mgr->handler->device_node);
- if (!strcmp(na, nb)) {
+ char *nb = of_get_reproducible_name(mgr->handler->device_node);
+ if (!na || !strcmp(na, nb)) {
free(na);
free(nb);
return mgr;
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 33/44] rtc: export rtc_class in header
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (31 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 32/44] firmware: " Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 34/44] driver: featctrl: export of_feature_controllers Ahmad Fatoum
` (12 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This list will be used by the upcoming bfetch command to
determine whether the running barebox has any RTCs registered.
The symbol already has external linkage.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
include/linux/rtc.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 4fa999723de1..43c8fb248f86 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -15,6 +15,7 @@
#include <common.h>
#include <linux/types.h>
+#include <linux/list.h>
#include <linux/errno.h>
#include <linux/nvmem-provider.h>
#include <rtc.h>
@@ -40,6 +41,8 @@ struct rtc_class_ops {
int (*set_time)(struct rtc_device *, struct rtc_time *);
};
+extern struct class rtc_class;
+
extern int rtc_register(struct rtc_device *rtcdev);
#ifdef CONFIG_RTC_CLASS
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 34/44] driver: featctrl: export of_feature_controllers
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (32 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 33/44] rtc: export rtc_class in header Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 35/44] net: dsa: export dsa_switch_list Ahmad Fatoum
` (11 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This list will be used by the upcoming bfetch command to
determine whether the running barebox has a feature controller
driver bound.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/base/featctrl.c | 2 +-
include/featctrl.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/base/featctrl.c b/drivers/base/featctrl.c
index 153720e5ee6b..8ae432f1d6da 100644
--- a/drivers/base/featctrl.c
+++ b/drivers/base/featctrl.c
@@ -11,7 +11,7 @@
#include <featctrl.h>
/* List of registered feature controllers */
-static LIST_HEAD(of_feature_controllers);
+LIST_HEAD(of_feature_controllers);
/**
* feature_controller_register() - Register a feature controller
diff --git a/include/featctrl.h b/include/featctrl.h
index 6f99c96b8aec..c24b12515d7a 100644
--- a/include/featctrl.h
+++ b/include/featctrl.h
@@ -15,6 +15,8 @@ struct feature_controller {
enum { FEATCTRL_GATED = 0, FEATCTRL_OKAY = 1 };
+extern struct list_head of_feature_controllers;
+
int feature_controller_register(struct feature_controller *);
#ifdef CONFIG_FEATURE_CONTROLLER
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 35/44] net: dsa: export dsa_switch_list
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (33 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 34/44] driver: featctrl: export of_feature_controllers Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 36/44] usb: export usb_host_list Ahmad Fatoum
` (10 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This list will be used by the upcoming bfetch command to
determine whether the running barebox has any DSA drivers bound.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/net/dsa.c | 4 ++++
include/dsa.h | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/drivers/net/dsa.c b/drivers/net/dsa.c
index 537e9dd72ac6..667297e8fea3 100644
--- a/drivers/net/dsa.c
+++ b/drivers/net/dsa.c
@@ -6,6 +6,8 @@
#include <of_net.h>
#include <param.h>
+LIST_HEAD(dsa_switch_list);
+
u32 dsa_user_ports(struct dsa_switch *ds)
{
u32 mask = 0;
@@ -472,6 +474,8 @@ int dsa_register_switch(struct dsa_switch *ds)
ds->tx_buf = dma_alloc(DSA_PKTSIZE);
+ list_add_tail(&ds->list, &dsa_switch_list);
+
return 0;
}
EXPORT_SYMBOL_GPL(dsa_register_switch);
diff --git a/include/dsa.h b/include/dsa.h
index ecf7c4f429f3..b106d5474f7b 100644
--- a/include/dsa.h
+++ b/include/dsa.h
@@ -7,6 +7,7 @@
#define __DSA_H__
#include <linux/phy.h>
+#include <linux/list.h>
#include <net.h>
/**
@@ -88,6 +89,7 @@ struct dsa_switch {
u32 phys_mii_mask;
void *priv;
u32 forwarding_enable;
+ struct list_head list;
};
static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)
@@ -98,6 +100,8 @@ static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)
return ds->dp[p];
}
+extern struct list_head dsa_switch_list;
+
int dsa_register_switch(struct dsa_switch *ds);
u32 dsa_user_ports(struct dsa_switch *ds);
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 36/44] usb: export usb_host_list
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (34 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 35/44] net: dsa: export dsa_switch_list Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 37/44] pstore: export pstore_is_ready Ahmad Fatoum
` (9 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This list will be used by the upcoming bfetch command to
determine whether the running barebox has USB hosts registered.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/usb/core/usb.c | 8 ++++----
include/linux/usb/usb.h | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index d144e9840916..ae87137447c7 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -48,7 +48,7 @@
static int dev_count;
static int dev_index;
-static LIST_HEAD(host_list);
+LIST_HEAD(usb_host_list);
LIST_HEAD(usb_device_list);
static void print_usb_device(struct usb_device *dev)
@@ -81,7 +81,7 @@ static int usb_hw_detect(struct device *dev)
{
struct usb_host *host;
- list_for_each_entry(host, &host_list, list) {
+ list_for_each_entry(host, &usb_host_list, list) {
if (dev == host->hw_dev)
return usb_host_detect(host);
}
@@ -91,7 +91,7 @@ static int usb_hw_detect(struct device *dev)
int usb_register_host(struct usb_host *host)
{
- list_add_tail(&host->list, &host_list);
+ list_add_tail(&host->list, &usb_host_list);
host->busnum = host_busnum++;
slice_init(&host->slice, dev_name(host->hw_dev));
if (!host->hw_dev->detect)
@@ -653,7 +653,7 @@ int usb_rescan(void)
pr_info("USB: scanning bus for devices...\n");
- list_for_each_entry(host, &host_list, list) {
+ list_for_each_entry(host, &usb_host_list, list) {
ret = usb_host_detect(host);
if (ret)
continue;
diff --git a/include/linux/usb/usb.h b/include/linux/usb/usb.h
index f2cc69751064..cc994fdff1e6 100644
--- a/include/linux/usb/usb.h
+++ b/include/linux/usb/usb.h
@@ -482,6 +482,7 @@ int otg_device_get_mode(struct device *dev);
extern struct bus_type otg_bus_type;
extern struct list_head usb_device_list;
+extern struct list_head usb_host_list;
bool usb_hub_is_root_hub(struct usb_device *hdev);
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 37/44] pstore: export pstore_is_ready
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (35 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 36/44] usb: export usb_host_list Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 38/44] pinctrl: export pinctrl_list Ahmad Fatoum
` (8 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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 functional pstore support.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
fs/pstore/platform.c | 5 +++++
include/linux/pstore.h | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 50a1bffdd053..3157cc90d514 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -46,6 +46,11 @@ void pstore_set_kmsg_bytes(int bytes)
static int pstore_ready;
+bool pstore_is_ready(void)
+{
+ return pstore_ready;
+}
+
void pstore_log(const char *str)
{
uint64_t id;
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 90e3bd2d4255..a3e6a26be94c 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -83,6 +83,7 @@ struct pstore_info {
#ifdef CONFIG_FS_PSTORE
extern int pstore_register(struct pstore_info *);
extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
+extern bool pstore_is_ready(void);
extern void pstore_log(const char *msg);
#else
static inline int
@@ -95,6 +96,10 @@ pstore_cannot_block_path(enum kmsg_dump_reason reason)
{
return false;
}
+static inline bool pstore_is_ready(void)
+{
+ return false;
+}
static inline void pstore_log(const char *msg)
{
}
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 38/44] pinctrl: export pinctrl_list
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (36 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 37/44] pstore: export pstore_is_ready Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 39/44] clk: implement clk_have_nonfixed_providers Ahmad Fatoum
` (7 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This list will be used by the upcoming bfetch command to
determine whether the running barebox has pinctrl devices bound.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/pinctrl/pinctrl.c | 2 +-
include/linux/pinctrl/consumer.h | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl.c b/drivers/pinctrl/pinctrl.c
index dd0ed156ec9e..106a4423184c 100644
--- a/drivers/pinctrl/pinctrl.c
+++ b/drivers/pinctrl/pinctrl.c
@@ -18,7 +18,7 @@ struct pinctrl_state {
struct property prop;
};
-static LIST_HEAD(pinctrl_list);
+LIST_HEAD(pinctrl_list);
static struct pinctrl_device *pin_to_pinctrl(unsigned int pin)
{
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index c13f9822ab1a..3c99e9d189f2 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -4,6 +4,7 @@
#include <linux/errno.h>
#include <linux/err.h>
+#include <linux/list.h>
#include <device.h>
struct device;
@@ -11,6 +12,8 @@ struct device_node;
struct pinctrl;
+extern struct list_head pinctrl_list;
+
#ifdef CONFIG_PINCTRL
struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *pinctrl,
const char *name);
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 39/44] clk: implement clk_have_nonfixed_providers
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (37 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 38/44] pinctrl: export pinctrl_list Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-13 5:38 ` Sascha Hauer
2025-08-11 12:28 ` [PATCH 40/44] driver: bus: export get_bus_by_name Ahmad Fatoum
` (6 subsequent siblings)
45 siblings, 1 reply; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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 regulators for board-level oscillators.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
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] 53+ messages in thread
* [PATCH 40/44] driver: bus: export get_bus_by_name
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (38 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 39/44] clk: implement clk_have_nonfixed_providers Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 41/44] fimware: arm_scmi: export scmi_list Ahmad Fatoum
` (5 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This function will be called from the upcoming bfetch command to
reference an unexported bus.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/base/bus.c | 3 ++-
include/linux/device/bus.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 2595c22209b4..7ee5959e8b9f 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -4,13 +4,14 @@
*/
#include <common.h>
+#include <linux/device/bus.h>
#include <driver.h>
#include <errno.h>
#include <of.h>
DEFINE_DEV_CLASS(bus_class, "bus");
-static struct bus_type *get_bus_by_name(const char *name)
+struct bus_type *get_bus_by_name(const char *name)
{
struct bus_type *bus;
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index 2364645bad4a..678a7ffa8a4f 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -22,6 +22,7 @@ struct bus_type {
int bus_register(struct bus_type *bus);
int device_match(struct device *dev, const struct driver *drv);
+struct bus_type *get_bus_by_name(const char *name);
extern struct class bus_class;
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 41/44] fimware: arm_scmi: export scmi_list
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (39 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 40/44] driver: bus: export get_bus_by_name Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 42/44] block: define BLK_TYPE_COUNT as last enum blk_type value Ahmad Fatoum
` (4 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This list will be used by the upcoming bfetch command to
determine whether the running barebox has SCMI support at runtime.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
drivers/firmware/arm_scmi/driver.c | 2 +-
include/linux/scmi_protocol.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 0048cc012223..bbb62dd5191a 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -38,7 +38,7 @@ static DEFINE_IDR(scmi_protocols);
static DEFINE_SPINLOCK(protocol_lock);
/* List of all SCMI devices active in system */
-static LIST_HEAD(scmi_list);
+LIST_HEAD(scmi_list);
/* Protection for the entire list */
static DEFINE_MUTEX(scmi_list_mutex);
/* Track the unique id for the transfers for debug & profiling purpose */
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index c9cacb7f617a..b73b88cea94b 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -691,4 +691,6 @@ scmi_driver_register(struct scmi_driver *driver)
struct scmi_protocol;
int scmi_protocol_register(const struct scmi_protocol *proto);
+extern struct list_head scmi_list;
+
#endif /* _LINUX_SCMI_PROTOCOL_H */
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 42/44] block: define BLK_TYPE_COUNT as last enum blk_type value
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (40 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 41/44] fimware: arm_scmi: export scmi_list Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 43/44] commands: introduce bfetch command Ahmad Fatoum
` (3 subsequent siblings)
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This makes it easier for code that consumes this information to size
arrays that hold statistics.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
include/block.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/block.h b/include/block.h
index b66830c8943e..fc7a0a32fb2d 100644
--- a/include/block.h
+++ b/include/block.h
@@ -28,6 +28,7 @@ enum blk_type {
BLK_TYPE_NVME,
BLK_TYPE_VIRTUAL,
BLK_TYPE_MMC,
+ BLK_TYPE_COUNT,
};
const char *blk_type_str(enum blk_type);
--
2.39.5
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH 43/44] commands: introduce bfetch command
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (41 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 42/44] block: define BLK_TYPE_COUNT as last enum blk_type value Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-12 10:39 ` Sascha Hauer
2025-08-11 12:28 ` [PATCH 44/44] configs: enable bfetch in some popular defconfigs Ahmad Fatoum
` (2 subsequent siblings)
45 siblings, 1 reply; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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>
---
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..8f78a6fa8652
--- /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\n");
+
+ /* 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\n",
+ 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] 53+ messages in thread
* [PATCH 44/44] configs: enable bfetch in some popular defconfigs
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (42 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 43/44] commands: introduce bfetch command Ahmad Fatoum
@ 2025-08-11 12:28 ` Ahmad Fatoum
2025-08-12 10:29 ` [PATCH 00/44] commands: add bfetch/buds of command redirection Sascha Hauer
2025-08-13 5:48 ` (subset) " Sascha Hauer
45 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-11 12:28 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>
---
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 bb4f487de976..fbe80cc2993e 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 550b9b07f491..95f8e497fc3a 100644
--- a/arch/arm/configs/multi_v8_defconfig
+++ b/arch/arm/configs/multi_v8_defconfig
@@ -81,6 +81,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] 53+ messages in thread
* Re: [PATCH 23/44] optee: add revision info to tee devinfo output
2025-08-11 12:28 ` [PATCH 23/44] optee: add revision info to tee devinfo output Ahmad Fatoum
@ 2025-08-12 9:35 ` Sascha Hauer
2025-08-12 9:44 ` Ahmad Fatoum
0 siblings, 1 reply; 53+ messages in thread
From: Sascha Hauer @ 2025-08-12 9:35 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Aug 11, 2025 at 02:28:03PM +0200, Ahmad Fatoum wrote:
> 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>
> ---
> drivers/tee/optee/smc_abi.c | 16 +++++++++++-----
> drivers/tee/tee_core.c | 20 +++++++++++++++++++-
> 2 files changed, 30 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
> index aab8ebb186ed..0b8d581cf19b 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,14 @@ 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);
> +
> + pr_info("revision %s\n", param->get(dev, param));
In 20/44 you protected this with a if (!IS_ERR(param)). Don't we need this
here as well?
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH 23/44] optee: add revision info to tee devinfo output
2025-08-12 9:35 ` Sascha Hauer
@ 2025-08-12 9:44 ` Ahmad Fatoum
0 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-12 9:44 UTC (permalink / raw)
To: Sascha Hauer, Ahmad Fatoum; +Cc: barebox
Hi Sascha,
On 8/12/25 11:35, Sascha Hauer wrote:
> On Mon, Aug 11, 2025 at 02:28:03PM +0200, Ahmad Fatoum wrote:
>> 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>
>> ---
>> drivers/tee/optee/smc_abi.c | 16 +++++++++++-----
>> drivers/tee/tee_core.c | 20 +++++++++++++++++++-
>> 2 files changed, 30 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
>> index aab8ebb186ed..0b8d581cf19b 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,14 @@ 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);
>> +
>> + pr_info("revision %s\n", param->get(dev, param));
>
> In 20/44 you protected this with a if (!IS_ERR(param)). Don't we need this
> here as well?
Yes, good point. I will add a helper that does this check and use if for
v2 (which will hopefully be much shorter, because the rest is applied? ;-)
Cheers,
Ahmad
>
> Sascha
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH 00/44] commands: add bfetch/buds of command redirection
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (43 preceding siblings ...)
2025-08-11 12:28 ` [PATCH 44/44] configs: enable bfetch in some popular defconfigs Ahmad Fatoum
@ 2025-08-12 10:29 ` Sascha Hauer
2025-08-12 11:23 ` Ahmad Fatoum
2025-08-13 5:48 ` (subset) " Sascha Hauer
45 siblings, 1 reply; 53+ messages in thread
From: Sascha Hauer @ 2025-08-12 10:29 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Aug 11, 2025 at 02:27:40PM +0200, Ahmad Fatoum wrote:
> Inspired by U-Boot's addition of the ufetch command and the neofetch
> utility for Linux, add a similar command to barebox.
>
> The command is meant to fancily show off a barebox port with some
> colored ASCII art. The usual alternative is a screenshot of a barebox
> boot up and prompt, which doesn't look fancy, because a first port nearly
> always contains some warning/error messages (e.g. because there is no
> bootsource available and net boot is unconfigured). Example:
>
> https://raw.githubusercontent.com/a3f/a3f.github.io/refs/heads/master/img/bfetch.png
>
> This series also includes an abnormal amount of Yakshaving.
>
> Understandably, we need to export a lot of helpers and lists for bfetch
> to be able to enumerate what features are available at runtime.
>
> For some things like what CPU we are running on, what uptime we have or
> what's the TEE's implementation ID, we readily have code that prints
> to stdout, but it is not reusable because we do not buffer console
> output streams and thus no command output capture or piping support.
>
> But even if we had piping, we would need to manipulate strings to split
> lines into key/value pairs.
>
> Instead, let's rethink the problem: We have commands like cpuinfo, which
> format a table with key/value pairs and print it to out. Then the UNIX
> way would be to use awk/grep/sed/perl or whatever to separate them out
> again.
>
> Why not skip that and have commands directly return an object
> with key/value pairs (attributes) or more complex data structures
> like PowerShell is able to do?
>
> This series does exactly that. Device parameters are now associated
> with a struct bobject and that bobject can be returned and consumed
> by commands without requiring association with a device.
>
> This mechanism should be able to bring support for the pipe operator
> to barebox' shell once the critical commands are adapted to use it and
> there exists a way for commands to report whether they support
> structured I/O or not. As I am still figuring out how to do that,
> I did not include a command that captures structured output to
> a variable, but that would follow in future.
Very nice!
How about something along the lines:
struct device structio_device = {
.name = "structio",
.id = DEVICE_ID_SINGLE,
};
static int do_structio(int argc, char *argv[])
{
int ret;
active_capture = &structio_device.bobject;
bobject_del(active_capture);
/* TODO: merge argv[1-x] to a single string */
ret = run_command(argv[1]);
active_capture = NULL;
return ret;
}
static int structio_init(void)
{
return register_device(&structio_device);
}
late_initcall(structio_init);
BAREBOX_CMD_START(structio)
.cmd = do_structio,
BAREBOX_CMD_DESC("run with structio")
BAREBOX_CMD_GROUP(CMD_GRP_INFO)
BAREBOX_CMD_END
With this you could do a
structio cpuinfo; echo $structio.core
We would have to replace characters like whitespaces and hyphens in the
variablenames though.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH 43/44] commands: introduce bfetch command
2025-08-11 12:28 ` [PATCH 43/44] commands: introduce bfetch command Ahmad Fatoum
@ 2025-08-12 10:39 ` Sascha Hauer
2025-08-12 11:09 ` Ahmad Fatoum
0 siblings, 1 reply; 53+ messages in thread
From: Sascha Hauer @ 2025-08-12 10:39 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Aug 11, 2025 at 02:28:23PM +0200, Ahmad Fatoum wrote:
> 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
> .=*@@@@@@@@@@@%*-.
> -+%@@@@%+:
> -@@- :==. :@@-
> :**. .**:
Commands like cpuinfo and uptime are not selected by bfetch, but used
unconditionally, so we might get some not-so-fancy
cpuinfo: No such file or directory
uptime: No such file or directory
messages in the bfetch output.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH 43/44] commands: introduce bfetch command
2025-08-12 10:39 ` Sascha Hauer
@ 2025-08-12 11:09 ` Ahmad Fatoum
0 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-12 11:09 UTC (permalink / raw)
To: Sascha Hauer, Ahmad Fatoum; +Cc: barebox
Hi Sascha,
On 12.08.25 12:39, Sascha Hauer wrote:
> On Mon, Aug 11, 2025 at 02:28:23PM +0200, Ahmad Fatoum wrote:
>> 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
>> .=*@@@@@@@@@@@%*-.
>> -+%@@@@%+:
>> -@@- :==. :@@-
>> :**. .**:
>
> Commands like cpuinfo and uptime are not selected by bfetch, but used
> unconditionally, so we might get some not-so-fancy
>
> cpuinfo: No such file or directory
> uptime: No such file or directory
>
> messages in the bfetch output.
Oh, that's decidedly not fancy. I wil suppress the error message when in structio
context for v2.
Cheers,
Ahmad
>
> Sascha
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH 00/44] commands: add bfetch/buds of command redirection
2025-08-12 10:29 ` [PATCH 00/44] commands: add bfetch/buds of command redirection Sascha Hauer
@ 2025-08-12 11:23 ` Ahmad Fatoum
0 siblings, 0 replies; 53+ messages in thread
From: Ahmad Fatoum @ 2025-08-12 11:23 UTC (permalink / raw)
To: Sascha Hauer, Ahmad Fatoum; +Cc: barebox
Hello Sascha,
On 12.08.25 12:29, Sascha Hauer wrote:
> On Mon, Aug 11, 2025 at 02:27:40PM +0200, Ahmad Fatoum wrote:
>> This series does exactly that. Device parameters are now associated
>> with a struct bobject and that bobject can be returned and consumed
>> by commands without requiring association with a device.
>>
>> This mechanism should be able to bring support for the pipe operator
>> to barebox' shell once the critical commands are adapted to use it and
>> there exists a way for commands to report whether they support
>> structured I/O or not. As I am still figuring out how to do that,
>> I did not include a command that captures structured output to
>> a variable, but that would follow in future.
>
> Very nice!
>
> How about something along the lines:
>
> struct device structio_device = {
> .name = "structio",
> .id = DEVICE_ID_SINGLE,
> };
bobjects already have a local flag. I think we should rather have a
bobject_export() that clears the flag on an existing object and makes
it available globally. Code will need to be adapted to loop through
global bobjects instead of devices.
Then there is the matter that:
- many commands return lists or a tree of objects (e.g. iomem,
clk_dump, findmnt), so structio should perhaps
- We will probably want an error bobject that not only holds an
error code, but also a message.
(Future teaser: Once we have support for bobject trees, every
structio command output can be trivially formatted as JSON
output for test suite consumption!)
> static int do_structio(int argc, char *argv[])
> {
> int ret;
>
> active_capture = &structio_device.bobject;
>
> bobject_del(active_capture);
>
> /* TODO: merge argv[1-x] to a single string */
> ret = run_command(argv[1]);
We have strjoin for that used in watch and time, but we should really
have a function that takes argv directly to avoid whitespace issues.
> static int structio_init(void)
> {
> return register_device(&structio_device);
> }
> late_initcall(structio_init);
I was thinking of a command that you pass in the variable name and the
bobject is exported using that name. That way you can call multiple
commands to collect the results and then operate on them.
Shell variable garbage collection should in this case take care to
free the bobjects.
That command would also check if structio is even supported for the
command to be executed and fail otherwise.
That's all future work though.
Cheers,
Ahmad
> BAREBOX_CMD_START(structio)
> .cmd = do_structio,
> BAREBOX_CMD_DESC("run with structio")
> BAREBOX_CMD_GROUP(CMD_GRP_INFO)
> BAREBOX_CMD_END
>
> With this you could do a
>
> structio cpuinfo; echo $structio.core
>
> We would have to replace characters like whitespaces and hyphens in the
> variablenames though.
>
> Sascha
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH 39/44] clk: implement clk_have_nonfixed_providers
2025-08-11 12:28 ` [PATCH 39/44] clk: implement clk_have_nonfixed_providers Ahmad Fatoum
@ 2025-08-13 5:38 ` Sascha Hauer
0 siblings, 0 replies; 53+ messages in thread
From: Sascha Hauer @ 2025-08-13 5:38 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Aug 11, 2025 at 02:28:19PM +0200, Ahmad Fatoum wrote:
> 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 regulators for board-level oscillators.
s/regulators/clocks/
Sascha
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
> ---
> 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
>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: (subset) [PATCH 00/44] commands: add bfetch/buds of command redirection
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
` (44 preceding siblings ...)
2025-08-12 10:29 ` [PATCH 00/44] commands: add bfetch/buds of command redirection Sascha Hauer
@ 2025-08-13 5:48 ` Sascha Hauer
45 siblings, 0 replies; 53+ messages in thread
From: Sascha Hauer @ 2025-08-13 5:48 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Mon, 11 Aug 2025 14:27:40 +0200, Ahmad Fatoum wrote:
> Inspired by U-Boot's addition of the ufetch command and the neofetch
> utility for Linux, add a similar command to barebox.
>
> The command is meant to fancily show off a barebox port with some
> colored ASCII art. The usual alternative is a screenshot of a barebox
> boot up and prompt, which doesn't look fancy, because a first port nearly
> always contains some warning/error messages (e.g. because there is no
> bootsource available and net boot is unconfigured). Example:
>
> [...]
Applied, thanks!
[01/44] driver: move device name definition into device.h
https://git.pengutronix.de/cgit/barebox/commit/?id=78d33fd1a777 (link may not be stable)
[02/44] driver: introduce common struct bobject
https://git.pengutronix.de/cgit/barebox/commit/?id=211d38eb0103 (link may not be stable)
[03/44] lib: param: rename dev_remove_param to param_remove
https://git.pengutronix.de/cgit/barebox/commit/?id=af5e8d5f08d6 (link may not be stable)
[04/44] param: implement dev_remove_parameters using param_remove
https://git.pengutronix.de/cgit/barebox/commit/?id=12b0e9f7baff (link may not be stable)
[05/44] lib: param: add dev_for_each_param helpers
https://git.pengutronix.de/cgit/barebox/commit/?id=b19b035e99b6 (link may not be stable)
[06/44] driver: initialize device parameters as part of bobject
https://git.pengutronix.de/cgit/barebox/commit/?id=01494fc0dd16 (link may not be stable)
[07/44] param: operate on bobjects instead of full devices
https://git.pengutronix.de/cgit/barebox/commit/?id=feef2e053ea4 (link may not be stable)
[08/44] commands: version: print value of CONFIG_NAME
https://git.pengutronix.de/cgit/barebox/commit/?id=3ba1359ac440 (link may not be stable)
[09/44] treewide: populate CONFIG_NAME for all configs in-tree
https://git.pengutronix.de/cgit/barebox/commit/?id=9b8385fbe4f8 (link may not be stable)
[10/44] test: py: change barebox_config from set to dict
https://git.pengutronix.de/cgit/barebox/commit/?id=99e4ab188caf (link may not be stable)
[11/44] test: add heuristic for guessing labgrid environment YAML
https://git.pengutronix.de/cgit/barebox/commit/?id=3c268e85898e (link may not be stable)
[12/44] usb: drop dead iSerialNumber parameter addition
https://git.pengutronix.de/cgit/barebox/commit/?id=4406cf2fd6dc (link may not be stable)
[13/44] drivers: use dev_add_param_uint32_fixed for IDs
https://git.pengutronix.de/cgit/barebox/commit/?id=76c3881b4a51 (link may not be stable)
[14/44] param: make bobject_add_param_fixed variadic
https://git.pengutronix.de/cgit/barebox/commit/?id=89eb9e8b4522 (link may not be stable)
[15/44] param: handle NULL gracefully in bobject_get_param
https://git.pengutronix.de/cgit/barebox/commit/?id=384b808eadc5 (link may not be stable)
[22/44] stringlist: implement string_list_empty
https://git.pengutronix.de/cgit/barebox/commit/?id=52bcc953af3c (link may not be stable)
[25/44] mtd: add devices to new mtd class
https://git.pengutronix.de/cgit/barebox/commit/?id=80050d10f158 (link may not be stable)
[26/44] nvmem: add devices to new nvmem class
https://git.pengutronix.de/cgit/barebox/commit/?id=e7a81d77636d (link may not be stable)
[27/44] nvmem: export functions to query NVMEM size
https://git.pengutronix.de/cgit/barebox/commit/?id=6155dd258bd8 (link may not be stable)
[28/44] video: add devices to new fb class
https://git.pengutronix.de/cgit/barebox/commit/?id=84a6fb6f5d1f (link may not be stable)
[29/44] security: blobgen: add easy way to check for existent providers
(no commit info)
[30/44] pmdomain: add easy way to check for provider support
https://git.pengutronix.de/cgit/barebox/commit/?id=8b2e8c80bbfd (link may not be stable)
[31/44] bbu: add easy way to check for existent providers
https://git.pengutronix.de/cgit/barebox/commit/?id=94ba8bd38096 (link may not be stable)
[32/44] firmware: add easy way to check for existent providers
https://git.pengutronix.de/cgit/barebox/commit/?id=a3d9dbed7f1e (link may not be stable)
[33/44] rtc: export rtc_class in header
https://git.pengutronix.de/cgit/barebox/commit/?id=5c0216a04109 (link may not be stable)
[34/44] driver: featctrl: export of_feature_controllers
https://git.pengutronix.de/cgit/barebox/commit/?id=4cdbe2c90f35 (link may not be stable)
[35/44] net: dsa: export dsa_switch_list
https://git.pengutronix.de/cgit/barebox/commit/?id=3bc835a170a9 (link may not be stable)
[36/44] usb: export usb_host_list
https://git.pengutronix.de/cgit/barebox/commit/?id=8d1e246f484e (link may not be stable)
[37/44] pstore: export pstore_is_ready
https://git.pengutronix.de/cgit/barebox/commit/?id=97909d7d58f6 (link may not be stable)
[38/44] pinctrl: export pinctrl_list
https://git.pengutronix.de/cgit/barebox/commit/?id=04fc0b090e4b (link may not be stable)
[40/44] driver: bus: export get_bus_by_name
https://git.pengutronix.de/cgit/barebox/commit/?id=8353464156ef (link may not be stable)
[41/44] fimware: arm_scmi: export scmi_list
https://git.pengutronix.de/cgit/barebox/commit/?id=c326e91075bc (link may not be stable)
[42/44] block: define BLK_TYPE_COUNT as last enum blk_type value
https://git.pengutronix.de/cgit/barebox/commit/?id=f3eebaa9c64a (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 53+ messages in thread
end of thread, other threads:[~2025-08-13 6:02 UTC | newest]
Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-11 12:27 [PATCH 00/44] commands: add bfetch/buds of command redirection Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 01/44] driver: move device name definition into device.h Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 02/44] driver: introduce common struct bobject Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 03/44] lib: param: rename dev_remove_param to param_remove Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 04/44] param: implement dev_remove_parameters using param_remove Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 05/44] lib: param: add dev_for_each_param helpers Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 06/44] driver: initialize device parameters as part of bobject Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 07/44] param: operate on bobjects instead of full devices Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 08/44] commands: version: print value of CONFIG_NAME Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 09/44] treewide: populate CONFIG_NAME for all configs in-tree Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 10/44] test: py: change barebox_config from set to dict Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 11/44] test: add heuristic for guessing labgrid environment YAML Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 12/44] usb: drop dead iSerialNumber parameter addition Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 13/44] drivers: use dev_add_param_uint32_fixed for IDs Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 14/44] param: make bobject_add_param_fixed variadic Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 15/44] param: handle NULL gracefully in bobject_get_param Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 16/44] common: introduce structured I/O Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 17/44] ARM: cpuinfo: support structio output Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 18/44] commands: uptime: enable structured I/O Ahmad Fatoum
2025-08-11 12:27 ` [PATCH 19/44] string: implement strv_length helper Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 20/44] ARM: psci: client: add PSCI version/method parameters Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 21/44] net: move netmask_to_prefix into header Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 22/44] stringlist: implement string_list_empty Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 23/44] optee: add revision info to tee devinfo output Ahmad Fatoum
2025-08-12 9:35 ` Sascha Hauer
2025-08-12 9:44 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 24/44] tee: enable structured I/O in devinfo handler Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 25/44] mtd: add devices to new mtd class Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 26/44] nvmem: add devices to new nvmem class Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 27/44] nvmem: export functions to query NVMEM size Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 28/44] video: add devices to new fb class Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 29/44] security: blobgen: add easy way to check for existent providers Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 30/44] pmdomain: add easy way to check for provider support Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 31/44] bbu: add easy way to check for existent providers Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 32/44] firmware: " Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 33/44] rtc: export rtc_class in header Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 34/44] driver: featctrl: export of_feature_controllers Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 35/44] net: dsa: export dsa_switch_list Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 36/44] usb: export usb_host_list Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 37/44] pstore: export pstore_is_ready Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 38/44] pinctrl: export pinctrl_list Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 39/44] clk: implement clk_have_nonfixed_providers Ahmad Fatoum
2025-08-13 5:38 ` Sascha Hauer
2025-08-11 12:28 ` [PATCH 40/44] driver: bus: export get_bus_by_name Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 41/44] fimware: arm_scmi: export scmi_list Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 42/44] block: define BLK_TYPE_COUNT as last enum blk_type value Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 43/44] commands: introduce bfetch command Ahmad Fatoum
2025-08-12 10:39 ` Sascha Hauer
2025-08-12 11:09 ` Ahmad Fatoum
2025-08-11 12:28 ` [PATCH 44/44] configs: enable bfetch in some popular defconfigs Ahmad Fatoum
2025-08-12 10:29 ` [PATCH 00/44] commands: add bfetch/buds of command redirection Sascha Hauer
2025-08-12 11:23 ` Ahmad Fatoum
2025-08-13 5:48 ` (subset) " Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox