i586-poky-linux:没有规则可以制作目标`arch / x86 / tools / relocs.c',`arch / x86 / tools / relocs'

时间:2014-09-13 17:09:00

标签: linux linux-kernel kernel kernel-module

我在Macbook Pro上的VirtualBox上运行Ubuntu 14.04 64位MAC。我在hello_kernel.c中有以下要运行的内容。

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>   

static int __init enter(void)
{
    printk(KERN_ALERT "Hello Kernel Galileo\n");
    return 0;
}

static void __exit exit(void)
{
    printk(KERN_ALERT "Bye kernel Galileo\n");
    return;
}

module_init(enter);
module_exit(exit);

我在/home/esp/SDK/i586-poky-linux安装了i586-poky-linux,这是我的Makefile

obj-m:= hello_kernel.o

ARCH=x86
CROSS_COMPILE=i586-poky-linux-

all:
    make -C /home/esp/SDK/sysroots/i586-poky-linux/usr/src/kernel M=$(PWD) modules

clean:
    rm -fr *.o
    rm -fr *.ko
    rm -fr *.mod.c
    rm -fr *.order
    rm -fr *.symvers

运行sudo make时出现以下错误。

make[2]: Nothing to be done for `all'.
make[2]: *** No rule to make target `arch/x86/tools/relocs.c', needed by `arch/x86/tools/relocs'.  Stop.
make[1]: *** [archscripts] Error 2
make[1]: Leaving directory `/home/esp/SDK/sysroots/i586-poky-linux/usr/src/kernel'

我在relocs中看不到relocs.c~/SDK/sysroots/i586-poky-linux/usr/src/kernel/arch/x86/tools/

1 个答案:

答案 0 :(得分:0)

找到解决方案!我的i586-poky-linux内核安装中缺少一些脚本。要生成这些脚本,请在sudo make scripts中运行SDK/sysroots/i586-poky-linux/usr/src/kernel。这将生成所需的脚本,一切正常。 :)