2 Comments

Cross-Compiling Ruby using LTIB

Linux Target Image Builder (LTIB) is a tool used to develop and deploy board support packages for an embedded target platform. I used LTIB on my last project to create the kernel image and root file system for an i.MX28 freescale processor running on a custom board.

During development I found I could use Ruby on target to aid development and testing but was unable to find a suitable Ruby package available in LTIB’s Global Package Pool (GPP). I created my own installation package for Ruby 1.8.7 p334 starting from Fedora’s 14 Ruby source RPM and cross-compiled the package from LTIB’s Private Package Pool (PPP). Eventually I’d like to publish the Ruby package to the GPP once it has been verified on several other platforms. That is where you come in: if you’d like to try the package, please follow the instructions below. All of the steps below are based on LTIB’s documentation.

Overview

You will need to install the Ruby source code in LTIB’s PPP. The PPP is just a local directory on your system that LTIB puts the archives of your source code. After adding the Ruby source code, you need to add the LTIB spec file which is LTIB’s makefile equivalent. Finally, run LTIB’s commands to build the package.

Disclaimer: The package has only been cross-compiled and tested for a single target platform so far.

Setup

  • Download the Ruby source code configured for LTIB: ruby-1.8.7-p334-ltib.tar.gz

  • Copy the file to your PPP (for Freescale LTIB installations, this is located at /opt/freescale/pkgs)

  • Download the LTIB spec file: ruby.spec

  • Create a directory ltib/dist/lfs-5.1/ruby to put the Ruby LTIB spec file in

  • Copy the LTIB spec file into the created directory

Building

Run LTIB package prep command specifying the Ruby spec file: ./ltib -m prep -p ruby.spec

Configuring LTIB’s User Interface to Recognize the Package

  • Add PKG_RUBY = ruby to the ltib/config/userspace/pkg_map file

  • Add the below configuration to ltib/config/userspace/packages.lkc file (maintain alphabetical order of file by config name when adding)

config PKG_RUBY
    depends CAP_HAS_MMU
    bool "ruby"
    help
      An interpreter of object-oriented scripting language

Rebuild LTIB ensuring you select the Ruby package for installation in your rootfs, install your image and power up your board. Please leave me a comment letting me know how it worked and what platform you installed it on.