Skip to content

Commit

Permalink
fix linux-driver build err
Browse files Browse the repository at this point in the history
  • Loading branch information
ririyeye committed Oct 22, 2024
1 parent a7aab9d commit fcf649a
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 15 deletions.
1 change: 1 addition & 0 deletions tests/projects/linux/driver/hello/src/add.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "add.h"
int add(int a, int b) {
return a + b;
}
2 changes: 2 additions & 0 deletions tests/projects/linux/driver/hello/src/add.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#pragma once
int add(int a, int b);
7 changes: 3 additions & 4 deletions tests/projects/linux/driver/hello/src/hello.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
#include <linux/init.h>
#include <linux/module.h>
#include "add.h"

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)
static int hello_init(void)
{
printk(KERN_INFO "Hello World: %d\n", add(1, 2));
return 0;
}

void hello_exit(void)
static void hello_exit(void)
{
printk(KERN_INFO "Goodbye World\n");
}
Expand Down
1 change: 1 addition & 0 deletions tests/projects/linux/driver/hello_custom/src/add.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "add.h"
int add(int a, int b) {
return a + b;
}
2 changes: 2 additions & 0 deletions tests/projects/linux/driver/hello_custom/src/add.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#pragma once
int add(int a, int b);
8 changes: 3 additions & 5 deletions tests/projects/linux/driver/hello_custom/src/hello.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
#include <linux/init.h>
#include <linux/module.h>

#include "add.h"
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)
static int hello_init(void)
{
printk(KERN_INFO "Hello World: %d\n", add(1, 2));
return 0;
}

void hello_exit(void)
static void hello_exit(void)
{
printk(KERN_INFO "Goodbye World\n");
}
Expand Down
1 change: 1 addition & 0 deletions tests/projects/linux/driver/hello_makefile/src/add.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "add.h"
int add(int a, int b) {
return a + b;
}
2 changes: 2 additions & 0 deletions tests/projects/linux/driver/hello_makefile/src/add.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#pragma once
int add(int a, int b);
7 changes: 3 additions & 4 deletions tests/projects/linux/driver/hello_makefile/src/hello.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
#include <linux/init.h>
#include <linux/module.h>
#include "add.h"

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)
static int hello_init(void)
{
printk(KERN_INFO "Hello World: %d\n", add(1, 2));
return 0;
}

void hello_exit(void)
static void hello_exit(void)
{
printk(KERN_INFO "Goodbye World\n");
}
Expand Down
4 changes: 2 additions & 2 deletions xmake/rules/platform/linux/driver/driver_modules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ MODULE_AUTHOR("Ruki");
MODULE_DESCRIPTION("A simple Hello World Module");
MODULE_ALIAS("a simplest module");
int hello_init(void) {
static int hello_init(void) {
printk(KERN_INFO "Hello World\n");
return 0;
}
void hello_exit(void) {
static void hello_exit(void) {
printk(KERN_INFO "Goodbye World\n");
}
Expand Down

0 comments on commit fcf649a

Please sign in to comment.