element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Freescale i.MX6 Development Platforms
  • Products
  • Dev Tools
  • Single-Board Computers
  • Freescale i.MX6 Development Platforms
  • More
  • Cancel
Freescale i.MX6 Development Platforms
Blog Using LTIB to Build Programs for SABRE Lite (i.MX6)
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Freescale i.MX6 Development Platforms requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: oneleggedredcow
  • Date Created: 17 Apr 2014 2:39 AM Date Created
  • Views 901 views
  • Likes 0 likes
  • Comments 2 comments
Related
Recommended

Using LTIB to Build Programs for SABRE Lite (i.MX6)

oneleggedredcow
oneleggedredcow
17 Apr 2014

In this article, we are going to set up LTIB on a Linux machine to do cross compilation for the SABRE Lite (i.MX6)SABRE Lite (i.MX6).  Then we are going to use LTIB to compile the standard Hello World program and test to make sure that everything works as expected.

 

The Linux Target Image Builder (LTIB) is an open source project that lets you compile applications on your Linux machine that will run on a different platform.  This comes in handy when you are developing a new application and all of your tools reside on your desktop Linux machine.  This way you can use all of your normal tools, in a familiar environment, and target a single board computer like the SABRE Lite (i.MX6).

 

Prerequisites

Before we get going, it is always a good idea to make sure that your system is up to date:

 

 

 

Once that completes, then you need to install the LTIB dependencies which are:

 

 

If your desktop PC is running a 64 bit version of Linux, then you need one more library:

 

 

Getting LTIB Source

The first step is to get the LTIB source that lets you target the SABRE Lite (i.MX6).  It can be found here:

 

http://community.freescale.com/docs/DOC-95560

 

The file that you want is labeled L3.0.35_4.1.0_SOURCE_BSP.

 

Once the download has completed, then unzip the source with:

 

 

Inside the directory that was created you should find an install script, run that and accept the EULA.

 

Getting Extra Libraries

If you try to run LTIB right now, it will error out trying to find some packages that it can’t locate. Unfortunately, the list of packages that it needs but can’t find is pretty long.  So, to make it easier, I’ve attached a zip to this post that contains most of the missing packages.  Download that file and then put its contents into:

 

/opt/freescale/pkgs

 

I’m not really sure why the packages can’t be resolved.  The fact that they can’t be resolved really make me think that I’m either doing something wrong, or that the preferred way is now to use the yocto project.  (Yocto is another tool for doing cross compilation.)

 

Building LTIB

Now that you have all of the required packages, you can build LTIB by typing:

 

 

If this completes successfully, then you will be presented with a screen that looks like this:

 

image

 

Using this screen you can set the platform that you would like to compile to.  This setting is already correct by default, so you don’t need to make any changes here.  So, hit the right arrow on your keyboard and select “Exit” and press enter.  It will then prompt you asking whether or not you would like to save.

 

After you save, then you will be prompted with another screen that looks similar to the first one:

 

image

 

On this screen there are some changes that need to be made.  You need to change the platform type from imx25_3stack to be imx6q.  To do this, highlight the “Selection (imx25_3stack)  --->” line and hit enter.  This will bring up another form that looks like this:

 

image

 

Find the imx6q option and hit enter.  This is the only change that is required for this form, so Exit and save just like we did before.

 

This will bring up one more dialog:

 

image

 

On this dialog, we need to change the board from mx6q_arm2 to mx6q_sabrelite.  The procedure for this is similar to the last change that we made.  After you make this change, exit and save.

 

This will kick off a building process.  Unfortunately, this process initially fails for me with an error about a package called busybox.

 

This is fairly easy to fix. Within your LTIB directory there will be a file called:

 

dist/lfs-5.1/base_libs/base_libs.spec

 

Open up this file and make a small modification.  First, find the lines that look like this:

 

 

What you want to do is to remove the last two lines:

 

 

 

Once they are deleted, then rerun ./ltib.  When you run it a second time, you will not have to go through the previous screens, it will just start building where it left off.  This time busybox should succeed and you will eventually see a screen that looks like this:

 

image

 

Great success!

 

Compiling Hello World

Now that we have LTIB set up to do cross-compilation, let’s test it out and see if it works.  To do this we are going to use the classic hello world example:

 

 

 

Once you have that code into a file, let’s call it test.cpp, then fire up LTIB in shell mode:

 

 

This will give you a prompt that acts like you are on the SABRE Lite (i.MX6).  So, when you compile within this shell, the executable will be compiled for the SABRE Lite (i.MX6) instead of the machine that you are on. So, compile the program like you normally would:

 

 

As a quick test, you can inspect what type of file the executable is by doing:

 

 

This inspects the file’s “magic numbers” that describes what type of file it is.  This command should print out:

 

ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.31, not stripped

 

Excellent, now copy over the executable to the SABRE Lite and you should see the program run and print out “Hello World!”.

 

Summary

In this article, we got LTIB up and running on our desktop PC so that we could cross compile applications for the SABRE Lite (i.MX6).  We then used LTIB to compile a Hello World program and run it on the SABRE Lite (i.MX6)SABRE Lite (i.MX6).

 

With all of the work around to get LTIB set up, I’m not sure this is the best way to go about it. Seems like the yocto project has become the preferred way to go, but that’s just a guess.  I haven’t given that one a try yet, so I’m not sure it is easier to set up.

 

Video

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Attachments:
LTIB Dependencies.zip
  • Sign in to reply
  • amgalbu
    amgalbu over 8 years ago

    Hi Shaun

    the LTIB can be used to build platform for iMX6-board from any vendor? How manufacturer-specific drivers are handled?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 8 years ago

    Hi

     

    I followed the exact way as mentioned above but the build was not successful.

     

    When I executed ./ltib, a error log file was created. Please find the error log below:

     

    Processing: mtd-utils

    =======================

    Build path taken because: no prebuilt rpm,

    Testing network connectivity

    No network download connection available

     

    Can't get: mtd-utils-1.5.0.tar.gz at ./ltib line 802.

    Died at ./ltib line 1392.

    traceback:

    main::build_host_rpms:1392

      main::host_checks:1447

       main:554

     

     

    Started: Thu Nov 20 22:21:11 2014

    Ended:   Thu Nov 20 22:21:39 2014

    Elapsed: 28 seconds

     

    These packages failed to build:

    mtd-utils

     

    Build Failed

     

     

    ----------------------------------

     

    Seeing the above error log, I could see that it is trying to connect to internet but failing. But internet is there for the ubuntu desktop I am using.

    Is there anything you can help me with ?

     

    Thanks

    Nandhan

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube