Building The i.MX28 Board Support Package (BSP) With LTIB - Part 1
My first attempt at building the BSP for i.MX28 evaluation board. Freescale provides the source code required to build the BSP for its i.MX28 evaluation board. We take a look at the tool LTIB which is used to build its BSP.
Registering With Freescale
Before we proceed with the download of the source code and tools we need to register with the Freescale website. After registering with the website log on to the website with the credentials used at the time of registeration:
i.MX28 Software and Development Tool Resources
The development software and tools are available in the Linux section of the i.MX28 current software releases. When writing this article the page that was available to me had the link imx28-sw-link.
On clicking the “Linux source files” link we’re taken to a license agreement.
If all goes according to plan then you should see a download of the package L2.6.35_1.1.0_130130_source.tar.gz
which you can save to your linux development environment. In my case it is an Ubuntu virtual machine running on my Windows laptop. The package download will take some time based on your network bandwidth and speed. The size of the package is roughly about 710MB.
Unpacking The IMX28_SW Package
Move the package to a suitable folder and make sure there is sufficient space on the drive before unpacking the gunzipped tarball.
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ ls
L2.6.35_1.1.0_130130_source.tar.gz
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ tar xvzf L2.6.35_1.1.0_130130_source.tar.gz
L2.6.35_1.1.0_130130_source/
L2.6.35_1.1.0_130130_source/pkgs/
L2.6.35_1.1.0_130130_source/pkgs/16colors.txt
.
.
.
L2.6.35_1.1.0_130130_source/EULA
L2.6.35_1.1.0_130130_source/package_manifest.txt
L2.6.35_1.1.0_130130_source/redboot_201003.zip
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ ls -l
total 727632
drwxrwxr-x 3 ubuntu ubuntu 4096 Jan 30 2013 L2.6.35_1.1.0_130130_source
-rwxrwx--- 1 ubuntu vboxsf 744357641 Jan 20 22:55 L2.6.35_1.1.0_130130_source.tar.gz
ubuntu@ubuntu-VirtualBox:~/beta/projectX$
Above we use tar xvzf
to gunzip the tarball in one step. Lots of files get unpacked to the folder L2.6.35_1.1.0_130130_source
.
Exploring And Installing The IMX28_SW Package
The directory L2.6.35_1.1.0_130130_source contains an install script which we run. Before proceeding with the installation it presents the EULA which must be accepted before installation.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/L2.6.35_1.1.0_130130_source$ ls
EULA install ltib.tar.gz package_manifest.txt pkgs redboot_201003.zip tftp.zip
ubuntu@ubuntu-VirtualBox:~/beta/projectX/L2.6.35_1.1.0_130130_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:
IMPORTANT. Read the following Freescale Software License Agreement
.
.
As shown above Hit ‘Y’ to read the EULA
At this point we have to scroll and read the EULA before it prompts us with a declaration stating that we have read and accept the EULA, to which we reply “yes”.
.
.
I have read and accept the EULA (yes|no):
yes
Next we’re asked about the installation path. We can hit “Enter” to use the default which is /home/ubuntu/beta/projectX/L2.6.35_1.1.0_130130_source. However it doesn’t allow us to install it there so we supply a level above the current directory i.e. /home/ubuntu/beta/projectX/.
.
.
Copying packages to /home/ubuntu/beta/projectX//ltib/pkgs
Installation complete, your ltib installation has been placed in
/home/ubuntu/beta/projectX//ltib, to complete the installation:
cd /home/ubuntu/beta/projectX//ltib
./ltib
The installation is completed along with a hint of the next step which is running the Linux Target Image Builder (LTIB) tool.
What Is LTIB?
Well LTIB is a tool which is used by Freescale to develop, build and deploy the software i.e. bootloaders, linux kernel, applications, daemons, etc.. required to support the board which in this case happens to be an i.MX28 board. It is uses the RPM way to manage software which has to be built for the target board.
It is advisable to read the Introduction and FAQ section present on the LTIB website at the following links:
Building LTIB
The hint given above is to configure and build LTIB. Within the configuration various settings such as toolchain path, platform details, C library to be used, etc can be configured.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/L2.6.35_1.1.0_130130_source$ cd /home/ubuntu/beta/projectX//ltib
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ ls -l
total 184
drwxrwxrwx 2 ubuntu ubuntu 4096 Jan 8 2013 bin
drwxrwxrwx 6 ubuntu ubuntu 4096 Jan 8 2013 config
-rwxrwxrwx 1 ubuntu ubuntu 17989 Jan 8 2013 COPYING
drwxrwxrwx 3 ubuntu ubuntu 4096 Jan 8 2013 dist
drwxrwxrwx 2 ubuntu ubuntu 4096 Jan 8 2013 doc
-rwxrwxrwx 1 ubuntu ubuntu 41 Jan 30 2013 hash
-rwxrwxrwx 1 ubuntu ubuntu 106077 Jan 8 2013 ltib
drwxr-xr-x 2 ubuntu ubuntu 32768 Jan 28 06:49 pkgs
-rwxrwxrwx 1 ubuntu ubuntu 952 Jan 8 2013 README
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$
Problems Running LTIB
Okay there were several issues seen while trying to install LTIB on my Ubuntu system. We’ll take a look at each one as they occurred in sequence and my steps taken to fix all of them.
Warning
This part will vary from system to system. It depends on your system configuration so you may face issues different to those listed here.
Fixing Dependency Issues
LTIB failed and cribbed on my system complaninig about missing packages as shown below.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ ./ltib
Don't have HTTP::Request::Common
Don't have LWP::UserAgent
Cannot test proxies, or remote file availability without both
HTTP::Request::Common and LWP::UserAgent
defined(@array) is deprecated at /home/ubuntu/beta/projectX/ltib/bin/Ltibutils.pm line 362.
(Maybe you should just omit the defined()?)
ltib cannot be run because one or more of the host packages needed to run it
are either missing or out of date or not in ltib's standard path. Please
install/upgrade these packages on your host. If you have your own utilities
in non-standard paths, please add an entry into the .ltibrc file for example:
%path_std
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/my/own/exes
Package Minimum ver Installed info
------- ----------- ---------------
zlib 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
Died at ./ltib line 1409.
traceback:
main::host_checks:1409
main:554
Started: Fri Jan 30 00:53:17 2015
Ended: Fri Jan 30 00:53:17 2015
Elapsed: 0 seconds
Build Failed
Exiting on error or interrupt
Using the Advanced Packaging Tool (APT) utility we are able to fix the missing package issues. The stratedgy involves trying to identify the package equivalent for Ubuntu using the command below.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-cache search m4
- Example of searching packages related to m4 using the APT utility
And then installing the package
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-get install m4
The above shows an example of installing m4 using the APT utility
The ltib utility can be executed again to see if the package errors reduce with each successful installation. Documentation of installation of the missing packages proceeds in the subsections below. They can be avoided if the same problems do not exist.
Installing m4
Installation of m4 proceeded with no problems
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-get install m4
Reading package lists... Done
Building dependency tree
Reading state information... Done
.
.
.
Need to get 206 kB of archives.
After this operation, 390 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
.
.
.
Processing triggers for libc-bin (2.19-0ubuntu6.5) ...
The above shows a command to install m4 followed by a prompt asking for user input confirming installation.
Installing rpm
Installation of rpm proceeded with no problems
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-get install rpm
[sudo] password for ubuntu:
Reading package lists... Done
Building dependency tree
Reading state information... Done
.
.
.
Do you want to continue? [Y/n] Y
.
.
.
Processing triggers for libc-bin (2.19-0ubuntu6.5) ...
-
Command to install rpm
-
User input confirming installation
Installing bison
Installation of bison proceeded with no problems
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-get install bison
Reading package lists... Done
Building dependency tree
Reading state information... Done
.
.
.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main libbison-dev i386 2:3.0.2.dfsg-2 [338 kB]
.
.
.
update-alternatives: using /usr/bin/bison.yacc to provide /usr/bin/yacc (yacc) in auto mode
-
Command to install bison
-
User input confirming installation
Installing ncurses-devel
Installation of ncurses-devel proceeded with no problems after locating the correct package name as libncurses5-dev.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-get install libncurses5-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
.
.
.
Do you want to continue? [Y/n] Y
.
.
.
Setting up libncurses5-dev:i386 (5.9+20140118-1ubuntu1) ...
-
Command to install bison
-
User input confirming installation
Installing zlib
Installation of zlib was not straightforward after several attempts to install packages like zlibc & zlib-bin LTIB was still failing and cribbing saying the package was missing from the system.
Aparently all the dependencies are stored in the file ./bin/Ltibutils.pm. So on greping the file for zlib we get the paths which are searched for in order to look for the zlib package.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ grep -A 4 -B 2 zlib ./bin/Ltibutils.pm
`makeinfo --version 2>/dev/null`;
},
zlib => sub { my @f = (glob('/usr/lib/libz.so*'),
glob('/lib/libz.so*'),
glob('/lib64/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 },
'zlib-devel' => sub { -f '/usr/include/zlib.h' },
};
sub get_ver
{
- Greping 4 lines after(-A 4) and 2 lines before(-B 2) for zlib in the file Ltibutils.pm
After doing going through some basic perl sites it was decided to print the value of array @f which was being used in the get_ver function exposed by Ltibutils.pm. The following was the change done:
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ grep -A 4 -B 2 zlib ./bin/Ltibutils.pm
`makeinfo --version 2>/dev/null`;
},
zlib => sub { my @f = (glob('/usr/lib/libz.so*'),
glob('/lib/libz.so*'),
glob('/lib64/libz.so*'),
glob('/usr/lib/i386-linux-gnu/libz.so*'),
glob('/usr/lib32/libz.so*'),
glob('/usr/lib/x86_64-linux-gnu/libz.so*') );print "Value of list = @f\n"; @f > 1 ? 1 : 0 },
'zlib-devel' => sub { -f '/usr/include/zlib.h' },
};
sub get_ver
{
-
Greping 4 lines after(-A 4) and 2 lines before(-B 2) for zlib in the file Ltibutils.pm
-
print “Value of list = @f\n”; is added
Additionally we run ltib with verbose option –verbose to see if we can get any more details that can help us debug the dependency issue. This time after we execute the ltib script we get the details below:
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ ./ltib --verbose
Don't have HTTP::Request::Common
Don't have LWP::UserAgent
.
.
.
pkg=gcc-c++, min=2.96, got: 4.8.2,
ref=4, min=2
pkg=sudo, min=0, got: 1.8.9,
ref=1, min=0
Value of list = /usr/lib/i386-linux-gnu/libz.so
pkg=zlib, min=0, got: -1, not installed
pkg=zlib-devel, min=0, got: 0,
ref=0, min=0
pkg=rpm, min=0, got: 4.0.4,
ref=4, min=0
.
.
.
pkg=rpm-build, min=0, got: 4.0.4,
ref=4, min=0
.
.
.
Build Failed
Exiting on error or interrupt
ubuntu@ubuntu-VirtualBox:~/beta/project
-
This is the value of @f which implies that our zlib library is /usr/lib/i386-linux-gnu/libz.so
-
This print indicates that the version obtained is -1 and hence it is forced to mark zlib as not installed
The flow of calls is:
-
check_basic_deps in ltib iterates through $pkg to find each version with get_ver
-
get_ver is defined in bin/Ltibutils.pm and has a series of checks for the version
-
If the $pkg is not defined in the predefined app_checks it issues a ‘$pkg –version 2>/dev/null’ to get the package version information
-
If the $pkg is defined as ‘CODE’ it executes the pkg as a function call
-
Lastly it executes the value of
$app_checks→{$pkg}
-
If $_ is not set to anything then -1 is returned as the version
-
Finally after understanding the mapping of app_checks for zlib it looked as though the expression @f > 1 ? 1 : 0 _ was evaluating to 1 instead of 2. And this was because only one path was valid from the list of paths i.e. _/usr/lib/i386-linux-gnu/libz.so. This is a softlink to the path /lib/i386-linux-gnu/libz.so.1.2.8 so we add that to the list of options available. This change is similar to With this change the zlib dependency is detected and the file now looks like this:
buntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ grep -A 4 -B 2 zlib ./bin/Ltibutils.pm
`makeinfo --version 2>/dev/null`;
},
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*') );print "Value of list = @f\n"; @f > 1 ? 1 : 0 },
'zlib-devel' => sub { -f '/usr/include/zlib.h' },
};
sub get_ver
{
-
This is the new path added in bin/Ltibutils.pm
-
This is the original path which is detected in the system. The above path is the actual file to this soft link.
We revert all changes except the fix to the original script files i.e. print “Value of list = @f\n”; which was added for debugging and is not required now.
Setting sudo Permissions For rpm
The next issue was because of a test done by ltib to check if there are sudo permissions for rpm.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ ./ltib
Don't have HTTP::Request::Common
.
.
.
Don't have LWP::UserAgent
I ran the command: sudo -S -l which returned:
[sudo] password for ubuntu: Sorry, try again.
[sudo] password for ubuntu: Sorry, try again.
[sudo] password for ubuntu: Sorry, try again.
sudo: 3 incorrect password attempts
This means you don't have sudo permission to execute rpm commands as root
without a password. This is needed for this build script to operate correctly.
To configure this, as root using the command "/usr/sbin/visudo",
and add the following line in the User privilege section:
ubuntu ALL = NOPASSWD: /usr/bin/rpm, /opt/freescale/ltib/usr/bin/rpm
.
.
.
-
ltib explaining what is run to test for sudo priviledges
-
Explaning what is wrong in the system
-
Potential fix
We can execute “/usr/sbin/visudo” as indicated or “sudo vim /etc/sudoers” is also fine.
Installing The Host Support Packages
After fixing the sudo issue we run ltib yet again to find a new problem as shown below:
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ ./ltib
Don't have HTTP::Request::Common
Don't have LWP::UserAgent
Cannot test proxies, or remote file availability without both
HTTP::Request::Common and LWP::UserAgent
defined(@array) is deprecated at /home/ubuntu/beta/projectX/ltib/bin/Ltibutils.pm line 362.
(Maybe you should just omit the defined()?)
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/beta/projectX/ltib/host_config.log
Exiting on error or interrupt
Please see >> /home/ubuntu/beta/projectX/ltib/host_config.log for details
- Exited on error
Opening the /home/ubuntu/beta/projectX/ltib/host_config.log file we see that there is some trouble building the lkc packge:
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ tail /home/ubuntu/beta/projectX/ltib/host_config.log
Started: Tue Feb 3 04:13:25 2015
Ended: Tue Feb 3 04:13:29 2015
Elapsed: 4 seconds
These packages failed to build:
lkc
Build Failed
Searching For A Simpler Installation
Aparently most of the problems seen are due to the newer version of Ubuntu of my system. When going through the Freescale forums for similar problems a solution was provided in the form of a patch at https://community.freescale.com/docs/DOC-93454.
The temporary fix to find zlib as a dependency was removed and the patch was installed using the steps highlighted in the forum.
Unpacking The Patch
The patch file has to be copied to the ltib directory and untarred there.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ ls
bin config COPYING dist doc hash host_config.log ltib README tmp ubuntu-ltib-patch.tgz
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ tar xvzf ubuntu-ltib-patch.tgz
ubuntu-ltib-patch/
ubuntu-ltib-patch/zlib.patch
ubuntu-ltib-patch/sparse-0.4-fixlabel.patch
ubuntu-ltib-patch/lkc-1.4-lib.patch
ubuntu-ltib-patch/mux_server.spec
ubuntu-ltib-patch/sparse-0.4-fixlabel.patch.md5
ubuntu-ltib-patch/install-patches.sh
ubuntu-ltib-patch/lkc.spec
ubuntu-ltib-patch/sparse.spec
ubuntu-ltib-patch/lkc-1.4-lib.patch.md5
-
List of files in the ltib directory. ubuntu-ltib-patch.tgz is the new addition.
-
Untarring the package.
Install The Patches
Go to the extracted directory and run install-patches.sh with the full path of the ltib directory to install the patches.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ cd ubuntu-ltib-patch/
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib/ubuntu-ltib-patch$ ./install-patches.sh /home/ubuntu/beta/projectX/ltib/
cp lkc-1.4-lib.patch /opt/freescale/pkgs
cp lkc-1.4-lib.patch.md5 /opt/freescale/pkgs
cp sparse-0.4-fixlabel.patch /opt/freescale/pkgs
cp sparse-0.4-fixlabel.patch.md5 /opt/freescale/pkgs
Patching Spec Files
Done
patching file bin/Ltibutils.pm
After running the ltib script we were able to see the path added to the bin/Ltibutils.pm file.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ grep -A 4 -B 2 zlib ./bin/Ltibutils.pm
`makeinfo --version 2>/dev/null`;
},
zlib => sub { my @f = (glob('/usr/lib/libz.so*'),
glob('/lib/libz.so*'),
glob('/lib/i386-linux-gnu/libz.so*'),
glob('/lib64/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 },
'zlib-devel' => sub { -f '/usr/include/zlib.h' },
};
sub get_ver
{
We see a new set of wget errors this time and after searching the forums we get help in this post about dead links in LTIB installation. https://community.freescale.com/thread/308278.
Trying By Patching Earlier On
LTIB doesn’t work without the patch from Freescale especially if you are using a newer Ubuntu system which is greater than Ubuntu 9.0. Not sure about the next steps we put this attempt to rest and retry with another attempt by applying the patch earlier on rather than later as a logical progression of the installation.
Sometimes it’s good to erase the board and start with a fresh perspective.
Cleaning Up The Old Installation
We clean up the folders created when we install and configure the LTIB package:
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ rm -Rf ltib/
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ sudo rm -Rf /opt/freescale
Repeat The Installaion
As mentioned in section section_title repeat all the installation steps outlined in that session until you get the fresh ltib folder created at /home/ubuntu/beta/projectX/ltib.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/L2.6.35_1.1.0_130130_source$ ls
EULA install ltib.tar.gz package_manifest.txt pkgs redboot_201003.zip tftp.zip
ubuntu@ubuntu-VirtualBox:~/beta/projectX/L2.6.35_1.1.0_130130_source$ ./install
.
.
Apply The Ubuntu Patch
As mentioned in the section_title and section_title sections patch the fresh ltib folder again.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ tar xvzf ubuntu-ltib-patch.tgz
ubuntu-ltib-patch/
ubuntu-ltib-patch/zlib.patch
ubuntu-ltib-patch/sparse-0.4-fixlabel.patch
ubuntu-ltib-patch/lkc-1.4-lib.patch
ubuntu-ltib-patch/mux_server.spec
ubuntu-ltib-patch/sparse-0.4-fixlabel.patch.md5
ubuntu-ltib-patch/install-patches.sh
ubuntu-ltib-patch/lkc.spec
ubuntu-ltib-patch/sparse.spec
ubuntu-ltib-patch/lkc-1.4-lib.patch.md5
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ cd ubuntu-ltib-patch/
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib/ubuntu-ltib-patch$ ./install-patches.sh /home/ubuntu/beta/projectX/ltib/
cp lkc-1.4-lib.patch /opt/freescale/pkgs
cp lkc-1.4-lib.patch.md5 /opt/freescale/pkgs
cp sparse-0.4-fixlabel.patch /opt/freescale/pkgs
cp sparse-0.4-fixlabel.patch.md5 /opt/freescale/pkgs
Patching Spec Files
Done
patching file bin/Ltibutils.pm
Repeat The Build
Again we try to configure and build LTIB with the same command
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ ./ltib
Don't have HTTP::Request::Common
Don't have LWP::UserAgent
Cannot test proxies, or remote file availability without both
HTTP::Request::Common and LWP::UserAgent
defined(@array) is deprecated at /home/ubuntu/beta/projectX/ltib/bin/Ltibutils.pm line 362.
(Maybe you should just omit the defined()?)
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/beta/projectX/ltib/host_config.log
[sudo] password for ubuntu:
Exiting on error or interrupt
Please see >> /home/ubuntu/beta/projectX/ltib/host_config.log for details
-
Execute the ltib command to being the configuration and build
-
Enter the login password for sudo
Missing lzo/lzo1x.h
Ok after a while it looks like there’s a different type of error that is thrown. After opening the host_config.log we see the following type of error related to missing lzo/lzo1x.h.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ tail -n 30 /home/ubuntu/beta/projectX/ltib/host_config.log
CC compr_lzo.o
compr_lzo.c:31:23: fatal error: lzo/lzo1x.h: No such file or directory
#include <lzo/lzo1x.h>
^
compilation terminated.
make: *** [/opt/freescale/ltib/usr/src/rpm/BUILD/mtd-utils/compr_lzo.o] Error 1
error: Bad exit status from /home/ubuntu/beta/projectX/ltib/tmp/rpm-tmp.80059 (%build)
RPM build errors:
Bad exit status from /home/ubuntu/beta/projectX/ltib/tmp/rpm-tmp.80059 (%build)
Build time for mtd-utils: 6 seconds
Failed building mtd-utils
Died at ./ltib line 1392.
traceback:
main::build_host_rpms:1392
main::host_checks:1447
main:554
Started: Thu Feb 5 05:36:42 2015
Ended: Thu Feb 5 05:46:54 2015
Elapsed: 612 seconds
These packages failed to build:
mtd-utils
Build Failed
Ok so we’re missing some package in our system. Let’s try using APT again.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-cache search "lzo"
file-roller - archive manager for GNOME
liblzo2-2 - data compression library
liblzo2-dev - data compression library (development files)
lrzip - compression program with a very high compression ratio
lzop - fast compression program
patool - command line archive file manager
python-lzo - Python bindings for the LZO data compression library
zope-debhelper - debhelper script for zope packaging
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-cache search "liblzo2-dev"
liblzo2-dev - data compression library (development files)
-
Example of searching packages related to lzo using the APT utility
-
Looks like a good candidate since header file is missing and it is a development package
Installing the package liblzo2-dev
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-get install liblzo2-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
.
.
.
Unpacking liblzo2-dev:i386 (2.06-1.2ubuntu1.1) ...
Setting up liblzo2-dev:i386 (2.06-1.2ubuntu1.1) ...
- Installation of liblzo2-dev
Running ltib again we get an error almost immediately. Again we open the /home/ubuntu/beta/projectX/ltib/host_config.log file and see that the build stopped with a message as shown below:
Processing: u-boot-tools
==========================
Processing: mtd-utils
=======================
Build path taken because: directory build, no prebuilt rpm,
Cowardly refusing to clobber existing directory:
/opt/freescale/ltib/usr/src/rpm/BUILD/mtd-utils
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
- Reason why ltib fails
Let’s do as it says and try again.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo rm -Rf /opt/freescale/ltib/usr/src/rpm/BUILD/mtd-utils
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ ./ltib
Missing uuid/uuid.h
It fails again. After opening the host_config.log we see the following type of error related to missing uuid/uuid.h.
.
.
LD jffs2reader
CC mkfs.ubifs/mkfs.ubifs.o
In file included from mkfs.ubifs/mkfs.ubifs.c:25:0:
mkfs.ubifs/mkfs.ubifs.h:48:23: fatal error: uuid/uuid.h: No such file or directory
#include <uuid/uuid.h>
^
.
.
Ok so we’re missing another package in our system. Let’s try using APT again.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-cache search uuid
.
.
libuuid1 - Universally Unique ID library
postgresql-contrib-9.3 - additional facilities for PostgreSQL
uuid-dev - universally unique id library - headers and static libraries
uuid-runtime - runtime components for the Universally Unique ID library
uuidcdef - Universally Unique Identifier (UUID) generator
.
.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo apt-get install uuid-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
uuid-dev
.
.
Setting up uuid-dev (2.20.1-5.1ubuntu20.3) ...
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ sudo rm -Rf /opt/freescale/ltib/usr/src/rpm/BUILD/mtd-utils
-
Looks like a good candidate as header files are missing
-
Installing the package
-
Removing mtd-utils as it won’t build because of the previous error
Missing /usr/include/sys/types.h
It fails again. After opening the host_config.log we see the following type of error related to missing /usr/include/sys/types.h. This is different from the previous errors. It looks like some system header file is not in place where it should be. After searching a bit on Google this blog entry gives us clues as to how to fix these errors https://importgeek.wordpress.com/2014/08/21/imx-ltib-common-errors/
It looks like the types.h file is in /usr/incude/i386-linux-gnu/sys so we create a softlink as shown below to solve this issue:
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ vim /home/ubuntu/beta/projectX/ltib/host_config.log
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ cd /usr/include/
ubuntu@ubuntu-VirtualBox:/usr/include$ sudo ln -s i386-linux-gnu/sys sys
ubuntu@ubuntu-VirtualBox:/usr/include$ cd -
/home/ubuntu/beta/projectX/ltib
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$
Loader Error Missing Maths Library
It fails again. Opening up the host_config.log file we see the error as follows:
.
.
gcc AESKey.o Blob.o crc.o DataSource.o DataTarget.o ELFSourceFile.o EncoreBootImage.o EvalContext.o GHSSecInfo.o GlobMatcher.o HexValues.o Logging.o Operation.o OptionDictionary.o options.o OutputSection.o Random.o RijndaelCBCMAC.o rijndael.o SHA1.o SourceFile.o SRecordSourceFile.o stdafx.o StELFFile.o StExecutableImage.o StSRecordFile.o Value.o Version.o format_string.o ExcludesListMatcher.o SearchPath.o DataSourceImager.o IVTDataSource.o BootImageGenerator.o ConversionController.o ElftosbAST.o elftosb.o elftosb_lexer.o ElftosbLexer.o elftosb_parser.tab.o EncoreBootImageGenerator.o -lstdc++ -o elftosb
/usr/bin/ld: ElftosbAST.o: undefined reference to symbol 'powf@@GLIBC_2.0'
//lib/i386-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [elftosb] Error 1
make[1]: Leaving directory `/opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-2.6.35.3-1.1.0/bld/linux'
make: *** [all] Error 2
error: Bad exit status from /home/ubuntu/beta/projectX/ltib/tmp/rpm-tmp.5414 (%build)
.
.
- Exact error is an unknown reference to symbol ‘powf@@GLIBC_2.0’
This error is covered in the same blog link given above so we follow the instructions
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ cp /opt/freescale/pkgs/elftosb-2.6.35.3-1.1.0.tar.gz ~/beta/projectX/.
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ cd ~/beta/projectX/
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ ls
elftosb-2.6.35.3-1.1.0.tar.gz L2.6.35_1.1.0_130130_source L2.6.35_1.1.0_130130_source.tar.gz ltib
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ tar xvzf elftosb-2.6.35.3-1.1.0.tar.gz
elftosb-2.6.35.3-1.1.0/
elftosb-2.6.35.3-1.1.0/COPYING
elftosb-2.6.35.3-1.1.0/ReadMe.txt
elftosb-2.6.35.3-1.1.0/bdfiles/
elftosb-2.6.35.3-1.1.0/bdfiles/basic_test_cmd.e
.
.
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ cd elftosb-2.6.35.3-1.1.0/
ubuntu@ubuntu-VirtualBox:~/beta/projectX/elftosb-2.6.35.3-1.1.0$ ls
bdfiles COPYING elftosb.ccscc elftosb.sln elftosb.xcodeproj keygen makefile.rules sbtool test_elftosb.bat test_files
common elftosb2 elftosb.ncb elftosb.suo encryptgpk makefile ReadMe.txt stdafx.h test_elftosb.sh winsupport
ubuntu@ubuntu-VirtualBox:~/beta/projectX/elftosb-2.6.35.3-1.1.0$
ubuntu@ubuntu-VirtualBox:~/beta/projectX/elftosb-2.6.35.3-1.1.0$ vim makefile.rules
-
Copy elftosb-2.6.35.3-1.1.0.tar.gz from the pkgs directory to a temporary location
-
Unpack the compressed tarball
-
List the contents in elftosb-2.6.35.3-1.1.0 after unpacking
-
Edit the makefile.rules
The makefile requires adding the maths library to the LIBS path
OBJ_FILES_KEYGEN = \
${OBJ_FILES_COMMON} \
keygen.o
LIBS = -lstdc++ -lm
ifeq ("${UNAMES}", "Linux")
EXEC_FILE_ELFTOSB2 = elftosb
EXEC_FILE_SBTOOL = sbtool
- -lm is added to LIBS
Now repack the tarball, overwrite the orignal tarball, remove the build folder and run ltib again
ubuntu@ubuntu-VirtualBox:~/beta/projectX/elftosb-2.6.35.3-1.1.0$ cd ..
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ tar cvzf elftosb-2.6.35.3-1.1.0.tar.gz elftosb-2.6.35.3-1.1.0/
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ cp elftosb-2.6.35.3-1.1.0.tar.gz /opt/freescale/pkgs/elftosb-2.6.35.3-1.1.0.tar.gz
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ sudo rm -Rf /opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-2.6.35.3-1.1.0
ubuntu@ubuntu-VirtualBox:~/beta/projectX$ cd ltib
ubuntu@ubuntu-VirtualBox:~/beta/projectX/ltib$ ./ltib
-
Repacking elftosb-2.6.35.3-1.1.0/ into elftosb-2.6.35.3-1.1.0.tar.gz
-
Overwriting the original /opt/freescale/pkgs/elftosb-2.6.35.3-1.1.0.tar.gz package
-
Removing the previous /opt/freescale/ltib/usr/src/rpm/BUILD/elftosb-2.6.35.3-1.1.0 build directory
-
Trying to build again
Ncurses At Last!
Phew that took some fair amount of tinkering. We finally are able to move to the next step which is configuration of the BSP.
Conclusion
Well after a lot of probing we were finally able to build LTIB for our Ubuntu 14.04.1 LTS system. Since this post has been insanely long I’ve decided to split it into two parts.