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