环境:
PC:VMware Player Ubuntu 12.04 LTS
Linux BSP Source Code:L3.0.35_4.1.0_ER_SOURCE_BSP
开发板:i.MX6DL-SDP
一、准备工作:
1.Ubuntu 12.04 LTS 安装(详细步骤这里不再详述,方法在之前文档中有详细介绍)。
2.下载 Linux BSP Source Code 并将其拷贝到 ubuntu 下
下载地址链接为:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=RDIMX6SABREPLAT&fpsp=1&tab=Design_Tools_Tab
二、编译 Linux BSP
1、设置 linux host 环境
(1)Update source list
我看了下教程,说的很麻烦,我只用了下面的这个命令,更新下就好了,如果出现 包 无法apt-get的时候需要按教程的去设置源,因为我可以通过所以不打算写
#sudo apt-get update
(2)Sudoers
在命令行窗口输入命令:
sudo /usr/sbin/visudo
在User privilege specification
root ALL=(ALL) ALL 后面加入(强调一下 ubuntu 是 usrname)
ubuntu ALL=NOPASSWD:/usr/bin/rpm,/opt/freescale/ltib/usr/bin/rpm
注意:usrname是指登录Ubuntu的用户名,root登录的用户是编译通不过的,这是飞思卡尔规定的。
(3) Install Host Packages Needed by LTIB
下面要安装的这些包,如果嫌麻烦可以直接建个.sh文件,全复制进去运行,但是弊端是那个包没安装或者出错难检测,最好还是一个一个来
#!/bin/bash
# Install packages needed by LTIB( 首先要先安装aptitude : sudo apt-get install aptitude)
sudo aptitude -y install gettext libgtk2.0-dev rpm bison m4 libfreetype6-dev
sudo aptitude -y install libdbus-glib-1-dev liborbit2-dev intltool
sudo aptitude -y install ccache ncurses-dev zlib1g zlib1g-dev gcc g++ libtool
sudo aptitude -y install uuid-dev liblzo2-dev
sudo aptitude -y install tcl dpkg
sudo aptitude -y install asciidoc texlive-latex-base dblatex xutils-dev
sudo apt-get install texinfo
这是编译ltib需要的包,很重要,如果有安装不了的请更新源,少一个估计都会错误连连!
如果你的Ubuntu是64位(用如下命令查看):
uname -a|grep -sq 'x86_64'
那还需要安装这几个包:
sudo aptitude -y install ia32-libs libc6-dev-i386 lib32z1
下面的这些包不是ltib需要的,是linux需要的,必须要按,否则同样错误连连:
sudo aptitude -y install gparted emacs22-nox openssh-server
sudo aptitude -y install nfs-common nfs-kernel-server lintian
sudo aptitude -y install git-core git-doc git-email git-gui gitk
sudo aptitude -y install diffstat indent tofrodos fakeroot doxygen uboot-mkimage
sudo aptitude -y install sendmail mailutils meld atftpd sharutils
sudo aptitude -y install manpages-dev manpages-posix manpages-posix-dev linux-doc
sudo aptitude -y install vnc4server xvnc4viewer
2、安装并编译
(1)移走之前所有安装在/opt/freescale/pkgs下的包。(必须移走,否则编译会出错)
(2)安装 LTIB package,例如在/home/ubuntu/Desktop/imx6下(这是
L3.0.35_4.1.0_130816_source.tar.gz放置的目录
tar zxvf L3.0.35_4.1.0_130816_source.tar.gz ———-解压
进到目录 L3.0.35_4.1.0_130816_source 下执行./install 命令 ————安装
然后会出现如下:
You are about to install the LTIB (GNU/Linux Target Image Builder)
Before installing LTIB, you must read and accept the EULA
(End User License Agreement) which will be presented next.
Do you want to continue ? Y|n
Y
Hit enter to continue:
FREESCALE SEMICONDUCTOR SOFTWARE LICENSE AGREEMENT
………………..
………………..
………………..
I have read and accept the EULA (yes|no):
yes
The LTIB files are extracted from a tar file which includes the
prefix ltib. After installation you will find LTIB in:
/home/ubuntu/Desktop/imx6/L3.0.35_4.1.0_130816_source/ltib
Where do you want to install LTIB ? (/home/ubuntu/Desktop/imx6/L3.0.35_4.1.0_130816_source)
/home/ubuntu/Desktop/ltib ------------------输入你要安装的 LTIB 位置,然后回车
………………..
………………..
………………..
Copying packages to /home/ubuntu/Desktop/ltib/ltib/pkgs
Installation complete, your ltib installation has been placed in
/home/ubuntu/Desktop/ltib/ltib, to complete the installation:
cd /home/ubuntu/Desktop/ltib/ltib
./ltib
接着输入命令:
cd /home/ubuntu/Desktop/ltib/ltib
./ltib
此处建议用:
./ltib -m shell
这个命令,他能显示ltib需要的包那些没安,如下:
Package Minimum ver Installed info
------- ----------- ---------------
glibc-devel 0 not installed
zlib 0 not installed
如果编译没错就会出现类似内核make menuconfig的界面,此处不详述。
3、大体过程如上述所示,下面列举些可能会出现的错误:
Failed building busybox
RPM build errors:
Bad exit status from /home/xiangang/imx6q/03_tools/ltib/tmp/rpm-tmp.99346 (%build)
Build time for busybox: 85 seconds
Failed building busybox
f_buildrpms() returned an error, exiting
traceback:
main:572
Started: Fri Dec 23 11:30:19 2016
Ended: Fri Dec 23 12:33:42 2016
Elapsed: 3803 seconds
These packages failed to build:
busybox
Build Failed
Exiting on error or interrupt
解决办法:
1)在 /usr/include 下创建一个软链接:
cd /usr/include
sudo ln -s i386-linux-gun/sys sys
2)修改 ltib/dist/lfs-5.1/base_libs/base_libs.spec(注释#部分)
...
perl -w -e '
# @ARGV = grep { `file $_` =~ m,ASCII C program text, } @ARGV;
# exit (0) unless @ARGV;
base_libs.spec文件在新建的ltib目录下,按照这个路径应该可以找到,找不到的请find -name base_libs.spec注释掉这两行就可以了
2.Failed building flex
You don't have a working TeX binary installed, but the texi2dvi script
can't proceed without it. If you want to use this script, you have to
install some kind of TeX, for example TeX Live Debian packages. You can do
that with this command:
apt-get install texlive
make[2]: *** [flex.pdf] Error 1
make[2]: Leaving directory `/opt/freescale/ltib/usr/src/rpm/BUILD/flex-2.5.37/doc'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/opt/freescale/ltib/usr/src/rpm/BUILD/flex-2.5.37'
make: *** [install] Error 2
error: Bad exit status from /home/cody/i.mx6/ltib/tmp/rpm-tmp.99407 (%install)
RPM build errors:
Bad exit status from /home/cody/i.mx6/ltib/tmp/rpm-tmp.99407 (%install)
Build time for flex: 27 seconds
Failed building flex
Died at ./ltib line 1392.
traceback:
main::build_host_rpms:1392
main::host_checks:1447
main:554
解决办法:
sudo apt-get install texinfo
sudo apt-get install texlive
此处列举了两个错误,从中我们不难发现,出现的错误基本都是包的缺少,如果前面的包都安装上了,那么就不会出现这些问题,如果出现错误,就去host_config.log日志查看出现的错误,根据错误具体解决。
注:这是我第一次编译bsp,顺便记录下过程,有错误请各位指正!