1 .. SPDX-License-Identifier: GPL-2.0+
11 mbr verify [interface] [device no] [partition list]
12 mbr write [interface] [device no] [partition list]
17 The mbr command lets users create or verify the MBR (Master Boot Record)
18 partition layout based on the provided text description. The partition
19 layout is alternatively read from the 'mbr_parts' environment variable.
20 This can be used in scripts to help system image flashing tools to ensure
21 proper partition layout.
23 The syntax of the text description of the partition list is similar to
24 the one used by the 'gpt' command.
26 Supported partition parameters are:
28 * name (currently ignored)
29 * start (partition start offset in bytes)
30 * size (in bytes or '-' to expand it to the whole free area)
31 * bootable (boolean flag)
32 * id (MBR partition type)
34 If one wants to create more than 4 partitions, an 'Extended' primary
35 partition (with 0x05 ID) has to be explicitly provided as a one of the
38 Here is an example how to create a 6 partitions (3 on the 'extended
39 volume'), some of the predefined sizes:
43 => setenv mbr_parts 'name=boot,start=4M,size=128M,bootable,id=0x0e;
44 name=rootfs,size=3072M,id=0x83;
45 name=system-data,size=512M,id=0x83;
46 name=[ext],size=-,id=0x05;
47 name=user,size=-,id=0x83;
48 name=modules,size=100M,id=0x83;
49 name=ramdisk,size=8M,id=0x83'
52 To check if the layout on the MMC #0 storage device matches the provided
53 text description one has to issue following command (assuming that
54 mbr_parts environment variable is set):
60 The verify sub-command is especially useful in the system update scripts:
64 => if mbr verify mmc 0; then
65 echo MBR layout needs to be updated
69 The 'mbr write' command returns 0 on success write or 1 on failure.
71 The 'mbr verify' returns 0 if the layout matches the one on the storage
77 To use the mbr command you must specify CONFIG_CMD_MBR=y.
82 The variable *$?* takes the following values
84 +---+------------------------------+
85 | 0 | mbr write was succesful |
86 +---+------------------------------+
87 | 1 | mbr write failed |
88 +---+------------------------------+
89 | 0 | mbr verify was succesful |
90 +---+------------------------------+
91 | 1 | mbr verify was not succesful |
92 +---+------------------------------+
93 |-1 | invalid arguments |
94 +---+------------------------------+