nsh/script: support rc.sysinit script

Follow: http://glennastory.net/boot/sysinit.html

This is first script that init runs is rc.sysinit. This
script does serval initialization tasks about basic service.

The boot sequence currently provided to the board level is:
board_earlyinitialize->
    board_lateinitialize(Peripherals driver, core driver, ...)->
	run rcS script(mount fs, run service) ->
	    board_appinitialize->

After this patch:
The boot sequence currently provided to the board level is:
board_earlyinitialize->
    board_lateinitialize(core driver,...)->
	run rc.sysinit script(mount fs, run core service) ->
	    board_appinitialize(Peripherals driver)->
		run rcS script(run other service)->

So, Peripheral drivers can do more with the file system and
core services.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong
2022-04-15 21:59:24 +08:00
committed by Petro Karashchenko
parent 768a21b587
commit 9f79bf183a
7 changed files with 97 additions and 34 deletions

View File

@@ -340,10 +340,17 @@
# define CONFIG_NSH_ROMFSMOUNTPT "/etc"
# endif
# ifndef CONFIG_NSH_SYSINITSCRIPT
# define CONFIG_NSH_SYSINITSCRIPT "init.d/rc.sysinit"
# endif
# ifndef CONFIG_NSH_INITSCRIPT
# define CONFIG_NSH_INITSCRIPT "init.d/rcS"
# endif
# undef NSH_SYSINITPATH
# define NSH_SYSINITPATH CONFIG_NSH_ROMFSMOUNTPT "/" CONFIG_NSH_SYSINITSCRIPT
# undef NSH_INITPATH
# define NSH_INITPATH CONFIG_NSH_ROMFSMOUNTPT "/" CONFIG_NSH_INITSCRIPT
@@ -829,6 +836,7 @@ int nsh_usbconsole(void);
int nsh_script(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
FAR const char *path);
#ifdef CONFIG_NSH_ROMFSETC
int nsh_sysinitscript(FAR struct nsh_vtbl_s *vtbl);
int nsh_initscript(FAR struct nsh_vtbl_s *vtbl);
#ifdef CONFIG_NSH_ROMFSRC
int nsh_loginscript(FAR struct nsh_vtbl_s *vtbl);