文章转载出处:http://www.cnblogs.com/openusb/p/3437290.html
I.MX6 安装LTIB
1. 我用的是Debian 7,其实跟ubuntu也差不多的,先按照官方文档“Setting_Up_LTIB_Host.pdf”安装好相应的包
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
2. 解压L3.0.35_4.0.0_130424_source.tar(可以从官网下载的),运行解压目录下的install,注意选择好目标目录。
3. 运行./ltib –m config 就出错了
错误1:提示没安装zlib,其实系统已经安装了相应的包,只是没找到,网上有说注释掉zlib检查的代码,但我想这不是好办法,总不能出错的地方就不要了
解决:将下面的内容保存为zlibpatch.patch并放到ltib目录下,运行 patch –p1 < zlibpatch.patch
--- original/bin/Ltibutils.pm 2012-08-15 12:04:53.728901999 -0500
+++ ltib/bin/Ltibutils.pm 2012-08-15 12:12:01.916901781 -0500
@@ -562,7 +562,7 @@
binutils => 'ar --version 2>/dev/null',
'gcc-c++' => 'g++ --version 2>/dev/null',
glibc => 'ldd --version 2>/dev/null',
- 'glibc-devel' => sub { -f '/usr/lib/libm.so' || -f '/usr/lib64/libm.so' || -f '/usr/lib32/libm.so' || -f '/usr/lib/x86_64-linux-gnu/libm.so' || -f '/usr/lib/i386-linux-gnu/libm.so' },
+ 'glibc-devel' => sub { -f '/usr/lib/libm.so' || -f '/usr/lib64/libm.so' || -f '/usr/lib32/libm.so' || -f '/usr/lib/x86_64-linux-gnu/libm.so' || -f '/usr/lib/i386-linux-gnu/libm.so' || -f '/usr/lib64/libz.so' },
'glibc-headers' => sub { -f '/usr/include/stdio.h' },
'libstdc++' => sub {
return system_nb(<<TXT) == 0;
@@ -585,6 +585,7 @@
zlib => sub { my @f = (glob('/usr/lib/libz.so*'),
glob('/lib/libz.so*'),
glob('/lib64/libz.so*'),
+ glob('/lib/i386-linux-gnu/libz.so*'),
glob('/usr/lib/i386-linux-gnu/libz.so*'),
glob('/usr/lib32/libz.so*'),
glob('/usr/lib/x86_64-linux-gnu/libz.so*') ); @f > 1 ? 1 : 0 },
错误2:
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
错误3:
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
Died at ./ltib line 1392.
traceback:
main::build_host_rpms:1392
main::host_checks:1447
main:554
解决:
sudo rm -Rf /opt/freescale/ltib/usr/src/rpm/BUILD/flex-2.5.37
sudo rm -Rf /opt/freescale/ltib/usr/src/rpm/BUILD/libtool-2.4.2
错误4:
/opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-3.0.35-4.0.0/common/stdafx.h:30:36: fatal error: /usr/include/sys/types.h: No such file or directory
compilation terminated.
make[1]: *** [AESKey.o] Error 1
make[1]: Leaving directory `/opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-3.0.35-4.0.0/bld/linux'
make: *** [all] Error 2
error: Bad exit status from /home/cody/i.mx6/ltib/tmp/rpm-tmp.77914 (%build)
RPM build errors:
Bad exit status from /home/cody/i.mx6/ltib/tmp/rpm-tmp.77914 (%build)
Build time for elftosb: 1 seconds
Failed building elftosb
Died at ./ltib line 1392.
traceback:
main::build_host_rpms:1392
main::host_checks:1447
main:554
解决:将下面内容保存为:elftosb-types_h-fix.patch并放在/opt/freescale/pkgs/目录
diff -rupN elftosb-11.09.01/common/stdafx.h elftosb-11.09.01-new/common/stdafx.h
--- elftosb-11.09.01/common/stdafx.h 2011-03-01 05:05:19.000000000 +0100
+++ elftosb-11.09.01-new/common/stdafx.h 2013-05-07 06:03:56.399989483 +0200
@@ -27,7 +27,7 @@
// For Linux systems only, types.h only defines the signed
// integer types. This is not professional code.
// Update: They are defined in the header files in the more recent version of redhat enterprise gcc.
-#include "/usr/include/sys/types.h"
+#include <sys/types.h>
#include <stdint.h>
//typedef unsigned long uint32_t;
//typedef unsigned short uint16_t;
diff -rupN elftosb-11.09.01/stdafx.h elftosb-11.09.01-new/stdafx.h
--- elftosb-11.09.01/stdafx.h 2013-05-07 06:04:25.055987505 +0200
+++ elftosb-11.09.01-new/stdafx.h 2013-05-07 06:03:23.671990775 +0200
@@ -27,7 +27,7 @@
// For Linux systems only, types.h only defines the signed
// integer types. This is not professional code.
// Update: They are defined in the header files in the more recent version of redhat enterprise gcc.
-#include "/usr/include/sys/types.h"
+#include <sys/types.h>
//typedef unsigned long uint32_t;
//typedef unsigned short uint16_t;
//typedef unsigned char uint8_t;
再编辑文件ltib_root/dist/lfs-5.1/elftosb/elftosb.spec,增加如下红色部分内容:
...
Source : %{name}-%{version}-%{release}.tar.gz
Patch0 : elftosb-types_h-fix.patch
BuildRoot : %{_tmppath}/%{name}
...
%setup -n %{name}-%{version}-%{release}
%patch0 -p1
%Build
make
...
再删掉/opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-3.0.35-4.0.0,或其它以elftosb开头的,如有的话
4. 到这里应该没什么错误了,再根据官方文档“i.MX_6Dual6Quad_Sabre-AI_Linux_User_Guide”来配置就OK了
5.运行./ltib 又遇到错误:
/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld: cannot find /lib/ld-linux.so.3
collect2: ld returned 1 exit status
make: *** [busybox_unstripped] Error 1
error: Bad exit status from /home/cody/i.mx6/ltib/tmp/rpm-tmp.92805 (%build)
RPM build errors:
Bad exit status from /home/cody/i.mx6/ltib/tmp/rpm-tmp.92805 (%build)
Build time for busybox: 46 seconds
Failed building busybox
解决:https://community.freescale.com/message/332355#332355
1) install patch-ltib-ubuntu12.04.sh from (https://community.freescale.com/docs/DOC-93455).
2) create a soft link under /usr/include.
sudo ln -s i386-linux-gun/sys sys
3) install additional packages.
sudo aptitude -y install asciidoc texlive-latex-base dblatex xutils-dev
sudo apt-get install texinfo
4) modify 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;
6.终于看到成功的信息
Build Succeeded