]>
Commit | Line | Data |
---|---|---|
a0874dc4 SG |
1 | .. SPDX-License-Identifier: GPL-2.0+: |
2 | ||
60971e63 HS |
3 | .. index:: |
4 | single: cedit (command) | |
5 | ||
a0874dc4 SG |
6 | cedit command |
7 | ============= | |
8 | ||
98b5ea18 HS |
9 | Synopsis |
10 | -------- | |
a0874dc4 SG |
11 | |
12 | :: | |
13 | ||
14 | cedit load <interface> <dev[:part]> <filename> | |
15 | cedit run | |
2dee81fe | 16 | cedit write_fdt <dev[:part]> <filename> |
472317cb | 17 | cedit read_fdt <dev[:part]> <filename> |
fc9c0e07 | 18 | cedit write_env [-v] |
bcf2b720 | 19 | cedit read_env [-v] |
eb6c71b5 | 20 | cedit write_cmos [-v] [dev] |
ae3b5928 | 21 | cedit cb_load |
a0874dc4 SG |
22 | |
23 | Description | |
24 | ----------- | |
25 | ||
26 | The *cedit* command is used to load a configuration-editor description and allow | |
27 | the user to interact with it. | |
28 | ||
29 | It makes use of the expo subsystem. | |
30 | ||
31 | The description is in the form of a devicetree file, as documented at | |
32 | :ref:`expo_format`. | |
33 | ||
c5aacf5e SG |
34 | See :doc:`../../develop/cedit` for information about the configuration editor. |
35 | ||
d65ccbb6 SG |
36 | cedit load |
37 | ~~~~~~~~~~ | |
38 | ||
39 | Loads a configuration-editor description from a file. It creates a new cedit | |
40 | structure ready for use. Initially no settings are read, so default values are | |
41 | used for each object. | |
42 | ||
43 | cedit run | |
44 | ~~~~~~~~~ | |
45 | ||
46 | Runs the default configuration-editor event loop. This is very simple, just | |
47 | accepting character input and moving through the objects under user control. | |
48 | The implementation is at `cedit_run()`. | |
49 | ||
2dee81fe SG |
50 | cedit write_fdt |
51 | ~~~~~~~~~~~~~~~ | |
52 | ||
53 | Writes the current user settings to a devicetree file. For each menu item the | |
54 | selected ID and its text string are written. | |
55 | ||
472317cb SG |
56 | cedit read_fdt |
57 | ~~~~~~~~~~~~~~ | |
58 | ||
59 | Reads the user settings from a devicetree file and updates the cedit with those | |
60 | settings. | |
d65ccbb6 | 61 | |
bcf2b720 SG |
62 | cedit read_env |
63 | ~~~~~~~~~~~~~~ | |
64 | ||
65 | Reads the settings from the environment variables. For each menu item `<name>`, | |
66 | cedit looks for a variable called `c.<name>` with the ID of the selected menu | |
67 | item. | |
68 | ||
69 | The `-v` flag enables verbose mode, where each variable is printed after it is | |
70 | read. | |
71 | ||
fc9c0e07 SG |
72 | cedit write_env |
73 | ~~~~~~~~~~~~~~~ | |
74 | ||
75 | Writes the settings to environment variables. For each menu item the selected | |
76 | ID and its text string are written, similar to: | |
77 | ||
78 | setenv c.<name> <selected_id> | |
79 | setenv c.<name>-str <selected_id's text string> | |
80 | ||
81 | The `-v` flag enables verbose mode, where each variable is printed before it is | |
82 | set. | |
83 | ||
eb6c71b5 SG |
84 | cedit write_cmos |
85 | ~~~~~~~~~~~~~~~~ | |
86 | ||
87 | Writes the settings to locations in the CMOS RAM. The locations used are | |
88 | specified by the schema. See `expo_format_`. | |
89 | ||
90 | The `-v` flag enables verbose mode, which shows which CMOS locations were | |
91 | updated. | |
92 | ||
93 | Normally the first RTC device is used to hold the data. You can specify a | |
94 | different device by name using the `dev` parameter. | |
95 | ||
ae3b5928 SG |
96 | .. _cedit_cb_load: |
97 | ||
98 | cedit cb_load | |
99 | ~~~~~~~~~~~~~ | |
100 | ||
101 | This is supported only on x86 devices booted from coreboot. It creates a new | |
102 | configuration editor which can be used to edit CMOS settings. | |
fc9c0e07 | 103 | |
a0874dc4 SG |
104 | Example |
105 | ------- | |
106 | ||
107 | :: | |
108 | ||
109 | => cedit load hostfs - fred.dtb | |
110 | => cedit run | |
2dee81fe SG |
111 | => cedit write_fdt hostfs - settings.dtb |
112 | ||
113 | That results in:: | |
114 | ||
115 | / { | |
116 | cedit-values { | |
117 | cpu-speed = <0x00000006>; | |
55a9de57 | 118 | cpu-speed-value = <0x00000003>; |
2dee81fe SG |
119 | cpu-speed-str = "2 GHz"; |
120 | power-loss = <0x0000000a>; | |
55a9de57 | 121 | power-loss-value = <0x00000000>; |
2dee81fe SG |
122 | power-loss-str = "Always Off"; |
123 | }; | |
124 | } | |
472317cb SG |
125 | |
126 | => cedit read_fdt hostfs - settings.dtb | |
fc9c0e07 SG |
127 | |
128 | This shows settings being stored in the environment:: | |
129 | ||
130 | => cedit write_env -v | |
55a9de57 | 131 | c.cpu-speed=11 |
bcf2b720 | 132 | c.cpu-speed-str=2.5 GHz |
55a9de57 SG |
133 | c.cpu-speed-value=3 |
134 | c.power-loss=14 | |
135 | c.power-loss-str=Always Off | |
136 | c.power-loss-value=0 | |
137 | c.machine-name=my-machine | |
138 | c.cpu-speed=11 | |
139 | c.power-loss=14 | |
140 | c.machine-name=my-machine | |
fc9c0e07 SG |
141 | |
142 | ... | |
143 | c.cpu-speed=6 | |
144 | c.cpu-speed-str=2 GHz | |
145 | c.power-loss=10 | |
146 | c.power-loss-str=Always Off | |
55a9de57 | 147 | c.machine-name=my-machine |
fc9c0e07 | 148 | ... |
bcf2b720 SG |
149 | |
150 | => cedit read_env -v | |
151 | c.cpu-speed=7 | |
152 | c.power-loss=12 | |
eb6c71b5 SG |
153 | |
154 | This shows writing to CMOS RAM. Notice that the bytes at 80 and 84 change:: | |
155 | ||
156 | => rtc read 80 8 | |
157 | 00000080: 00 00 00 00 00 2f 2a 08 ...../*. | |
cfc402db | 158 | => cedit write_cmos -v |
eb6c71b5 SG |
159 | Write 2 bytes from offset 80 to 84 |
160 | => rtc read 80 8 | |
161 | 00000080: 01 00 00 00 08 2f 2a 08 ...../*. | |
cfc402db SG |
162 | => cedit read_cmos -v |
163 | Read 2 bytes from offset 80 to 84 | |
164 | ||
165 | Here is an example with the device specified:: | |
166 | ||
167 | => cedit write_cmos rtc@43 | |
168 | => | |
ae3b5928 SG |
169 | |
170 | This example shows editing coreboot CMOS-RAM settings. A script could be used | |
171 | to automate this:: | |
172 | ||
173 | => cbsysinfo | |
174 | Coreboot table at 500, size 5c4, records 1d (dec 29), decoded to 000000007dce3f40, forwarded to 000000007ff9a000 | |
175 | ||
176 | CPU KHz : 0 | |
177 | Serial I/O port: 00000000 | |
178 | base : 00000000 | |
179 | pointer : 000000007ff9a370 | |
180 | type : 1 | |
181 | base : 000003f8 | |
182 | baud : 0d115200 | |
183 | regwidth : 1 | |
184 | input_hz : 0d1843200 | |
185 | PCI addr : 00000010 | |
186 | Mem ranges : 7 | |
187 | id: type || base || size | |
188 | 0: 10:table 0000000000000000 0000000000001000 | |
189 | 1: 01:ram 0000000000001000 000000000009f000 | |
190 | 2: 02:reserved 00000000000a0000 0000000000060000 | |
191 | 3: 01:ram 0000000000100000 000000007fe6d000 | |
192 | 4: 10:table 000000007ff6d000 0000000000093000 | |
193 | 5: 02:reserved 00000000fec00000 0000000000001000 | |
194 | 6: 02:reserved 00000000ff800000 0000000000800000 | |
195 | option_table: 000000007ff9a018 | |
196 | Bit Len Cfg ID Name | |
197 | 0 180 r 0 reserved_memory | |
198 | 180 1 e 4 boot_option 0:Fallback 1:Normal | |
199 | 184 4 h 0 reboot_counter | |
200 | 190 8 r 0 reserved_century | |
201 | 1b8 8 r 0 reserved_ibm_ps2_century | |
202 | 1c0 1 e 1 power_on_after_fail 0:Disable 1:Enable | |
203 | 1c4 4 e 6 debug_level 5:Notice 6:Info 7:Debug 8:Spew | |
204 | 1d0 80 r 0 vbnv | |
205 | 3f0 10 h 0 check_sum | |
206 | CMOS start : 1c0 | |
207 | CMOS end : 1cf | |
208 | CMOS csum loc: 3f0 | |
209 | VBNV start : ffffffff | |
210 | VBNV size : ffffffff | |
211 | ... | |
212 | Unimpl. : 10 37 40 | |
213 | ||
214 | Check that the CMOS RAM checksum is correct, then create a configuration editor | |
215 | and load the settings from CMOS RAM:: | |
216 | ||
217 | => cbcmos check | |
218 | => cedit cb | |
219 | => cedit read_cmos | |
220 | ||
221 | Now run the cedit. In this case the user selected 'save' so `cedit run` returns | |
222 | success:: | |
223 | ||
224 | => if cedit run; then cedit write_cmos -v; fi | |
225 | Write 2 bytes from offset 30 to 38 | |
226 | => echo $? | |
227 | 0 | |
228 | ||
229 | Update the checksum in CMOS RAM:: | |
230 | ||
231 | => cbcmos check | |
232 | Checksum 6100 error: calculated 7100 | |
233 | => cbcmos update | |
234 | Checksum 7100 written | |
235 | => cbcmos check | |
236 | => |