Skip to content
This repository was archived by the owner on Mar 7, 2021. It is now read-only.

Use target from rust itself #172

Merged
merged 1 commit into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ matrix:

language: rust
rust:
- nightly-2019-08-15
- nightly-2019-09-11
cache:
- cargo: true

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ cd hello-world
3. Build the static object with cargo xbuild, pointing it at our custom target

```
cargo xbuild --target $(pwd)/../x86_64-linux-kernel-module.json
cargo xbuild --target x86_64-linux-kernel
```

4. Build the kernel module using the Linux kernel build system (kbuild)
Expand Down
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn main() {
.derive_default(true)
.rustfmt_bindings(true);

builder = builder.clang_arg("--target=x86_64-linux-kernel-module");
builder = builder.clang_arg("--target=x86_64-linux-kernel");
for arg in shlex::split(std::str::from_utf8(&output.stdout).unwrap()).unwrap() {
builder = builder.clang_arg(arg.to_string());
}
Expand Down Expand Up @@ -140,7 +140,7 @@ fn main() {
let mut builder = cc::Build::new();
println!("cargo:rerun-if-env-changed=CLANG");
builder.compiler(env::var("CLANG").unwrap_or("clang".to_string()));
builder.target("x86_64-linux-kernel-module");
builder.target("x86_64-linux-kernel");
builder.warnings(false);
builder.file("src/helpers.c");
for arg in shlex::split(std::str::from_utf8(&output.stdout).unwrap()).unwrap() {
Expand Down
2 changes: 1 addition & 1 deletion hello-world/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ obj-m := helloworld.o
helloworld-objs := hello_world.rust.o
KDIR ?= /lib/modules/$(shell uname -r)/build

%.rust.o: target/x86_64-linux-kernel-module/debug/lib%.a
%.rust.o: target/x86_64-linux-kernel/debug/lib%.a
$(LD) -r -o $@ --whole-archive $<

all:
Expand Down
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ obj-m := testmodule.o
testmodule-objs := $(TEST_NAME).rust.o
KDIR ?= /lib/modules/$(shell uname -r)/build

%.rust.o: target/x86_64-linux-kernel-module/debug/lib%.a
%.rust.o: target/x86_64-linux-kernel/debug/lib%.a
$(LD) -r -o $@ --whole-archive $<

all:
Expand Down
5 changes: 1 addition & 4 deletions tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ def main():
print("+ [{}]".format(path))
run(
"cargo", "xbuild",
"--target",
os.path.join(
BASE_DIR, os.path.pardir, "x86_64-linux-kernel-module.json"
),
"--target", "x86_64-linux-kernel",
cwd=os.path.join(BASE_DIR, path),
environ=dict(
os.environ,
Expand Down
32 changes: 0 additions & 32 deletions x86_64-linux-kernel-module.json

This file was deleted.