cdrtools交叉编译过程

来源:互联网 发布:宁弈和知微的结局 编辑:程序博客网 时间:2024/05/16 08:09
cdrtool编译过程:


1. 首先保证cdrtool可以在linux主机上编译成功,并正常运行。
   (Linux 2.6.32-71.29.1.el6.i686 #1 SMP Mon Jun 27 i686 i386 GNU/Linux验证)


1.1 下载cdrtools的3.00版本;解压;进入主目录;make;


1.2 在./cdrecord/OBJ/i686-linux-cc与./mkisofs/OBJ/i686-linux-cc下分别生成
cdrtool与mkisofs,将两个二进制程序拷贝到同一目录下(./release/x86)。


1.3 验证版本:
[root@kongqx x86]# ./cdrecord -version
Cdrecord-ProDVD-ProBD-Clone 3.00 (i686-pc-linux-gnu) Copyright (C) 
1995-2010 JSchilling
[root@kongqx x86]# ./mkisofs -version
mkisofs 3.00 (i686-pc-linux-gnu) Copyright (C) 1993-1997 Eric 
Youngdale (C) 1997-2010 JSchilling


1.4 验证功能:
[root@kongqx x86]# ./cdrecord --scanbus
Cdrecord-ProDVD-ProBD-Clone 3.00 (i686-pc-linux-gnu) Copyright (C) 
1995-2010 JSchilling
Linux sg driver version: 3.5.34
Using libscg version 'schily-0.9'.
scsibus6:
6,0,0   600) 'ATA     ' 'SAMSUNG SP1604N/' 'TM10' Disk
6,1,0   601) *
6,2,0   602) *
6,3,0   603) *
6,4,0   604) *
6,5,0   605) *
6,6,0   606) *
6,7,0   607) *
scsibus12:
12,0,0  1200) 'HL-DT-ST' 'DVDRAM GP08NU6W ' '1.00' 
Removable CD-ROM
12,1,0  1201) *
12,2,0  1202) *
12,3,0  1203) *
12,4,0  1204) *
12,5,0  1205) *
12,6,0  1206) *
12,7,0  1207) *


1.5 X86上刻录验证:


2. 修改编译时规则:


2.1 RULES/rules.cnf,XCC_COM一行改为:XCC_COM=arm-hisiv100nptl-linux-gcc。


2.2 DEFAULTS/Defaults.linux,修改DEFCCOM为gcc。


2.3 libschily/findbyte.c,新增#define SIZE_LONG 4


2.4 RULES/cc-gcc.rul,修改echo后面有gcc的地方为arm-hisiv100nptl-linux-gcc,
有g++的地方为arm-hisiv100nptl-linux-g++,
分别是CC=/LDCC=/DYNLD=/MKDEP=这几行。


2.5 用RULES目录下armv5teb-linux-gcc.rul重命名为arm-linux-gcc.rul,
否则编译时会找不到rule。
cp RULES/armv5teb-linux-gcc.rul RULES/arm-linux-gcc.rul


3. 编译。运行命令:make K_ARCH=arm P_ARCH=arm


此过程编译不会通过,没有关系。但是inc/OBJ/arm-linux-gcc/下会生成align_test。

通过file align_test查看生成文件是否为ARM体系结构的目标文件。如果不是,说明
之前的编译规则更改存在错误。


[root@kongqx arm-linux-gcc]# file align_test
align_test: ELF 32-bit LSB executable, ARM, version 1 (SYSV), 
dynamically linked (uses shared libs), not stripped


4. 生成align.h文件。


4.1 此时incs/arm-linux-gcc/下的align.h文件长度为0字节。
xconfig.h文件的BITFIELDS_HTOL为undef状态且SIZEOF_XXX都为0。
这两个文件现在都是错误的,需要替换。


4.2 把inc/OBJ/arm-linux-gcc/align_test拷贝到arm板上。
执行align_test > align.h。
完成后将生成的align.h拷贝到incs/arm-linux-gcc/目录,覆盖同名文件。


4.3 将incs/i686-linux-cc/avoffset.h拷贝到incs/arm-linux-gcc/目录。
此步骤没有太大意义,仅仅为了防止编译时的错误输出。


4.4 注释掉MK_FILES= align_test.mk avoffset.mk。
防止每次编译,align.h与avoffset.h被再次覆盖。


5. 修改incs/arm-linux-gcc/xconfig.h,使其适配我们现在的CPU和编译器。


5.1 修改其为不支持浮点的定义,如下:
#undef HAVE_FLOAT_H
//#define HAVE_FLOAT_H 1/* if we may include float.h for FLT_MAX */


5.2 修改字节序和位序,如下:
/*
* Byteorder/Bitorder
*/
//#define HAVE_C_BIGENDIAN /* Flag that WORDS_BIGENDIAN test was done */
#undef WORDS_BIGENDIAN /* If using network byte order */
//#define HAVE_C_BITFIELDS /* Flag that BITFIELDS_HTOL test was done  *///#define BITFIELDS_HTOL       //define this field on ARM */  
#undef BITFIELDS_HTOL/* If high bits come first in structures */


5.3 修改sizeof的定义,如下: 
/*
* Types/Keywords
*/
#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 8 
#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 8
#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_TIME_T  4  //SIZEOF_LONG_INT
#define SIZEOF_WCHAR   sizeof (L'a')
#define SIZEOF_WCHAR_T SIZEOF_CHAR/* sizeof (wchar_t) */


6. 使能FIFO。修改cdrecord/fifo.c:
#if !defined(USE_MMAP) && !defined(USE_USGSHM)处,强行打开FIFO支持,改成:
#ifdef 1
#if !defined(USE_MMAP) && !defined(USE_USGSHM)。


7. 修改其他:


7.1 修改libedc/edc_ecc.c,加上#include <align.h>。


7.2 修改include/schily/mconfig.h,加上#define NO_FLOATINGPOINT。
强行去掉浮点数的支持,否则会引发刻录大文件时进度显示异常和死机的问题。


7.3 (option)打开readcd/readcd.c,将clone替换为clone1,防止编译出错。
vi命令:":1, $ s/clone/clone1/g"


8. 编译:执行make K_ARCH=arm P_ARCH=arm clean;make K_ARCH=arm P_ARCH=arm


9. 创建copy_out_arm脚本,拷贝二进制到release/arm/下。








   


   
0 0