From af1618680f6ed2f90accafc534ffdfc7caf2f078 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 22 Dec 2021 22:40:40 +0800 Subject: add linux driver test for custom --- tests/projects/linux/driver/hello_custom/src/add.c | 3 +++ .../projects/linux/driver/hello_custom/src/hello.c | 23 ++++++++++++++++++++++ tests/projects/linux/driver/hello_custom/xmake.lua | 6 ++++++ 3 files changed, 32 insertions(+) create mode 100644 tests/projects/linux/driver/hello_custom/src/add.c create mode 100644 tests/projects/linux/driver/hello_custom/src/hello.c create mode 100644 tests/projects/linux/driver/hello_custom/xmake.lua (limited to 'tests/projects/linux/driver') diff --git a/tests/projects/linux/driver/hello_custom/src/add.c b/tests/projects/linux/driver/hello_custom/src/add.c new file mode 100644 index 000000000..59aab4983 --- /dev/null +++ b/tests/projects/linux/driver/hello_custom/src/add.c @@ -0,0 +1,3 @@ +int add(int a, int b) { + return a + b; +} diff --git a/tests/projects/linux/driver/hello_custom/src/hello.c b/tests/projects/linux/driver/hello_custom/src/hello.c new file mode 100644 index 000000000..414a03bb2 --- /dev/null +++ b/tests/projects/linux/driver/hello_custom/src/hello.c @@ -0,0 +1,23 @@ +#include +#include + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("Ruki"); +MODULE_DESCRIPTION("A simple Hello World Module"); +MODULE_ALIAS("a simplest module"); + +int add(int a, int b); + +int hello_init(void) +{ + printk(KERN_INFO "Hello World: %d\n", add(1, 2)); + return 0; +} + +void hello_exit(void) +{ + printk(KERN_INFO "Goodbye World\n"); +} + +module_init(hello_init); +module_exit(hello_exit); diff --git a/tests/projects/linux/driver/hello_custom/xmake.lua b/tests/projects/linux/driver/hello_custom/xmake.lua new file mode 100644 index 000000000..846bddc55 --- /dev/null +++ b/tests/projects/linux/driver/hello_custom/xmake.lua @@ -0,0 +1,6 @@ +option("linux-headers", {showmenu = true, description = "Set linux-headers path."}) +target("hello") + add_rules("platform.linux.driver") + add_files("src/*.c") + set_values("linux.driver.linux-headers", "$(linux-headers)") + -- cgit v1.3.1