Simon Glass | c892511 | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
Heinrich Schuchardt | 1b0c316 | 2024-01-14 14:53:13 +0100 | [diff] [blame] | 3 | .. index:: |
| 4 | single: cedit (command) |
| 5 | |
Simon Glass | c892511 | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 6 | cedit command |
| 7 | ============= |
| 8 | |
Heinrich Schuchardt | 44b09b3 | 2024-03-16 11:09:36 +0100 | [diff] [blame] | 9 | Synopsis |
| 10 | -------- |
Simon Glass | c892511 | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 11 | |
| 12 | :: |
| 13 | |
| 14 | cedit load <interface> <dev[:part]> <filename> |
| 15 | cedit run |
Simon Glass | 28bf435 | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 16 | cedit write_fdt <dev[:part]> <filename> |
Simon Glass | b1cd32b | 2023-08-14 16:40:34 -0600 | [diff] [blame] | 17 | cedit read_fdt <dev[:part]> <filename> |
Simon Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 18 | cedit write_env [-v] |
Simon Glass | 0f2e5a6 | 2023-08-14 16:40:36 -0600 | [diff] [blame] | 19 | cedit read_env [-v] |
Simon Glass | 2b91ca6 | 2023-08-14 16:40:37 -0600 | [diff] [blame] | 20 | cedit write_cmos [-v] [dev] |
Simon Glass | c892511 | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 21 | |
| 22 | Description |
| 23 | ----------- |
| 24 | |
| 25 | The *cedit* command is used to load a configuration-editor description and allow |
| 26 | the user to interact with it. |
| 27 | |
| 28 | It makes use of the expo subsystem. |
| 29 | |
| 30 | The description is in the form of a devicetree file, as documented at |
| 31 | :ref:`expo_format`. |
| 32 | |
Simon Glass | 40eb3c3 | 2023-08-14 16:40:29 -0600 | [diff] [blame] | 33 | See :doc:`../../develop/cedit` for information about the configuration editor. |
| 34 | |
Simon Glass | f8cb2e8 | 2023-08-14 16:40:31 -0600 | [diff] [blame] | 35 | cedit load |
| 36 | ~~~~~~~~~~ |
| 37 | |
| 38 | Loads a configuration-editor description from a file. It creates a new cedit |
| 39 | structure ready for use. Initially no settings are read, so default values are |
| 40 | used for each object. |
| 41 | |
| 42 | cedit run |
| 43 | ~~~~~~~~~ |
| 44 | |
| 45 | Runs the default configuration-editor event loop. This is very simple, just |
| 46 | accepting character input and moving through the objects under user control. |
| 47 | The implementation is at `cedit_run()`. |
| 48 | |
Simon Glass | 28bf435 | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 49 | cedit write_fdt |
| 50 | ~~~~~~~~~~~~~~~ |
| 51 | |
| 52 | Writes the current user settings to a devicetree file. For each menu item the |
| 53 | selected ID and its text string are written. |
| 54 | |
Simon Glass | b1cd32b | 2023-08-14 16:40:34 -0600 | [diff] [blame] | 55 | cedit read_fdt |
| 56 | ~~~~~~~~~~~~~~ |
| 57 | |
| 58 | Reads the user settings from a devicetree file and updates the cedit with those |
| 59 | settings. |
Simon Glass | f8cb2e8 | 2023-08-14 16:40:31 -0600 | [diff] [blame] | 60 | |
Simon Glass | 0f2e5a6 | 2023-08-14 16:40:36 -0600 | [diff] [blame] | 61 | cedit read_env |
| 62 | ~~~~~~~~~~~~~~ |
| 63 | |
| 64 | Reads the settings from the environment variables. For each menu item `<name>`, |
| 65 | cedit looks for a variable called `c.<name>` with the ID of the selected menu |
| 66 | item. |
| 67 | |
| 68 | The `-v` flag enables verbose mode, where each variable is printed after it is |
| 69 | read. |
| 70 | |
Simon Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 71 | cedit write_env |
| 72 | ~~~~~~~~~~~~~~~ |
| 73 | |
| 74 | Writes the settings to environment variables. For each menu item the selected |
| 75 | ID 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 | |
| 80 | The `-v` flag enables verbose mode, where each variable is printed before it is |
| 81 | set. |
| 82 | |
Simon Glass | 2b91ca6 | 2023-08-14 16:40:37 -0600 | [diff] [blame] | 83 | cedit write_cmos |
| 84 | ~~~~~~~~~~~~~~~~ |
| 85 | |
| 86 | Writes the settings to locations in the CMOS RAM. The locations used are |
| 87 | specified by the schema. See `expo_format_`. |
| 88 | |
| 89 | The `-v` flag enables verbose mode, which shows which CMOS locations were |
| 90 | updated. |
| 91 | |
| 92 | Normally the first RTC device is used to hold the data. You can specify a |
| 93 | different device by name using the `dev` parameter. |
| 94 | |
Simon Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 95 | |
Simon Glass | c892511 | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 96 | Example |
| 97 | ------- |
| 98 | |
| 99 | :: |
| 100 | |
| 101 | => cedit load hostfs - fred.dtb |
| 102 | => cedit run |
Simon Glass | 28bf435 | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 103 | => cedit write_fdt hostfs - settings.dtb |
| 104 | |
| 105 | That results in:: |
| 106 | |
| 107 | / { |
| 108 | cedit-values { |
| 109 | cpu-speed = <0x00000006>; |
Simon Glass | 6f3e87a | 2024-10-14 16:32:00 -0600 | [diff] [blame] | 110 | cpu-speed-value = <0x00000003>; |
Simon Glass | 28bf435 | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 111 | cpu-speed-str = "2 GHz"; |
| 112 | power-loss = <0x0000000a>; |
Simon Glass | 6f3e87a | 2024-10-14 16:32:00 -0600 | [diff] [blame] | 113 | power-loss-value = <0x00000000>; |
Simon Glass | 28bf435 | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 114 | power-loss-str = "Always Off"; |
| 115 | }; |
| 116 | } |
Simon Glass | b1cd32b | 2023-08-14 16:40:34 -0600 | [diff] [blame] | 117 | |
| 118 | => cedit read_fdt hostfs - settings.dtb |
Simon Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 119 | |
| 120 | This shows settings being stored in the environment:: |
| 121 | |
| 122 | => cedit write_env -v |
Simon Glass | 6f3e87a | 2024-10-14 16:32:00 -0600 | [diff] [blame] | 123 | c.cpu-speed=11 |
Simon Glass | 0f2e5a6 | 2023-08-14 16:40:36 -0600 | [diff] [blame] | 124 | c.cpu-speed-str=2.5 GHz |
Simon Glass | 6f3e87a | 2024-10-14 16:32:00 -0600 | [diff] [blame] | 125 | 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 Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 133 | => 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 Glass | 6f3e87a | 2024-10-14 16:32:00 -0600 | [diff] [blame] | 139 | c.machine-name=my-machine |
Simon Glass | 237f375 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 140 | ... |
Simon Glass | 0f2e5a6 | 2023-08-14 16:40:36 -0600 | [diff] [blame] | 141 | |
| 142 | => cedit read_env -v |
| 143 | c.cpu-speed=7 |
| 144 | c.power-loss=12 |
Simon Glass | 2b91ca6 | 2023-08-14 16:40:37 -0600 | [diff] [blame] | 145 | |
| 146 | This 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 Glass | 4462fa3 | 2023-08-14 16:40:38 -0600 | [diff] [blame] | 150 | => cedit write_cmos -v |
Simon Glass | 2b91ca6 | 2023-08-14 16:40:37 -0600 | [diff] [blame] | 151 | Write 2 bytes from offset 80 to 84 |
| 152 | => rtc read 80 8 |
| 153 | 00000080: 01 00 00 00 08 2f 2a 08 ...../*. |
Simon Glass | 4462fa3 | 2023-08-14 16:40:38 -0600 | [diff] [blame] | 154 | => cedit read_cmos -v |
| 155 | Read 2 bytes from offset 80 to 84 |
| 156 | |
| 157 | Here is an example with the device specified:: |
| 158 | |
| 159 | => cedit write_cmos rtc@43 |
| 160 | => |