Description
The Linux kernel has ~20k (yes, kilo!) configuration options, and we pass them via --cfg
s. This means that, in our rust-project.json
file, we have to put (a subset of) all of them, repeated per crate.
Currently we only have a small number of crates, but our configuration file can already reach 150k lines, ~7.5 MiB with just 6 crates (plus core
etc. that do not need the cfg
s). As Rust in the kernel grows, and as we start splitting our kernel
crate in smaller ones, it can get out of control soon: we may have 10 now, but we can eventually end up with 1000s if Rust is a success. Thus the file size may explode, and I imagine performance and memory usage may not be great either, depending on how it is implemented.
From a quick look at the documentation, it does not seem like one can define a set of "global" cfg
s to apply to "all" crates. Ideally, one would be able to define "groups" and then apply those groups to some crates before their individual set of cfg
s.
So, for instance, in our case, we would just define a group like "kernel": ["CONFIG_...=...", ...],
with essentially all the cfg
s, and then in each kernel crate that needs them we would have a key like: "cfg_groups": ["kernel"],
, rather than repeating every time all the cfg
s in the existing "cfg"
key.