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

Fixes #177 -- let the kernel build process drive cargo #188

Merged
merged 1 commit into from
Sep 15, 2019

Conversation

alex
Copy link
Member

@alex alex commented Sep 14, 2019

A more minimal version of #185. Doesn't have all of the benefits, but does work in more cases I believe!

build.rs Show resolved Hide resolved
obj-m := helloworld.o
helloworld-objs := hello_world.rust.o
KDIR ?= /lib/modules/$(shell uname -r)/build

$(src)/target/x86_64-linux-kernel/debug/libhello_world.a: $(src)/Cargo.toml $(wildcard $(src)/src/*.c)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading Documentation/kbuild/makefiles.rst right, the target side of this should be $(obj), but I guess that involves setting CARGO_TARGET_DIR and some other things (cf. rust-lang/cargo#1657). Doesn't need to be done now but we should do it at some point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's right.

hello-world/Makefile Outdated Show resolved Hide resolved
@@ -9,3 +9,4 @@ Module.symvers
*.mod.c
*.o
modules.order
dummy.c
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why does this move? We're still doing a make -C kernel-cflags-finder, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a dummy.c somewhere I didn't expect it. It's possible it came from some random intermediate debugging state.

tests/Makefile Outdated Show resolved Hide resolved
tests/run_tests.py Show resolved Hide resolved
@alex alex force-pushed the kbuild-drives-minimal branch 2 times, most recently from 4ce96f1 to 43105da Compare September 15, 2019 18:29
@alex alex merged commit 5536879 into master Sep 15, 2019
@alex alex deleted the kbuild-drives-minimal branch September 15, 2019 19:23
geofft added a commit that referenced this pull request Aug 9, 2020
This is #185 minus #188, but with the CONFIG_CC_IS_CLANG fix from #227.

Co-authored-by: Geoffrey Thomas <[email protected]>
geofft added a commit that referenced this pull request Aug 11, 2020
The bulk of this is the changes from #185 that didn't make it into #188.

We also upgrade Travis's Clang/LLVM version to 9 to pick up some sort
of bugfix in relocation processing. With older versions, we get

[ 1827.072410] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000197e607d, val ffffffffc0703520

(where that "loc" seems to be random/garbage data, disconcertingly).
Clang 9 is already required by kernels 5.0+ so this shouldn't be too
much of a problem.

Co-authored-by: Alex Gaynor <[email protected]>
geofft added a commit that referenced this pull request Aug 11, 2020
The bulk of this is the changes from #185 that didn't make it into #188.

We also upgrade Travis's Clang/LLVM version to 9 to pick up some sort
of bugfix in relocation processing. With older versions, we get

[ 1827.072410] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000197e607d, val ffffffffc0703520

(where that "loc" seems to be random/garbage data, disconcertingly).
Clang 9 is already required by kernels 5.0+ so this shouldn't be too
much of a problem.

Co-authored-by: Alex Gaynor <[email protected]>
geofft added a commit that referenced this pull request Aug 11, 2020
The bulk of this is the changes from #185 that didn't make it into #188.

We also upgrade Travis's Clang/LLVM version to 9 to pick up some sort
of bugfix in relocation processing. With older versions, we get

[ 1827.072410] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000197e607d, val ffffffffc0703520

(where that "loc" seems to be random/garbage data, disconcertingly).
Clang 9 is already required by kernels 5.0+ so this shouldn't be too
much of a problem.

Co-authored-by: Alex Gaynor <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants