分享

LTIB

 Kinetis 2014-08-08
LTIB(Linux Target Image Builder)工程是一个使用在不同的目标平台下,用于开发和部署BSP
(Board Support Packages)的简单工具。使用该工具,用户能够为其目标平台开发符合GNU/Linux标准的映像。
LTIB支持PPC,ARM,Coldfire等多种目标架构。包含超过200个用户使用的工具包以及通用跨平台的根文件系统。LTIB支持bootloader和内核映像的构建。编译时可对交叉编译工具进行选择。支持RAMDISK和JFFS2 Flash映像的创建。2.3节提及的开发流程中的2到5步以及后期的应用程序扩展都可以在该工具下进行。
what is ltib?
The LTIB (Linux Target Image Builder) project is a simple tool that can be used to develop and 
depoy BSPs (Board Support Packages) for various target platforms. Using this tool a user will be 
able to develop a GNU/Linux image for their target platform.
上面是官方解释。实际上,ltib是一系列脚本和管理方法的集合。开发者可以将源代码或开源软件包配置,编译,部署和压缩,成为可以烧写到flash上的bootloader,kernel和root file system映像。而这一切作都是通过./ltib命令加选项加参数实现的。要注意的是ltib的安装与使用必须在非root用户下。
以iMX6为例,先从官网下载L3.0.35_4.1.0_130816_source.gz BSP包。在解压安装前,一定要先执行下面几个步骤,很关键:
1,更新source.list。(我这里用的是网易提供的源)
具体参见:http://wiki./%E6%BA%90%E5%88%97%E8%A1%A8
2,修改执行权限。
由于安装 LTIB需要普通用户身份,但部分命令要超级用户权限才行,所以需要执行visudo增加。根据说明文档和网络资料,操作如下:
在命令行窗口输入命令: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 
编辑更改后Ctrl+X,然后选择Y,回车后保存退出
(如果在root用户下,可以使用#exit,退出root身份,回到普通用户<username>身份)
 注意:/usr/bin/rpm, /opt/freescale/ltib/usr/bin/rpm路径一定要完全一致!
 3,在安装LTIB之前,主机必须安装有以下的软件包,否则安装无法正常进行。操作如下:  
#!/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 
# 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

完成以上几步,就可以安心的解压安装了,如下:
将下载好的BSP存放或者COPY到/opt目录下,tar zxvf L3.0.35_4.0.0_130424_source.tar.gz解压。解压后,在/opt当前目录下我们会发现多了一个L3.0.35_4.1.0_130816_source文件夹,进入会发现有个/pkgs文件夹,后面install完成后的源代码都会在这里。
继续执行:./L3.0.35_4.0.0_130424_source/install
具体参见 [在Ubuntu 12.04上用LTIB编译linux BSP.pdf];
可是在执行./ltib时报错如下: 
Package                Minimum ver   Installed info
-------                       -----------   ---------------
libstdc++               0             not installed
gcc-c++                 2.96         not installed
zlib                   0             not installed
zlib-devel             0             not installed
rpm                     0             not installed
rpm-build               0             not installed
ncurses-devel           0             not installed
m4                     0             not installed
bison                   0             not installed
tcl                     0             not installed
1)针对这个情况,先执行下面这个指令:
sudo apt-get install build-essential
执行完成后,再尝试执行./ltib时报错如下:
Package                Minimum ver   Installed info
-------                 -----------   ---------------
zlib                   0             not installed
zlib-devel             0             not installed
rpm                     0             not installed
rpm-build               0             not installed
ncurses-devel           0             not installed
m4                     0             not installed
bison                   0             not installed
tcl                     0             not installed
发现前两个package已经安装过了,下面看看build-essential里面具体有哪些package,安装信息如下,划线部分即被安装的工具:
The following packages were automatically installed and are no longer required:
  gir1.2-ubuntuoneui-3.0 libubuntuoneui-3.0-1 thunderbird-globalmenu
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  dpkg-dev fakeroot g++ g++-4.6 libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libdpkg-perl libstdc++6-4.6-dev
Suggested packages:
  debian-keyring g++-multilib g++-4.6-multilib gcc-4.6-doc libstdc++6-4.6-dbg
  libstdc++6-4.6-doc
The following NEW packages will be installed:
  build-essential dpkg-dev fakeroot g++ g++-4.6 libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libstdc++6-4.6-dev
2)在执行sudo apt-get install zlib1g zlib1g-dev,发现zlib-devel工具被安装(用apt-cache policy查看发现安装的是zlib1g-dev和zlib1g,zlib-devel并未看到安装信息),但zlib还是缺的;
3)执行sudo apt-get install ncurses-dev可安装ncurses-devel;
4)执行sudo apt-get install alien。其实不懂,alien是一个.deb与.rpm包转换工具,但安装后发现rpm,rpm-build不在有需求了,其中rpm确实已经安装了,但rpm-build还是没有安装;(devel后缀是rpm系的习惯,deb系用的是dev,这个可以解释上面安装包不同名的情况。另外可见,这里其实是有deb的,确实rpm,有了这个转换工具包,问题自然就解决了。
5)执行sudo apt-get install bison。此时,m4,bison需求也没有了。
6)执行sudo apt-get install tcl。此时,tcl需求也没有了。
可是这时仍然缺少zlib,如是继续百度,看到这样一个回复:
你使用的是64bit的ubuntu,所以在这里你需要执行以下命令sudo aptitude -y install ia32-libs libc6-dev-i386 lib32z1,然后再编译。~~~
如是就执行了,回车之后一想,这个是之前已经执行过的命令啊,晕!!!可是最终不解的事情发生了:再后无办法后,再次执行了./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 
……在这个卡顿出现的时候,我才恍惚发现,过了!!!

问题再次出现:
1)Build path taken because: directory build, no prebuilt rpm, 
Cowardly refusing to clobber existing directory:
 /opt/freescale/ltib/usr/src/rpm/BUILD/flex-2.5.37
Remove this by hand if you really want to rebuild this package from scratch
解决:sudo rm -Rf /opt/freescale/ltib/usr/src/rpm/BUILD/flex-2.5.37
2)Build path taken because: no prebuilt rpm,
……
These packages failed to build:
flex
Build Failed
解决:sudo apt-get install texinfo
            sudo apt-get install texlive


install完成后,在/opt下生成了一个freescale文件夹。这就是我们的ltib工具集,它包括三部分:/ltib文件夹是ltib工具的相关工具集;/pkgs是源代码包,相当多的开源软件包,当然你也可以添加新的进去;/usr里面是编译器,已经默认装好了powerpc-linux编译器了。

参考文档有:
LTIB 详解(一) 安装与卸载                   http://blog.csdn.net/junht/article/details/7656408
LTIB 详解(二)配置选项与命令            http://blog.csdn.net/junht/article/details/7656521
LTIB详解(三)包和源码                         http://blog.csdn.net/junht/article/details/7656540
LTIB详解(四)根文件系统与镜像文件 http://blog.csdn.net/junht/article/details/7656564
LTIB详解(五)编译新的U-Boot             http://blog.csdn.net/junht/article/details/7656585
LTIB详解(六)部署文件                         http://blog.csdn.net/junht/article/details/7656668 
LTIB(七) 一个实例                                   http://blog.csdn.net/junht/article/details/8242705




    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多