Specifications
The protect command is another complex one. It is used to set certain parts of the flash memory to
read-only mode or to make them writable again. Flash memory that is "protected" (= read-only) cannot be
written (with the cp command) or erased (with the erase command). Protected areas are marked as (RO)
(for "read-only") in the output of the flinfo command:
Note: Included topic DULGData_m28.UBootProtect does not exist yet
The actual level of protection depends on the flash chips used on your hardware, and on the
implementation of the flash device driver for this board. In most cases U-Boot provides just a simple
software-protection, i. e. it prevents you from erasing or overwriting important stuff by accident (like the
U-Boot code itself or U-Boot's environment variables), but it cannot prevent you from circumventing these
restrictions - a nasty user who is loading and running his own flash driver code cannot and will not be stopped
by this mechanism. Also, in most cases this protection is only effective while running U-Boot, i. e. any
operating system will not know about "protected" flash areas and will happily erase these if requested to do
so.
5.9.3.5. mtdparts - define a Linux compatible MTD partition
scheme
U-Boot implements two different approaches to define a MTD partition scheme that can be shared easily with
the linux kernel.
The first one is to define a single, static partition in your board config file, for example:
#undef CONFIG_JFFS2_CMDLINE
#define CONFIG_JFFS2_DEV "nor0"
#define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF /* use whole device */
#define CONFIG_JFFS2_PART_SIZE 0x00100000 /* use 1MB */
#define CONFIG_JFFS2_PART_OFFSET 0x00000000
The second method uses the Linux kernel's mtdparts command line option and dynamic partitioning:
#define CONFIG_CMD_MTDPARTS
#define MTDIDS_DEFAULT "nor1=zuma-1,nor2=zuma-2"
#define MTDPARTS_DEFAULT "mtdparts=zuma-1:-(jffs2),zuma-2:-(user)"
Command line of course produces bigger images, and may be inappropriate for some targets, so by default it's
off.
The mtdparts command offers an easy to use and powerful interface to define the contents of the
environment variable of the same name that can be passed as boot argument to the Linux kernel:
=> help mtdparts
mtdparts - define flash/nand partitions
Usage:
mtdparts
- list partition table
mtdparts delall
- delete all partitions
mtdparts del part-id
- delete partition (e.g. part-id = nand0,1)
mtdparts add <mtd-dev> <size>[@<offset>] [<name>] [ro]
- add partition
mtdparts default
- reset partition table to defaults
-----
5.9.3.4. protect - enable or disable FLASH write protection 52