Ubuntu 16.04上使用crosstool-ng建立树莓派2B的编译环境

环境准备


$ sudo apt-get -y update
$ sudo apt-get install -y bison flex texinfo gawk automake subversion
$ sudo apt-get install -y gperf help2man make libtool libncurses5-dev 
$ sudo apt-get install -y gcj-jdk python-dev g++
$ sudo apt-get install libtool-bin

编译crosstool-ng


$ git clone https://github.com/crosstool-ng/crosstool-ng.git
$ cd crosstool-ng
$ ./bootstrap
$ ./configure --prefix=/opt/crosstool-ng
$ make
$ sudo make install

然后加环境变量 export PATH=$PATH:/opt/crosstool-ng/bin

配置编译选项


$ mkdir toolchain
$ cd toolchain
$ ct-ng armv7-rpi2-linux-gnueabihf

如果想自己配置调整某些参数,则执行

$ ct-ng menuconfig

最后执行

$ ct-ng build

默认情况下,生成的编译工具在当前用户目录下的x-tools目录下,如果需要调整这个目录,可以参考
Mac OSX下执行crosstool-ng提示“Your file system ‘xxxx’ is *not* case-sensitive!”

编译树莓派源代码


Ubuntu 16.04 (x64)树莓派B+(Raspberry Pi  B+)源代码编译

参考链接


自己编译给树莓派的交叉编译工具

发布者

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注