Relocation the generic ELF 问题
这个连接问题是由于将两个使用不同编译器编译出的目标文件连接到一起而导致的,原因经常是因为没有在所有的Makefile中统一使用$(CC)代表编译器。
/* 是否相等 */
ifeq ($(PLATFORM), 目标硬件平台)
export CROSS_COMPILE := 编译器前缀 --------一定要导出这个,要不会出现Relocation the generic ELF (EM 40)的问题
endif
export CC:= $(CROSS_COMPILE)gcc /* 编译器 */
export AR:= $(CROSS_COMPILE)ar /* 生成.a文件 */
export AS:= $(CROSS_COMPILE)as /* 汇编器 */
export LD:= $(CROSS_COMPILE)ld /* 连接器 */
export NM:= $(CROSS_COMPILE)nm /* */
export RANLIB:= $(CROSS_COMPILE)ranlib /* */
export STRIP:= $(CROSS_COMPILE)strip /* 优化目标文件大小 */
export SIZE:= $(CROSS_COMPILE)size /* */
文章出处:http://www.diybl.com/course/3_program/c++/cppsl/200899/141297.html
error: `PCIMEM_BASE ' undeclared
/home/buery/workspace/linux-2.6.29/init/main.c:694: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `run_init_process':
/home/buery/workspace/linux-2.6.29/init/main.c:781: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `init_post':
/home/buery/workspace/linux-2.6.29/init/main.c:790: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `name_to_dev_t':
/home/buery/workspace/linux-2.6.29/init/do_mounts.c:77: undefined reference to `__gnu_mcount_nc'
init/built-in.o: In function `rest_init':
/home/buery/workspace/linux-2.6.29/init/main.c:452: undefined reference to `__gnu_mcount_nc'
init/built-in.o:/home/buery/workspace/linux-2.6.29/init/calibrate.c:123: more undefined references to `__gnu_mcount_nc' follow
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"
MACH_TYPE = 782
NOW, Booting Linux......
Failed to execute /linuxrc. Attempting defaults...
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
只要重新烧写kernel和文件系统,让kernel的common-smdk.c中的nand的分区信息和vivi中的分区信息保持一致即可。