cdrtools-3.02 arm7 交叉编译通过
蒋俊人
2023-12-01
1) uname -a 查看 armv7l 内核2.6
Linux dvr 2.6.37 #57 Fri Aug 14 10:35:26 CST 2015 armv7l unknown
设置编译环境:
export PATH=/home/yod/workbench/github/out_project/2016-01-25/toolchain/bin/:$PATH
export CONFIG_RMTDEBUG=true
export CONFIG_RMTCALL=:
export CC=/home/yod/workbench/github/out_project/2016-01-25/toolchain/bin/arm-linux-gcc
export CONFIG_RMTHOST=NONE
export SYSROOT=/home/yod/workbench/github/out_project/2016-01-25/toolchain/arm-none-linux-gnueabi/libc
编译:
make ARCH=armv7l OSNAME=linux CCOM=gcc "CC_COM=$CC"
会报错,
然后开始查找错误:
主要是以下为空或者不存在,
incs/armv7l-linux-gcc/align.h
incs/armv7l-linux-gcc/avoffset.h
修改步骤:
a)
diff --git a/RULES/rules.inc b/RULES/rules.inc
15 index e0c3ea8..fe790c4 100755
16 --- a/RULES/rules.inc
17 +++ b/RULES/rules.inc
18 @@ -46,11 +46,11 @@ $(PTARGETCX): $(OFILES) $(SRCLIBS)
19 # If calling "$(PTARGETC)$(_XEXEEXT)" fails, this may be a cross compilation,
20 # so retry to run the command under control of "$(CONFIG_RMTCALL)".
21 #
22 -$(PTARGET): $(OINCSDIR) $(PTARGETCX)
23 - @echo " ==> GENERATING include file \"$@\""; \
24 - $(PTARGETC)$(_XEXEEXT) > $@ || \
25 - $(CONFIG_RMTCALL) $(PTARGETC)$(_XEXEEXT) > $@
26 -
27 +#$(PTARGET): $(OINCSDIR) $(PTARGETCX)
28 +# @echo " ==> GENERATING include file \"$@\""; \
29 +# $(PTARGETC)$(_XEXEEXT) > $@ || \
30 +# $(CONFIG_RMTCALL) $(PTARGETC)$(_XEXEEXT) > $@
31 +#
b)拷贝如下到板子上,
./inc/OBJ/armv7l-linux-gcc/align_test > align.h
./inc/OBJ/armv7l-linux-gcc/avoffset > avoffset.h
分别运行 生成对应头文件,然后copy回来,放到 incs/armv7l-linux-gcc/
c) cdrtools-3.02 源码,重新从解压处获取一份。然后make,直接在linux下编译,应该是直接编译过去的。然后对比xconfig.h 文件;
/home/yod/workbench/github/out_project/arm/new_0127/cdrtools-3.02/incs/armv7l-linux-gcc/xconfig.h
/home/yod/workbench/github/out_project/cdrtools-3.02_linux/cdrtools-3.02/incs/x86_64-linux-cc/xconfig.h
主要修改
#define SIZEOF_CHAR 1
#define SIZEOF_SHORT_INT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG_INT 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF___INT64 0
#define SIZEOF_CHAR_P 4
#define SIZEOF_UNSIGNED_CHAR 1
#define SIZEOF_UNSIGNED_SHORT_INT 2
#define SIZEOF_UNSIGNED_INT 4
#define SIZEOF_UNSIGNED_LONG_INT 4
#define SIZEOF_UNSIGNED_LONG_LONG 8
#define SIZEOF_UNSIGNED___INT64 0
#define SIZEOF_UNSIGNED_CHAR_P 4
#define SIZEOF_FLOAT 4
#define SIZEOF_DOUBLE 8
#define SIZEOF_LONG_DOUBLE 8
#define SIZEOF_SIZE_T 4
#define SIZEOF_SSIZE_T 4
#define SIZEOF_PTRDIFF_T 4
#define SIZEOF_MODE_T 4
#define SIZEOF_UID_T 4
#define SIZEOF_GID_T 4
#define SIZEOF_PID_T 4
请参考align.h 里面的sizeofint等,
然后再
make ARCH=armv7l OSNAME=linux CCOM=gcc "CC_COM=$CC"
这次应该成功了。
sudo make install ARCH=armv7l OSNAME=linux CCOM=gcc "CC_COM=$CC"