blob: 4e1a9410f3fa77d1585ce153b958db36b7348fb4 [file] [log] [blame]
Jason D. Clinton974d4112018-04-14 15:27:14 -06001mosys - The more open system tool
dhendrix@google.com17bee8a2010-06-15 01:41:24 +00002
3Introduction
4------------
5Mosys is designed to aid in obtaining obscure system-specific information
6and present it in a uniform, human-friendly manner that is also parseable. It
7is intended to complement other systems software and may overlap in some areas.
8
dhendrix@google.com17bee8a2010-06-15 01:41:24 +00009Configuration & Building
10------------------------
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060011
Jack Rosenthal1a2c65e2020-05-15 09:47:06 -060012Mosys uses meson to build. To setup the build, use:
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060013
Jack Rosenthal1a2c65e2020-05-15 09:47:06 -060014 meson output_dir
Jason D. Clinton974d4112018-04-14 15:27:14 -060015
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060016Flags of interest:
Jason D. Clinton974d4112018-04-14 15:27:14 -060017-Duse_cros_config=true/false: whether to enable linking to cros_config for
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060018 Chrome OS. See Chrome OS example in Mosys ebuild.
dhendrix@google.com17bee8a2010-06-15 01:41:24 +000019
C Shapirod71e6ee2018-11-06 09:39:47 -070020To build with use_cros_config=true, you need one file that is dynamically
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060021provided as inputs to the build process from other ebuilds in the Chrome OS
22build system:
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060023 lib/cros_config/cros_config_data.c
24
Raul E Rangelc972fe02019-05-22 11:05:31 -060025You can use -Dcros_config_data_src to override the config file that will be used
26by the build system.
27
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060028If you just want to compile something quickly, you can do:
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060029 cp lib/cros_config/dummy_cros_config_data.c lib/cros_config/cros_config_data.c
30
Jack Rosenthal1a2c65e2020-05-15 09:47:06 -060031Then, to compile mosys, run:
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060032
Jack Rosenthal1a2c65e2020-05-15 09:47:06 -060033 ninja -C output_dir
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060034
Jack Rosenthal1a2c65e2020-05-15 09:47:06 -060035The mosys executable will be placed at `output_dir/mains/mosys`.
Samantha Millerb7e74212018-08-23 10:08:59 -060036
dhendrix@google.com17bee8a2010-06-15 01:41:24 +000037Usage
38-----
39Mosys uses a natural language syntax to navigate thru a command hierarchy for
40a given platform. Each supported platform will have a specific set of commands
41available.
42
dhendrix@google.com17bee8a2010-06-15 01:41:24 +000043Mosys returns EXIT_SUCCESS upon successful completion of a command, or
44EXIT_FAILURE if a command is not supported on a given platform. These values
Jason D. Clinton59c19dc2018-08-29 13:44:24 -060045are defined in the system's stdlib.h. In case of failure, Mosys will also print
dhendrix@google.com17bee8a2010-06-15 01:41:24 +000046a message to stderr to let the user know.
47
48Use "mosys -t" to display the command tree for the host platform.
Samantha Millerb7e74212018-08-23 10:08:59 -060049
50Debugging
51---------
52Mosys uses a minijail to restrict behavior. This can sometimes restrict desired
Jack Rosenthal7905c4c2019-11-06 02:45:42 -070053behavior, especially system calls not whitelisted by the seccomp filter.
Samantha Millerb7e74212018-08-23 10:08:59 -060054If a subcommand is returning with an error that should be passing, this might
55be why. In order to debug this, run seccomp_debug.sh with the failing command.
56This will print out the system calls that caused the run to fail.
57
Jack Rosenthal7905c4c2019-11-06 02:45:42 -070058For example, to debug `mosys ec info`, copy over `seccomp_debug.sh` to
59the DUT and run:
60
61 ./seccomp_debug.sh mosys ec info