diff --git a/nshlib/nsh_altconsole.c b/nshlib/nsh_altconsole.c index f003f4276..f407ceffd 100644 --- a/nshlib/nsh_altconsole.c +++ b/nshlib/nsh_altconsole.c @@ -257,12 +257,10 @@ int nsh_consolemain(int argc, FAR char *argv[]) usbtrace_enable(TRACE_BITSET); #endif - /* Execute the one-time start-up script. - * Any output will go to /dev/console. - */ +#if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_DISABLESCRIPT) + /* Execute the system init script */ -#ifdef CONFIG_NSH_ROMFSETC - nsh_initscript(&pstate->cn_vtbl); + nsh_sysinitscript(&pstate->cn_vtbl); #endif #ifdef CONFIG_NSH_NETINIT @@ -277,10 +275,17 @@ int nsh_consolemain(int argc, FAR char *argv[]) boardctl(BOARDIOC_FINALINIT, 0); #endif + /* Execute the one-time start-up script. + * Any output will go to /dev/console. + */ + +#ifdef CONFIG_NSH_ROMFSETC + nsh_initscript(&pstate->cn_vtbl); +#endif + /* First map stderr and stdout to alternative devices */ ret = nsh_clone_console(pstate); - if (ret < 0) { return ret; diff --git a/nshlib/nsh_usbconsole.c b/nshlib/nsh_usbconsole.c index 5ec2ac4c9..bdde01986 100644 --- a/nshlib/nsh_usbconsole.c +++ b/nshlib/nsh_usbconsole.c @@ -284,10 +284,10 @@ int nsh_consolemain(int argc, FAR char *argv[]) nsh_nullstdio(); #endif - /* Execute the one-time start-up script (output may go to /dev/null) */ +#if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_DISABLESCRIPT) + /* Execute the system init script */ -#ifdef CONFIG_NSH_ROMFSETC - nsh_initscript(&pstate->cn_vtbl); + nsh_sysinitscript(&pstate->cn_vtbl); #endif #ifdef CONFIG_NSH_NETINIT @@ -302,6 +302,12 @@ int nsh_consolemain(int argc, FAR char *argv[]) boardctl(BOARDIOC_FINALINIT, 0); #endif + /* Execute the one-time start-up script (output may go to /dev/null) */ + +#ifdef CONFIG_NSH_ROMFSETC + nsh_initscript(&pstate->cn_vtbl); +#endif + /* Now loop, executing creating a session for each USB connection */ for (; ; )