blob: b39d708281d6ba3d29040173a8531746d7b6c9cc [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
9Synopis
10-------
11
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>;
110 cpu-speed-str = "2 GHz";
111 power-loss = <0x0000000a>;
112 power-loss-str = "Always Off";
113 };
114 }
Simon Glassb1cd32b2023-08-14 16:40:34 -0600115
116 => cedit read_fdt hostfs - settings.dtb
Simon Glass237f3752023-08-14 16:40:35 -0600117
118This shows settings being stored in the environment::
119
120 => cedit write_env -v
Simon Glass0f2e5a62023-08-14 16:40:36 -0600121 c.cpu-speed=7
122 c.cpu-speed-str=2.5 GHz
123 c.power-loss=12
124 c.power-loss-str=Memory
Simon Glass237f3752023-08-14 16:40:35 -0600125 => print
126 ...
127 c.cpu-speed=6
128 c.cpu-speed-str=2 GHz
129 c.power-loss=10
130 c.power-loss-str=Always Off
131 ...
Simon Glass0f2e5a62023-08-14 16:40:36 -0600132
133 => cedit read_env -v
134 c.cpu-speed=7
135 c.power-loss=12
Simon Glass2b91ca62023-08-14 16:40:37 -0600136
137This shows writing to CMOS RAM. Notice that the bytes at 80 and 84 change::
138
139 => rtc read 80 8
140 00000080: 00 00 00 00 00 2f 2a 08 ...../*.
Simon Glass4462fa32023-08-14 16:40:38 -0600141 => cedit write_cmos -v
Simon Glass2b91ca62023-08-14 16:40:37 -0600142 Write 2 bytes from offset 80 to 84
143 => rtc read 80 8
144 00000080: 01 00 00 00 08 2f 2a 08 ...../*.
Simon Glass4462fa32023-08-14 16:40:38 -0600145 => cedit read_cmos -v
146 Read 2 bytes from offset 80 to 84
147
148Here is an example with the device specified::
149
150 => cedit write_cmos rtc@43
151 =>