nuttx/boards/risc-v/esp32c3/esp32c3-devkit/src
Jiuzhu Dong de1c184e6c boards/sim: support rc.sysinit
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>
2022-04-21 12:54:53 +03:00
..
etc boards/sim: support rc.sysinit 2022-04-21 12:54:53 +03:00
.gitignore boards/esp32c3-devkit: Add etctmp to .gitignore 2021-07-06 09:49:43 -05:00
esp32c3_adc.c riscv/esp32c3: Add ESP32-C3 ADC driver 2021-05-18 09:20:46 -03:00
esp32c3_appinit.c Rename CONFIG_LIB_BOARDCTL to CONFIG_BOARDCTL 2021-08-06 13:58:26 +02:00
esp32c3_bmp180.c Don't include debug.h from public header file 2021-06-01 06:42:02 +09:00
esp32c3_board_spi.c arch/risc-v: Remove FAR from chip and board folder 2022-04-19 00:22:45 +03:00
esp32c3_board_spidev.c arch/risc-v: Remove FAR from chip and board folder 2022-04-19 00:22:45 +03:00
esp32c3_board_spislavedev.c arch/risc-v: Remove FAR from chip and board folder 2022-04-19 00:22:45 +03:00
esp32c3_board_wlan.c risc-v/esp32-c3: refactor the Wi-Fi board logic. 2021-09-09 20:14:04 +08:00
esp32c3_boot.c boards/risc-v/esp32c3-devkit: Include "config.h" in esp32c3_boot.c 2021-06-18 00:53:42 -05:00
esp32c3_bringup.c boards/risc-v/esp32c3: ESP32C3 TWAI (CAN) controller bringup for DevKitM-1. 2022-04-15 22:55:26 +08:00
esp32c3_gc9a01.c arch/risc-v: Remove FAR from chip and board folder 2022-04-19 00:22:45 +03:00
esp32c3_gpio.c arch/risc-v: Remove FAR from chip and board folder 2022-04-19 00:22:45 +03:00
esp32c3_i2c.c arch/risc-v: Remove FAR from chip and board folder 2022-04-19 00:22:45 +03:00
esp32c3_ioctl.c risc-v/esp32c3: Add board_ioctl and board_uniqueid 2021-07-05 23:12:17 -05:00
esp32c3_ledc.c riscv/esp32c3: Add ESP32-C3 LEDC(PWM) driver 2021-05-15 08:38:37 -03:00
esp32c3_oneshot.c arch/risc-v: Remove FAR from chip and board folder 2022-04-19 00:22:45 +03:00
esp32c3_reset.c boards/Kconfig: set BOARD_ASSERT_RESET_VALUE default value to be 1 2021-11-16 10:44:54 -03:00
esp32c3_spiflash.c arch/risc-v: Remove FAR from chip and board folder 2022-04-19 00:22:45 +03:00
esp32c3_st7735.c arch/risc-v: Remove FAR from chip and board folder 2022-04-19 00:22:45 +03:00
esp32c3_st7789.c arch/risc-v: Remove FAR from chip and board folder 2022-04-19 00:22:45 +03:00
esp32c3_twai.c boards/risc-v/esp32c3: ESP32C3 TWAI (CAN) controller bringup for DevKitM-1. 2022-04-15 22:55:26 +08:00
esp32c3_uid.c boards/esp32c3-devkit: Fix compiling error 2021-07-07 02:49:52 -05:00
esp32c3_wdt.c risc-v/esp32c3: Add support for MWDT0 and MWDT1 2021-02-22 17:18:01 +00:00
esp32c3-devkit.h boards/risc-v/esp32c3: ESP32C3 TWAI (CAN) controller bringup for DevKitM-1. 2022-04-15 22:55:26 +08:00
Makefile boards/sim: support rc.sysinit 2022-04-21 12:54:53 +03:00
README.txt boards/sim: support rc.sysinit 2022-04-21 12:54:53 +03:00

README
======

  Overview
  --------
  This directory contains logic to support a custom ROMFS system-init script
  and start-up script.  These scripts are used by by the NSH when it starts
  provided that CONFIG_NSH_ARCHROMFS=y.  These scripts provide a ROMFS volume
  that will be mounted at /etc and will look like this at run-time:

    NuttShell (NSH) NuttX-10.1.0-RC1
    MOTD: username=admin password=Administrator
    nsh> ls -Rl /etc
    /etc:
     dr-xr-xr-x       0 .
     -r--r--r--      20 group
     dr-xr-xr-x       0 init.d/
     -r--r--r--      35 passwd
    /etc/init.d:
     dr-xr-xr-x       0 ..
     -r--r--r--     110 rcS
     -r--r--r--     110 rc.sysinit
    nsh>

  /etc/init.d/rc.sysinit is system init script; /etc/init.d/rcS is the start-up
  script; /etc/passwd is a the password file.  It supports a single user:

    USERNAME:  admin
    PASSWORD:  Administrator

    nsh> cat /etc/passwd
    admin:8Tv+Hbmr3pLddSjtzL0kwC:0:0:/

  The encrypted passwords in the provided passwd file are only valid if the
  TEA key is set to:  012345678 9abcdef0 012345678 9abcdef0.  Changes to either
  the key or the password word will require regeneration of the nsh_romfimg.h
  header file.

  The format of the password file is:

    user:x:uid:gid:home

  Where:
    user:  User name
    x:     Encrypted password
    uid:   User ID (0 for now)
    gid:   Group ID (0 for now)
    home:  Login directory (/ for now)

  /etc/group is a group file.  It is not currently used.

    nsh> cat /etc/group
    root:*:0:root,admin

  The format of the group file is:

    group:x:gid:users

  Where:
    group:  The group name
    x:      Group password
    gid:    Group ID
    users:  A comma separated list of members of the group

  Updating the ROMFS File System
  ------------------------------
  The content on the nsh_romfsimg.h header file is generated from a sample
  directory structure. You can directly modify files under etc/ folder,
  The build system will regenerate nsh_romfsimg.h automatically.

  See the esp32c3-devkit/nsh configuration for an example of the use of this file
  system.

  Replacing the Password File
  ---------------------------
  The esp32c3-devkit/nsh configuration can also be used to create a new password file.
  First, make these configuration changes:

    1. Disable logins

       - CONFIG_NSH_CONSOLE_LOGIN=y
       + # CONFIG_NSH_CONSOLE_LOGIN is not set
         # CONFIG_NSH_TELNET_LOGIN is not set

    2. Move the password file to a write-able file system:

       - CONFIG_FSUTILS_PASSWD_PATH="/etc/passwd"
       + CONFIG_FSUTILS_PASSWD_PATH="/tmp/passwd"

    3. make the password file modifiable

       - CONFIG_FSUTILS_PASSWD_READONLY=y
       # CONFIG_FSUTILS_PASSWD_READONLY is not set

  Now rebuild the simulation.  No login should be required to enter the
  shell and you should find the 'useradd', 'userdel', and 'passwd' commands
  available in the help summary, provided that they are enabled.  Make
  certain that the 'useradd' command is not disabled:

      # CONFIG_NSH_DISABLE_USERADD is not set

  Use the NSH 'useradd' command to add new uses with new user passwords like:

    nsh> useradd <username> <password>

  Do this as many times as you would like.  Each time that you do this a new
  entry with an encrypted password will be added to the passwd file at
  /tmp/passwd.  You can see the passwd file like:

    nsh> cat /tmp/passwd

  When you are finished, you can simply copy the /tmp/passwd content from the
  'cat' command and paste it into an editor.  Make sure to remove any
  carriage returns that may have ended up on the file if you are using
  Windows.

  Then recreate the nsh_romfsimg.h file as described above.  In step 2,
  simply replace the old /etc/passwd file with the one in your editor.
  When you are finished, the new passwd file will be in the ROMFS file
  system at the path /etc/passwd.  When you restore the original NSH
  sim configuration, these are the passwords that will be used.