1 |
1026 |
ivang |
@c
|
2 |
|
|
@c COPYRIGHT (c) 1988-2002.
|
3 |
|
|
@c On-Line Applications Research Corporation (OAR).
|
4 |
|
|
@c All rights reserved.
|
5 |
|
|
@c
|
6 |
|
|
@c init.t,v 1.8 2002/01/17 21:47:45 joel Exp
|
7 |
|
|
@c
|
8 |
|
|
|
9 |
|
|
@chapter System Initialization
|
10 |
|
|
|
11 |
|
|
After the RTEMS initialization is performed, the application's
|
12 |
|
|
initialization will be performed. Part of initialization is a call to
|
13 |
|
|
rtems_filesystem_initialize(). This routine will mount the `In Memory File
|
14 |
|
|
System' as the base filesystem. Mounting the base filesystem consists
|
15 |
|
|
of the following:
|
16 |
|
|
|
17 |
|
|
@itemize @bullet
|
18 |
|
|
|
19 |
|
|
@item Initialization of mount table chain control structure
|
20 |
|
|
|
21 |
|
|
@item Allocation of a @code{jnode} structure that will server as the root node
|
22 |
|
|
of the `In Memory Filesystem'
|
23 |
|
|
|
24 |
|
|
@item Initialization of the allocated @code{jnode} with the appropriate OPS,
|
25 |
|
|
directory handlers and pathconf limits and options.
|
26 |
|
|
|
27 |
|
|
@item Allocation of a memory region for filesystem specific global
|
28 |
|
|
management variables
|
29 |
|
|
|
30 |
|
|
@item Creation of first mount table entry for the base filesystem
|
31 |
|
|
|
32 |
|
|
@item Initialization of the first mount table chain entry to indicate that
|
33 |
|
|
the mount point is NULL and the mounted filesystem is the base file
|
34 |
|
|
system
|
35 |
|
|
|
36 |
|
|
@end itemize
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
After the base filesystem has been mounted, the following operations are
|
40 |
|
|
performed under its directory structure:
|
41 |
|
|
|
42 |
|
|
@itemize @bullet
|
43 |
|
|
|
44 |
|
|
@item Creation of the /dev directory
|
45 |
|
|
|
46 |
|
|
@item Registration of devices under /dev directory
|
47 |
|
|
|
48 |
|
|
@end itemize
|
49 |
|
|
|
50 |
|
|
@section Base Filesystem
|
51 |
|
|
|
52 |
|
|
RTEMS initially mounts a RAM based file system known as the base file system.
|
53 |
|
|
The root directory of this file system tree serves as the logical root of the
|
54 |
|
|
directory hierarchy (Figure 3). Under the root directory a `/dev' directory
|
55 |
|
|
is created under which all I/O device directories and files are registered as
|
56 |
|
|
part of the file system hierarchy.
|
57 |
|
|
|
58 |
|
|
@example
|
59 |
|
|
Figure of the tree structure goes here.
|
60 |
|
|
@end example
|
61 |
|
|
|
62 |
|
|
A RAM based file system draws its management resources from memory. File and
|
63 |
|
|
directory nodes are simply allocated blocks of memory. Data associated with
|
64 |
|
|
regular files is stored in collections of memory blocks. When the system is
|
65 |
|
|
turned off or restarted all memory-based components of the file system are
|
66 |
|
|
lost.
|
67 |
|
|
|
68 |
|
|
The base file system serves as a starting point for the mounting of file
|
69 |
|
|
systems that are resident on semi-permanent storage media. Examples of such
|
70 |
|
|
media include non- volatile memory, flash memory and IDE hard disk drives
|
71 |
|
|
(Figure 3). File systems of other types will be mounted onto mount points
|
72 |
|
|
within the base file system or other file systems that are subordinate to the
|
73 |
|
|
base file system. The framework set up under the base file system will allow
|
74 |
|
|
for these new file system types and the unique data and functionality that is
|
75 |
|
|
required to manage the future file systems.
|
76 |
|
|
|
77 |
|
|
@subsection Base Filesystem Mounting
|
78 |
|
|
|
79 |
|
|
At present, the first file system to be mounted is the `In Memory File
|
80 |
|
|
System'. It is mounted using a standard MOUNT() command in which the mount
|
81 |
|
|
point is NULL. This flags the mount as the first file system to be
|
82 |
|
|
registered under the operating system and appropriate initialization of file
|
83 |
|
|
system management information is performed (See figures 4 and 5). If a
|
84 |
|
|
different file system type is desired as the base file system, alterations
|
85 |
|
|
must be made to base_fs.c. This routine handles the mount of the base file
|
86 |
|
|
system.
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
@example
|
90 |
|
|
Figure of the mount table chain goes here.
|
91 |
|
|
@end example
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
Once the root of the base file system has been established and it has been
|
95 |
|
|
recorded as the mount point of the base file system, devices are integrated
|
96 |
|
|
into the base file system. For every device that is configured into the
|
97 |
|
|
system (See ioman.c) a device registration process is performed. Device
|
98 |
|
|
registration produces a unique dev_t handle that consists of a major and
|
99 |
|
|
minor device number. In addition, the configuration information for each
|
100 |
|
|
device contains a text string that represents the fully qualified pathname to
|
101 |
|
|
that device's place in the base file system's hierarchy. A file system node
|
102 |
|
|
is created for the device along the specified registration path.
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
@example
|
106 |
|
|
Figure of the Mount Table Processing goes here.
|
107 |
|
|
@end example
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
Note: Other file systems can be mounted but they are mounted onto points
|
111 |
|
|
(directory mount points) in the base file system.
|
112 |
|
|
|
113 |
|
|
|