Simon Glass | a0874dc | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
| 3 | cedit command |
| 4 | ============= |
| 5 | |
| 6 | Synopis |
| 7 | ------- |
| 8 | |
| 9 | :: |
| 10 | |
| 11 | cedit load <interface> <dev[:part]> <filename> |
| 12 | cedit run |
Simon Glass | 2dee81f | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 13 | cedit write_fdt <dev[:part]> <filename> |
Simon Glass | 472317c | 2023-08-14 16:40:34 -0600 | [diff] [blame] | 14 | cedit read_fdt <dev[:part]> <filename> |
Simon Glass | fc9c0e0 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 15 | cedit write_env [-v] |
Simon Glass | bcf2b72 | 2023-08-14 16:40:36 -0600 | [diff] [blame^] | 16 | cedit read_env [-v] |
Simon Glass | a0874dc | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 17 | |
| 18 | Description |
| 19 | ----------- |
| 20 | |
| 21 | The *cedit* command is used to load a configuration-editor description and allow |
| 22 | the user to interact with it. |
| 23 | |
| 24 | It makes use of the expo subsystem. |
| 25 | |
| 26 | The description is in the form of a devicetree file, as documented at |
| 27 | :ref:`expo_format`. |
| 28 | |
Simon Glass | c5aacf5 | 2023-08-14 16:40:29 -0600 | [diff] [blame] | 29 | See :doc:`../../develop/cedit` for information about the configuration editor. |
| 30 | |
Simon Glass | d65ccbb | 2023-08-14 16:40:31 -0600 | [diff] [blame] | 31 | cedit load |
| 32 | ~~~~~~~~~~ |
| 33 | |
| 34 | Loads a configuration-editor description from a file. It creates a new cedit |
| 35 | structure ready for use. Initially no settings are read, so default values are |
| 36 | used for each object. |
| 37 | |
| 38 | cedit run |
| 39 | ~~~~~~~~~ |
| 40 | |
| 41 | Runs the default configuration-editor event loop. This is very simple, just |
| 42 | accepting character input and moving through the objects under user control. |
| 43 | The implementation is at `cedit_run()`. |
| 44 | |
Simon Glass | 2dee81f | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 45 | cedit write_fdt |
| 46 | ~~~~~~~~~~~~~~~ |
| 47 | |
| 48 | Writes the current user settings to a devicetree file. For each menu item the |
| 49 | selected ID and its text string are written. |
| 50 | |
Simon Glass | 472317c | 2023-08-14 16:40:34 -0600 | [diff] [blame] | 51 | cedit read_fdt |
| 52 | ~~~~~~~~~~~~~~ |
| 53 | |
| 54 | Reads the user settings from a devicetree file and updates the cedit with those |
| 55 | settings. |
Simon Glass | d65ccbb | 2023-08-14 16:40:31 -0600 | [diff] [blame] | 56 | |
Simon Glass | bcf2b72 | 2023-08-14 16:40:36 -0600 | [diff] [blame^] | 57 | cedit read_env |
| 58 | ~~~~~~~~~~~~~~ |
| 59 | |
| 60 | Reads the settings from the environment variables. For each menu item `<name>`, |
| 61 | cedit looks for a variable called `c.<name>` with the ID of the selected menu |
| 62 | item. |
| 63 | |
| 64 | The `-v` flag enables verbose mode, where each variable is printed after it is |
| 65 | read. |
| 66 | |
Simon Glass | fc9c0e0 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 67 | cedit write_env |
| 68 | ~~~~~~~~~~~~~~~ |
| 69 | |
| 70 | Writes the settings to environment variables. For each menu item the selected |
| 71 | ID 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 | |
| 76 | The `-v` flag enables verbose mode, where each variable is printed before it is |
| 77 | set. |
| 78 | |
| 79 | |
Simon Glass | a0874dc | 2023-06-01 10:23:02 -0600 | [diff] [blame] | 80 | Example |
| 81 | ------- |
| 82 | |
| 83 | :: |
| 84 | |
| 85 | => cedit load hostfs - fred.dtb |
| 86 | => cedit run |
Simon Glass | 2dee81f | 2023-08-14 16:40:33 -0600 | [diff] [blame] | 87 | => cedit write_fdt hostfs - settings.dtb |
| 88 | |
| 89 | That 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 Glass | 472317c | 2023-08-14 16:40:34 -0600 | [diff] [blame] | 99 | |
| 100 | => cedit read_fdt hostfs - settings.dtb |
Simon Glass | fc9c0e0 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 101 | |
| 102 | This shows settings being stored in the environment:: |
| 103 | |
| 104 | => cedit write_env -v |
Simon Glass | bcf2b72 | 2023-08-14 16:40:36 -0600 | [diff] [blame^] | 105 | c.cpu-speed=7 |
| 106 | c.cpu-speed-str=2.5 GHz |
| 107 | c.power-loss=12 |
| 108 | c.power-loss-str=Memory |
Simon Glass | fc9c0e0 | 2023-08-14 16:40:35 -0600 | [diff] [blame] | 109 | => 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 Glass | bcf2b72 | 2023-08-14 16:40:36 -0600 | [diff] [blame^] | 116 | |
| 117 | => cedit read_env -v |
| 118 | c.cpu-speed=7 |
| 119 | c.power-loss=12 |