Re: [PATCH] rockchip: mkimage: fix mkimage -l for header v1

2024-06-14 Thread Kever Yang



On 2024/6/6 19:44, Quentin Schulz wrote:

From: Quentin Schulz 

There are two paths to reach this function, either through mkimage -l or
through dumpimage -l. The latter passes a NULL imagename while the
former passes an empty string. Therefore, let's make both tools behave
the same by handling the empty string the same way as for NULL.

Without this, the only way to get some information out of mkimage -l is
to provide "-n rk3399" for example, which isn't documented in the usage
of the tool.

Signed-off-by: Quentin Schulz 

Reviewed-by: Kever Yang 

Thanks,
- Kever

---
  tools/rkcommon.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/rkcommon.c b/tools/rkcommon.c
index 12c27b34eaa..3e52236b15a 100644
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -470,7 +470,7 @@ int rkcommon_verify_header(unsigned char *buf, int size,
 * If no 'imagename' is specified via the commandline (e.g. if this is
 * 'dumpimage -l' w/o any further constraints), we accept any spl_info.
 */
-   if (params->imagename == NULL)
+   if (params->imagename == NULL || !strlen(params->imagename))
return 0;
  
  	/* Match the 'imagename' against the 'spl_hdr' found */


---
base-commit: 4b992573b34b1586e323e27b177680a6efec1c76
change-id: 20240606-rkcommon-dumpimage-mkimage-58610cf07340

Best regards,


[PATCH] rockchip: mkimage: fix mkimage -l for header v1

2024-06-06 Thread Quentin Schulz
From: Quentin Schulz 

There are two paths to reach this function, either through mkimage -l or
through dumpimage -l. The latter passes a NULL imagename while the
former passes an empty string. Therefore, let's make both tools behave
the same by handling the empty string the same way as for NULL.

Without this, the only way to get some information out of mkimage -l is
to provide "-n rk3399" for example, which isn't documented in the usage
of the tool.

Signed-off-by: Quentin Schulz 
---
 tools/rkcommon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/rkcommon.c b/tools/rkcommon.c
index 12c27b34eaa..3e52236b15a 100644
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -470,7 +470,7 @@ int rkcommon_verify_header(unsigned char *buf, int size,
 * If no 'imagename' is specified via the commandline (e.g. if this is
 * 'dumpimage -l' w/o any further constraints), we accept any spl_info.
 */
-   if (params->imagename == NULL)
+   if (params->imagename == NULL || !strlen(params->imagename))
return 0;
 
/* Match the 'imagename' against the 'spl_hdr' found */

---
base-commit: 4b992573b34b1586e323e27b177680a6efec1c76
change-id: 20240606-rkcommon-dumpimage-mkimage-58610cf07340

Best regards,
-- 
Quentin Schulz