diff options
Diffstat (limited to 'documentation/rmc/README')
-rw-r--r-- | documentation/rmc/README | 343 |
1 files changed, 343 insertions, 0 deletions
diff --git a/documentation/rmc/README b/documentation/rmc/README new file mode 100644 index 00000000..ba476b0e --- /dev/null +++ b/documentation/rmc/README | |||
@@ -0,0 +1,343 @@ | |||
1 | Runtime Machine Configuration (RMC) | ||
2 | -------------------------------------------------------------------------------- | ||
3 | Table of Contents | ||
4 | |||
5 | Introduction | ||
6 | Usage | ||
7 | Enable RMC Feature | ||
8 | Examples | ||
9 | Troubleshooting | ||
10 | When you (don't) need RMC feature | ||
11 | |||
12 | |||
13 | Introduction: | ||
14 | -------------------------------------------------------------------------------- | ||
15 | RMC Project - a light-weight project provide developers a mechanism to keep | ||
16 | their software implementation board-type agnostic, yet still able to customize | ||
17 | software behavior according to the type of a running board at runtime. Recipes | ||
18 | and bbclasses are available for other components to reuse to construct their own | ||
19 | RMC database. | ||
20 | |||
21 | RMC Feature - An end-to-end solution based on RMC project to have a generic | ||
22 | image capable to apply board-type-specific quirks and configurations for a board | ||
23 | at runtime. It consists of a modified bootloader (systemd-boot), an updated EFI | ||
24 | installer, recipes, bbclass and RMC project. | ||
25 | |||
26 | RMC feature supports special customizations cannot be covered by conventional | ||
27 | auto-detection features based on probing a hardware module because they happen | ||
28 | at a board or a product level. For example: | ||
29 | - tty console for kernel log output in kernel cmdline | ||
30 | - default audio route configuration | ||
31 | - network configuration | ||
32 | - UI layout | ||
33 | - requirement to software driven by a mechanical design | ||
34 | - or static configuration bits for a physical bus that doesn't support to | ||
35 | identify devices or their presence at runtime | ||
36 | |||
37 | An image with the feature has ability to configure supported boards with data | ||
38 | associated only to a type of board to get full functionality of the target at | ||
39 | runtime, yet still with a single image. | ||
40 | |||
41 | Effect after installation is identical to what a conventional image specially | ||
42 | customized for a type of board (depending on the way to deploy image). | ||
43 | |||
44 | Main functions of RMC Feature: | ||
45 | |||
46 | Show board-specific boot entries in boot menu and boot system with configuration | ||
47 | (boot title, boot options, etc) in a selected boot entry. | ||
48 | |||
49 | Support a "global" kernel boot command line fragment which is effective for all | ||
50 | boot entries. | ||
51 | |||
52 | Deploy file blobs and create directories specific to the type of running board. | ||
53 | |||
54 | Beside from this document, you can also find several built-in examples in | ||
55 | common/recipes-bsp/rmc/boards/. Refer to "Examples" section. | ||
56 | |||
57 | You can also add new board types in your layer via a simple variable. | ||
58 | |||
59 | |||
60 | |||
61 | Usage | ||
62 | -------------------------------------------------------------------------------- | ||
63 | Developers are suggested to organize all board-specific files in their own layer | ||
64 | following this example, so that RMC recipes can pick up them correctly in build. | ||
65 | |||
66 | - my_top_dir/ Top directory of your board (Note 0) | ||
67 | |- rmc-db.bbappend bbappend file to rmc-db recipe at a lower level | ||
68 | |- rmc/ | ||
69 | |- target_board_1/ subdirectory of a board. | ||
70 | | |- board1.fp fingerprint file must be provided (NOTE 1) | ||
71 | | |- BOOTENTRY.CONFIG optional config file for boot entries. (NOTE 2) | ||
72 | | |- INSTALLER.CONFIG optional config file for installer. (NOTE 3) | ||
73 | | |- board_file_1 A file blob specific to the type of board | ||
74 | | |- board_file_2 An another file specific to the type of board | ||
75 | | |- ...more files | ||
76 | |- target_board_2/ subdirectory of another board. | ||
77 | |- board_2_v2.fp fingerprint file for board 2. | ||
78 | |- BOOTENTRY.CONFIG | ||
79 | |- INSTALLER.CONFIG | ||
80 | |- board_file_1 | ||
81 | |- ...more files | ||
82 | |||
83 | Note 0: | ||
84 | To add your boards into RMC feature, simply put this line in your | ||
85 | rmc-db.bbappend: | ||
86 | |||
87 | RMC_BOARD_DATA_DIRS_append := " ${THISDIR}/my_top_dir" | ||
88 | |||
89 | RMC db recipe takes all top directories specified in RMC_BOARD_DATA_DIRS to | ||
90 | construct and deploy a central RMC database inside image. The bbclass of the | ||
91 | bare RMC project also provide function for other components to construct their | ||
92 | own RMC database file. Please refer to rmc-db.bbclass for more information. | ||
93 | |||
94 | Subdirectory is not supported in a board's directory. | ||
95 | |||
96 | Note 1: | ||
97 | Fingerprint files must be provided and with ".fp" at the end of their names. | ||
98 | Fingerprint can be obtained by running RMC tool on your board. An easy way is to | ||
99 | live-boot USB stick flashed with any image enabled this feature on your board, | ||
100 | then run this command: | ||
101 | |||
102 | # rmc -F -o my_board.fp | ||
103 | |||
104 | Or you will need to build RMC tool for the architecture of your board, 32 or | ||
105 | 64 bit x86, from RMC project. | ||
106 | |||
107 | You can run RMC tool without any argument to get usage and examples. | ||
108 | |||
109 | DO NOT NAME ANY FILE ENDING WITH '.fp' IF IT IS NOT A RMC FINGERPRINT FILE. | ||
110 | |||
111 | If you do need a .fp file deployed onto target, please rename it in source and | ||
112 | specify the real name of file on target in INSTALLER.CONFIG. | ||
113 | |||
114 | Note 2: | ||
115 | At runtime, RMC bootloader tries to fetch this file specific to the board at run | ||
116 | time, then tries to fetch each boot entry file specified in BOOTENTRY.CONFIG and | ||
117 | show them in boot menu options. The format of this file is very simple. Each | ||
118 | line is the name of a boot entry file: | ||
119 | |||
120 | boot.conf | ||
121 | Install.conf | ||
122 | myrmcboot.conf | ||
123 | |||
124 | Name of a boot entry file is defined by developer so it can be anything. But the | ||
125 | name of config file is what RMC bootloader looks up in RMC database, so it must | ||
126 | be named BOOTENTRY.CONFIG. | ||
127 | |||
128 | Bootloader skips loading entry conf files from disk once any entry is loaded | ||
129 | from RMC database. | ||
130 | |||
131 | Note 3: | ||
132 | At runtime, RMC installer tries to fetch INSTALLER.CONFIG file specific to the | ||
133 | board, then tries to fetch each file specified in this config file, and then | ||
134 | deploy the file onto target with its permissions, UID, GID and other attributes | ||
135 | also specified in this config file if file for the board can be retrieved from | ||
136 | RMC database. The format of this file is (# is for comment line) | ||
137 | |||
138 | # name:uid:gid:mode:path_on_target | ||
139 | # to create a directory, add a “/” at the end of path_on_target: | ||
140 | audio_policy:0:0:600:/etc/audio/ | ||
141 | audio_def_policy:0:0:600:/etc/audio/audio_policy | ||
142 | |||
143 | The above example creates /etc/audio directory first, then fetch a file named | ||
144 | “audio_def_policy” from RMC database for the board, then copy it to /etc/audio/ | ||
145 | with a new name “audio_policy”. | ||
146 | |||
147 | If this config file is not provided, No data in RMC database is deployed to the | ||
148 | target. | ||
149 | |||
150 | Some steps defined by developers could not be supported on a filesystem. | ||
151 | Installer simply ignores any errors in RMC deployment stage. | ||
152 | |||
153 | The name of this config file is what installer looks up first, so it must be | ||
154 | INSTALLER.CONFIG. | ||
155 | |||
156 | |||
157 | |||
158 | Enable RMC Feature | ||
159 | -------------------------------------------------------------------------------- | ||
160 | To Enable RMC feature in build, add the below lines in a conf file: | ||
161 | DISTRO_FEATURES_append = " rmc" | ||
162 | EFI_PROVIDER = "rmc-systemd-boot" | ||
163 | |||
164 | Note: | ||
165 | Image could be still bootable if you only have either of two lines, but RMC | ||
166 | feature won't be fully functional. | ||
167 | |||
168 | |||
169 | |||
170 | Examples | ||
171 | -------------------------------------------------------------------------------- | ||
172 | We checked in configuration data in common/recipes-bsp/rmc/boards/ for several | ||
173 | boards, to help users to understand the RMC feature. These examples are also for | ||
174 | validation. For any example you find not working as what this section depicts, | ||
175 | it should be treated as a bug to be fixed. | ||
176 | |||
177 | To test this feature with examples, enable it and build an image first, then | ||
178 | boot the built image on supported boards. Examples are always built in when the | ||
179 | feature is enabled, except for the EXAMPLE 1. | ||
180 | |||
181 | EXAMPLE 1: Support a new board type: | ||
182 | (1) enable the feature and do a build to get a live-boot image by adding these | ||
183 | lines in conf/local.conf: | ||
184 | DISTRO_FEATURES_append = " rmc" | ||
185 | EFI_PROVIDER = "rmc-systemd-boot" | ||
186 | |||
187 | (2) flash the image to a USB stick and boot it on your board | ||
188 | |||
189 | (3) in super user mode, run "rmc -F -o my_board.fp" | ||
190 | |||
191 | (4) create directories in your host "mkdir -p my_top_dir/my_rmc/my_board" | ||
192 | |||
193 | (5) copy my_board.fp from target to my_top_dir/my_rmc/my_board/ on host | ||
194 | |||
195 | (6) create a file my_top_dir/my_rmc/my_board/KBOOTPARAM, put some fake | ||
196 | and harmless options in a single line, say, "loglevel=7" | ||
197 | |||
198 | (7) create a file my_top_dir/rmc-db.bbappend, put this single line in it: | ||
199 | RMC_BOARD_DATA_DIRS_append := " ${THISDIR}/my_rmc" | ||
200 | From parent directory of my_top_dir, the tree should look like: | ||
201 | my_top_dir/ | ||
202 | my_rmc/ | ||
203 | my_board/ | ||
204 | KBOOTPARAM | ||
205 | my_board.fp | ||
206 | rmc-db.bbappend | ||
207 | Later, you can add more board directories in my_rmc directory. | ||
208 | |||
209 | (8) modify build configuration to add my_top_dir into build, for example, put | ||
210 | this line in a bblayers.conf: | ||
211 | BBFILES += "/full/path/of/my_top_dir/rmc-db.bbappend" | ||
212 | |||
213 | (9) build image again then boot it on your board | ||
214 | |||
215 | (10) Once you login to shell, new options should be effective, run this command | ||
216 | "cat /proc/cmdline" to verify the result. | ||
217 | |||
218 | EXAMPLE 2: Board-specific boot entry | ||
219 | MinnowBoard MAX and B3 version: | ||
220 | common/recipes-bsp/rmc/boards/minnowmax | ||
221 | common/recipes-bsp/rmc/boards/minnowmaxB3 | ||
222 | |||
223 | We have found two identities (type of board) exist for the "same" Minnow Max | ||
224 | hardware, so they have to be treated as two different types of hardware. The two | ||
225 | examples show you a boot entry specific to a type of board. Titles shown in boot | ||
226 | menu have different names according to the type of running board, "Minnow Max | ||
227 | boot" or "Minnow Max B3 boot". in /proc/cmdline, "console=ttyS0,115200n8" shall | ||
228 | be there. Kernel prints logs from 6-pin FTDI serial port on Minnow Max(s). This | ||
229 | console setting is in board-specific entries, so you won't see it effective if | ||
230 | you select default "boot" entry to boot the device. | ||
231 | |||
232 | EXAMPLE 3: Board-specific boot entry, global kernel cmdline and installer | ||
233 | NUC Gen 6: | ||
234 | common/recipes-bsp/rmc/boards/nucgen6 | ||
235 | This is a combo example with all supported configuration data for NUC Gen 6 | ||
236 | product. It shows two boot entries in bootloader menu when you boot image on NUC | ||
237 | Gen 6 product, with "NUC Gen6" in entry titles. There shall no any "console=" in | ||
238 | /proc/cmdline when you boot with either of two "NUC Gen6"entries. We designed it | ||
239 | this way because there is no accessible tty port on NUC Gen 6 with housing. | ||
240 | |||
241 | This example also includes a global kernel cmdline fragment KBOOTPARAM. Content | ||
242 | of KBOOTPARAM shall be at the end of /proc/cmdline no matter which boot entry | ||
243 | you selected to boot NUC Gen6. | ||
244 | |||
245 | INSTALLER.CONFIG directs installer to create a directory and deploy a file in it | ||
246 | when install the image on NUC Gen6. | ||
247 | |||
248 | Choose "NUC Gen6 install" boot entry to boot shall start installation. Once | ||
249 | the device reboots after installation, we can verify the configurations. | ||
250 | |||
251 | The boot entry "NUC Gen6 boot" shall be shown in boot menu. | ||
252 | |||
253 | The content of KBOOTPARAM shall be in /proc/cmdline too. | ||
254 | |||
255 | A directory /etc/mylib/ is created and a file "mylib.conf" is there. The content | ||
256 | of that file shall be what we put in mylib.conf in | ||
257 | common/recipes-bsp/rmc/boards/nucgen6 | ||
258 | |||
259 | EXAMPLE 4: For validation only | ||
260 | T100 (32bit): | ||
261 | common/recipes-bsp/rmc/boards/T100-32bit | ||
262 | This example is provided for validation on 32 bit X86 architecture. It doesn't | ||
263 | provide any new function not mentioned in above examples. | ||
264 | |||
265 | |||
266 | |||
267 | Troubleshooting | ||
268 | -------------------------------------------------------------------------------- | ||
269 | Issue: Cannot obtain RMC fingerprint for a board | ||
270 | |||
271 | RMC tool requires UEFI BIOS and SMBIOS support in firmware. It doesn't support | ||
272 | other type of firmware, e.g. legacy BIOS. It also requires EFI driver enabled | ||
273 | in Linux kernel. | ||
274 | |||
275 | Issue: Configuration for a board seems not effective at runtime. | ||
276 | |||
277 | Check if board is booted from the storage where the image or installation lives | ||
278 | when you have multiple boot options in BIOS. On some old hardwares it is not | ||
279 | that obvious as you assume. A build image can support boot from both of legacy | ||
280 | and UEFI mode, but RMC only works with UEFI boot so far. | ||
281 | |||
282 | Make sure configuration files (BOOTENTRY.CONFIG, INSTALLER.CONFIG and, | ||
283 | KBOOTPARAM ...) are properly named in the board directory. | ||
284 | |||
285 | Make sure configuration files have correct contents. | ||
286 | |||
287 | Some file attributes could not be supported by targeted file system. Installer | ||
288 | cannot setup file blobs as you wish. It simply move to the next step if a step | ||
289 | fails. | ||
290 | |||
291 | Kernel command line can be customized globally with KBOOTPARAM or just in a boot | ||
292 | entry for the type of board. They have different effective scopes. | ||
293 | |||
294 | If no any board-specific configuration becomes effective on your board but it | ||
295 | works on other boards of same product, you can run rmc tool to obtain | ||
296 | fingerprint file on your board and compare it with fingerprint of a working | ||
297 | board. It is possible they have different firmware versions and unluckily, some | ||
298 | information for fingerprint changes between two versions. You can update BIOS | ||
299 | on every board to the same BIOS version if it is feasible. Otherwise you have | ||
300 | to treat them as two different type of boards. We could extend rmc design to | ||
301 | allow multiple fingerprints in a board directory as a workaround. | ||
302 | |||
303 | Issue: RMC reports error because it cannot find fingerprint when building image. | ||
304 | |||
305 | Make sure you have a fingerprint file. Its name must be ended with '.fp'. You | ||
306 | can put a fingerprint file in a board directory and provide data later. | ||
307 | |||
308 | Issue: Any problems the above troubleshooting cannot help | ||
309 | |||
310 | Please report it to us. Extra information like the type of your board or a dump | ||
311 | file from dmidecode tool is helpful. We will investigate the problem and keep | ||
312 | improving this feature. | ||
313 | |||
314 | |||
315 | |||
316 | |||
317 | When you (don't) need RMC feature | ||
318 | -------------------------------------------------------------------------------- | ||
319 | RMC feature is designed to as generic as possible, in order to support a large | ||
320 | number of types of boards. And it shall be designed not to break things when it | ||
321 | is disabled. These considerations help users to decide if they really need or | ||
322 | enable it. | ||
323 | |||
324 | If you are satisfied with a dedicated build target and image for each board in | ||
325 | your development cycle (source, build, validation, release, etc), you don't need | ||
326 | this feature. | ||
327 | |||
328 | If you have a generic build for multiple type of boards and features supported | ||
329 | by that build meet your needs to functionality on all of boards, you don't need | ||
330 | to have this feature or you can disable it until you need to check in the first | ||
331 | board's data, in order to apply a quirk or customization only for that board. | ||
332 | |||
333 | If you want this feature but have concerns to see more and more boards' finger- | ||
334 | prints and data in a generic project, you can have another layer to hold all of | ||
335 | board-specific data to split them from a generic layer at source level. Another | ||
336 | suggestion is always seeking chances not to clone or copy a common configuration | ||
337 | to each board's directory. | ||
338 | |||
339 | |||
340 | |||
341 | Thanks | ||
342 | |||
343 | Jianxun Zhang <jianxun.zhang@linux.intel.com> | ||