在MAC系统下构建uboot的gcc编译环境
来源:互联网 发布:ubuntu ant 安装路径 编辑:程序博客网 时间:2024/06/06 04:55
前言
一直想在MAC系统下搭建路由器的开发环境,OpenWrt官方已经全面支持MAC系统下编译,然而,MT7620的uboot却始终无法顺利编译。原因在于,MT7620的uboot需要用到老版本的gcc342来进行编译,因此,如何在MAC环境中编译gcc342成为本文讨论的重点。
准备工作
下载binutils-2.24.tar.bz2和gcc-3.4.2.tar.bz2源码。二者缺一不可,binutils用于生成as(汇编语言编译器)。
编译
在编译binutils的时候,出现一处错误:
as.c: In function 'dump_statistics':as.c:977:3: error: 'sbrk' is deprecated (declared at /usr/include/unistd.h:582) [-Werror=deprecated-declarations] char *lim = (char *) sbrk (0); ^as.c: In function 'main':as.c:1146:3: error: 'sbrk' is deprecated (declared at /usr/include/unistd.h:582) [-Werror=deprecated-declarations] start_sbrk = (char *) sbrk (0); ^cc1: all warnings being treated as errorsmake[4]: *** [as.o] Error 1make[3]: *** [all-recursive] Error 1make[2]: *** [all] Error 2make[1]: *** [all-gas] Error 2make: *** [all] Error 2
通过参照
http://stackoverflow.com/questions/20426213/error-building-ellcc
设置编译参数:
./configure --prefix=/opt/mips-gcc --target=mipsel-linux --disable-werror
编译通过。总结
编译binutils时,需要
./configure --prefix=/opt/mips-gcc --target=mipsel-linux --disable-werror
编译gcc342时,需要
./configure --prefix=/opt/mips-gcc --target=mipsel-linux --enable-languages=c --without-headers --with-newlib --disable-shared --disable-threads
然后分别make,sudo make install
最后编译uboot时,出现了这些错误:
sed: RE error: illegal byte sequence"/opt/mips-gcc/bin"/mipsel-linux-objcopy --gap-fill=0xff -O srec u-boot u-boot.srec"/opt/mips-gcc/bin"/mipsel-linux-objcopy --gap-fill=0xff -O binary u-boot uboot.bin #temp.bin===============<<IMPORTANT>>==================Notes:Uboot firmware is uboot.bin NOT uboot.img================================================/bin/sh: readelf: command not found./tools/lzma --best --keep uboot.bin./tools/lzma: ./tools/lzma: cannot execute binary filemake: *** [uboot.img] Error 126
这些问题应该就比较好解决了。
对于sed: RE error: illegal byte sequence,可以参考http://stackoverflow.com/questions/19242275/re-error-illegal-byte-sequence-on-mac-os-x
在sed命令前加入 LC_ALL=C sed ...
对于 readelf的问题,可以用sudo port install binutils,得到greadelf
至于lzma,相信聪明的你已经想到解决的办法了
- 在MAC系统下构建uboot的gcc编译环境
- MAC环境下配置GCC编译环境
- Windows下 gcc编译环境的构建(Sublime + Mingw)
- 在linux\mac os\raspberry pi\环境下用gcc编译openssl代码
- gcc在window系统环境下的安装
- AIX6.1 下构建 GCC/G++ 编译环境
- Windows下配置Notepad++构建Gcc编译环境
- 【Lua】Mac系统下配置SublimeText的Lua编译环境
- android在mac环境下的反编译和重新编译
- 设置 quick-cocos2d-x 在 Mac 下的编译环境
- 设置 quick-cocos2d-x 在 Mac 下的编译环境
- 建立Windows下的GCC编译环境
- 建立Windows下的GCC编译环境
- [编译环境][gcc]下的内联汇编
- mac环境下编写的中文注释在win环境下vs2010打开编译不通过。
- Mac 下gcc环境安装
- 刚在虚拟机上装好的系统安装gcc编译环境
- 64位系统下libmemcached在GCC 4.7.1 下编译失败的解决方案
- ogg_单项同步_ddl
- 两个线程同时调用同一个处理函数的互斥问题
- ogg_rman 初始化
- ACM比赛经验总结
- Lua学习之3 :tolua++导出C++变量给Lua使用
- 在MAC系统下构建uboot的gcc编译环境
- 在IIS中部署WEB应用
- bootstrap使用简介
- web前端资料收集集锦
- hdu_1686 Oulipo
- activemq的连接池,通过spring的JmsTemplate发送消息到指定的Destination
- SDUT 1591 交叉排序
- oracle 数据类型详解---日期型(转载)
- 经常遇到Please ensure that adb is correctly located at 'D:\java\sdk\platform-tools\adb.exe' and can be