hermit-os / hermit-rs

Hermit for Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Networking config file

hugusmaximus opened this issue · comments

I wonder if it would be possible to have some compile-time config file (not source code) so some critical parameters of networking (static IP address, DNS servers, dhcp on/off,...) could be setup there before compiling and without having to change source code.

Yeah, we have to describe it better. It exists sone environment variables to define the static network configuration. See https://github.com/hermit-os/kernel/blob/main/src/executor/device.rs#L95

Sure, this is what I'm doing (and also disabling the dhcpv4 feature) but just wondered if this could be in a separated config file... It's fine, I can go ahead by modifying those variables you mention.

Yes, we should do it. I will talk @mkroening about it.

I'm not sure how easy that would be.

Where would we search for that file?

  • We could do it like Cargo does for .config/cargo.toml, but that depends on the current directory and I am not sure how well that composes with our build scripts.
  • We could put it into the kernel's source root, but that is not easily accessible when not developing the kernel locally.
  • We might want to put it next to the application being built, but that directory is not exposed to build scripts by cargo. Then, we could parse the file in the build script and set corresponding environment variables. This approach would translate very poorly to C applications, too.
  • We might want to put it in some Hermitfile describing the image, similar to a Dockerfile. That would be ideal, I think, but we don't have such a thing yet.

I think for the mean time, it would be easiest to work around this by setting up some shell script (maybe even a local alias for cargo), which would represent a self-built version of such a configuration file.