ubuntu10.04环境下
参照http://docs.blackfin.uclinux.org/doku.php?id=toolchain:installing
toolchin、u-boot、kernel等资料最新的下载在http://blackfin.uclinux.org/gf/gf/project/uclinux-dist/forum/?action=browseRedirect
1)下载
在http://blackfin.uclinux.org/gf/project/toolchain/frs/?action=FrsReleaseBrowse&frs_package_id=74&__utma=28888175.1113242415.1292832096.1292893767.1292904669.3&__utmz=28888175.1292904888.3.5.utmcsr%3Dbaidu%7Cutmccn%3D%28organic%29%7Cutmcmd%3Dorganic%7Cutmctr%3Dblackfin+%B9%D9%CD%F8&__utmc=28888175&__utmb=28888175.11.10.1292904669&_br_pkgrls_total=100&_br_pkgrls_page=3下载下面几项:
blackfin-toolchain-09r1.1-2.i386.tar.bz2
blackfin-toolchain-elf-gcc-4.1-09r1.1-2.i386.tar.bz2
blackfin-toolchain-uclibc-full-09r1.1-2.i386.tar.bz2
2)安装
a)解压3个包到/opt下,在/opt下可以输入find -name "bin" 查看是否安装好,安装好的会看到
./uClinux/bfin-elf/bfin-elf/bin
./uClinux/bfin-elf/bin
./uClinux/bfin-uclinux/bin
./uClinux/bfin-uclinux/bfin-uclinux/bin
./uClinux/bfin-linux-uclibc/bin
./uClinux/bfin-linux-uclibc/bfin-linux-uclibc/bin
b)然后设置环境变量,在用户目录下的.bashrc中添加,又或是在/etc/bash.bashrc中添加如下:
export PATH=$PATH:/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/bin:/opt/uClinux/bfin-linux-uclibc/bin:/opt/uClinux/bfin-uclinux/bin:/opt/uClinux/bfin-uclinux/bfin-uclinux/bin:/opt/uClinux/bfin-elf/bfin-elf/bin:/opt/uClinux/bfin-elf/bin
3)其他安装
除了这三个包以外,还需要一些其他必要的包,具体参考http://docs.blackfin.uclinux.org/doku.php?id=installing_linux
4)测试
下面就试着编译u-boot和内核看看是否已经安装成功
a)编译u-boot
在http://blackfin.uclinux.org/gf/project/u-boot/frs/?action=FrsReleaseBrowse&frs_package_id=67&__utma=28888175.1113242415.1292832096.1292904669.1292978556.4&__utmz=28888175.1292904888.3.5.utmcsr%3Dbaidu%7Cutmccn%3D%28organic%29%7Cutmcmd%3Dorganic%7Cutmctr%3Dblackfin+%B9%D9%CD%F8&__utmb=28888175.32.10.1292978556&__utmc=28888175&_br_pkgrls_total=100&_br_pkgrls_page=2中下载 u-boot-2008.10-2009R1.1-rc1.tar.bz2
解压
cd u-boot-2008.10-2009R1.1-rc1
make bf548-ezkit
make
最后生成u-boot.bin
b)编译内核
在http://blackfin.uclinux.org/gf/project/uclinux-dist/frs/?action=FrsReleaseBrowse&frs_package_id=76&__utma=28888175.1113242415.1292832096.1292904669.1292978556.4&__utmz=28888175.1292904888.3.5.utmcsr%3Dbaidu%7Cutmccn%3D%28organic%29%7Cutmcmd%3Dorganic%7Cutmctr%3Dblackfin+%B9%D9%CD%F8&__utmb=28888175.39.10.1292978556&__utmc=28888175&_br_pkgrls_total=100&_br_pkgrls_page=2中下载uClinux-dist-2009R1.1-RC4.tar.bz2
解压
make menuconfig 选择 BF548-EZKIT 平台
make
好吧,出现错误了,log如下:
make[4]: *** [/home/bert/hsae/uClinux-dist/user/mtd-utils/build-606f38a2221648ca5c5fa292c9f71d2ddd59fa66-host/compr_lzo.o] Error 1
make[4]: Leaving directory `/home/bert/hsae/uClinux-dist/user/mtd-utils/606f38a2221648ca5c5fa292c9f71d2ddd59fa66'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/bert/hsae/uClinux-dist/user/mtd-utils'
make[2]: *** [mtd-utils] Error 2
make[2]: Leaving directory `/home/bert/hsae/uClinux-dist/user'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/bert/hsae/uClinux-dist/user'
make: *** [subdirs] Error 1
我们重新make menuconfig,选上
[*] Customize Kernel Settings
[*] Customize Application/Library Settings
之后弹出配置选项框,选择Flash Tools ---> ,把其中的[ ] mtd-utils 选项去掉*
make
内核编译成功,生成在/images中
其实也可以不去掉选项,就是要在http://www.oberhumer.com/opensource/lzo/中,把lzo库下回来,编译安装,修改环境变量,编译内核即可。当然,最好的解决办法就是下 mtd-utils-1.1.0.tar.bz2 和 zlib-1.2.3.tar.gz 这两个包,然后都make install就可以正常编译通过了。(在安装mtd-utils时可能会报错,本机上就报错 error: sys/acl.h ,只需要apt-get install libacl1-dev 之后再次make install可以安装成功。)
参考:http://www.cnblogs.com/rockstone/archive/2010/01/29/1659401.html