Jason D. Clinton | 974d411 | 2018-04-14 15:27:14 -0600 | [diff] [blame] | 1 | mosys - The more open system tool |
dhendrix@google.com | 17bee8a | 2010-06-15 01:41:24 +0000 | [diff] [blame] | 2 | |
| 3 | Introduction |
| 4 | ------------ |
| 5 | Mosys is designed to aid in obtaining obscure system-specific information |
| 6 | and present it in a uniform, human-friendly manner that is also parseable. It |
| 7 | is intended to complement other systems software and may overlap in some areas. |
| 8 | |
dhendrix@google.com | 17bee8a | 2010-06-15 01:41:24 +0000 | [diff] [blame] | 9 | Configuration & Building |
| 10 | ------------------------ |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 11 | |
Jack Rosenthal | 1a2c65e | 2020-05-15 09:47:06 -0600 | [diff] [blame] | 12 | Mosys uses meson to build. To setup the build, use: |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 13 | |
Jack Rosenthal | 1a2c65e | 2020-05-15 09:47:06 -0600 | [diff] [blame] | 14 | meson output_dir |
Jason D. Clinton | 974d411 | 2018-04-14 15:27:14 -0600 | [diff] [blame] | 15 | |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 16 | Flags of interest: |
Jason D. Clinton | 974d411 | 2018-04-14 15:27:14 -0600 | [diff] [blame] | 17 | -Duse_cros_config=true/false: whether to enable linking to cros_config for |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 18 | Chrome OS. See Chrome OS example in Mosys ebuild. |
dhendrix@google.com | 17bee8a | 2010-06-15 01:41:24 +0000 | [diff] [blame] | 19 | |
C Shapiro | d71e6ee | 2018-11-06 09:39:47 -0700 | [diff] [blame] | 20 | To build with use_cros_config=true, you need one file that is dynamically |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 21 | provided as inputs to the build process from other ebuilds in the Chrome OS |
| 22 | build system: |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 23 | lib/cros_config/cros_config_data.c |
| 24 | |
Raul E Rangel | c972fe0 | 2019-05-22 11:05:31 -0600 | [diff] [blame] | 25 | You can use -Dcros_config_data_src to override the config file that will be used |
| 26 | by the build system. |
| 27 | |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 28 | If you just want to compile something quickly, you can do: |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 29 | cp lib/cros_config/dummy_cros_config_data.c lib/cros_config/cros_config_data.c |
| 30 | |
Jack Rosenthal | 1a2c65e | 2020-05-15 09:47:06 -0600 | [diff] [blame] | 31 | Then, to compile mosys, run: |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 32 | |
Jack Rosenthal | 1a2c65e | 2020-05-15 09:47:06 -0600 | [diff] [blame] | 33 | ninja -C output_dir |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 34 | |
Jack Rosenthal | 1a2c65e | 2020-05-15 09:47:06 -0600 | [diff] [blame] | 35 | The mosys executable will be placed at `output_dir/mains/mosys`. |
Samantha Miller | b7e7421 | 2018-08-23 10:08:59 -0600 | [diff] [blame] | 36 | |
dhendrix@google.com | 17bee8a | 2010-06-15 01:41:24 +0000 | [diff] [blame] | 37 | Usage |
| 38 | ----- |
| 39 | Mosys uses a natural language syntax to navigate thru a command hierarchy for |
| 40 | a given platform. Each supported platform will have a specific set of commands |
| 41 | available. |
| 42 | |
dhendrix@google.com | 17bee8a | 2010-06-15 01:41:24 +0000 | [diff] [blame] | 43 | Mosys returns EXIT_SUCCESS upon successful completion of a command, or |
| 44 | EXIT_FAILURE if a command is not supported on a given platform. These values |
Jason D. Clinton | 59c19dc | 2018-08-29 13:44:24 -0600 | [diff] [blame] | 45 | are defined in the system's stdlib.h. In case of failure, Mosys will also print |
dhendrix@google.com | 17bee8a | 2010-06-15 01:41:24 +0000 | [diff] [blame] | 46 | a message to stderr to let the user know. |
| 47 | |
| 48 | Use "mosys -t" to display the command tree for the host platform. |
Samantha Miller | b7e7421 | 2018-08-23 10:08:59 -0600 | [diff] [blame] | 49 | |
| 50 | Debugging |
| 51 | --------- |
| 52 | Mosys uses a minijail to restrict behavior. This can sometimes restrict desired |
Jack Rosenthal | 7905c4c | 2019-11-06 02:45:42 -0700 | [diff] [blame] | 53 | behavior, especially system calls not whitelisted by the seccomp filter. |
Samantha Miller | b7e7421 | 2018-08-23 10:08:59 -0600 | [diff] [blame] | 54 | If a subcommand is returning with an error that should be passing, this might |
| 55 | be why. In order to debug this, run seccomp_debug.sh with the failing command. |
| 56 | This will print out the system calls that caused the run to fail. |
| 57 | |
Jack Rosenthal | 7905c4c | 2019-11-06 02:45:42 -0700 | [diff] [blame] | 58 | For example, to debug `mosys ec info`, copy over `seccomp_debug.sh` to |
| 59 | the DUT and run: |
| 60 | |
| 61 | ./seccomp_debug.sh mosys ec info |