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

Commit fbde0fb

Browse files
committed
Undefine these if upstream has it
1 parent fd0da95 commit fbde0fb

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

hello-world/Kbuild

+3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
obj-m := helloworld.o
22
helloworld-objs := hello_world.rust.o
33

4+
# Don't define these if the kernel we're compiling against already has them.
5+
ifndef CONFIG_RUST
46
CARGO ?= cargo
57

68
$(src)/target/x86_64-linux-kernel/debug/libhello_world.a: $(src)/Cargo.toml $(wildcard $(src)/src/*.rs)
79
cd $(src); env -u MAKE -u MAKEFLAGS $(CARGO) build -Z build-std=core,alloc --target=x86_64-linux-kernel
810

911
%.rust.o: target/x86_64-linux-kernel/debug/lib%.a
1012
$(LD) -r -o $@ --whole-archive $<
13+
endif

tests/Kbuild

+3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
obj-m := testmodule.o
22
testmodule-objs := $(TEST_NAME).rust.o
33

4+
# Don't define these if the kernel we're compiling against already has them.
5+
ifndef CONFIG_RUST
46
CARGO ?= cargo
57

68
$(src)/target/x86_64-linux-kernel/debug/lib%.a: $(src)/$(TEST_PATH)/Cargo.toml $(wildcard $(src)/$(TEST_PATH)/src/*.rs)
79
cd $(src)/$(TEST_PATH); env -u MAKE -u MAKEFLAGS CARGO_TARGET_DIR=../target $(CARGO) build -Z build-std=core,alloc --target=x86_64-linux-kernel
810

911
%.rust.o: target/x86_64-linux-kernel/debug/lib%.a
1012
$(LD) -r -o $@ --whole-archive $<
13+
endif

0 commit comments

Comments
 (0)