在Ubuntu 12.04上安装LTIB及编译Linux BSP
Freescale官方提供的《Setting_Up_LTIB_host.pdf》文件是指导如何在Ubuntu 9.04(32位或64位)上安装LTIB,通过网上查找资料了解到,由于Ubuntu 9.04的系统比较老旧,ltib中的一些补丁包与系统不兼容,安装过程容易出现错误,而且难以解决,故在这里采用Ubuntu 12.04(32位)来安装LTIB。
相关信息链接为:
开发环境
PC机:VMware Workstation 11 + Ubuntu 12.04 LTS(32位)
Linux BSP Package:L3.0.35_4.1.0_ER_SOURCE_BSP(即L3.0.35_4.1.0_130816_source.tar.gz压缩包)
硬件平台
Freescale I.MX6Q SABRE-AI
需注意在32位与64位Ubuntu上安装LTIB的细微差别。
一、准备工作
1、Ubuntu 12.04 LTS安装(详细步骤这里不再详述)
Ubuntu下载链接为
1) 网易开源镜像站:http://mirrors.163.com/ubuntu-releases/
2) 搜狐开源镜像站:http://mirrors.sohu.com/ubuntu-releases/
2、下载Linux BSP Package,并将其拷贝到ubuntu中自己的工作目录中
下载链接为:
在这过程中可能遇到的问题
1. 用VMware安装64位的Ubuntu时,会弹出对话框,报如下错误信息
Thishost supports Intel VT-x, but Intel VT-x is disabled
IntelVT-x might be disabled if it has been disabled in the BIOS/firmware settings orthe host has not been power-cycled since changing this setting
解决方法:重启开机按Del进入BIOS界面,按Enter进到CPU的设置,然后方向键滚动到“Intel Virtualization Technology”,Enter键选择"Enable", 按"Esc"回到BIOS主界面,选择Security,找到“Intel VT-x”,改为"Enable"。 然后,保存设置并退出。
2. 点击“虚拟机->安装VMware Tools”会在桌面出现VMware Tools文件夹,然后Ctrl+Alt+T弹出Terminal,输入
$ cd /media/VMware\ tools
解压VMware Tools文件
$ sudo tar –zxvf VMwareTools-9.9.0-2304977.tar.gz
会出现诸如
Read-only file system
Cannot open: No such file or directory
tar: Exiting with failure status due to previous errors等错误信息。
解决方法:VMware Tools挂载在/media下,不能在此解压,需把VMwareTools-9.9.0-2304977.tar.gz拷贝到其他目录下再执行解压操作,例如home或opt下的工作目录中。
安装时,须用sudo ./vmware-install.pl命令
二、编译Linux BSP
1、设置Ubuntu主机环境
a) 更新 Ubuntu packages,打开Update Manager,点击check按钮检查更新,最后点击Install Updates按钮更新系统
b) Update source list(源很重要,源有问题的话会出现很多错误,建议更新一下)
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak (backup original file)
$ sudo gedit /etc/apt/sources.list
Delete all item in this file, then copy the following server addresses to it
deb http://mirrors.163.com/ubuntu/ precise main restricted
deb-src http://mirrors.163.com/ubuntu/ precise main restricted
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted
deb http://mirrors.163.com/ubuntu/ precise-security universe
deb-src http://mirrors.163.com/ubuntu/ precise-security universe
deb http://mirrors.163.com/ubuntu/ precise-security multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
将以上源内容复制到sources.list中,保存并退出。
运行如下命令来更新系统
$ sudo apt-get update
c) 修改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
d) Install Host Packages Needed by LTIB
首先要先安装aptitude
$ sudo apt-get install aptitude
然后在Ubuntu中将以下内容保存为名为host-setup.sh的脚本文件。
#!/bin/bash
# Install packages needed by LTIBsudo 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
# 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
sudo aptitude -y install ia32-libs libc6-dev-i386 lib32z1
# The following recommended for Linux development.
# They are not required by LTIB.
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
然后执行来安装LTIB所需要的包。
$ ./host-setup.sh
注意:由于Linux与Windows行结束的标志不同,不能在Windows下将以上代码保存为.sh文件再拷贝到Ubuntu中,这样执行每行会出现^M的错误。
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位置,然后回车,注意其中ubuntu为username
………………..
………………..
………………..
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
Installing host support packages.
This only needs to be done once per host, but may take up to
an hour to complete ...
If an error occurs, a log file with the full output may be found in:
/home/ubuntu/Desktop/ltib/ltib/host_config.log
这时会报如下错误信息
解决方法:
参考网上该贴:http://blog.chinaunix.net/uid-29629597-id-4338617.html
在Ubuntu中将下列信息保存名为patch-ltib-ubuntu12.04.sh的文件,将其拷贝到ltib的文件夹中。
#!/usr/bin/env bash
# get the patch tarball and untar it
wget -O ubuntu-ltib-patch.tgz https://community.freescale.com/servlet/JiveServlet/downloadBody/93454-102-3-2834/ubuntu-ltib-patch.tgz
tar -xzvf ubuntu-ltib-patch.tgz
# execute the script which do the patching
ltibDir=`pwd`
cd ubuntu-ltib-patch
./install-patches.sh $ltibDir
然后执行
$ ./ patch-ltib-ubuntu12.04.sh
这时可以看到上面的问题已经修复,再次执行./ltib,仍会出现错误信息,如下
These packages failed to build:
elftosb
Build Failed
以上错误是因为/opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-x.x.x/common/stdafx.h,包含的头文件types.h的路径不对导致,修改stdafx.h文件
解决方法:
方法引自网上该贴:http://bbs.21ic.com/icview-828582-1-1.html
1) $ cd /opt/freescale/pkgs/
2) $ tar zxvf elftosb-x.x.x.tar.gz
3) 修改stdafx.h文件(一个在elftosb-x.x.x,另一个在elftosb-x.x.x/common目录),#include"/usr/include/sys/types.h" 改成 #include"/usr/include/i386-linux-gnu/sys/types.h"
4) 重新打包 $ tar zcvf elftosb-x.x.x.tar.gz elftosb-x.x.x
5) $ rm -rf /opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-x.x.x
完成以上操作后,再次执行./ltib,会出现如下Platform选择窗口,选择Freescale i.MX reference boards,退出并保存。
然后会弹出platform type和package profile选择窗口,分别选择imx6q和Min profile,退出并保存。
接着要选择u-boot,因为硬件平台是i.MX 6Quad SABRE-AI board,,所以Choose yourboard for U-Boot为mx6q_sabreauto,退出并保存。
出现failed buding busybox,这时候要执行如下操作:
1)在 /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;
然后在ltib下运行./ltib,编译成功,如下图所示:
在这里需要注意的是,如果操作系统是Ubuntu12.04,需要有如下操作才可以成功编译
A、 执行如下命令
$ sudo apt-get install texinfo
B、 修改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
成功编译以后,kernel image和U-Boot images就在rootfs/boot目录下面了。
参考文档
1、i.MX_6Solo6DualLite_SABRE-AI_Linux_User's_Guide.pdf
2、i.MX_6Solo6DualLite_SABRE-AI_Linux_Release_Notes.pdf
3、Setting_Up_LTIB_host.pdf
4、i.MX6+Ubuntu12.04上编译LTIB.pdf