我正在尝试为ARM构建Linux内核3.2.81 .

以下是我要遵循的步骤:

这是我面临的错误输出,当我进行第7步(make all)时:

CC      init/do_mounts_initrd.o
  LD      init/mounts.o
init/do_mounts_initrd.o: In function `return_address':
/home/ramy/QEMU_Learn/Kernel/linux-3.2.81/arch/arm/include/asm/ftrace.h:51: multiple definition of `return_address'
init/do_mounts.o:/home/ramy/QEMU_Learn/Kernel/linux-3.2.81/arch/arm/include/asm/ftrace.h:51: first defined here
scripts/Makefile.build:427: recipe for target 'init/mounts.o' failed
make[1]: *** [init/mounts.o] Error 1
Makefile:947: recipe for target 'init' failed
make: *** [init] Error 2

这是错误中提到的ftrace.h(ftrace.h:51)中的部分:

#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)
/*
 * return_address uses walk_stackframe to do it's work.  If both
 * CONFIG_FRAME_POINTER=y and CONFIG_ARM_UNWIND=y walk_stackframe uses unwind
 * information.  For this to work in the function tracer many functions would
 * have to be marked with __notrace.  So for now just depend on
 * !CONFIG_ARM_UNWIND.
 */

void *return_address(unsigned int);

#else

extern inline void *return_address(unsigned int level)
{
    return NULL;
}

我正在使用Ubuntu操作系统,并使用Linaro工具链 .

PATH变量:

printenv | grep PATH
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ramy/gcc-arm-none-eabi-5_3-2016q1/bin
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path