mailarchive of the pengutronix oss-tools mailing list
 help / color / mirror / Atom feed
* [OSS-Tools] [PATCH dt-utils 1/5] meson.build: fix building with -Dbarebox-state=false
@ 2026-01-27 12:12 Enrico Jörns
  2026-01-27 12:12 ` [OSS-Tools] [PATCH dt-utils 2/5] state: helpful error message if state GUID cannot be found Enrico Jörns
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Enrico Jörns @ 2026-01-27 12:12 UTC (permalink / raw)
  To: oss-tools

Since barebox-state is built uconditionally, but the defintion of
sources_barebox_state is conditional, a build for barebox-state=false
will fail with:

| ERROR: Unknown variable "sources_barebox_state".

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
---
 meson.build | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/meson.build b/meson.build
index bf60171..8c7b8b9 100644
--- a/meson.build
+++ b/meson.build
@@ -148,14 +148,16 @@ libdt = shared_library('dt-utils',
   version: '@0@.@1@.@2@'.format(lt_current - lt_age, lt_age, lt_revision),
   install : true)
 
-executable('barebox-state',
-  sources_barebox_state,
-  include_directories : incdir,
-  link_args : ld_flags,
-  c_args : ['-include', meson.current_build_dir() / 'version.h'],
-  dependencies : [versiondep],
-  link_with : libdt,
-  install : true)
+if get_option('barebox-state')
+  executable('barebox-state',
+    sources_barebox_state,
+    include_directories : incdir,
+    link_args : ld_flags,
+    c_args : ['-include', meson.current_build_dir() / 'version.h'],
+    dependencies : [versiondep],
+    link_with : libdt,
+    install : true)
+endif
 
 executable('fdtdump',
   sources_fdtdump,
-- 
2.47.3




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [OSS-Tools] [PATCH dt-utils 2/5] state: helpful error message if state GUID cannot be found
  2026-01-27 12:12 [OSS-Tools] [PATCH dt-utils 1/5] meson.build: fix building with -Dbarebox-state=false Enrico Jörns
@ 2026-01-27 12:12 ` Enrico Jörns
  2026-01-27 12:12 ` [OSS-Tools] [PATCH dt-utils 3/5] libdt: error handling for udev read of ID_PART_TABLE_TYPE Enrico Jörns
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Enrico Jörns @ 2026-01-27 12:12 UTC (permalink / raw)
  To: oss-tools

Port of barebox commit:

| state: helpful error message if state GUID cannot be found
|
| So far, if the user didn't specify a valid GPT UID, state initialization
| failed with the not so helpful error message:
|
| | ERROR: state state.of: probe failed: Invalid argument
|
| Improve this by also providing a helpful error message.
|
| Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
| Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
| Link: https://lore.barebox.org/20260113132444.3808198-1-ejo@pengutronix.de
| Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
---
 src/barebox-state/state.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/barebox-state/state.c b/src/barebox-state/state.c
index 3b02624..851f595 100644
--- a/src/barebox-state/state.c
+++ b/src/barebox-state/state.c
@@ -646,6 +646,7 @@ struct state *state_new_from_node(struct device_node *node, bool readonly)
 	if (cdev_is_block_disk(cdev)) {
 		cdev = cdev_find_child_by_gpt_typeuuid(cdev, &barebox_state_partition_guid);
 		if (IS_ERR(cdev)) {
+			dev_err(&state->dev, "cannot find backend GPT partition by PartitionTypeGUID\n");
 			ret = -EINVAL;
 			goto out_release_state;
 		}
-- 
2.47.3




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [OSS-Tools] [PATCH dt-utils 3/5] libdt: error handling for udev read of ID_PART_TABLE_TYPE
  2026-01-27 12:12 [OSS-Tools] [PATCH dt-utils 1/5] meson.build: fix building with -Dbarebox-state=false Enrico Jörns
  2026-01-27 12:12 ` [OSS-Tools] [PATCH dt-utils 2/5] state: helpful error message if state GUID cannot be found Enrico Jörns
@ 2026-01-27 12:12 ` Enrico Jörns
  2026-01-27 12:13 ` [OSS-Tools] [PATCH dt-utils 4/5] libdt: print error if device is not GPT-partitioned Enrico Jörns
  2026-01-27 12:13 ` [OSS-Tools] [PATCH dt-utils 5/5] libdt: print error for failed udev_new() for consistency Enrico Jörns
  3 siblings, 0 replies; 5+ messages in thread
From: Enrico Jörns @ 2026-01-27 12:12 UTC (permalink / raw)
  To: oss-tools

Since the code does not differentiate between not being able to detect
the partition type and being non-GPT, at least print an error message if
udev_device_get_property_value() returned NULL.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
---
 src/libdt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/libdt.c b/src/libdt.c
index 72e8ab4..1bef154 100644
--- a/src/libdt.c
+++ b/src/libdt.c
@@ -2337,6 +2337,9 @@ static int cdev_from_block_device(struct udev_device *dev,
 
 		cdev->devpath = strdup(udev_device_get_devnode(best_match));
 		part_type = udev_device_get_property_value(best_match, "ID_PART_TABLE_TYPE");
+		if (!part_type) {
+			fprintf(stderr, "Can't read property ID_PART_TABLE_TYPE\n");
+		}
 		cdev->is_gpt_partitioned = part_type && !strcmp(part_type, "gpt");
 	}
 
-- 
2.47.3




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [OSS-Tools] [PATCH dt-utils 4/5] libdt: print error if device is not GPT-partitioned
  2026-01-27 12:12 [OSS-Tools] [PATCH dt-utils 1/5] meson.build: fix building with -Dbarebox-state=false Enrico Jörns
  2026-01-27 12:12 ` [OSS-Tools] [PATCH dt-utils 2/5] state: helpful error message if state GUID cannot be found Enrico Jörns
  2026-01-27 12:12 ` [OSS-Tools] [PATCH dt-utils 3/5] libdt: error handling for udev read of ID_PART_TABLE_TYPE Enrico Jörns
@ 2026-01-27 12:13 ` Enrico Jörns
  2026-01-27 12:13 ` [OSS-Tools] [PATCH dt-utils 5/5] libdt: print error for failed udev_new() for consistency Enrico Jörns
  3 siblings, 0 replies; 5+ messages in thread
From: Enrico Jörns @ 2026-01-27 12:13 UTC (permalink / raw)
  To: oss-tools

This might really help debugging. Since we cannot differentiate between
not detecting the type properly and detecting it is not GPT, use a
wording that indicates this.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
---
 src/libdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/libdt.c b/src/libdt.c
index 1bef154..f51ed17 100644
--- a/src/libdt.c
+++ b/src/libdt.c
@@ -2817,8 +2817,10 @@ struct cdev *cdev_find_child_by_gpt_typeuuid(struct cdev *cdev, guid_t *typeuuid
 	int ret;
 
 
-	if (!cdev->is_gpt_partitioned)
+	if (!cdev->is_gpt_partitioned) {
+		fprintf(stderr, "%s is not detected as GPT-partitioned\n", cdev->devpath);
 		return ERR_PTR(-EINVAL);
+	}
 
 	udev = udev_new();
 	if (!udev)
-- 
2.47.3




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [OSS-Tools] [PATCH dt-utils 5/5] libdt: print error for failed udev_new() for consistency
  2026-01-27 12:12 [OSS-Tools] [PATCH dt-utils 1/5] meson.build: fix building with -Dbarebox-state=false Enrico Jörns
                   ` (2 preceding siblings ...)
  2026-01-27 12:13 ` [OSS-Tools] [PATCH dt-utils 4/5] libdt: print error if device is not GPT-partitioned Enrico Jörns
@ 2026-01-27 12:13 ` Enrico Jörns
  3 siblings, 0 replies; 5+ messages in thread
From: Enrico Jörns @ 2026-01-27 12:13 UTC (permalink / raw)
  To: oss-tools

All other calls of udev_new() in libdt.c print this error string, thus
print it here, too.

Signed-off-by: Enrico Jörns <ejo@pengutronix.de>
---
 src/libdt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/libdt.c b/src/libdt.c
index f51ed17..cecdb41 100644
--- a/src/libdt.c
+++ b/src/libdt.c
@@ -2823,8 +2823,10 @@ struct cdev *cdev_find_child_by_gpt_typeuuid(struct cdev *cdev, guid_t *typeuuid
 	}
 
 	udev = udev_new();
-	if (!udev)
+	if (!udev) {
+		fprintf(stderr, "Can't create udev\n");
 		return ERR_PTR(-ENOMEM);
+	}
 
 	parent = udev_from_devpath(udev, cdev->devpath);
 	if (!parent)
-- 
2.47.3




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-27 12:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-27 12:12 [OSS-Tools] [PATCH dt-utils 1/5] meson.build: fix building with -Dbarebox-state=false Enrico Jörns
2026-01-27 12:12 ` [OSS-Tools] [PATCH dt-utils 2/5] state: helpful error message if state GUID cannot be found Enrico Jörns
2026-01-27 12:12 ` [OSS-Tools] [PATCH dt-utils 3/5] libdt: error handling for udev read of ID_PART_TABLE_TYPE Enrico Jörns
2026-01-27 12:13 ` [OSS-Tools] [PATCH dt-utils 4/5] libdt: print error if device is not GPT-partitioned Enrico Jörns
2026-01-27 12:13 ` [OSS-Tools] [PATCH dt-utils 5/5] libdt: print error for failed udev_new() for consistency Enrico Jörns

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox