六,编译Bootstrap+U-BOOT启动代码
0赞
1,传送文件包到LINUX系统并解压
A,利用SecureCRT 5.1.3登陆,传送文件到系统
root@yuanxh-desktop:/home/yuanxh# mkdir at91_works
root@yuanxh-desktop:/home/yuanxh# chmod 777 at91_works/
root@yuanxh-desktop:/home/yuanxh# cd at91_works/
root@yuanxh-desktop:/home/yuanxh/at91_works# rz
在SecureCRT弹出的窗口中选择AT91Bootstrap1.5.zip,u-boot-1.1.5.tar.bz2,u-boot-1.1.5_atmel_1.4.diff.bz2软件包
B,解压所有软件包
在虚拟机窗口中右击AT91Bootstrap1.5.zip,选择“解压到此处”来解压,同样解压u-boot-1.1.5_atmel_1.4.diff.bz2;
root@yuanxh-desktop:/home/yuanxh/at91_works# tar xjvf u-boot-1.1.5.tar.bz2
2,编译生成一级启动目标码
A,为Bootstrap-v1.5指定编译器
root@yuanxh-desktop:/home/yuanxh/at91_works# cd Bootstrap-v1.5/board/at91sam9260ek/nandflash/
root@yuanxh-desktop:/home/yuanxh/at91_works/Bootstrap-v1.5/board/at91sam9260ek/nandflash# vi Makefile
把文件中的CROSS_COMPILE=/usr/local/arm/eldk-4.1/usr/bin/arm-linux-填好,指定eldk-4.1的编译器;
B,编译生成了目标码并传送回XP
root@yuanxh-desktop:/home/yuanxh/at91_works/Bootstrap-v1.5/board/at91sam9260ek/nandflash# make
root@yuanxh-desktop:/home/yuanxh/at91_works/Bootstrap-v1.5/board/at91sam9260ek/nandflash# sz nandflash_at91sam9260ek.bin
在dataflash目录同样修改Makefile也能生成dataflash_at91sam9260ek.bin;
注意:必须保证 dataflash_at91sam9260ek.bin 和平nandflash_at91sam9260ek.bin 小于4KB;
3,编译生成二级启动目标码
A,打上补丁
root@yuanxh-desktop:/home/yuanxh/at91_works# cd u-boot-1.1.5
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# mv ../u-boot-1.1.5_atmel_1.4.diff .
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# apt-get install patch
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# patch -p1 < ./u-boot-1.1.5_atmel_1.4.diff
B,指定编译器
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# vi Makefile
把CROSS_COMPILE = arm-linux- 改成 CROSS_COMPILE=/usr/local/arm/eldk-4.1/usr/bin/arm-linux-
C,配置并编译在DATAFLASH中运行模式
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# apt-get install libncurses5-dev
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# make clean
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# make mrproper
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# make at91sam9260ek_config
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# make
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# mv u-boot.bin u-boot-env-df.bin
注意:需要修改一下/u-boot-1.1.5/examples/Makefile的语法错误,请按/u-boot-1.1.6/examples/Makefile部分更新;
D,配置并编译在NANDFLASH中运行模式
修改配置头文件
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# vi include/configs/at91sam9260ek.h
把文件中的
#define CFG_ENV_IS_IN_DATAFLASH 1
#undef CFG_ENV_IS_IN_NAND
改成
#undef CFG_ENV_IS_IN_DATAFLASH
#define CFG_ENV_IS_IN_NAND 1
重新编译
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# make clean
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# make mrproper
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# make at91sam9260ek_config
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# make
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# mv u-boot.bin u-boot-env-nf.bin
E,发送目标码
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# sz u-boot-env-df.bin
root@yuanxh-desktop:/home/yuanxh/at91_works/u-boot-1.1.5# sz u-boot-env-nf.bin
