Search This Blog

Thursday, January 19, 2012

LTIB - best link

Ref link: http://boundarydevices.com/blogs/revisiting-ltib-on-i-mx5x-this-time-with-java

Revisiting LTIB on i.MX5x (this time with Java)

We’ve recently been hearing from customers that they’d like to use the Nitrogen i.MX51 board as a Java platform, and have customers using both Ubuntu and Debian to develop their applications in Java. Each of those userland environments has merit, but also drawbacks. Neither is particularly small.
In this post, I’ll walk through the LTIB alternative, which is a lighter-weight method of getting Sun’s JRE (1.6.0.10) up and running on a Nitrogen board.
In our previous post on LTIB we described some of the issues we encountered in our first attempts at using the LTIB package from Freescale. We also glossed over a number of steps. In this post, we’ll try to detail each step and will publish the resulting configuration file.

Step 1: Get and install LTIB core package

The current release of the Freescale LTIB package can be found on the Freescale site.
You may need to register with Freescale and agree to their licensing provisions.
Once downloaded, the file L2.6.31_10.07.11_ER_source_bundle.tar.gz will contain a couple of packages:
1user@host:~/Downloads$ tar ztvf L2.6.31_10.07.11_ER_source_bundle.tar.gz
2-rwxrwxrwx 0/0        19184893 2010-08-04 10:25 L2.6.31_10.07.11_ER_docs.tar.gz
3-rwxrwxrwx 0/0       600781672 2010-08-02 09:38 L2.6.31_10.07.11_ER_source.tar.gz
You’ll want to extract them from the bundle and then extract the contents of the source package:
01user@host:~/Downloads$ tar zxvf L2.6.31_10.07.11_ER_source_bundle.tar.gz
02L2.6.31_10.07.11_ER_docs.tar.gz
03L2.6.31_10.07.11_ER_source.tar.gz
04user@host:~/Downloads$ tar zxvf L2.6.31_10.07.11_ER_source.tar.gz
05L2.6.31_10.07.11_ER_source/
06L2.6.31_10.07.11_ER_source/redboot_201003.zip
07L2.6.31_10.07.11_ER_source/package_manifest.txt
08L2.6.31_10.07.11_ER_source/pkgs/
09L2.6.31_10.07.11_ER_source/pkgs/libXrender-0.9.4.tar.bz2.md5
10L2.6.31_10.07.11_ER_source/pkgs/strace-4.5.14-linux-dirent.patch.md5
11L2.6.31_10.07.11_ER_source/pkgs/net-tools-1.60.tar.bz2.md5
12...
After doing this, you’ll find an install script that will install LTIB onto your machine.
1user@host:~/Downloads$ ls L2.6.31_10.07.11_ER_source/
2EULA  install  ltib.tar.gz  package_manifest.txt  pkgs  redboot_201003.zip  tftp.zip
Running the install script will prompt you to agree to some license terms and ask you where you want to install LTIB. Note that the directory name ltib will be appended to your answer.
01user@host:~$ ./L2.6.31_10.07.11_ER_source/install
02
03You are about to install the LTIB (GNU/Linux Target Image Builder)
04
05Before installing LTIB, you must read and accept the EULA
06(End User License Agreement) which will be presented next.
07
08Do you want to continue ? Y|n
09Y
10
11Hit enter to continue:
12IMPORTANT. Read the following Freescale Software License Agreement
13("Agreement") completely. By selecting the "I Accept" button at the
14end of this page, you indicate that you accept the terms of the
15...
16I have read and accept the EULA (yes|no):
17yes
18
19The LTIB files are extracted from a tar file which includes the
20prefix ltib.  After installation you will find LTIB in:
21/home/user/ltib
22
23Where do you want to install LTIB ? (/home/user)
24
25Making target directory /home/user/ltib
26Installing LTIB to /home/user/ltib
27ltib/
28ltib/hash
29ltib/doc/
30ltib/doc/LtibFreescaleSpecifics
31ltib/doc/LtibReleaseProcess
32ltib/doc/LtibCreateNewTarget
33ltib/doc/LtibTodo
34ltib/doc/LtibFeatures
35...

Step 2: Fix up for an Ubuntu host and run ltib for the first time

This is stage where some edits to LTIB are necessary on an Ubuntu 10.04 host. Refer to the previous post for commentary.
Edit the ltib script, changing a zero to a one:
01user@host:~/ltib$ diff -Naurb ltib.original ltib
02--- ltib.original   2010-10-27 10:46:14.000000000 -0700
03+++ ltib    2010-10-27 10:46:41.000000000 -0700
04@@ -192,7 +192,7 @@
05     hostcf       => 0,
06     fullbsp      => 0,
07     distmap      => 0,
08-    no_sudo_check => 0,  # fc9 work-around
09+    no_sudo_check => 1,  # fc9 work-around
10
11     help         => 0,
12 };
Add an item to your sudoers file (replacing user with your username):
1user ALL = NOPASSWD: /usr/bin/rpm, /opt/freescale/ltib/usr/bin/rpm
At this stage, you should be able to run LTIB for the first time. This first run populates /opt/freescale with LTIB packages from your source bundle and completes the installation of LTIB itself.
01user@host:~/ltib$ ./ltib -c
02
03Installing host support packages.
04
05This only needs to be done once per host, but may take up to
06an hour to complete ...
07
08If an error occurs, a log file with the full output may be found in:
09/home/user/ltib/host_config.log
10...
If you have trouble at this stage, it’s most likely due to un-met dependencies in your host environment. Check out these links for details:
  • http://www.imxdev.org/wiki/index.php?title=All_Boards_LTIB
  • http://www.imxdev.org/wiki/index.php?title=ALL_Boards_ltib_config_ubuntu
  • http://forums.freescale.com/t5/i-MX-Microprocessors/iMX25-SDK-LTIB-error-with-Ubuntu/td-p/52117
Also note that if you do have problems in this stage, you may need to remove some files from /opt/freescale/ltib/usr/src/rpm/BUILD because LTIB is Cowardly. As the message above says: refer to host_config.log for details.
Assuming all of it’s dependencies are met, LTIB will eventually present you with a series of kconfig menus asking you to define the type of device and the details of what you’d like it to build.
The first iteration will prompt you to select your device type. Choose “Freescale reference platform”, save and exit.

The second iteration will prompt you for the machine type and release type. Choose imx5x and Gnome release respectively.

The system will then allow you to select packages and set various options for userland startup. There are far too many options to discuss in one blog post, so we’ll simply take the defaults for now and allow compilation to complete.
If you’re running on an Ubuntu development machine, you may need to patch the gtkhtml package with the following:
01diff --exclude CVS --exclude .git -uNr gtkhtml-3.24.2/gtkhtml/Makefile.in gtkhtml-3.24.2.modified/gtkhtml/Makefile.in
02--- gtkhtml-3.24.2/gtkhtml/Makefile.in  2008-11-19 22:12:29.000000000 -0700
03+++ gtkhtml-3.24.2.modified/gtkhtml/Makefile.in 2010-07-05 21:12:13.199920018 -0700
04@@ -384,7 +384,6 @@
05 INCLUDES = \
06    -I$(top_srcdir)         \
07    -I$(srcdir)         \
08-   -I$(includedir)         \
09    $(GTKHTML_CFLAGS)       \
10    $(SOUP_CFLAGS)          \
11    $(I18N_LIB_CFLAGS)      \
If you place the contents of this tarball into /opt/freescale/pkgs/, you can save yourself the steps of hand editing.
Full disclosure: you may also have some other difficulties during the build process. As with most other userland cross-compilation toolkits, we’ve found some issues related to leakage from your host environment into the cross-compile. LTIB does an impressive job of pulling together all of the bits, but there are a lot of details to catch.
If all goes according to plan, you should end up with a message like this:
01Filesystem stats, including padding:
02
03    Total size            = 324124k
04    Total number of files = 18221
05
06Started: Thu Oct 28 05:46:19 2010
07Ended:   Thu Oct 28 05:51:39 2010
08Elapsed: 320 seconds
09
10Build Succeeded

Step 3: Add gstreamer acceleration

In the steps above, we didn’t include the Freescale codec package. The reason we omitted this step is that the first build of LTIB will populate /opt/freescale and the codec package needs to be installed into that directory.
At this point you can download the multimedia codec source bundle. The bundle consists of both documents and the packages, so you’ll need a couple of unzip steps:
01user@host:~/Downloads$ ls MX5X_10.07_SS_MM_Standard_Source_Bundle.zip
02MX5X_10.07_SS_MM_Standard_Source_Bundle.zip
03user@host:~/Downloads$ unzip -l MX5X_10.07_SS_MM_Standard_Source_Bundle.zip
04Archive:  MX5X_10.07_SS_MM_Standard_Source_Bundle.zip
05  Length      Date    Time    Name
06---------  ---------- -----   ----
07   305549  2010-08-04 12:28   Linux_Multimedia_Framework_Docs_MX51Ubuntu_1.9.0.tar.gz
08 45482112  2010-08-02 15:39   MX5X_10.07_SS_MM_Standard_Source.zip
09---------                     -------
10 45787661                     2 files
11user@host:~/Downloads$ unzip  MX5X_10.07_SS_MM_Standard_Source_Bundle.zip Archive:  MX5X_10.07_SS_MM_Standard_Source_Bundle.zip
12  inflating: Linux_Multimedia_Framework_Docs_MX51Ubuntu_1.9.0.tar.gz
13  inflating: MX5X_10.07_SS_MM_Standard_Source.zip
14user@host:~/Downloads$ unzip MX5X_10.07_SS_MM_Standard_Source.zip
15Archive:  MX5X_10.07_SS_MM_Standard_Source.zip
16   creating: MX5X_10.07_SS_MM_Standard_Source/
17  inflating: MX5X_10.07_SS_MM_Standard_Source/fsl-mm-codeclib-1.9.0.tar.gz
18...
19  inflating: MX5X_10.07_SS_MM_Standard_Source/gst-plugins-base0.10_0.10.25-2ubuntu1.2-fslmm3.tar.gz
20  inflating: MX5X_10.07_SS_MM_Standard_Source/gst-fsl-plugin_1.9.0.orig.tar.gz
21 extracting: MX5X_10.07_SS_MM_Standard_Source/gst-fsl-plugin_1.9.0-2.diff.gz
22 extracting: MX5X_10.07_SS_MM_Standard_Source/fsl-mm-codeclib_1.9.0-2.diff.gz
23user@host:~/Downloads$ cp -fv MX5X_10.07_SS_MM_Standard_Source/* /opt/freescale/pkgs/
24`MX5X_10.07_SS_MM_Standard_Source/fsl-mm-codeclib_1.9.0-2.diff.gz' -> `/opt/freescale/pkgs/fsl-mm-codeclib_1.9.0-2.diff.gz'
25`MX5X_10.07_SS_MM_Standard_Source/fsl-mm-codeclib_1.9.0-2.dsc' -> `/opt/freescale/pkgs/fsl-mm-codeclib_1.9.0-2.dsc'
26`MX5X_10.07_SS_MM_Standard_Source/fsl-mm-codeclib_1.9.0.orig.tar.gz' -> `/opt/freescale/pkgs/fsl-mm-codeclib_1.9.0.orig.tar.gz'
27`MX5X_10.07_SS_MM_Standard_Source/fsl-mm-codeclib-1.9.0.tar.gz' -> `/opt/freescale/pkgs/fsl-mm-codeclib-1.9.0.tar.gz'
28`MX5X_10.07_SS_MM_Standard_Source/gst-fsl-plugin_1.9.0-2.diff.gz' -> `/opt/freescale/pkgs/gst-fsl-plugin_1.9.0-2.diff.gz'
29`MX5X_10.07_SS_MM_Standard_Source/gst-fsl-plugin_1.9.0-2.dsc' -> `/opt/freescale/pkgs/gst-fsl-plugin_1.9.0-2.dsc'
30`MX5X_10.07_SS_MM_Standard_Source/gst-fsl-plugin_1.9.0.orig.tar.gz' -> `/opt/freescale/pkgs/gst-fsl-plugin_1.9.0.orig.tar.gz'
31`MX5X_10.07_SS_MM_Standard_Source/gst-fsl-plugin-1.9.0.tar.gz' -> `/opt/freescale/pkgs/gst-fsl-plugin-1.9.0.tar.gz'
32`MX5X_10.07_SS_MM_Standard_Source/gst-plugins-base0.10_0.10.25-2ubuntu1.2-fslmm3.dsc' -> `/opt/freescale/pkgs/gst-plugins-base0.10_0.10.25-2ubuntu1.2-fslmm3.dsc'
33`MX5X_10.07_SS_MM_Standard_Source/gst-plugins-base0.10_0.10.25-2ubuntu1.2-fslmm3.tar.gz' -> `/opt/freescale/pkgs/gst-plugins-base0.10_0.10.25-2ubuntu1.2-fslmm3.tar.gz'
34`MX5X_10.07_SS_MM_Standard_Source/gst-plugins-base0.10_0.10.25.orig.tar.gz' -> `/opt/freescale/pkgs/gst-plugins-base0.10_0.10.25.orig.tar.gz'
35`MX5X_10.07_SS_MM_Standard_Source/gstreamer0.10_0.10.25-2-fslmm2.dsc' -> `/opt/freescale/pkgs/gstreamer0.10_0.10.25-2-fslmm2.dsc'
36`MX5X_10.07_SS_MM_Standard_Source/gstreamer0.10_0.10.25-2-fslmm2.tar.gz' -> `/opt/freescale/pkgs/gstreamer0.10_0.10.25-2-fslmm2.tar.gz'
37`MX5X_10.07_SS_MM_Standard_Source/gstreamer0.10_0.10.25.orig.tar.gz' -> `/opt/freescale/pkgs/gstreamer0.10_0.10.25.orig.tar.gz'
After this, you can configure LTIB to include them using ltib -m config
1user@host~/ltib$ ./ltib -m config
You’ll want to select the package gst-fsl-plugins under the menu selections Package List|Freescale Multimedia Plugins/Codecs.

Finally, you may want to include our color-keying patch. If so, you can apply it now. This will require two steps.
The first step patches the spec file to include the patch:
1user@host~/ltib$ cd dist
2user@host~/ltib/dist$ curl http://boundarydevices.com/gst-fsl-plugin.spec.patch | patch -p1
3  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
4                                 Dload  Upload   Total   Spent    Left  Speed
5105   525  105   525    0     0   1126      0 --:--:-- --:--:-- --:--:--  7500
6patching file lfs-5.1/fsl-mm/gst-fsl-plugin.spec
The second step retrieves the gstreamer patch itself and places it into the pkgs/ directory:
1user@host:~/ltib$ cd /opt/freescale/pkgs/
2user@host:/opt/freescale/pkgs$ wget http://boundarydevices.com/gst-fsl-plugin-1.9.0-1285979227.patch && cd ~/ltib

Step 4: Add libXi and libXtst

This step took a while to figure out, and as it so often happens in the software-wrangling business, after you figure out how to do something, you find that someone else has it figured out. In this case, the wonderful community at imxdev.org has a post on how to support Java. In the third note on the page, it has a link to download the spec files for LTIB releases that don’t include the libXi and libXtst packages that Sun’s JVM requires.
To install them, you’ll need to download these patches and copy them into your ltib/dist/lfs-5.1/ tree:
03Resolving www.imxdev.org... 74.220.215.56
04Connecting to www.imxdev.org|74.220.215.56|:80... connected.
05HTTP request sent, awaiting response... 200 OK
06Length: 814 [application/x-gzip]
07Saving to: `Libxtst_libxi_specs.tar.gz'
08100%[======================================>] 814         --.-K/s   in 0s
092010-10-28 09:31:45 (33.5 MB/s) - `Libxtst_libxi_specs.tar.gz' saved [814/814]
10user@host:~$ tar zxvf Libxtst_libxi_specs.tar.gz
11libXi.spec
12libXtst.spec
13user@host:~$ mkdir -p ltib/dist/lfs-5.1/libXi && mv libXi.spec ltib/dist/lfs-5.1/libXi/
14user@host:~$ mkdir -p ltib/dist/lfs-5.1/libXtst && mv libXtst.spec ltib/dist/lfs-5.1/libXtst/
15user@host:~$ rm -f Libxtst_libxi_specs.tar.gz
After this, you still won’t be able to select them using LTIB until you’ve added them to the files ltib/config/userspace/packages.lkc and ltib/config/userspace/pkg_map:
01diff --git a/packages.lkc b/packages.lkc
02index 79e2ea4..ab9db91 100755
03--- a/packages.lkc
04+++ b/packages.lkc
05@@ -3742,6 +3742,22 @@ config PKG_LIBXAW
06     bool "libXaw"
07     help
08       X.Org X11 libXaw runtime library
09+config PKG_LIBXI
10+    depends CAP_HAS_MMU
11+        select PKG_XORG_SERVER
12+    select PKG_LIBXMU
13+    select PKG_LIBXPM
14+    bool "libXi"
15+    help
16+      X.Org X11 libXi runtime library
17+config PKG_LIBXTST
18+    depends CAP_HAS_MMU
19+        select PKG_XORG_SERVER
20+    select PKG_LIBXMU
21+    select PKG_LIBXPM
22+    bool "libXtst"
23+    help
24+      X.Org X11 libXtst runtime library
25 config PKG_LIBXXF86DGA
26     depends CAP_HAS_MMU
27     bool "libXxf86dga"
28diff --git a/pkg_map b/pkg_map
29index 865bac5..4de6ac7 100755
30--- a/pkg_map
31+++ b/pkg_map
32@@ -193,6 +193,8 @@ PKG_LIBXPM                       = libXpm
33 PKG_LIBXT                        = libXt
34 PKG_LIBXMU                       = libXmu
35 PKG_LIBXAW                       = libXaw
36+PKG_LIBXI                        = libXi
37+PKG_LIBXTST                      = libXtst
38
39 PKG_DBUS                         = dbus
40 PKG_DBUS_GLIB                    = dbus-glib
We’ve placed this patch on our web-site so you can do this more quickly like so:
1user@host:~/ltib/config/userspace$ curl http://boundarydevices.com/config_userspace_libxtst_libxi.patch | patch -p1
2  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
3                                 Dload  Upload   Total   Spent    Left  Speed
4102  1131  102  1131    0     0   3104      0 --:--:-- --:--:-- --:--:-- 16391
5patching file packages.lkc
6patching file pkg_map
Once you’ve installed the spec files and listed them in the package list, you can use ltib -m config again to select them. They’ll be located in the menu under Package List|X11:

Step 5: Compile

After all of this, compiling is pretty anti-climactic. It will also run much more quickly than the previous compile because most of the packages haven’t changed:
01user@host:~/ltib$ ./ltib
02...
03Processing: pixman
04====================
05
06Processing: libXau
07====================
08
09Processing: libxcb
10====================
11
12Processing: libXfont
13...
14Started: Thu Oct 28 09:57:11 2010
15Ended:   Thu Oct 28 10:02:19 2010
16Elapsed: 308 seconds
17
18Build Succeeded
Once again, you should see the happy words Build Succeeded, which this time means that you have all
of the pre-requisites for Java installed.

Step 6: Install Java

Please don’t assume that we’re experts in Java. We were successful in choosing from the myriad of options on Oracle’s site to find a JVM that runs nicely on the Nitrogen board. We chose the ARMv7, Headful, Hard Float, Little-Endian choice from this page, although the resulting download indicated that the JVM was configured for ARMv6.
We extracted it into the ltib/rootfs/root/ directory:
1user@host:~/ltib/rootfs/root$ sudo tar zxvf ~/Downloads/ejre-1_6_0_10-fcs-b42-linux-armv6-vfp-eabi-min-10_jun_2010.tar.gz
2ejre1.6.0_10/
3ejre1.6.0_10/bin/
4ejre1.6.0_10/bin/java
5ejre1.6.0_10/bin/keytool
6ejre1.6.0_10/bin/jcontrol
7ejre1.6.0_10/bin/ControlPanel
8ejre1.6.0_10/bin/java_vm
9...
As you can see, the JVM binaries are loaded into ejre1.6.0_10/bin and you’ll want to create a file named .profile in the /root directory so that java can be found.
1user@host:~/ltib/rootfs/root$ sudo vi .profile
2export PATH=$PATH:/root/ejre1.6.0_10/bin
This is also a good time to grab the example code from the imxdev site and compile it:
01user@host:~/ltib/rootfs/root$ sudo vi Example1.java && chmod 777 *.java
02import java.awt.*;
03
04public class Example1 extends java.applet.Applet
05{
06   public void init()
07   {
08      add(new Button("One"));
09      add(new Button("Two"));
10   
11
12   public Dimension preferredSize()
13   {
14      return new Dimension(480, 640);
15   }
16
17   public static void main(String [] args)
18   {
19      Frame f = new Frame("Example 1");
20
21      Example1 ex = new Example1();
22
23      ex.init();
24
25      f.add("Center", ex);
26
27      f.pack();
28      f.show();
29   }
30}
31user@host:~/ltib/rootfs/root$ sudo ecj Example1.java

Step 7: Run via NFS

At this stage, we’re ready to run this image over NFS.
If you’re using the nfs-kernel-server package, you’ll need to add a line into /etc/exports like the following (replacing 192.168.0.0 with your subnet):
1/home/user/ltib/rootfs 192.168.0.0/255.255.255.0(rw,no_root_squash,no_subtree_check,no_all_squash,sync)
Then you’ll need to tell the NFS server to load the updated file:
1user@host: ~/$ sudo /etc/init.d/nfs-kernel-server reload
If you have an SD card from us, it’s likely to have a kernel in the first (FAT) partition, and you can boot it over NFS by setting your bootargs environment variable like so:
01U-Boot > set bootargs rootwait ip=dhcp root=/dev/nfs nfsroot=192.168.0.254:/home/user/ltib/rootfs
02U-Boot > fatload mmc 0 92000000 uImage && bootm 92000000
03reading uImage
04
052300984 bytes read
06## Booting kernel from Legacy Image at 92000000 ...
07   Image Name:   Linux-2.6.31-01053-g739d881-dirt
08   Image Type:   ARM Linux Kernel Image (uncompressed)
09   Data Size:    2300920 Bytes =  2.2 MB
10   Load Address: 90008000
11   Entry Point:  90008000
12   Verifying Checksum ... OK
13   Loading Kernel Image ... OK
14OK
15
16Starting kernel ...
17
18Uncompressing Linux................................................................................................................................................. done, booting the kernel.
19Linux version 2.6.31-01053-g739d881-dirty (user@host) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) ) #5 PREEMPT Wed Oct 27 14:07:24 MST 2010
20CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c53c7f
21CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
22...
23Freescale Semiconductor, Inc.
24
25freescale login:
Note that you’ll need to replace 192.168.0.254 with the IP address of your development machine and /home/user/ltib with your LTIB installation directory.
Because you probably haven’t (yet) installed xterm, you may need to test this from the serial console and set the DISPLAY environment variable:
1freescale login: root
2
3BusyBox v1.15.0 () built-in shell (ash)
4Enter 'help' for a list of built-in commands.
5
6root@freescale ~$ DISPLAY=:0 java Example1

This is a probably good time to discuss the merits of NFS. I forgot to add any media to the filesystem, but can update the running system on the server side. This command will grab Freescale’s 720P video file and place it in the root user’s home directory:
Now that I have a video, I can test the installation of the GStreamer plugins:
1root@freescale ~$ gst-launch filesrc location=FSL_Mosaic_Video_1280x720_H264_7mbps.mp4 \
2                          ! decodebin \
3                          ! mfw_v4lsink x11enable=1

Step 8: Run via SD card

There are a quite a few ways to set your machine up to boot to SD card. In this post, I’ll use the simplest by just copying the filesystem to an EXT3 filesystem in the second partition of the SD card. Because I’m using a built-in SD card reader, my physical SD card device shows up as /dev/mmcblk0 and each partition shows up as /dev/mmcblk0p#. If you’re using a USB reader, the device will likely appear as something like /dev/sdb.
01user@host:~/ltib$ sudo fdisk -l /dev/mmcblk0
02
03Disk /dev/mmcblk0: 3999 MB, 3999268864 bytes
044 heads, 16 sectors/track, 122048 cylinders
05Units = cylinders of 64 * 512 = 32768 bytes
06Sector size (logical/physical): 512 bytes / 512 bytes
07I/O size (minimum/optimal): 512 bytes / 512 bytes
08Disk identifier: 0x00000000
09
10        Device Boot      Start         End      Blocks   Id  System
11/dev/mmcblk0p1               1        3201      102424    b  W95 FAT32
12/dev/mmcblk0p2            3202      122048     3803104   83  Linux
13user@host:~/ltib$ sudo mkfs.ext3 -L rootfs /dev/mmcblk0p2
14mke2fs 1.41.11 (14-Mar-2010)
15warning: 504 blocks unused.
16
17Filesystem label=rootfs
18OS type: Linux
19Block size=4096 (log=2)
20Fragment size=4096 (log=2)
21Stride=0 blocks, Stripe width=0 blocks
22238032 inodes, 950272 blocks
2347538 blocks (5.00%) reserved for the super user
24First data block=0
25Maximum filesystem blocks=973078528
2629 block groups
2732768 blocks per group, 32768 fragments per group
288208 inodes per group
29Superblock backups stored on blocks:
30    32768, 98304, 163840, 229376, 294912, 819200, 884736
31
32Writing inode tables: done
33Creating journal (16384 blocks): done
34Writing superblocks and filesystem accounting information: done
35
36This filesystem will be automatically checked every 38 mounts or
37180 days, whichever comes first.  Use tune2fs -c or -i to override.
38
39user@host:~/ltib$ ls -l /dev/disk/by-label/
40total 0
41lrwxrwxrwx 1 root root 15 2010-10-28 15:29 boot -> ../../mmcblk0p1
42lrwxrwxrwx 1 root root 15 2010-10-28 15:29 rootfs -> ../../mmcblk0p2
43
44user@host:~/ltib$ sudo partprobe /dev/mmcblk0
45user@host:~/ltib$ mount | grep mmcblk0
46/dev/mmcblk0p1 on /media/BOOT type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,flush)
47/dev/mmcblk0p2 on /media/rootfs type ext3 (rw,nosuid,nodev,uhelper=udisks)
Copying the disk should be straightforward:
1user@host:~/ltib$ cp -avfr rootfs/* /media/rootfs/
2user@host:~/ltib$ sync && sudo umount /media/*
In order to configure U-Boot to boot to the second partition, you’ll need to set the root=/dev/mmcblk0p2 and rootwait command-line arguments:
01U-Boot > set bootargs rootwait root=/dev/mmcblk0p2
02U-Boot > fatload mmc 0 92000000 uImage && bootm 92000000
03reading uImage
04
052300984 bytes read
06## Booting kernel from Legacy Image at 92000000 ...
07   Image Name:   Linux-2.6.31-01053-g739d881-dirt
08   Image Type:   ARM Linux Kernel Image (uncompressed)
09   Data Size:    2300920 Bytes =  2.2 MB
10   Load Address: 90008000
11   Entry Point:  90008000
12   Verifying Checksum ... OK
13   Loading Kernel Image ... OK
14OK
15
16Starting kernel ...
17
18Uncompressing Linux................................................................................................................................................. done, booting the kernel.
19Linux version 2.6.31-01053-g739d881-dirty (user@host) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202) ) #5 PREEMPT Wed Oct 27 14:07:24 MST 2010
20CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c53c7f
21CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
22...
23Freescale Semiconductor, Inc.
24
25freescale login:

Recap

This was a rather long post, but it still only scratches the surface of LTIB and its’ usage on a Nitrogen board. There’s a lot of power in the toolset, and we encourage you to engage with the LTIB community at , and also the IMX Community and imxdev.org. A lot of talented developers out there are producing some amazing things on the i.MX51 and other Freescale processors.
During this build cycle, we tailored a demo image that includes some other useful parts, including mplayer, ffmpeg and some other bits. The .config file is on our web site at http://boundarydevices.com/ltib_config_20101028.
In case you just want to kick the tires on the end-result, we also copied the rootfs tarball to our web-site: http://boundarydevices.com/ltib_rootfs_20101028.tar.gz.

2 comments to Revisiting LTIB on i.MX5x (this time with Java)

  • Jason Sando
    Hi Eric,
    I have some experience running various Java VM’s on ARM products, including PhoneME, Sun Java 6, and recently also jamvm. PhoneME is GPL, very robust, but has a very small subset of the Java api’s (it is actually the vm in billions of mobile phones). Sun’s Java 6 for ARM products are very high quality, but also very LARGE on storage (>32MB), although RAM utilization is not too bad (10-12MB minimum, but you can pack *a lot* of functionality into <20MB). And recently I did some performance testing of jamvm (also GPL) … and was very impressed. Jamvm has no JIT, so not so good with cpu-intensive tasks but its startup time and footprint is very low, I think the whole interpreter binary was less than 200k.
    Java allows terrific developer productivity gains, and even allow reuse of binaries across completely different architectures … saving major engineering time and speeding time to market. Not right for every project of course, but still a very valuable tool. Glad to see support on Boundary products "out of the box"!
    -Jason
  • Swamy
    Hi,
    I am using IMX53 Sabre Tab(SMD) with 11.05 BSP, I am following your document to support Jave, but I am getting following error. Please suggest.
    Regards,
    Swamy
    Processing: libXi
    ===================
    Build path taken because: directory build, build key set, no prebuilt rpm,
    rpmbuild –dbpath /home/lucid/ltib/rootfs//var/lib/rpm –target arm –define ‘_unpackaged_files_terminate_build 0′ –define ‘_target_cpu arm’ –define ‘__strip strip’ –define ‘_topdir /home/lucid/ltib/rpm’ –define ‘_prefix /usr’ –define ‘_tmppath /home/lucid/ltib/tmp’ –define ‘_rpmdir /home/lucid/ltib/rpm/RPMS’ –define ‘_mandir /usr/share/man’ –define ‘_sysconfdir /etc’ –define ‘_localstatedir /var’ -bc –short-circuit /home/lucid/ltib/dist/lfs-5.1/libXi/libXi.spec
    Building target platforms: arm
    Building for target arm
    Executing(%build): /bin/sh -e /home/lucid/ltib/tmp/rpm-tmp.95844
    + umask 022
    + cd /home/lucid/ltib/rpm/BUILD
    + cd libXi-1.1.4
    +
    : not found/ltib/tmp/rpm-tmp.95844: 1:
    error: Bad exit status from /home/lucid/ltib/tmp/rpm-tmp.95844 (%build)
    RPM build errors:
    Bad exit status from /home/lucid/ltib/tmp/rpm-tmp.95844 (%build)
    Build time for libXi: 0 seconds
    Failed building libXi
    f_buildrpms() returned an error, exiting
    traceback:
    main:560
    Started: Wed Dec 7 02:45:49 2011
    Ended: Wed Dec 7 02:45:57 2011
    Elapsed: 8 seconds
    These packages failed to build:
    libXi
    Build Failed
    Exiting on error or interrupt
    lucid@ubuntu:~/ltib$

No comments:

Post a Comment