diff --git a/hello-world/src/lib.rs b/hello-world/src/lib.rs index 1799c1ff..4ac88f5f 100644 --- a/hello-world/src/lib.rs +++ b/hello-world/src/lib.rs @@ -32,5 +32,5 @@ kernel_module!( HelloWorldModule, author: "Alex Gaynor and Geoffrey Thomas", description: "An extremely simple kernel module", - license: "GPL" + __module_license_string: "GPL" ); diff --git a/tests/Makefile b/tests/Makefile index 5184e4d7..f7975996 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,9 +1,14 @@ +ifneq ($(KERNELRELEASE),) obj-m := testmodule.o testmodule-objs := $(TEST_LIBRARY) EXTRA_LDFLAGS += --entry=init_module +$(M)/$(TEST_LIBRARY): $(TEST_LIBRARY_ARCHIVE) + $(LD) -r -o $@ --whole-archive $^ +else all: $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) clean: $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(CURDIR) clean +endif \ No newline at end of file diff --git a/tests/run_tests.py b/tests/run_tests.py index f8fae900..aa337174 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -46,6 +46,8 @@ def main(): path ) ) + library_archive, _ = os.path.splitext(os.path.basename(module)) + library_archive = os.path.join(library_archive, ".a") run( "make", "-C", BASE_DIR, "TEST_LIBRARY={}".format( @@ -54,6 +56,7 @@ def main(): os.path.basename(module) ) ), + "TEST_LIBRARY_ARCHIVE={}".format(library_archive), ) run( "rustc",