From 30a028d4e69fc927a257bd08bc1b939d2c2c50d3 Mon Sep 17 00:00:00 2001 From: Justin Hammond Date: Fri, 7 Aug 2026 16:54:15 +0800 Subject: [PATCH] examples/lvglterm: Let the shell be named something other than nsh. The terminal spawned "nsh" by a name compiled in, which finds nothing on a system that installs NSH under another name, as a kernel build does when NSH is the system's init: the program is /system/bin/init and no "nsh" exists at all. The terminal came up, took keystrokes, and had no shell behind it. The name is now configurable and still defaults to "nsh", so a bare name is looked up on PATH as before and a path is taken as given. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond --- examples/lvglterm/Kconfig | 10 ++++++++++ examples/lvglterm/lvglterm.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/lvglterm/Kconfig b/examples/lvglterm/Kconfig index 7c4a70683..dba596b44 100644 --- a/examples/lvglterm/Kconfig +++ b/examples/lvglterm/Kconfig @@ -75,3 +75,13 @@ config EXAMPLES_LVGLTERM_STACKSIZE default 16384 endif # EXAMPLES_LVGLTERM + +config EXAMPLES_LVGLTERM_SHELL + string "Shell to run in the terminal" + default "nsh" + depends on EXAMPLES_LVGLTERM + ---help--- + The program the terminal spawns. A bare name is looked up on + PATH; a path is taken as given, which is what a configuration + installing NSH under another name needs -- "/system/bin/init", + for instance, where NSH is the system's init. diff --git a/examples/lvglterm/lvglterm.c b/examples/lvglterm/lvglterm.c index f2dcb1f10..ad555cc55 100644 --- a/examples/lvglterm/lvglterm.c +++ b/examples/lvglterm/lvglterm.c @@ -93,7 +93,16 @@ /* NSH Task to be started */ -#define NSH_TASK "nsh" +/* The shell to run. A name is looked up on PATH, a path is taken as + * given, which matters where the shell is installed under another name, + * as it is when NSH is built as the system's init. + */ + +#ifdef CONFIG_EXAMPLES_LVGLTERM_SHELL +# define NSH_TASK CONFIG_EXAMPLES_LVGLTERM_SHELL +#else +# define NSH_TASK "nsh" +#endif /**************************************************************************** * Private Function Prototypes