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

Commit

Permalink
Undefine these if upstream has it
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Sep 23, 2019
1 parent fd0da95 commit fbde0fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hello-world/Kbuild
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
obj-m := helloworld.o
helloworld-objs := hello_world.rust.o

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

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

%.rust.o: target/x86_64-linux-kernel/debug/lib%.a
$(LD) -r -o $@ --whole-archive $<
endif
3 changes: 3 additions & 0 deletions tests/Kbuild
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
obj-m := testmodule.o
testmodule-objs := $(TEST_NAME).rust.o

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

$(src)/target/x86_64-linux-kernel/debug/lib%.a: $(src)/$(TEST_PATH)/Cargo.toml $(wildcard $(src)/$(TEST_PATH)/src/*.rs)
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

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

0 comments on commit fbde0fb

Please sign in to comment.