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

@@ -700,8 +700,9 @@ config NSH_ROMFSETC
default n
depends on FS_ROMFS
---help---
Mount a ROMFS filesystem at /etc and provide a startup script
at /etc/init.d/rcS. The default startup script will mount
Mount a ROMFS filesystem at /etc and provide a system init
script at /etc/init.d/rc.sysinit and a startup script
at /etc/init.d/rcS. The default system init script will mount
a FAT FS RAMDISK at /tmp but the logic is easily extensible.
if NSH_ROMFSETC
@@ -711,8 +712,9 @@ config NSH_CROMFSETC
default n
depends on FS_CROMFS
---help---
Mount a CROMFS filesystem at /etc and provide a compressed startup
script at /etc/init.d/rcS.
Mount a CROMFS filesystem at /etc and provide a compressed system
init script at /etc/init.d/rc.sysinit and a startup script
at /etc/init.d/rcS.
config NSH_ROMFSRC
bool "Support ROMFS login script"
@@ -734,6 +736,14 @@ config NSH_ROMFSMOUNTPT
can be changed with this setting. This must be a absolute path
beginning with '/'.
config NSH_SYSINITSCRIPT
string "Relative path to sysinit script"
default "init.d/rc.sysinit"
---help---
This is the relative path to the sysinit script within the mountpoint.
The default is init.d/rc.sysinit. This is a relative path and must not
start with '/'.
config NSH_INITSCRIPT
string "Relative path to startup script"
default "init.d/rcS"