commit eea26837fb12f9705e8e6120c992c96f332380d1 Author: inexcode Date: Tue Mar 21 11:19:59 2023 +0300 Initial commit diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..53624c9 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..23382d0 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +obj-m += hello.o +# make -C $(nix-build -E '(import {}).linux.dev' --no-out-link)/lib/modules/*/build M=$(pwd) + +all: + make -C /nix/store/f0b11y3qv1y0l3yvwkl88m181fnbmn80-linux-5.15.92-dev/lib/modules/*/build M=/home/inex/dev/Linux modules +clean: + make -C /nix/store/f0b11y3qv1y0l3yvwkl88m181fnbmn80-linux-5.15.92-dev/lib/modules/*/build M=/home/inex/dev/Linux clean diff --git a/hello.c b/hello.c new file mode 100644 index 0000000..8f2301f --- /dev/null +++ b/hello.c @@ -0,0 +1,25 @@ +#include +#include +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Inex Code"); +MODULE_DESCRIPTION("A hello world"); +MODULE_VERSION("0.0.2"); + +static char *whom = "world"; +module_param(whom, charp, 0); +static int howmany = 1; +module_param(howmany, int, 0); + +static int __init hello_init(void) { + int i; + for (i = 0; i < howmany; i++) + printk(KERN_INFO "Hello %s.\n", whom); + return 1; +} + +static void __exit hello_goodbye(void) { + printk(KERN_INFO "Goodbye cruel %s.\n", whom); +} + +module_init(hello_init); +module_exit(hello_goodbye);