【问题标题】:make[1]: *** No rule to make target 'something.o', needed by `something/built-in.o'. Stopmake[1]: *** 没有规则来制作目标“something.o”,这是“something/built-in.o”所需要的。停止
【发布时间】:2015-06-11 15:16:52
【问题描述】:

我是内核编码的新手,我正在完成一项学校作业。我应该向内核添加一个系统调用并编译它。 到目前为止,我所做的如下: 我在内核中创建了一个文件夹,称为 syscalls。

在该系统调用文件夹中,我添加了 3 个文件:

1) syscall.c 2)syscall.h 3) 生成文件

make文件只有一行代码

obj-y := syscall.o

syscall.c 有一个方法,签名如下:

asmlinkage long sys_call_function(struct array_stats *stats, long data[],long size)

然后我将以下内容添加到 arch/x86/syscalls/syscall_64.tbl

330     common  syscall         sys_call_function

然后我将下面的粗体文本添加到内核的 Make 文件中 core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ syscalls/

然后我去了 ma​​ke clean 然后 ma​​ke -j3 但我收到以下错误:

make[1]: *** No rule to make target `syscalls/syscall.o', needed by `syscalls/built-in.o'.  Stop.

make: * [cs300] 错误 2 make: * 等待未完成的工作......

谁能给我一些提示。我被卡住了,无法继续前进。

【问题讨论】:

    标签: linux-kernel system-calls


    【解决方案1】:

    使用此补丁(针对 v4.0-rc7)

    diff --git a/Makefile b/Makefile
    index 54430f9..874ac96 100644
    --- a/Makefile
    +++ b/Makefile
    @@ -884,7 +884,7 @@ export mod_sign_cmd
    
    
     ifeq ($(KBUILD_EXTMOD),)
    -core-y         += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
    +core-y         += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ xyz/
    
     vmlinux-dirs   := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
                         $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
    diff --git a/xyz/Makefile b/xyz/Makefile
    new file mode 100644
    index 0000000..0096b34
    --- /dev/null
    +++ b/xyz/Makefile
    @@ -0,0 +1 @@
    +obj-y := abc.o
    diff --git a/xyz/abc.c b/xyz/abc.c
    new file mode 100644
    index 0000000..1edff5b
    --- /dev/null
    +++ b/xyz/abc.c
    @@ -0,0 +1,4 @@
    +int somefunc(int somevar)
    +{
    +       return somevar + 2;
    +}
    

    我无法重现您的问题。你能发布你的补丁吗?

    【讨论】:

      猜你喜欢
      • 2012-02-14
      • 1970-01-01
      • 1970-01-01
      • 2014-06-07
      • 2014-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多