blob: 3d6f26e631d6f629afa9386fda1587cce6d682b1 [file] [log] [blame]
Simon Glassa0874dc2023-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 Glass2dee81f2023-08-14 16:40:33 -060013 cedit write_fdt <dev[:part]> <filename>
Simon Glass472317c2023-08-14 16:40:34 -060014 cedit read_fdt <dev[:part]> <filename>
Simon Glassfc9c0e02023-08-14 16:40:35 -060015 cedit write_env [-v]
Simon Glassbcf2b722023-08-14 16:40:36 -060016 cedit read_env [-v]
Simon Glasseb6c71b2023-08-14 16:40:37 -060017 cedit write_cmos [-v] [dev]
Simon Glassa0874dc2023-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 Glassc5aacf52023-08-14 16:40:29 -060030See :doc:`../../develop/cedit` for information about the configuration editor.
31
Simon Glassd65ccbb2023-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 Glass2dee81f2023-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 Glass472317c2023-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 Glassd65ccbb2023-08-14 16:40:31 -060057
Simon Glassbcf2b722023-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 Glassfc9c0e02023-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 Glasseb6c71b2023-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 Glassfc9c0e02023-08-14 16:40:35 -060092
Simon Glassa0874dc2023-06-01 10:23:02 -060093Example
94-------
95
96::
97
98 => cedit load hostfs - fred.dtb
99 => cedit run
Simon Glass2dee81f2023-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 Glass472317c2023-08-14 16:40:34 -0600112
113 => cedit read_fdt hostfs - settings.dtb
Simon Glassfc9c0e02023-08-14 16:40:35 -0600114
115This shows settings being stored in the environment::
116
117 => cedit write_env -v
Simon Glassbcf2b722023-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 Glassfc9c0e02023-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 Glassbcf2b722023-08-14 16:40:36 -0600129
130 => cedit read_env -v
131 c.cpu-speed=7
132 c.power-loss=12
Simon Glasseb6c71b2023-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 ...../*.
138 => cedit write_cmos
139 Write 2 bytes from offset 80 to 84
140 => rtc read 80 8
141 00000080: 01 00 00 00 08 2f 2a 08 ...../*.