diff --git a/README.md b/README.md index fd58c88..f3e5816 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ cargo xtask build-ebpf ``` To perform a release build you can use the `--release` flag. -You may also change the target architecture with the `--target` flag +You may also change the target architecture with the `--target` flag. +If you require a specific (nightly) version of the toolchain, you can use the `--toolchain` flag. ## Build Userspace diff --git a/xtask/src/build_ebpf.rs b/xtask/src/build_ebpf.rs index 25c4f06..272cf91 100644 --- a/xtask/src/build_ebpf.rs +++ b/xtask/src/build_ebpf.rs @@ -34,6 +34,9 @@ pub struct Options { /// Set the endianness of the BPF target #[clap(default_value = "bpfel-unknown-none", long)] pub target: Architecture, + /// Set the rust toolchain + #[clap(default_value = "+nightly", long)] + pub toolchain: String, /// Build the release target #[clap(long)] pub release: bool, @@ -43,7 +46,7 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("{{project-name}}-ebpf"); let target = format!("--target={}", opts.target); let mut args = vec![ - "+nightly", + opts.toolchain.as_str(), "build", "--verbose", target.as_str(), diff --git a/xtask/src/run.rs b/xtask/src/run.rs index 55a9806..10bde90 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -19,6 +19,9 @@ pub struct Options { /// Arguments to pass to your application #[clap(name = "args", last = true)] pub run_args: Vec, + /// Set the rust toolchain + #[clap(default_value = "+nightly", long)] + pub toolchain: String, } /// Build the project @@ -41,6 +44,7 @@ pub fn run(opts: Options) -> Result<(), anyhow::Error> { build_ebpf(BuildOptions { target: opts.bpf_target, release: opts.release, + toolchain: opts.toolchain.clone(), }) .context("Error while building eBPF program")?; build(&opts).context("Error while building userspace application")?;