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

Commit e0ce128

Browse files
committed
Use target from rust itself
1 parent 9a7e780 commit e0ce128

File tree

7 files changed

+7
-42
lines changed

7 files changed

+7
-42
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ matrix:
44

55
language: rust
66
rust:
7-
- nightly-2019-08-15
7+
- nightly-2019-09-05
88
cache:
99
- cargo: true
1010

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ cd hello-world
7676
3. Build the static object with cargo xbuild, pointing it at our custom target
7777

7878
```
79-
cargo xbuild --target $(pwd)/../x86_64-linux-kernel-module.json
79+
cargo xbuild --target x86_64-linux-kernel
8080
```
8181

8282
4. Build the kernel module using the Linux kernel build system (kbuild)

build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn main() {
109109
.derive_default(true)
110110
.rustfmt_bindings(true);
111111

112-
builder = builder.clang_arg("--target=x86_64-linux-kernel-module");
112+
builder = builder.clang_arg("--target=x86_64-linux-kernel");
113113
for arg in shlex::split(std::str::from_utf8(&output.stdout).unwrap()).unwrap() {
114114
builder = builder.clang_arg(arg.to_string());
115115
}
@@ -141,7 +141,7 @@ fn main() {
141141
let mut builder = cc::Build::new();
142142
println!("cargo:rerun-if-env-changed=CLANG");
143143
builder.compiler(env::var("CLANG").unwrap_or("clang".to_string()));
144-
builder.target("x86_64-linux-kernel-module");
144+
builder.target("x86_64-linux-kernel");
145145
builder.warnings(false);
146146
builder.file("src/helpers.c");
147147
for arg in shlex::split(std::str::from_utf8(&output.stdout).unwrap()).unwrap() {

hello-world/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ obj-m := helloworld.o
22
helloworld-objs := hello_world.rust.o
33
KDIR ?= /lib/modules/$(shell uname -r)/build
44

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

88
all:

tests/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ obj-m := testmodule.o
22
testmodule-objs := $(TEST_NAME).rust.o
33
KDIR ?= /lib/modules/$(shell uname -r)/build
44

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

88
all:

tests/run_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ def main():
2727
print("+ [{}]".format(path))
2828
run(
2929
"cargo", "xbuild",
30-
"--target",
31-
os.path.join(
32-
BASE_DIR, os.path.pardir, "x86_64-linux-kernel-module.json"
33-
),
30+
"--target", "x86_64-linux-kernel",
3431
cwd=os.path.join(BASE_DIR, path),
3532
environ=dict(
3633
os.environ,

x86_64-linux-kernel-module.json

-32
This file was deleted.

0 commit comments

Comments
 (0)