1 |
786 |
skrzyp |
|
2 |
|
|
FAT Filesystem README
|
3 |
|
|
+++++++++++++++++++++
|
4 |
|
|
|
5 |
|
|
This file serves as documentation for the FAT filesystem until full
|
6 |
|
|
documentation can be generated.
|
7 |
|
|
|
8 |
|
|
Configuring FAT
|
9 |
|
|
===============
|
10 |
|
|
|
11 |
|
|
The FAT filesystem support consists of several packages:
|
12 |
|
|
|
13 |
|
|
CYGPKG_FS_FAT
|
14 |
|
|
The FAT filesystem itself.
|
15 |
|
|
|
16 |
|
|
CYGPKG_BLOCK_LIB
|
17 |
|
|
Block library. This actually implements the block cache. It
|
18 |
|
|
depends on the Linux compatibility library
|
19 |
|
|
(CYGPKG_LINUX_COMPAT) for support.
|
20 |
|
|
|
21 |
|
|
CYGPKG_IO_DISK
|
22 |
|
|
Disk device IO support. This provides the top level disk
|
23 |
|
|
driver functions. It also interprets partition tables and
|
24 |
|
|
provides a separate access channel for each partition.
|
25 |
|
|
|
26 |
|
|
CYGPKG_DEVS_DISK_ECOSYNTH
|
27 |
|
|
This is the only low level device driver currently known to
|
28 |
|
|
work. This driver treats a file in the Linux filesystem as a
|
29 |
|
|
disk image.
|
30 |
|
|
|
31 |
|
|
CYGPKG_DEVS_DISK_V85X_EDB_V850
|
32 |
|
|
This is a device driver for an IDE compatible Compact Flash
|
33 |
|
|
device on a platform that is otherwise unsupported. It has not
|
34 |
|
|
been tested.
|
35 |
|
|
|
36 |
|
|
and other disk drivers which have been added in the mean time.
|
37 |
|
|
|
38 |
|
|
In addition the above new packages, FAT support also relies on the
|
39 |
|
|
following existing packages:
|
40 |
|
|
|
41 |
|
|
CYGPKG_IO_FILEIO
|
42 |
|
|
The File IO package. This provides the API by which the FAT
|
43 |
|
|
filesystem is accessed.
|
44 |
|
|
|
45 |
|
|
CYGPKG_IO
|
46 |
|
|
Device IO package. This provides all the infrastructure for
|
47 |
|
|
the disk devices.
|
48 |
|
|
|
49 |
|
|
CYGPKG_LIBC_STRING
|
50 |
|
|
Strings library. This provides the string and memory move and
|
51 |
|
|
compare routines used by the filesystem.
|
52 |
|
|
|
53 |
|
|
CYGPKG_MEMALLOC
|
54 |
|
|
The FAT filesystem currently uses malloc() to allocate
|
55 |
|
|
its memory resources, so this package is required.
|
56 |
|
|
|
57 |
|
|
The doc directory that contains this file contains a number of .ecm
|
58 |
|
|
files that will add the FAT filesystem to most configurations. These
|
59 |
|
|
should be used as a basis for creating new configurations.
|
60 |
|
|
|
61 |
|
|
Device Drivers
|
62 |
|
|
==============
|
63 |
|
|
|
64 |
|
|
The disk device interface is divided into a generic layer in the
|
65 |
|
|
CYGPKG_IO_DISK package and drivers for each device.
|
66 |
|
|
|
67 |
|
|
Each disk driver provides a number of device files. The drivers use a
|
68 |
|
|
naming convention to ensure they are unique. The convention is
|
69 |
|
|
/dev/XXXdiskY/Z. XXX is the name of the device driver, eg ide, mmc,
|
70 |
|
|
synth etc. The DISK packages provide support for disk partitions. They
|
71 |
|
|
interpret the on-disk data structures and provides an independent
|
72 |
|
|
channel to access each partition independently. Partitions are
|
73 |
|
|
referenced using an additional element to the device name. If the
|
74 |
|
|
device is named "/dev/XXXdisk0" then "/dev/XXXdisk0/1" refers to
|
75 |
|
|
partition 1, "/dev/XXXdisk0/2" to partition 2 and so on. If the disk
|
76 |
|
|
is not partitioned, for example a floppy disk, then "/dev/XXXdisk0/0"
|
77 |
|
|
refers to the whole disk.
|
78 |
|
|
|
79 |
|
|
Testing
|
80 |
|
|
=======
|
81 |
|
|
|
82 |
|
|
There is currently just one test available for the FAT filesystem,
|
83 |
|
|
fileio1. This test will currently only run on the Linux synthetic
|
84 |
|
|
target and needs a special disk image. However, with some work it
|
85 |
|
|
should be possible to make this test run on other disk drivers, if the
|
86 |
|
|
image can be installed and the configury set appropriately.
|
87 |
|
|
|
88 |
|
|
To run the test you first need to configure the synthetic disk driver
|
89 |
|
|
to access the disk image. This is most easily done by importing the
|
90 |
|
|
fat16.ecm file. A complete build would look like this:
|
91 |
|
|
|
92 |
|
|
$ mkdir linux.fat16
|
93 |
|
|
$ cd linux.fat16
|
94 |
|
|
$ ecosconfig new linux
|
95 |
|
|
$ ecosconfig import $ECOS_REPOSITORY/fs/fat/current/doc/fat16.ecm
|
96 |
|
|
$ ecosconfig tree
|
97 |
|
|
$ make tests
|
98 |
|
|
|
99 |
|
|
To make the disk image, first ensure that there is at least 10MB of
|
100 |
|
|
space available in your /tmp directory. Add the following two lines to
|
101 |
|
|
your ~/.mtoolsrc file (you may need to create it):
|
102 |
|
|
|
103 |
|
|
drive z: file="/tmp/disk0.img" partition=1
|
104 |
|
|
drive y: file="/tmp/disk0.img" partition=2
|
105 |
|
|
|
106 |
|
|
Now run the mkdisk0 shell script from the fs/fat/doc directory:
|
107 |
|
|
|
108 |
|
|
$ source $ECOS_REPOSITORY/fs/fat/current/doc/mkdisk0
|
109 |
|
|
20000+0 records in
|
110 |
|
|
20000+0 records out
|
111 |
|
|
Warning: no active (bootable) partition present
|
112 |
|
|
$
|
113 |
|
|
|
114 |
|
|
Ignore the warning, we are not interested in booting this disk.
|
115 |
|
|
|
116 |
|
|
It should now be possible to run the fileio1 test program.
|