FLASHPROG-WRITE-PROTECT(8) 2024-11-03 FLASHPROG-WRITE-PROTECT(8)

flashprog-write-protect - control write-protection settings of flash chips

flashprog write-protect [status] <options>
flashprog write-protect  list    <options>
flashprog write-protect  disable <options> [--temporary]
flashprog write-protect  enable  <options> [--temporary]
flashprog write-protect  range   <options> [--temporary] <start>,<len>
flashprog write-protect  region  <options> [--temporary] <region-name>

Where generic <options> are:

-p <programmername>[:<parameters>] [-c <chipname>]
[-V[V[V]]] [-o <logfile>] [-h]

and layout <options> are:

[(-l|--layout) <layout-file>|--fmap <fmap-file>|--fmap|--ifd]

flashprog-write-protect is a utility for reading and writing the write-protection settings of flash chips. Currently, it supports only block protection of SPI NOR chips.

You can specify one operation per call. status is the default operation.

status

Shows the write-protection state, including the currently programmed protection range.

list

Prints a list of write-protection ranges supported for the flash chip.

disable

Disables write protection locks. The configured range usually stays as is, but it will be possible to override it.

enable

Enables write protection locks. The write-protection range should be set before running the enable operation.

range <start>,<len>

Configures the protected range. start and length specify the range in decimal, octal (0 prefix), or hexadecimal (0x prefix) numbers of bytes. Any zero-length range will unprotect the entire flash (e.g. range 0,0).

region <region-name>

Configures the protected range, matching a region of the loaded layout (from a file or flash, see the respective option-descriptions in for possible layout sources).

All operations require the -p/--programmer option to be used (please see for more information on programmer support and parameters).

-p, --programmer <name>[:<parameter>[,<parameter>]...]

Specify the programmer device. This is mandatory for all operations. Please see the manual for a list of currently supported programmers and their parameters.

-c, --chip <chipname>

Probe only for the specified flash ROM chip. This option takes the chip name as printed by flashprog -L without the vendor name as parameter. Please note that the chip name is case sensitive.

-V, --verbose

More verbose output. This option can be supplied multiple times (max. 3 times, i.e. -VVV) for even more debug output.

-o, --output <logfile>

Save the full debug log to <logfile>. If the file already exists, it will be overwritten. This is the recommended way to gather logs from flashprog because they will be verbose even if the on-screen messages are not verbose and don't require output redirection.

-h, --help

Show a help text and exit.

(-l|--layout) <layout-file>, --fmap-file <fmap-file>, --fmap, --ifd

Please see the manual for information about layout files and other layout sources.

--temporary

When the --temporary option is provided for any operation that alters the flash chip's configuration, flashprog will attempt to write a temporary value that is not stored to flash. This requires special support by the flash chip for a volatile write status register command. The new value will be lost upon reset of the flash chip. Hence, it is futile to use this with external programmers that toggle power to the flash chip (e.g. Dediprog).

To just print the current write-protection state of the internal BIOS flash:

flashprog write-protect -p internal
or
flashprog write-protect status -p internal
To temporarily enable the currently configured range:
flashprog write-protect enable -p internal --temporary

flashprog exits with 0 on success, 1 on most failures but with 3 if a call to mmap() fails.

flashprog needs different access permissions for different programmers. See this section in the manual for details.

You can report bugs, ask us questions or send success reports via our communication channels listed here: https://www.flashprog.org/Contact.

flashprog is covered by the GNU General Public License (GPL), version 2. Some files are additionally available under any later version of the GPL.

Please see the individual files.

This manual page was written by Nico Huber and is derived from the flashprog(8) manual. It is licensed under the terms of the GNU GPL (version 2 or later).

2024-11-03 flashprog-write-protect-1.3