SAMA5D3-EK: Enable the procfs file system in the NSH configuration
This commit is contained in:
parent
1c198f6a86
commit
19f66cd92b
@ -3287,8 +3287,8 @@ Configurations
|
|||||||
|
|
||||||
6. This configuration has support for NSH built-in applications enabled.
|
6. This configuration has support for NSH built-in applications enabled.
|
||||||
|
|
||||||
7. This configuration has support for the FAT and ROMFS file systems
|
7. This configuration has support for the FAT, ROMFS, and PROCFS file
|
||||||
built in.
|
systems built in.
|
||||||
|
|
||||||
The FAT file system includes long file name support. Please be aware
|
The FAT file system includes long file name support. Please be aware
|
||||||
that Microsoft claims patents against the long file name support (see
|
that Microsoft claims patents against the long file name support (see
|
||||||
@ -3304,14 +3304,19 @@ Configurations
|
|||||||
|
|
||||||
CONFIG_FS_ROMFS=y : Enable ROMFS file system
|
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:
|
file system is mounted at /etc and provides:
|
||||||
|
|
||||||
|- dev/
|
|- dev/
|
||||||
| `- ram0
|
| |- ...
|
||||||
|
| `- ram0 : ROMFS block driver
|
||||||
`- etc/
|
`- etc/
|
||||||
`- init.d/
|
`- init.d/
|
||||||
`- rcS
|
`- rcS : Start-up script
|
||||||
|
|
||||||
(There will, of course, be other devices uner /dev include /dev/console,
|
(There will, of course, be other devices uner /dev include /dev/console,
|
||||||
/dev/null, /dev/zero, /dev/random, etc.).
|
/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
|
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:
|
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
|
mkfatfs /dev/ram1
|
||||||
mount -t vfat /dev/ram1 /tmp
|
mount -t vfat /dev/ram1 /tmp
|
||||||
|
echo "rcS: Mounted /tmp"
|
||||||
|
|
||||||
The above commands will create a RAM disk block device at /dev/ram1.
|
The above commands will mount the procfs file system at /proc and a
|
||||||
The RAM disk will take 0.4MiB of memory (512 x 1024). Then it will
|
RAM disk at /tmp.
|
||||||
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/
|
|- dev/
|
||||||
| |- ram0
|
| |- ...
|
||||||
| `- ram2
|
| `- ram0 : ROMFS block driver
|
||||||
|
| `- ram1 : RAM disk block driver
|
||||||
|- etc/
|
|- etc/
|
||||||
| `- init.d/
|
| `- init.d/
|
||||||
| `- rcS
|
`- rcS : Start-up script
|
||||||
`- tmp/
|
|- 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 /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.
|
9. The Real Time Clock/Calendar (RTC) is enabled in this configuration.
|
||||||
See the section entitled "RTC" above for detailed configuration
|
See the section entitled "RTC" above for detailed configuration
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
unsigned char romfs_img[] = {
|
unsigned char romfs_img[] = {
|
||||||
0x2d, 0x72, 0x6f, 0x6d, 0x31, 0x66, 0x73, 0x2d, 0x00, 0x00, 0x01, 0x50,
|
0x2d, 0x72, 0x6f, 0x6d, 0x31, 0x66, 0x73, 0x2d, 0x00, 0x00, 0x02, 0x00,
|
||||||
0x9f, 0x13, 0x82, 0x87, 0x4e, 0x53, 0x48, 0x49, 0x6e, 0x69, 0x74, 0x56,
|
0xe7, 0x04, 0x63, 0xbd, 0x4e, 0x53, 0x48, 0x49, 0x6e, 0x69, 0x74, 0x56,
|
||||||
0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49,
|
0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49,
|
||||||
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xff, 0x97,
|
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xff, 0x97,
|
||||||
0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0,
|
||||||
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xff, 0x00,
|
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xff, 0x00,
|
||||||
0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x20,
|
||||||
0x00, 0x00, 0x00, 0x6e, 0x8d, 0x9c, 0xab, 0x58, 0x72, 0x63, 0x53, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0x20, 0x2e, 0x2e, 0x00, 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, 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,
|
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,
|
||||||
|
@ -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
|
# Create a RAMDISK at /dev/ram1, size 0.5MiB, format it with a FAT
|
||||||
# file system and mount it at /tmp
|
# file system and mount it at /tmp
|
||||||
|
|
||||||
mkrd -m 2 -s 512 1024
|
mkrd -m 1 -s 512 1024
|
||||||
mkfatfs /dev/ram1
|
mkfatfs /dev/ram1
|
||||||
mount -t vfat /dev/ram1 /tmp
|
mount -t vfat /dev/ram1 /tmp
|
||||||
|
echo "rcS: Mounted /tmp"
|
||||||
|
@ -707,7 +707,14 @@ CONFIG_FAT_MAXFNAME=32
|
|||||||
CONFIG_FS_ROMFS=y
|
CONFIG_FS_ROMFS=y
|
||||||
# CONFIG_FS_SMARTFS is not set
|
# CONFIG_FS_SMARTFS is not set
|
||||||
# CONFIG_FS_BINFS 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
|
# System Logging
|
||||||
@ -974,6 +981,7 @@ CONFIG_NSH_BUILTIN_APPS=y
|
|||||||
# CONFIG_NSH_CMDOPT_DF_H is not set
|
# CONFIG_NSH_CMDOPT_DF_H is not set
|
||||||
CONFIG_NSH_CODECS_BUFSIZE=128
|
CONFIG_NSH_CODECS_BUFSIZE=128
|
||||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
CONFIG_NSH_PROC_MOUNTPOUNT="/proc"
|
||||||
CONFIG_NSH_FILEIOSIZE=512
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
CONFIG_NSH_LINELEN=80
|
CONFIG_NSH_LINELEN=80
|
||||||
# CONFIG_NSH_DISABLE_SEMICOLON is not set
|
# CONFIG_NSH_DISABLE_SEMICOLON is not set
|
||||||
|
Loading…
Reference in New Issue
Block a user