交叉编译环境搭建
编译环境搭建
在按照虚拟机Ubuntu的安装说明手册完成虚拟机的安装与设置后,我们还需要配置Linux的开发环境。
安装交叉编译器
步骤1:将文件gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.gz拷贝到Ubuntu主目录下
OKMX6Q-C用户资料\工具\gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.gz
步骤2:在Ubuntu中新建一个终端,输入下面的命令安装交叉编译器:
#cd (进入主目录)
#mkdir -p /opt/freescale/usr/local (创建目录,若目录已存在会提示错误,跳过即可)
#tar zxvf gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.gz -C /opt/freescale/usr/local (编译器解压到/opt/freescale/usr/local )
步骤3:查看gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12是否解压成功
#ls -l /opt/freescale/usr/local
如可以看到gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12文件夹即解压成功
**步骤4:**添加环境变量到Profile,执行命令打开编辑Profile后,重启电脑
#gedit /etc/profile
最后一行添加以下内容
export ARCH=arm
export CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- export PATH=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin:$PATH
之后执行命令:
#source /etc/profile
来使得刚配置的环境变量生效。
步骤5: 在终端里面执行以下命令,验证交叉编译器安装是否成功#arm-fsl-linux-gnueabi-gcc –v
下图为安装成功提示
安装依赖包
只需要执行如下脚本:
```bash
#!/bin/bash
# Install packages needed by LTIB(首先要先安装aptitude : sudo apt-get install aptitude)
apt-get install aptitude
aptitude -y install gettext libgtk2.0-dev rpm bison m4 libfreetype6-dev
aptitude -y install libdbus-glib-1 -dev liborbit2-dev intltool
aptitude -y install ccache ncurses-dev zlib1g zlib1g-dev gcc g++ libtool
aptitude -y install uuid-dev liblzo2-dev
aptitude -y install tcl dpkg
aptitude -y install asciidoc texlive-latex-base dblatex xutils-dev
apt-get install texinfo
# Packages required for 64-bit Ubuntu
# Do "uname -a" and see if the word "x86_64" shows up.
if uname -a|grep -sq 'x86_64'; then
aptitude -y install ia32-libs libc6-dev-i386 lib32z1
if
# The following recommended for Linux development.
# They are not required by LTIB.
aptitude -y install gparted emacs22-nox openssh-server
aptitude -y install nfs-common nfs-kernel-server lintian
aptitude -y install git-core git-doc git-email git-gui gitk
aptitude -y install diffstat indent tofrodos fakeroot doxygen uboot-mkimage
aptitude -y install sendmail mailutils meld atftpd sharutils
aptitude -y install manpages-dev manpages-posix manpages-posix-dev linux-doc
aptitude -y install vnc4server xvnc4viewer