annotate doc/TIFFS-Overview @ 445:9eeeef3ff7db

os_sem_fl.c: os_QuerySemaphore() done
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 23 Jun 2014 01:19:50 +0000
parents 14618bd924ec
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
224
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 All TI GSM firmwares known to this author (FreeCalypso developer Space Falcon)
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 implement some kind of flash file system, or FFS. Several different FFS code
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 implementations, and correspondingly several different on-flash data formats,
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 have been used throughout the history of TI's involvement in the wireless
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 terminal business. The FFS incarnation of primary interest to the FreeCalypso
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 project is the one invented by Mads Meisner-Jensen at TI in the early 2000s
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 (at least according to the comments in the sources available to us), and it is
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 relevant to us in the following ways:
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 * When targeting the GSM modem in Openmoko's GTA01/02 smartphones, we need to
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 work with the original FFS from the factory (call it MokoFFS), the same FFS
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 as used by the mokoN firmwares: this FFS contains the IMEI and the RF
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 calibration values from the factory, which we most certainly don't want to go
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 without.
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 * The Leonardo firmware semi-src which we are using as the reference for
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 building our own full source, multi-target GSM fw contains a turnkey-working
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 implementation of this very FFS, using the on-flash format in question and
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 providing run-time APIs expected by the rest of the GSM fw suite. Following
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 the principle of ``if it ain't broke, don't fix it'', we can use this FFS not
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 only on the gtamodem target, but also on other targets, including those where
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 we would be starting from a blank state and thus have the freedom to use
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 whatever FFS we like.
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 * The original proprietary fw on the Pirelli DP-L10 phone also happens to use
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 an FFS in the same format. Pirelli's FFS does *not* contain the IMEI or any
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 of the RF calibration values though, and trying to reuse it directly for our
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 own FC GSM fw seems to be more trouble than benefit - so we'll probably have
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 our fw start with a blank TIFFS instead - but there is still insight to be
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 gained from in-vitro examination of captured Pirelli FFS images.
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 Naming
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 ======
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 I have previously referred to the FFS format in question as Mokopir-FFS or
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 MPFFS, from "Moko" and "Pirelli". I was originally hesitant to call it TIFFS,
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 as lacking the source code, I had no way of knowing whether the FFS format and
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 implementation were of TI's own invention, or something that TI licensed as a
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 black box from one of their many proprietary software partners. (I was unable
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 to identify it as any well-known, industry-standard FFS format, but absence of
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 evidence is not evidence of absence.) But now that we have TI's original source
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 code which implements this FFS (first the MV100-0.1.rar source, then the full
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 Leonardo one), complete with comments and a HISTORY file, we know that our FFS
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 was invented and implemented by someone named Mads Meisner-Jensen at TI - I'm
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 guessing in the SSA group in Nice, France.
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 I am now making a naming transition from MPFFS to TIFFS: there is really no
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 link between this FFS format and the Openmoko+Pirelli duo, other than the
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 happenstance of me having first encountered this FFS on these two GSM device
2900fe603f8a beginning of MPFFS->TIFFS naming convention change
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 brands, and the name TIFFS is more neutrally-descriptive.
227
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
51
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
52 What it is
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
53 ==========
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
54
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
55 In a rare departure from TI's norm (most of TI's GSM firmware and associated
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
56 development tools suffer from heavy Windows poisoning), what I call TIFFS is
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
57 very Unixy. It is a file system with a hierarchical directory tree structure
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
58 and with Unixy forward-slash-separated, case-sensitive pathnames; the semantics
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
59 of "what is a file" and "what is a directory" are exactly the same as in UNIX;
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
60 and TIFFS even supports symlinks, although that support is a little under-
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
61 developed, and apparently no FFS symlinks were ever used in any production GSM
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
62 device. Thus the FFS implemented in TI-based GSM devices (modems and
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
63 "dumbphones") is really no different from, for example, JFFS2 in embedded Linux
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
64 systems.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
65
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
66 (The only traditional UNIX file system features which are missing in TIFFS are
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
67 the creation/modification/access timestamps and the ownership/permission
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
68 fields.)
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
69
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
70 The FFS in a GSM device typically stores two kinds of content:
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
71
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
72 * Factory data: IMEI, RF calibration values, device make/model/revision
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
73 ID strings etc. These files are expected to be programmed on the factory
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
74 production line and not changed afterward.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
75
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
76 * Dynamic data written into the FFS in normal device operation: when you use a
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
77 "dumbphone" running TI-based firmware, every time you store something "on the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
78 phone" or in "non-volatile memory", that item is actually stored in the FFS.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
79 (Where else, if you think of it?) That includes contacts and received SMS
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
80 stored "on the phone" instead of the SIM, any selections you make in the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
81 settings/preferences menus which persist across reboots (power cycles), call
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
82 history etc.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
83
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
84 It needs to be noted that the "dynamic data" aspect of FFS usage applies not
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
85 only to complete phones, but also to modems like the one used in the GTA01/02.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
86 One would naively think that non-volatile storage of data in flash outside of
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
87 factory programming would be needed only in a device with its own UI, and that
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
88 a modem subservient to external AT commands would be completely stateless
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
89 across reboot/power cycles; but that is not the case in actuality. TI's GSM
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
90 firmwares, including the Openmoko ones (the "standard" mokoN), are designed to
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
91 always "mount" their FFS with read/write access; TI's FFS implementation in the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
92 firmware has no concept of a "read-only mount".
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
93
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
94 I am still investigating just what kinds of data are routinely written into the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
95 non-volatile FFS by the firmware in normal operation on devices like the GTA0x
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
96 modem, but there most definitely are some.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
97
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
98 There is no hard separation between "static" and "dynamic" data in the file
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
99 system structure; TIFFS is thus akin to an embedded Linux system with just a
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
100 single root file system containing both "static" files like userland binaries
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
101 and "dynamic" ones like configuration files under /etc which the user is
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
102 expected to edit with vi after logging into the box, or log and similar files
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
103 created by the system itself under /var, for example.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
104
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
105 Where it lives
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
106 ==============
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
107
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
108 The type of flash memory used in Calypso GSM modems and "dumbphones" is called
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
109 NOR flash. This NOR flash memory is physically divided (by the design of the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
110 flash chip itself) into units called "sectors" or more descriptively, erase
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
111 blocks. The typical NOR flash sector size (in Calypso GSM devices) ranges from
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
112 64 KiB in the GTA02 modem's NOR flash (4 MiB total) to 256 KiB in the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
113 S71PL129NC0 flash+RAM chip used in the Pirelli DP-L10 (16 MiB of flash total).
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
114 The key physical property is that any bit may be changed from a '1' to a '0' at
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
115 any time, in any combination, but resetting of '0' bits back to ones can be
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
116 done only on the granularity of these largish sectors, in an operation called
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
117 "sector erase".
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
118
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
119 The location of TIFFS within the flash memory of a given GSM device is defined
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
120 by the firmware design of that device, but is always some integral number of
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
121 contiguous flash sectors. Some examples:
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
122
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
123 * On the GTA01/02 GSM modem, FFS occupies 7 sectors of 64 KiB each, starting at
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
124 flash offset 0x380000.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
125
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
126 * On the Pirelli DP-L10, the FFS used by the original proprietary fw occupies
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
127 18 sectors of 256 KiB each (for 4.5 MiB in total), starting at the beginning
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
128 of the 2nd flash chip select (0x02000000 in the ARM7 address space).
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
129
430
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
130 * On Motorola/Compal C139/140 phones, the FFS used by the original proprietary
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
131 fw occupies 5 sectors of 64 KiB each (320 KiB in total), starting at 0x370000.
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
132 C11x/123 use smaller FFS configurations, whereas C155/156 seem to have
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
133 switched to some other FFS format, different from our familiar TIFFS.
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
134
227
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
135 * The smallest real FFS configuration called for by the table in dev.c in TI's
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
136 original Leonardo fw source is 3 sectors of 64 KiB each; the same table also
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
137 sports a 4 KiB x 4 configuration for RAM-based testing (emulation of FFS in
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
138 RAM without real flash).
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
139
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
140 * The largest FFS configuration that has been envisioned by the original
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
141 designers seems to be somewhere around 128 sectors.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
142
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
143 Each flash sector used for TIFFS begins with this 6-byte signature:
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
144
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
145 46 66 73 23 10 02
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
146
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
147 The first 4 bytes are 'Ffs#' in ASCII, and the following two bytes are the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
148 format version number of 0x0210 in little-endian byte order. The following two
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
149 bytes give a count of how many times that sector has been erased and rewritten
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
150 (FF FF in "fresh" or "virgin" FFS images), and the following byte indicates
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
151 that block's role and status in the FFS life cycle.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
152
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
153 How it works
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
154 ============
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
155
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
156 Just like JFFS2 and other high-quality flash file systems, TIFFS is designed to
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
157 recover gracefully from any possible power failure or crash: one can yank the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
158 battery from the GSM device (or induce a firmware crash) at the most mis-
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
159 opportune moment in the middle of an FFS write operation, and the FFS is
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
160 expected to recover on the next boot cycle. I won't be able to document here
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
161 all gory details of exactly how this goal is achieved, partly because I haven't
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
162 studied the code to the requisite level of depth myself yet, but all of the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
163 responsible code lives under gsm-fw/services/ffs in this freecalypso-sw source
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
164 tree; feel free to study it.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
165
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
166 In its "normal" or "clean" state (i.e., when not in the middle of a write
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
167 operation or recovery from an ungracefully interrupted one), a TIFFS instance
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
168 consists of the following 3 types of blocks:
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
169
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
170 * One block containing inode records, indicated by AB in its type/flags/status
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
171 byte in the block header;
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
172 * N-2 blocks (where N is the total number of flash sectors allocated for the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
173 FFS) containing (or waiting to be filled with) data chunks - indicated by BD
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
174 in the type/flags/status byte;
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
175 * One "free" block, indicated by BF - destined to become a new AB or a new BD
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
176 at some point.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
177
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
178 Each object written into the FFS (file, directory or symlink) consists of a
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
179 16-byte inode record written into the AB block and a data chunk written into
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
180 one of the BD blocks. The data chunk includes the name of the object, hence
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
181 one is required even for directories. Data chunks are contiguous, uncompressed,
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
182 and subject to an upper size limit of 2048 or 8192 bytes, depending on the FFS
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
183 configuration. Files larger than this limit are stored in a "segmented" form,
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
184 giving rise to a 4th inode or object type (after file, directory and symlink):
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
185 segment. Each segment of a segmented file consists of not only a data chunk,
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
186 but also an inode record for the segment, which gives the location of the data
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
187 chunk and ties the segment object into the overall FFS structure, making it
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
188 accessible.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
189
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
190 Because aside from complete sector erasure, flash memory bits can only
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
191 transition from '1' to '0' but not the other way around, overwriting an existing
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
192 file with some new content (an operation which any reasonable file system must
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
193 implement in some way) cannot be done in place. Instead like most flash file
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
194 systems, TIFFS implements this common operation by writing the new version of
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
195 the file to a new location (previously blank flash) and then invalidating the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
196 old version - and doing all that while keeping in mind the possibility of an
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
197 ungraceful crash or powerdown at any moment, and the requirement of recovering
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
198 gracefully from any such event.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
199
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
200 Of course as an FFS receives more write activity, even if one keeps overwriting
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
201 some existing files with new content of the same size, without adding to the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
202 visible total content size (think du(1) command), eventually all remaining blank
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
203 flash space will fill up. At that point (or at some earlier point, depending
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
204 on the FFS design and/or configuration) the FFS has to invoke a compaction or
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
205 reclamation or garbage collection procedure: any "mixed" blocks containing both
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
206 valid and stale data are transitioned into a "stale-only" state by having the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
207 active data moved to a new block, and then the "all stale" blocks are subjected
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
208 to sector erasure, becoming new blank sectors. The logic responsible for these
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
209 operations once again needs to be resilient to the possibility of a crash or
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
210 powerdown occurring at the most mis-opportune moment, and it also needs to
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
211 implement flash wear leveling: there is a physical limit to how many times a
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
212 given flash sector can be erased and rewritten before it goes bad.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
213
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
214 All of the above are common and well-known principles, successfully implemented
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
215 in well-known flash file systems such as JFFS2 in Linux. TIFFS is absolutely
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
216 no different in this regard; for the implementation details, read the source
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
217 code.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
218
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
219 How this FFS comes into being
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
220 =============================
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
221
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
222 (This section is only relevant to you if you plan on physically producing your
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
223 own GSM phones or modems on your own factory production line, like this author
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
224 fancies doing in the not-too-distant future, or if you simply enjoy knowing
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
225 how it is done.)
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
226
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
227 To my knowledge, TI never used or produced a tool akin to mkfs.jffs2 in the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
228 embedded Linux world, which would produce a TIFFS image complete with some
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
229 initial directory and file content "in vitro". Instead it appears that the FFS
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
230 instances found in shipped products such as Openmoko phones have been created
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
231 "in vivo" by TI's firmware running on the device itself during the "production
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
232 test" phase.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
233
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
234 The process seems to go like this:
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
235
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
236 * When the printed circuit board is physically populated with components such
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
237 as the Calypso chip and the flash chip, the latter can be blank - if the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
238 board design has the nIBOOT pin pulled low, enabling the Calypso boot ROM
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
239 (Openmoko and Pirelli both good on this one, but shame on Compal!), there is
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
240 no need to preprogram the flash chip with anything prior to populating it on
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
241 the board, and the device remains fully unbrickable at all times afterward.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
242
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
243 * When the assembled board is powered up for the first time, with completely
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
244 blank flash, the Calypso boot ROM will sit there and patiently wait for a
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
245 code download on either of its two UARTs.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
246
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
247 * Using TI's FLUID (Flash Loader Utility Independent of Device) or FreeCalypso's
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
248 fc-loadtool free replacement, the factory production station loads the main
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
249 firmware image into the flash. Note, it is just the firmware image at this
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
250 step, and the FFS sectors remain blank.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
251
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
252 * The board is commanded to reboot (or power-cycled), and the firmware image
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
253 boots for the first time.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
254
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
255 * TI's FFS implementation code in their standard firmware reacts to all blank
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
256 flash in the FFS sectors as follows: it performs what they call the preformat
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
257 operation, writing the TIFFS signature and a BF state byte into every FFS
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
258 sector, but the main "format" operation, which sets up the AB/BD block roles,
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
259 creates the root inode and makes the FFS ready to accept the creation of its
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
260 first directories and files, is not done automatically.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
261
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
262 In order to perform the FFS format operation and then fill the new FFS with
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
263 whatever directories and files are deemed needed to be present in "fresh"
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
264 shipping products, the factory production station connects to the just-booted
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
265 firmware running on the target via the RVT/ETM protocol (see the RVTMUX
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
266 write-up), and sends "test mode" commands to this running firmware. These
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
267 "FFS test mode" (or TMFFS) commands include the format operation, an mkdir
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
268 operation to create directories, and a "file write" operation akin to doing
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
269 'cat > /dir/whatever/file', creating files in FFS and storing any desired data
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
270 in them.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
271
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
272 The IMEI is assigned and written into FFS in this process, but it is not the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
273 only data item that will be unique for each individual device made. Much more
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
274 important are the RF calibration values: I have yet to learn exactly what is
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
275 being (or needs to be) measured, how these measurements are performed (under
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
276 what conditions; what external test equipment is needed), and how these measured
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
277 and recorded RF calibration values affect GSM device operation, but this TI
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
278 presentation gives some clues:
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
279
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
280 ftp://ftp.ifctf.org/pub/GSM/Calypso/rf_calibration.pdf
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
281
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
282 All of these calibration values are stored in a bunch of files under the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
283 /gsm/rf subtree, and these files seem to be "owned" by the L1 code. The latter
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
284 has RAM data structures which correspond to these files; upon normal boot the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
285 initialization code looks in FFS, and if it finds any of the RF calibration
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
286 files, it reads each present file into the corresponding RAM data structure,
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
287 overwriting the compiled-in defaults. It appears (slightly uncertain because I
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
288 have not yet reintegrated the code in question into our own gsm-fw) that the RF
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
289 calibration files in FFS come into being as follows:
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
290
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
291 * The RF calibration code in L1 (i.e., part of the main GSM fw) performs the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
292 measurements and stores results in its RAM data structures as commanded by
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
293 the production test station through the "test mode" interface;
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
294
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
295 * A final test mode command directs the above L1 code to write its RAM data
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
296 structures into FFS.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
297
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
298 Once I actually learn this RF calibration process properly in connection with
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
299 building my own Calypso-based GSM "dumbphone", I'll be able to say exactly what
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
300 it would take to recreate these RF calibration values if they are lost. But
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
301 until then the only advice I can give is to make a backup copy of your modem
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
302 FFS with fc-loadtool, and to save it securely.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
303
430
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
304 Compal and Pirelli differences
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
305 ==============================
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
306
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
307 The above description refers to TI's vanilla reference version, and it seems
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
308 like Openmoko (FIC) was the only phone/modem manufacturer who followed it
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
309 without major deviations. In contrast, both Compal (Mot C1xx) and Foxconn
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
310 (Pirelli DP-L10) moved the vital per-unit factory data (IMEI and RF calibration)
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
311 out of the FFS into their own ad hoc flash data structures (which are very
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
312 difficult to reverse-engineer and make use of, unfortunately), leaving their FFS
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
313 only for less critical data.
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
314
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
315 In Compal's case (at least on the C139 model with which I have extensive
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
316 personal experience) the FFS stores only users' personal information and nothing
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
317 more. One can turn the phone off, use fc-loadtool to erase the FFS sectors, and
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
318 boot the regular fw back up; the fw will automatically do a new FFS format (it
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
319 even displays a message on the LCD as it does so) and carry on happily as a
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
320 "fresh" or "blank", perfectly functional and usable phone.
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
321
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
322 In Pirelli's case, booting their official fw with blank FFS sectors will also
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
323 result in the FFS being automatically formatted, but their fw expects some
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
324 static "asset" files to be present in this FFS: UI graphics and language
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
325 strings, ringtones, firmware images for the WiFi and VoIP processors and some
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
326 static configuration files, about 3 MiB in total. Thus although the firmware
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
327 will auto-format the blank FFS sectors, it won't function normally with all of
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
328 these "asset" files missing. Foxconn's original factory production line station
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
329 must have uploaded these files to each phone via the TMFFS2 protocol, and our
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
330 FreeCalypso suite now features a tool that can replicate this feat: fc-fsio.
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
331
227
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
332 FreeCalypso support for TIFFS
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
333 =============================
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
334
250
3d88461d8284 beginning of TIFFS IVA documentation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 227
diff changeset
335 Aside from implementing and using it in our own gsm-fw, FreeCalypso offers
227
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
336 the following support for TIFFS:
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
337
250
3d88461d8284 beginning of TIFFS IVA documentation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 227
diff changeset
338 1. We have a utility for "in vitro" examination of FFS images read out of GSM
3d88461d8284 beginning of TIFFS IVA documentation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 227
diff changeset
339 devices with fc-loadtool. This tiffs utility (along with mokoffs and pirffs
3d88461d8284 beginning of TIFFS IVA documentation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 227
diff changeset
340 wrappers) lives in the ffstools top-level directory of the freecalypso-sw
3d88461d8284 beginning of TIFFS IVA documentation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 227
diff changeset
341 source tree. This TIFFS "in vitro analyzer" utility supplants the earlier
3d88461d8284 beginning of TIFFS IVA documentation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 227
diff changeset
342 mpffs-* tools, and adds some additional examination functionality. It is
3d88461d8284 beginning of TIFFS IVA documentation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 227
diff changeset
343 strictly a "read only" tool, however - it is not designed for "in vitro"
430
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
344 editing of TIFFS images.
227
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
345
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
346 2. A number of FC tools may be strung together into a kit for editing the FFS
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
347 content of a GSM device, e.g., for changing the IMEI. The following pieces
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
348 will be involved:
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
349
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
350 * What is destined to eventually become our totally free GSM fw (the gsm-fw
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
351 source subtree at the top of freecalypso-sw) does not contain any of the
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
352 actual GSM protocol stack (or even L1) functionality yet, but it already
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
353 contains both the FFS code and those components (ETM and TMFFS[12]) which
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
354 are needed for interfacing an external "test mode shell" to this FFS
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
355 implementation through the RVTMUX interface. And when our gsm-fw does gain
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
356 the actual GSM functionality, the ability to build a minimal FFS+ETM-only
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
357 configuration will still be retained.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
358
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
359 * The minimal FFS+ETM subset of gsm-fw can be built into a ramImage (runs
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
360 entirely from RAM via fc-xram, no flashing), and run on a physical device
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
361 such as the GTA0x GSM modem via the fc-xram host utility;
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
362
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
363 * After loading the ramImage, fc-xram will immediately exec our rvinterf host
430
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
364 utility (see rvinterf/README);
227
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
365
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
366 * Once the GSM device is running what is effectively an FFS editing agent out
430
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
367 of RAM, accessed via rvinterf over the serial channel, the user can run
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
368 fc-tmsh or fc-fsio, and this "test mode shell" provides commands for writing
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
369 things to FFS exactly like one would do in the factory production line
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
370 environment for which TI taylored their tools.
227
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
371
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
372 The "in vivo" method of editing the FFS content of a GSM device described above
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
373 will probably sound very convoluted, and you may find yourself asking for a way
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
374 to do it "in vitro" instead: read the FFS out of flash with fc-loadtool, edit
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
375 that image "in vitro" with some utility on your PC, and then use fc-loadtool
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
376 again to program it back into your device. But consider that an "in vitro" FFS
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
377 modification would involve erasing and rewriting all sectors of your FFS,
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
378 whereas an "in vivo" modification of some small file like the IMEI would be
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
379 just a short flash write operation without any erasures at all, i.e., kinder
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
380 on the flash.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
381
430
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
382 In any case, the "in vivo" method is already available now because all of the
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
383 components involved therein are also needed for other development uses in the
14618bd924ec doc/RVTMUX and doc/TIFFS-Overview: updates
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 250
diff changeset
384 FreeCalypso project, whereas developing a fully-functional "in vitro"
227
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
385 alternative (one that can create an FFS image "de novo" from a tree of files
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
386 and directories a la mkfs.jffs2, or add new files to an existing TIFFS image
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
387 etc) would be a good amount of extra work which we otherwise don't need - hence
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
388 the latter is not very likely to be written any time soon.
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
389
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
390 However, if the "in vitro" modification you seek is something trivial like
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
391 changing the byte content of a file such as /pcm/IMEI or /gsm/com/rfcap without
250
3d88461d8284 beginning of TIFFS IVA documentation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 227
diff changeset
392 changing its length, you can use the existing "in vitro, read-only" tiffs host
3d88461d8284 beginning of TIFFS IVA documentation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 227
diff changeset
393 utility to find the exact byte location of the file data within the TIFFS image,
3d88461d8284 beginning of TIFFS IVA documentation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 227
diff changeset
394 and then use your favourite hex editor to whack whatever new byte content you
227
1852900ce9ea doc/TIFFS write-up
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 224
diff changeset
395 like at that offset.