blob: f415b48699eacfad065f32adb94d6b5b529a269a [file] [log] [blame]
Simon Glassc8925112023-06-01 10:23:02 -06001.. SPDX-License-Identifier: GPL-2.0+:
2
3cedit command
4=============
5
6Synopis
7-------
8
9::
10
11 cedit load <interface> <dev[:part]> <filename>
12 cedit run
Simon Glass28bf4352023-08-14 16:40:33 -060013 cedit write_fdt <dev[:part]> <filename>
Simon Glassb1cd32b2023-08-14 16:40:34 -060014 cedit read_fdt <dev[:part]> <filename>
Simon Glass237f3752023-08-14 16:40:35 -060015 cedit write_env [-v]
Simon Glass0f2e5a62023-08-14 16:40:36 -060016 cedit read_env [-v]
Simon Glass2b91ca62023-08-14 16:40:37 -060017 cedit write_cmos [-v] [dev]
Simon Glassc8925112023-06-01 10:23:02 -060018
19Description
20-----------
21
22The *cedit* command is used to load a configuration-editor description and allow
23the user to interact with it.
24
25It makes use of the expo subsystem.
26
27The description is in the form of a devicetree file, as documented at
28:ref:`expo_format`.
29
Simon Glass40eb3c32023-08-14 16:40:29 -060030See :doc:`../../develop/cedit` for information about the configuration editor.
31
Simon Glassf8cb2e82023-08-14 16:40:31 -060032cedit load
33~~~~~~~~~~
34
35Loads a configuration-editor description from a file. It creates a new cedit
36structure ready for use. Initially no settings are read, so default values are
37used for each object.
38
39cedit run
40~~~~~~~~~
41
42Runs the default configuration-editor event loop. This is very simple, just
43accepting character input and moving through the objects under user control.
44The implementation is at `cedit_run()`.
45
Simon Glass28bf4352023-08-14 16:40:33 -060046cedit write_fdt
47~~~~~~~~~~~~~~~
48
49Writes the current user settings to a devicetree file. For each menu item the
50selected ID and its text string are written.
51
Simon Glassb1cd32b2023-08-14 16:40:34 -060052cedit read_fdt
53~~~~~~~~~~~~~~
54
55Reads the user settings from a devicetree file and updates the cedit with those
56settings.
Simon Glassf8cb2e82023-08-14 16:40:31 -060057
Simon Glass0f2e5a62023-08-14 16:40:36 -060058cedit read_env
59~~~~~~~~~~~~~~
60
61Reads the settings from the environment variables. For each menu item `<name>`,
62cedit looks for a variable called `c.<name>` with the ID of the selected menu
63item.
64
65The `-v` flag enables verbose mode, where each variable is printed after it is
66read.
67
Simon Glass237f3752023-08-14 16:40:35 -060068cedit write_env
69~~~~~~~~~~~~~~~
70
71Writes the settings to environment variables. For each menu item the selected
72ID and its text string are written, similar to:
73
74 setenv c.<name> <selected_id>
75 setenv c.<name>-str <selected_id's text string>
76
77The `-v` flag enables verbose mode, where each variable is printed before it is
78set.
79
Simon Glass2b91ca62023-08-14 16:40:37 -060080cedit write_cmos
81~~~~~~~~~~~~~~~~
82
83Writes the settings to locations in the CMOS RAM. The locations used are
84specified by the schema. See `expo_format_`.
85
86The `-v` flag enables verbose mode, which shows which CMOS locations were
87updated.
88
89Normally the first RTC device is used to hold the data. You can specify a
90different device by name using the `dev` parameter.
91
Simon Glass237f3752023-08-14 16:40:35 -060092
Simon Glassc8925112023-06-01 10:23:02 -060093Example
94-------
95
96::
97
98 => cedit load hostfs - fred.dtb
99 => cedit run
Simon Glass28bf4352023-08-14 16:40:33 -0600100 => cedit write_fdt hostfs - settings.dtb
101
102That results in::
103
104 / {
105 cedit-values {
106 cpu-speed = <0x00000006>;
107 cpu-speed-str = "2 GHz";
108 power-loss = <0x0000000a>;
109 power-loss-str = "Always Off";
110 };
111 }
Simon Glassb1cd32b2023-08-14 16:40:34 -0600112
113 => cedit read_fdt hostfs - settings.dtb
Simon Glass237f3752023-08-14 16:40:35 -0600114
115This shows settings being stored in the environment::
116
117 => cedit write_env -v
Simon Glass0f2e5a62023-08-14 16:40:36 -0600118 c.cpu-speed=7
119 c.cpu-speed-str=2.5 GHz
120 c.power-loss=12
121 c.power-loss-str=Memory
Simon Glass237f3752023-08-14 16:40:35 -0600122 => print
123 ...
124 c.cpu-speed=6
125 c.cpu-speed-str=2 GHz
126 c.power-loss=10
127 c.power-loss-str=Always Off
128 ...
Simon Glass0f2e5a62023-08-14 16:40:36 -0600129
130 => cedit read_env -v
131 c.cpu-speed=7
132 c.power-loss=12
Simon Glass2b91ca62023-08-14 16:40:37 -0600133
134This shows writing to CMOS RAM. Notice that the bytes at 80 and 84 change::
135
136 => rtc read 80 8
137 00000080: 00 00 00 00 00 2f 2a 08 ...../*.
Simon Glass4462fa32023-08-14 16:40:38 -0600138 => cedit write_cmos -v
Simon Glass2b91ca62023-08-14 16:40:37 -0600139 Write 2 bytes from offset 80 to 84
140 => rtc read 80 8
141 00000080: 01 00 00 00 08 2f 2a 08 ...../*.
Simon Glass4462fa32023-08-14 16:40:38 -0600142 => cedit read_cmos -v
143 Read 2 bytes from offset 80 to 84
144
145Here is an example with the device specified::
146
147 => cedit write_cmos rtc@43
148 =>