在 Ubuntu 12.04 上用 LTIB 編譯 linux BSP

環境:
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&fps
    p=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、大體過程如上述所示,下面列舉些可能會出現的錯誤:

  1. 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,順便記錄下過程,有錯誤請各位指正!!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章