-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linux: gigevision kernel driver build setup
It is just an empty driver for now :)
- Loading branch information
Showing
7 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ccflags-y := $(MODULE_CFLAGS) | ||
obj-m := aravis_gv.o | ||
aravis_gv-y := $(patsubst $(src)/%.c,%.o,$(wildcard $(src)/*.c)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <linux/module.h> | ||
|
||
MODULE_LICENSE("GPL"); | ||
MODULE_AUTHOR("Emmanuel Pacaud <[email protected]>"); | ||
|
||
int | ||
init_module(void) | ||
{ | ||
printk (KERN_ALERT "aravis: loaded\n"); | ||
|
||
return 0; | ||
} | ||
|
||
void | ||
cleanup_module(void) | ||
{ | ||
printk (KERN_ALERT "aravis: unloaded\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
gv_mkfile = custom_target('gv_makefile', output:'Makefile', command:['touch', '@OUTPUT@']) | ||
|
||
gv_sources = files([ | ||
'arvgvkmod.c' | ||
]) | ||
|
||
custom_target ('gv_kmod',input: gv_sources, output: 'aravis_gv.ko', command:[ | ||
'make', '-j4', '-C', kernel_build_dir, | ||
'M='+join_paths(meson.current_build_dir()), | ||
'src='+join_paths(meson.current_source_dir()), | ||
'MODULE_CFLAGS=-I'+meson.current_source_dir(), | ||
'modules'], depends:gv_mkfile, build_by_default:true) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
if host_machine.system()=='linux' | ||
kernel_version = run_command('uname', '-r').stdout().strip() | ||
kernel_build_dir = join_paths('/', 'lib', 'modules', kernel_version, 'build') | ||
|
||
# test running make in kernel directory, using "make kernelversion" | ||
make_returncode = run_command('make', '-sC', kernel_build_dir, 'kernelversion').returncode() | ||
if make_returncode != 0 | ||
error('Cannot compile kernel modules as requested - are kernel headers installed?') | ||
endif | ||
|
||
subdir('linux-gv') | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mkdir -p "$2/drivers/kmod.dir" | ||
cp -Rf "$1/drivers/"* "$2/drivers/kmod.dir" | ||
rm -f "$2/drivers/kmod.dir/meson.build" "$2/drivers/kmod.dir/mesonbuild.sh" | ||
cd "$2/drivers/kmod.dir" | ||
sed -i -e "s|\$(src)|$1/drivers|" "$2/drivers/kmod.dir/Kbuild" | ||
make | ||
mv "aravis_gv.ko" "$2/drivers" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters