Ядро собираю так:
Shell
$ echo | make oldconfig
...
$ make -j4
...
$Shell
$ sudo make modules_install install
...
$Shell
$ uname -r
7.3.5
$Shell
$ cat hello_world/sys_hello_world.c
#include <linux/syscalls.h>
SYSCALL_DEFINE0(hello_world)
{
printk("Hello, world!\n");
return -4;
};
$Shell
$ cat arch/x86/entry/syscalls/syscall_64.tbl | tail -n 3
999 64 hello_world sys_hello_world
# This is the end of the legacy x32 range. Numbers 548 and above are
# not special and are not to be used for x32-specific syscalls.
$Shell
$ cat foo.c
#include <stdio.h>
#include <unistd.h>
int main () {
int ret_val = syscall(999);
printf("[ERR] Retggg vall: %d\n", ret_val);
return 0;
}
$
$ gcc foo.c
$
$ ./a.out
[ERR] Retggg vall: -1
$Shell
$ sudo dmesg | tail -n 1
[ 6899.381683] Hello, world!
$