1、 修改CPU/2410/中的start.s文件
#define pWTCON 0x53000000
原代码:
ldr r0, =pWTCON
mov r1, #0x0 关闭看门狗
str r1, [r0]
改为:
ldr r0, =pWTCNT
ldr r1, =0x7724 大约15秒复位
str r1, [r0]
ldr r0, =pWTCON
ldr r1, =0xFF39 打开看门狗
str r1, [r0]
2、 宿主机安装binutils-dev
3、 make distclean
make smdk2410_config
make all
4、 出现错误:
gcc -Wall -pedantic -O -I/usr/include -c -o astest.o astest.c
astest.c: In function ‘process_section’:
astest.c:31: error: ‘asection’ has no member named ‘_cooked_size’
astest.c:31: error: ‘asection’ has no member named ‘_raw_size’
astest.c:35: warning: format ‘%ld’ expects type ‘long int’, but argument 4 has type ‘file_ptr’
astest.c:38: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘file_ptr’
astest.c:38: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘file_ptr’
astest.c:41: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘file_ptr’
make[2]: *** [astest.o] Error 1
make[2]: Leaving directory `/HHARM2410-R3/ppcboot-2.0.0/tools/gdb'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory `/HHARM2410-R3/ppcboot-2.0.0/tools'
make: *** [subdirs] Error 1
5、 解决方法:
ppcboot在fc4下编译会出错,在华恒的论坛上,有人指出
在ppcboot-2.0.0/tools/gdb/astest.c
找到下面代码
printf("\tcooked_size=%ld, raw_size=%ld, output_offset=%ld\n",
(long)sect->_cooked_size , (long)sect->_raw_size,
(long)sect->output_offset);
改成
printf("\tcooked_size=%ld, raw_size=%ld, output_offset=%ld\n",
(long)sect->size, (long)sect->rawsize,
(long)sect->output_offset);
看了一下/usr/includ/bfd.h,应该就是2.6的typedef struct bfd_section定义改变了的原因。
根本原因:编译内核版本不一致引起
6、编译成功,形成的ppcboot.bin自动拷贝到tftp目录中