blob: 1f92b7306a7ac3a1ebfa57175607d3c96b8a0ab7 [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 Glassa0874dc2023-06-01 10:23:02 -060017
18Description
19-----------
20
21The *cedit* command is used to load a configuration-editor description and allow
22the user to interact with it.
23
24It makes use of the expo subsystem.
25
26The description is in the form of a devicetree file, as documented at
27:ref:`expo_format`.
28
Simon Glassc5aacf52023-08-14 16:40:29 -060029See :doc:`../../develop/cedit` for information about the configuration editor.
30
Simon Glassd65ccbb2023-08-14 16:40:31 -060031cedit load
32~~~~~~~~~~
33
34Loads a configuration-editor description from a file. It creates a new cedit
35structure ready for use. Initially no settings are read, so default values are
36used for each object.
37
38cedit run
39~~~~~~~~~
40
41Runs the default configuration-editor event loop. This is very simple, just
42accepting character input and moving through the objects under user control.
43The implementation is at `cedit_run()`.
44
Simon Glass2dee81f2023-08-14 16:40:33 -060045cedit write_fdt
46~~~~~~~~~~~~~~~
47
48Writes the current user settings to a devicetree file. For each menu item the
49selected ID and its text string are written.
50
Simon Glass472317c2023-08-14 16:40:34 -060051cedit read_fdt
52~~~~~~~~~~~~~~
53
54Reads the user settings from a devicetree file and updates the cedit with those
55settings.
Simon Glassd65ccbb2023-08-14 16:40:31 -060056
Simon Glassbcf2b722023-08-14 16:40:36 -060057cedit read_env
58~~~~~~~~~~~~~~
59
60Reads the settings from the environment variables. For each menu item `<name>`,
61cedit looks for a variable called `c.<name>` with the ID of the selected menu
62item.
63
64The `-v` flag enables verbose mode, where each variable is printed after it is
65read.
66
Simon Glassfc9c0e02023-08-14 16:40:35 -060067cedit write_env
68~~~~~~~~~~~~~~~
69
70Writes the settings to environment variables. For each menu item the selected
71ID and its text string are written, similar to:
72
73 setenv c.<name> <selected_id>
74 setenv c.<name>-str <selected_id's text string>
75
76The `-v` flag enables verbose mode, where each variable is printed before it is
77set.
78
79
Simon Glassa0874dc2023-06-01 10:23:02 -060080Example
81-------
82
83::
84
85 => cedit load hostfs - fred.dtb
86 => cedit run
Simon Glass2dee81f2023-08-14 16:40:33 -060087 => cedit write_fdt hostfs - settings.dtb
88
89That results in::
90
91 / {
92 cedit-values {
93 cpu-speed = <0x00000006>;
94 cpu-speed-str = "2 GHz";
95 power-loss = <0x0000000a>;
96 power-loss-str = "Always Off";
97 };
98 }
Simon Glass472317c2023-08-14 16:40:34 -060099
100 => cedit read_fdt hostfs - settings.dtb
Simon Glassfc9c0e02023-08-14 16:40:35 -0600101
102This shows settings being stored in the environment::
103
104 => cedit write_env -v
Simon Glassbcf2b722023-08-14 16:40:36 -0600105 c.cpu-speed=7
106 c.cpu-speed-str=2.5 GHz
107 c.power-loss=12
108 c.power-loss-str=Memory
Simon Glassfc9c0e02023-08-14 16:40:35 -0600109 => print
110 ...
111 c.cpu-speed=6
112 c.cpu-speed-str=2 GHz
113 c.power-loss=10
114 c.power-loss-str=Always Off
115 ...
Simon Glassbcf2b722023-08-14 16:40:36 -0600116
117 => cedit read_env -v
118 c.cpu-speed=7
119 c.power-loss=12