From f2ebae771d26dc281073af9fd02b9db532ea8e8c Mon Sep 17 00:00:00 2001 From: Junbo Zheng Date: Fri, 24 Jul 2026 23:47:44 +0800 Subject: [PATCH] nshlib: add relative image path support in boot command cmd_boot passed the image path straight to boardctl(), which resolves it in a context that does not inherit the NSH shell cwd, so relative paths failed and only absolute paths worked. Use nsh_getfullpath() to resolve relative paths against the cwd before calling boardctl(). Signed-off-by: Junbo Zheng --- nshlib/nsh_syscmds.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c index 88db8c913..15ca82c46 100644 --- a/nshlib/nsh_syscmds.c +++ b/nshlib/nsh_syscmds.c @@ -405,6 +405,7 @@ int cmd_switchboot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) int cmd_boot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) { struct boardioc_boot_info_s info; + FAR char *fullpath = NULL; memset(&info, 0, sizeof(info)); @@ -421,7 +422,8 @@ int cmd_boot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) /* Go through */ case 1: - info.path = argv[1]; + fullpath = nsh_getfullpath(vtbl, argv[1]); + info.path = fullpath; /* Go through */ @@ -439,6 +441,7 @@ int cmd_boot(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) */ nsh_error(vtbl, g_fmtcmdfailed, argv[0], "boardctl", NSH_ERRNO); + nsh_freefullpath(fullpath); return ERROR; } #endif