小编use*_*939的帖子

为Arm/Raspberry PI扩展Rasbian内核(Linux内核3.10.28) - 如何正确添加自己的系统调用?

我需要为Raspbian Linux内核添加一个自己的系统调用.现在我在搜索了大约2天后找到了解决方案.

要添加系统调用,我基本上遵循以下git repo中的内核源代码的大纲(http://elinux.org/RPi_Kernel_Compilation):

混帐://github.com/raspberrypi/tools.git

我使用crosstool-ng安装了交叉编译环境(http://www.kitware.com/blog/home/post/426).

以上所有这些都有效.我能够编译和部署新内核.我还能够为Raspbian交叉编译.

我正在尝试添加一个'hello world'系统调用.该函数驻留在自己的实现文件(kernel/helloworld.?)中,并实现为:

helloworld.c:

#include <linux/linkage.h>
#include <linux/kernel.h>
#include <linux/random.h>
#include "helloworld.h"

asmlinkage long sys_helloworld(){
  printk (KERN_EMERG "hello world!");
  return get_random_int()*4;
}
Run Code Online (Sandbox Code Playgroud)

helloworld.h:

#ifndef HELLO_WORLD_H
#define HELLO_WORLD_H
asmlinkage long sys_helloworld(void);
#endif
Run Code Online (Sandbox Code Playgroud)

Makefile相应地扩展.

我现在卡在错误消息中

AS      arch/arm/kernel/entry-common.o
arch/arm/kernel/entry-common.S: Assembler messages:
arch/arm/kernel/entry-common.S:104: Error: __NR_syscalls is not equal to the size of the syscall table
make[1]: *** [arch/arm/kernel/entry-common.o] Error 1
Run Code Online (Sandbox Code Playgroud)

按照编写新系统调用的建议,我添加了以下内容:

linux kernel arm system-calls raspberry-pi

2
推荐指数
1
解决办法
1523
查看次数

标签 统计

arm ×1

kernel ×1

linux ×1

raspberry-pi ×1

system-calls ×1