38.10. getvar

The getvar helper script can print the values of internal LKMC variables.

Within our Python scripts such as common.py, those variable are visible as self.env[<var>].

For example, to find the Buildroot output directory for an aarch64 build, you could use:

./getvar --arch aarch64 buildroot_build_dir

which as of LKMC b15a0e455d691afa49f3b813ad9b09394dfb02b7 outputs:

/path/to/linux-kernel-module-cheat/out/buildroot/build/default/aarch64

You can also list all available variables in one go with just:

./getvar

Using getvar makes it possible to make Bash scripts more portable if for example directory structure changes across LKMC versions.

For this reason, we use it in particular often in this README to reduce the need for refactoring.