Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kpwn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dex
Kpwn
Commits
88b98432
Commit
88b98432
authored
4 years ago
by
dex
Browse files
Options
Downloads
Patches
Plain Diff
add lkm template
parent
4b8bfe6a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lkm/Makefile
+13
-0
13 additions, 0 deletions
lkm/Makefile
lkm/README.md
+19
-0
19 additions, 0 deletions
lkm/README.md
lkm/mod.c
+15
-0
15 additions, 0 deletions
lkm/mod.c
with
47 additions
and
0 deletions
lkm/Makefile
0 → 100644
+
13
−
0
View file @
88b98432
KDIR
?=
../kernel/linux-3.xx.y
CROSS
?=
arm-linux-gnueabi-
# use this if you want to cross-compile the module
PWD
:=
$(
shell
pwd
)
obj-m
+=
mod.o
all
:
make
ARCH
=
arm
CROSS_COMPILE
=
$(
CROSS
)
-C
$(
KDIR
)
M
=
$(
PWD
)
modules
# cross-compilation
#make -C
$(
KDIR
)
M
=
$(
PWD
)
modules
# non-cross-compilation
clean
:
make
-C
$(
KDIR
)
M
=
$(
PWD
)
clean
This diff is collapsed.
Click to expand it.
lkm/README.md
0 → 100644
+
19
−
0
View file @
88b98432
Minimal template for loadable kernel module (LKM) compilation.
Change
`Makefile`
to your needs.
Usage:
```
$ make KDIR=<path_to_kernel_out>
$ make KDIR=<path_to_kernel_out> clean
```
Copy
`mod.ko`
to target system.
On target:
```
$ insmod mod.ko
$ lsmod # should show LKM
```
This diff is collapsed.
Click to expand it.
lkm/mod.c
0 → 100644
+
15
−
0
View file @
88b98432
#include
<linux/module.h>
#include
<linux/kernel.h>
static
int
__init
initmodule
(
void
){
printk
(
"Hello Kernel!
\n
"
);
return
0
;
}
static
void
__exit
exitmodule
(
void
){
return
;
}
module_init
(
initmodule
);
module_exit
(
exitmodule
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment