diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-07-02 13:08:39 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-07-02 13:08:39 -0600 |
commit | d425428562f71a8a00bebed1238cfa632161a05f (patch) | |
tree | b82e38162c26cef16c1498b31bf2e09874e9496a | |
parent | 75f4d9bc277f7859adc27cdde6e6ec13463d2f0f (diff) | |
download | nuttx-d425428562f71a8a00bebed1238cfa632161a05f.tar.gz nuttx-d425428562f71a8a00bebed1238cfa632161a05f.tar.bz2 nuttx-d425428562f71a8a00bebed1238cfa632161a05f.zip |
SAMA5D3-EK: Enable the procfs file system in the NSH configuration
-rw-r--r-- | nuttx/configs/sama5d4-ek/README.txt | 99 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/include/nsh_romfsimg.h | 64 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/include/rcS.template | 8 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/nsh/defconfig | 10 |
4 files changed, 131 insertions, 50 deletions
diff --git a/nuttx/configs/sama5d4-ek/README.txt b/nuttx/configs/sama5d4-ek/README.txt index 09635e6ed..ce3c469f7 100644 --- a/nuttx/configs/sama5d4-ek/README.txt +++ b/nuttx/configs/sama5d4-ek/README.txt @@ -3287,8 +3287,8 @@ Configurations 6. This configuration has support for NSH built-in applications enabled. - 7. This configuration has support for the FAT and ROMFS file systems - built in. + 7. This configuration has support for the FAT, ROMFS, and PROCFS file + systems built in. The FAT file system includes long file name support. Please be aware that Microsoft claims patents against the long file name support (see @@ -3304,14 +3304,19 @@ Configurations CONFIG_FS_ROMFS=y : Enable ROMFS file system - 8. An NSH star-up script is provided by the ROMFS file system. The ROMFS + The ROMFS file system is enabled simply with: + + CONFIG_FS_PROCFS=y : Enable PROCFS file system + + 8. An NSH start-up script is provided by the ROMFS file system. The ROMFS file system is mounted at /etc and provides: |- dev/ - | `- ram0 + | |- ... + | `- ram0 : ROMFS block driver `- etc/ `- init.d/ - `- rcS + `- rcS : Start-up script (There will, of course, be other devices uner /dev include /dev/console, /dev/null, /dev/zero, /dev/random, etc.). @@ -3326,24 +3331,86 @@ Configurations The content of /etc/init.d/rcS can be see in the file rcS.template that can be found at: configs/sama5d4-ek/include/rcS.template: - mkrd -m 2 -s 512 1024 + # Mount the procfs file system at /proc + + mount -f procfs /proc + echo "rcS: Mounted /proc" + + # Create a RAMDISK at /dev/ram1, size 0.5MiB, format it with a FAT + # file system and mount it at /tmp + + mkrd -m 1 -s 512 1024 mkfatfs /dev/ram1 mount -t vfat /dev/ram1 /tmp + echo "rcS: Mounted /tmp" + + The above commands will mount the procfs file system at /proc and a + RAM disk at /tmp. - The above commands will create a RAM disk block device at /dev/ram1. - The RAM disk will take 0.4MiB of memory (512 x 1024). Then it will - create a FAT file system on the ram disk and mount it at /tmp. So - after NSH starts and runs the rcS script, we will have: + The second group of commands will: (1) Create a RAM disk block device + at /dev/ram1 (mkrd). The RAM disk will take 0.4MiB of memory (512 x + 1024). Then it will then: (2) create a FAT file system on the ram + disk (mkfatfs) and (3) mount it at /tmp (mount). + + So after NSH starts and runs the rcS script, we will have: |- dev/ - | |- ram0 - | `- ram2 + | |- ... + | `- ram0 : ROMFS block driver + | `- ram1 : RAM disk block driver |- etc/ | `- init.d/ - | `- rcS - `- tmp/ - - The /tmp directory can them be used for and scratch purpose. + `- rcS : Start-up script + |- proc/ + | |- 0/ : Information about Task ID 0 + | | |- cmdline + | | |- stack + | | |- status + | | `- group/ + | | |- fd + | | `- status + | |- 1/ : Information about Task ID 1 + | | `- ... : Same psuedo-directories as for Task ID 0 + | |- ... : ... + | |- n/ : Information about Task ID n + | | `- ... + | |- uptime : Processor uptime + `- tmp/ + + The /tmp directory can them be used for and scratch purpose. The + pseudo-files in the proc/ directory can be used to query properties + of NuttX. As examples: + + nsh> cat /proc/1/stack + StackBase: 0x2003b1e8 + StackSize: 2044 + + nsh> cat /proc/uptime + 31.89 + + nsh> cat /proc/1/status + Name: work + Type: Kernel thread + State: Signal wait + Priority: 192 + Scheduler: SCHED_FIFO + SigMask: 00000000 + + nsh> cat /proc/1/cmdline + work + + nsh> cat /proc/1/group/status + Flags: 0x00 + Members: 1 + + nsh> cat /proc/1/group/fd + + FD POS OFLAGS + 0 0 0003 + 1 0 0003 + 2 0 0003 + + SD RF TYP FLAGS 9. The Real Time Clock/Calendar (RTC) is enabled in this configuration. See the section entitled "RTC" above for detailed configuration diff --git a/nuttx/configs/sama5d4-ek/include/nsh_romfsimg.h b/nuttx/configs/sama5d4-ek/include/nsh_romfsimg.h index 49b0ad166..8b78c03f7 100644 --- a/nuttx/configs/sama5d4-ek/include/nsh_romfsimg.h +++ b/nuttx/configs/sama5d4-ek/include/nsh_romfsimg.h @@ -1,6 +1,6 @@ unsigned char romfs_img[] = { - 0x2d, 0x72, 0x6f, 0x6d, 0x31, 0x66, 0x73, 0x2d, 0x00, 0x00, 0x01, 0x50, - 0x9f, 0x13, 0x82, 0x87, 0x4e, 0x53, 0x48, 0x49, 0x6e, 0x69, 0x74, 0x56, + 0x2d, 0x72, 0x6f, 0x6d, 0x31, 0x66, 0x73, 0x2d, 0x00, 0x00, 0x02, 0x00, + 0xe7, 0x04, 0x63, 0xbd, 0x4e, 0x53, 0x48, 0x49, 0x6e, 0x69, 0x74, 0x56, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xff, 0x97, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -12,36 +12,36 @@ unsigned char romfs_img[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xff, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3a, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x6e, 0x8d, 0x9c, 0xab, 0x58, 0x72, 0x63, 0x53, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x23, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x52, - 0x41, 0x4d, 0x44, 0x49, 0x53, 0x4b, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x69, 0x74, 0x20, 0x61, 0x74, 0x20, 0x2f, - 0x74, 0x6d, 0x70, 0x0a, 0x0a, 0x6d, 0x6b, 0x72, 0x64, 0x20, 0x2d, 0x6d, - 0x20, 0x32, 0x20, 0x2d, 0x73, 0x20, 0x35, 0x31, 0x32, 0x20, 0x31, 0x30, - 0x32, 0x34, 0x0a, 0x6d, 0x6b, 0x66, 0x61, 0x74, 0x66, 0x73, 0x20, 0x2f, - 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x32, 0x0a, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x20, 0x2d, 0x74, 0x20, 0x76, 0x66, 0x61, 0x74, 0x20, 0x2f, - 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x32, 0x20, 0x2f, 0x74, 0x6d, - 0x70, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0xe0, 0x2e, 0x2e, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0x20, 0x2e, 0x2e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1f, + 0x8d, 0x9c, 0xab, 0xd7, 0x72, 0x63, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x20, 0x4d, 0x6f, + 0x75, 0x6e, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x63, + 0x66, 0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x20, 0x61, 0x74, 0x20, 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x0a, + 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x2d, 0x74, 0x20, 0x70, 0x72, + 0x6f, 0x63, 0x66, 0x73, 0x20, 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x0a, 0x65, + 0x63, 0x68, 0x6f, 0x20, 0x22, 0x72, 0x63, 0x53, 0x3a, 0x20, 0x4d, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x64, 0x20, 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x22, + 0x0a, 0x0a, 0x23, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, + 0x20, 0x52, 0x41, 0x4d, 0x44, 0x49, 0x53, 0x4b, 0x20, 0x61, 0x74, 0x20, + 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x31, 0x2c, 0x20, 0x73, + 0x69, 0x7a, 0x65, 0x20, 0x30, 0x2e, 0x35, 0x4d, 0x69, 0x42, 0x2c, 0x20, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x69, 0x74, 0x20, 0x77, 0x69, + 0x74, 0x68, 0x20, 0x61, 0x20, 0x46, 0x41, 0x54, 0x0a, 0x23, 0x20, 0x66, + 0x69, 0x6c, 0x65, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x61, + 0x6e, 0x64, 0x20, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x69, 0x74, 0x20, + 0x61, 0x74, 0x20, 0x2f, 0x74, 0x6d, 0x70, 0x0a, 0x0a, 0x6d, 0x6b, 0x72, + 0x64, 0x20, 0x2d, 0x6d, 0x20, 0x31, 0x20, 0x2d, 0x73, 0x20, 0x35, 0x31, + 0x32, 0x20, 0x31, 0x30, 0x32, 0x34, 0x0a, 0x6d, 0x6b, 0x66, 0x61, 0x74, + 0x66, 0x73, 0x20, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x31, + 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x2d, 0x74, 0x20, 0x76, 0x66, + 0x61, 0x74, 0x20, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x31, + 0x20, 0x2f, 0x74, 0x6d, 0x70, 0x0a, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, + 0x72, 0x63, 0x53, 0x3a, 0x20, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x64, + 0x20, 0x2f, 0x74, 0x6d, 0x70, 0x22, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/nuttx/configs/sama5d4-ek/include/rcS.template b/nuttx/configs/sama5d4-ek/include/rcS.template index d710b965b..077d99c3b 100644 --- a/nuttx/configs/sama5d4-ek/include/rcS.template +++ b/nuttx/configs/sama5d4-ek/include/rcS.template @@ -1,6 +1,12 @@ +# Mount the procfs file system at /proc + +mount -t procfs /proc +echo "rcS: Mounted /proc" + # Create a RAMDISK at /dev/ram1, size 0.5MiB, format it with a FAT # file system and mount it at /tmp -mkrd -m 2 -s 512 1024 +mkrd -m 1 -s 512 1024 mkfatfs /dev/ram1 mount -t vfat /dev/ram1 /tmp +echo "rcS: Mounted /tmp" diff --git a/nuttx/configs/sama5d4-ek/nsh/defconfig b/nuttx/configs/sama5d4-ek/nsh/defconfig index 9bf184487..a15fe9f1d 100644 --- a/nuttx/configs/sama5d4-ek/nsh/defconfig +++ b/nuttx/configs/sama5d4-ek/nsh/defconfig @@ -707,7 +707,14 @@ CONFIG_FAT_MAXFNAME=32 CONFIG_FS_ROMFS=y # CONFIG_FS_SMARTFS is not set # CONFIG_FS_BINFS is not set -# CONFIG_FS_PROCFS is not set +CONFIG_FS_PROCFS=y + +# +# Exclude individual procfs entries +# +# CONFIG_FS_PROCFS_EXCLUDE_PROCESS is not set +# CONFIG_FS_PROCFS_EXCLUDE_UPTIME is not set +# CONFIG_FS_PROCFS_EXCLUDE_MOUNTS is not set # # System Logging @@ -974,6 +981,7 @@ CONFIG_NSH_BUILTIN_APPS=y # CONFIG_NSH_CMDOPT_DF_H is not set CONFIG_NSH_CODECS_BUFSIZE=128 # CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_NSH_PROC_MOUNTPOUNT="/proc" CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_LINELEN=80 # CONFIG_NSH_DISABLE_SEMICOLON is not set |