blob: f29f1b3f38899d90bfb0a388fdedfca5b05c3ce3 [file] [log] [blame]
Simon Glassc8925112023-06-01 10:23:02 -06001.. SPDX-License-Identifier: GPL-2.0+:
2
Heinrich Schuchardt1b0c3162024-01-14 14:53:13 +01003.. index::
4 single: cedit (command)
5
Simon Glassc8925112023-06-01 10:23:02 -06006cedit command
7=============
8
Heinrich Schuchardt44b09b32024-03-16 11:09:36 +01009Synopsis
10--------
Simon Glassc8925112023-06-01 10:23:02 -060011
12::
13
14 cedit load <interface> <dev[:part]> <filename>
15 cedit run
Simon Glass28bf4352023-08-14 16:40:33 -060016 cedit write_fdt <dev[:part]> <filename>
Simon Glassb1cd32b2023-08-14 16:40:34 -060017 cedit read_fdt <dev[:part]> <filename>
Simon Glass237f3752023-08-14 16:40:35 -060018 cedit write_env [-v]
Simon Glass0f2e5a62023-08-14 16:40:36 -060019 cedit read_env [-v]
Simon Glass2b91ca62023-08-14 16:40:37 -060020 cedit write_cmos [-v] [dev]
Simon Glassc8925112023-06-01 10:23:02 -060021
22Description
23-----------
24
25The *cedit* command is used to load a configuration-editor description and allow
26the user to interact with it.
27
28It makes use of the expo subsystem.
29
30The description is in the form of a devicetree file, as documented at
31:ref:`expo_format`.
32
Simon Glass40eb3c32023-08-14 16:40:29 -060033See :doc:`../../develop/cedit` for information about the configuration editor.
34
Simon Glassf8cb2e82023-08-14 16:40:31 -060035cedit load
36~~~~~~~~~~
37
38Loads a configuration-editor description from a file. It creates a new cedit
39structure ready for use. Initially no settings are read, so default values are
40used for each object.
41
42cedit run
43~~~~~~~~~
44
45Runs the default configuration-editor event loop. This is very simple, just
46accepting character input and moving through the objects under user control.
47The implementation is at `cedit_run()`.
48
Simon Glass28bf4352023-08-14 16:40:33 -060049cedit write_fdt
50~~~~~~~~~~~~~~~
51
52Writes the current user settings to a devicetree file. For each menu item the
53selected ID and its text string are written.
54
Simon Glassb1cd32b2023-08-14 16:40:34 -060055cedit read_fdt
56~~~~~~~~~~~~~~
57
58Reads the user settings from a devicetree file and updates the cedit with those
59settings.
Simon Glassf8cb2e82023-08-14 16:40:31 -060060
Simon Glass0f2e5a62023-08-14 16:40:36 -060061cedit read_env
62~~~~~~~~~~~~~~
63
64Reads the settings from the environment variables. For each menu item `<name>`,
65cedit looks for a variable called `c.<name>` with the ID of the selected menu
66item.
67
68The `-v` flag enables verbose mode, where each variable is printed after it is
69read.
70
Simon Glass237f3752023-08-14 16:40:35 -060071cedit write_env
72~~~~~~~~~~~~~~~
73
74Writes the settings to environment variables. For each menu item the selected
75ID and its text string are written, similar to:
76
77 setenv c.<name> <selected_id>
78 setenv c.<name>-str <selected_id's text string>
79
80The `-v` flag enables verbose mode, where each variable is printed before it is
81set.
82
Simon Glass2b91ca62023-08-14 16:40:37 -060083cedit write_cmos
84~~~~~~~~~~~~~~~~
85
86Writes the settings to locations in the CMOS RAM. The locations used are
87specified by the schema. See `expo_format_`.
88
89The `-v` flag enables verbose mode, which shows which CMOS locations were
90updated.
91
92Normally the first RTC device is used to hold the data. You can specify a
93different device by name using the `dev` parameter.
94
Simon Glass237f3752023-08-14 16:40:35 -060095
Simon Glassc8925112023-06-01 10:23:02 -060096Example
97-------
98
99::
100
101 => cedit load hostfs - fred.dtb
102 => cedit run
Simon Glass28bf4352023-08-14 16:40:33 -0600103 => cedit write_fdt hostfs - settings.dtb
104
105That results in::
106
107 / {
108 cedit-values {
109 cpu-speed = <0x00000006>;
Simon Glass6f3e87a2024-10-14 16:32:00 -0600110 cpu-speed-value = <0x00000003>;
Simon Glass28bf4352023-08-14 16:40:33 -0600111 cpu-speed-str = "2 GHz";
112 power-loss = <0x0000000a>;
Simon Glass6f3e87a2024-10-14 16:32:00 -0600113 power-loss-value = <0x00000000>;
Simon Glass28bf4352023-08-14 16:40:33 -0600114 power-loss-str = "Always Off";
115 };
116 }
Simon Glassb1cd32b2023-08-14 16:40:34 -0600117
118 => cedit read_fdt hostfs - settings.dtb
Simon Glass237f3752023-08-14 16:40:35 -0600119
120This shows settings being stored in the environment::
121
122 => cedit write_env -v
Simon Glass6f3e87a2024-10-14 16:32:00 -0600123 c.cpu-speed=11
Simon Glass0f2e5a62023-08-14 16:40:36 -0600124 c.cpu-speed-str=2.5 GHz
Simon Glass6f3e87a2024-10-14 16:32:00 -0600125 c.cpu-speed-value=3
126 c.power-loss=14
127 c.power-loss-str=Always Off
128 c.power-loss-value=0
129 c.machine-name=my-machine
130 c.cpu-speed=11
131 c.power-loss=14
132 c.machine-name=my-machine
Simon Glass237f3752023-08-14 16:40:35 -0600133 => print
134 ...
135 c.cpu-speed=6
136 c.cpu-speed-str=2 GHz
137 c.power-loss=10
138 c.power-loss-str=Always Off
Simon Glass6f3e87a2024-10-14 16:32:00 -0600139 c.machine-name=my-machine
Simon Glass237f3752023-08-14 16:40:35 -0600140 ...
Simon Glass0f2e5a62023-08-14 16:40:36 -0600141
142 => cedit read_env -v
143 c.cpu-speed=7
144 c.power-loss=12
Simon Glass2b91ca62023-08-14 16:40:37 -0600145
146This shows writing to CMOS RAM. Notice that the bytes at 80 and 84 change::
147
148 => rtc read 80 8
149 00000080: 00 00 00 00 00 2f 2a 08 ...../*.
Simon Glass4462fa32023-08-14 16:40:38 -0600150 => cedit write_cmos -v
Simon Glass2b91ca62023-08-14 16:40:37 -0600151 Write 2 bytes from offset 80 to 84
152 => rtc read 80 8
153 00000080: 01 00 00 00 08 2f 2a 08 ...../*.
Simon Glass4462fa32023-08-14 16:40:38 -0600154 => cedit read_cmos -v
155 Read 2 bytes from offset 80 to 84
156
157Here is an example with the device specified::
158
159 => cedit write_cmos rtc@43
160 =>