aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/nandtool/nandtool.8
blob: 8f8f1deffddff2e4dbc68ec0385e65fce74557a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
.\" Copyright (c) 2010 Semihalf
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 10, 2012
.Dt NANDTOOL 8
.Os
.Sh NAME
.Nm nandtool
.Nd NAND devices swiss army knife
.Sh SYNOPSIS
.Nm
.Ar command
.Op Ar operands ...
.Sh DESCRIPTION
The
.Nm
utility can be used to perform various operations on
.Xr gnand 4
devices (read, write, erase,
read and write OOB area and to get info about NAND flash chip).
.Pp
The following commands are available:
.Bl -tag -width ".Cm of Ns = Ns Ar file"
.It Cm read Ns
Read pages from NAND device.
.It Cm write Ns
Write pages to NAND device.
.It Cm erase Ns
Erase blocks.
Requires offset aligned to block granularity.
.It Cm info Ns
Get information about NAND chip (page size, block size, OOB area size, chip size
and media size)
.It Cm readoob Ns
Read OOB area from specified page.
.It Cm writeoob Ns
Write OOB area bound to specified page.
.It Cm help Ns
Get usage info.
.El
.Sh COMMAND read
The following operands are available for
.Nm
.Cm read
command:
.Bl -tag -width ".Cm of Ns = Ns Ar file"
.It Cm dev Ns = Ns Ar <path>
Path to a
.Xr gnand 4
device node, required for all operations.
.It Cm out Ns = Ns Ar <file>
Output file path. If not specified, page contents
will be dumped to stdout in format similar to
.Xr hexdump 1
.It Cm page Ns = Ns Ar <n>
Offset on device, expressed as page number.
.It Cm block Ns = Ns Ar <n>
Offset on device, expressed as block number.
.It Cm pos Ns = Ns Ar <n>
Offset on device, expressed in bytes (however, must be aligned
to page granularity).
.It Cm count Ns = Ns Ar <n>
Count of objects (pages, blocks, bytes).
.El
.Sh COMMAND readoob
The following operands are available for
.Nm
.Cm readoob
command:
.Bl -tag -width ".Cm of Ns = Ns Ar file"
.It Cm dev Ns = Ns Ar <path>
Path to NAND device node.
.It Cm page Ns = Ns Ar <n>
Offset on device, expressed as page number.
.It Cm out Ns = Ns Ar <file>
Output file path, optional.
.El
.Sh COMMAND write
The following operands are available for
.Nm
.Cm write
command:
.Bl -tag -width ".Cm of Ns = Ns Ar file"
.It Cm dev Ns = Ns Ar <path>
Path to NAND device node.
.It Cm page Ns = Ns Ar <n>
Offset on device, expressed as page number.
.It Cm block Ns = Ns Ar <n>
Offset on device, expressed as block number.
.It Cm pos Ns = Ns Ar <n>
Offset on device, expressed in bytes (however, must be aligned
to page granularity).
.It Cm in Ns = Ns Ar <file>
Input file path.
.El
.Sh COMMAND writeoob
The following operands are available for
.Nm
.Cm writeoob
command:
.Bl -tag -width ".Cm of Ns = Ns Ar file"
.It Cm dev Ns = Ns Ar <path>
Path to NAND device node.
.It Cm page Ns = Ns Ar <n>
Offset on device, expressed as page number.
.It Cm in Ns = Ns Ar <file>
Input file path.
.El
.Sh COMMAND erase
The following operands are available for
.Nm
.Cm erase
command:
.Bl -tag -width ".Cm of Ns = Ns Ar file"
.It Cm dev Ns = Ns Ar <path>
Path to NAND device node.
.It Cm page Ns = Ns Ar <n>
Offset on device, expressed as page number.
.It Cm block Ns = Ns Ar <n>
Offset on device, expressed as block number.
.It Cm pos Ns = Ns Ar <n>
Offset on device, epressed in bytes (however, must be aligned
to block granularity).
.It Cm count Ns = Ns Ar <n>
Count of objects (pages, blocks, bytes).
.El
.Pp
WARNING: The only required parameter for the \fBerase\fP command is
.Ar dev .
When no other arguments are provided the whole device is erased!
.Sh COMMAND info
There is only one operand available for
.Nm
.Cm info
command:
.Bl -tag -width ".Cm of Ns = Ns Ar file"
.It Cm dev Ns = Ns Ar <path>
Path to NAND device node.
.El
.Sh COMMAND help
There is only one operand available for
.Nm
.Cm help
command:
.Bl -tag -width ".Cm of Ns = Ns Ar file"
.It Cm topic Ns = Ns Ar <name>
Help topic.
.El
.Sh EXIT STATUS
.Ex -std
If the supplied argument
.Ar dev
points to a device node other than gnand<num> or gnand.raw<num> both
.Nm
.Cm readoob
and
.Nm
.Cm writeoob
return error.
.Sh SEE ALSO
.Xr gnand 4