LTIB For I.mx28 A Step-By-step Guide
LTIB For I.mx28 A Step-By-step Guide
LTIB For I.mx28 A Step-By-step Guide
Install LTIB
Configure and build
First time configuration
LTIB configuration
Run the image on the target system
Boot from SD/MMC
Imaging with Linux
Boot the card
Boot from TFTP/NFS
Prepare host
Get the server's address
Link kernel image
Setup NFS
Boot into U-boot
Install LTIB
At the time of this writing, the latest BSP release is L2.6.31_10.08.01.
First, extract the source tar ball. You can do that with this command:
% tar -xzf L2.6.31_10.08.01_SDK_source.tar.gz
Now change into the extracted folder and execute the install script that is inside.
% cd L2.6.31_10.08.01_SDK_source
% ./install
The installer will ask you to read and accept a EULA and then ask you for the install directory. For this example, choose your home directory.
After the installation, there will be a new directory named "ltib" under the install directory you specified. This new directory contains the actual
ltib Perl script, config files, package specs, and utilities.
From this point on, the LTIB install directory will be referred to as "~/ltib" in example command lines, assuming you installed LTIB into your
home directory.
% ./ltib
This command invokes LTIB with its default behavior of performing a build. Since the installation has not yet been configured, LTIB will present
the curses configuration screen before building. Then, when you exit the configuration screen, LTIB will build the target image. Also, the very first
time you run LTIB on a system, it will build and install a number of host tools that it places under /opt/freescale.
To ask LTIB to show the configuration screen without building afterwards, run this command:
% ./ltib -m config
The first time you configure a given LTIB installation, you will be asked to select the platform. The first screen that appears looks like this:
Because the i.MX BSP contains only the i.MX platform, you don't need to change anything on this screen.
On all of the curses configuration screens for both LTIB and the kernel (they use the same mconf system), there are a standard set of keys that
are important to know. The bottom of each main screen shows <Select> and <Exit> items. The right and left arrows move between these two
items.
When <Select> is highlighted, the up and down arrows move between items in the main list. Pressing return on any item with an arrow to the right
will open up a sub-screen. Some sub-screens appear as windows on top of the current screen, and some appear as their own screens.
When <Exit> is selected, you can hit the return key to exit the current screen. On most main screens, exiting will bring up the following dialog
asking if you want to save changes.
Here, use the right and left arrow keys to select between <Yes> and <No>. Press return to activate your selection. Selecting <No> will cause
LTIB to not continue to the following step.
If you haven't already, exit the platform selection screen and save the configuration when asked. This will bring up another sub-platform
selection screen, shown here:
The first option available on this screen is used to choose the sub-platform type. For the i.MX platform, the sub-platform is the specific chip family
combined with the board type. For the i.MX28, this is the EVK board. The second option on this screen, under the Choose the packages profile
item, lets you select the default set of packages. Individual packages can be enabled and disabled later, as you need. The default choice is
sufficient for now.
If you need to change the sub-platform later, use the command:
% ./ltib -m selectype
Move the cursor down to the Selection item below the Choose the platform type line and press return to open up a platform selection
menu, shown here:
Select the imx28 platform, which is near the top of the list, and press return to return to the main screen.
Exit the sub-platform selection screen and save the configuration. This will bring you to the main LTIB configuration screen.
LTIB configuration
The screen below shows the full contents of the main LTIB configuration screen for the i.MX28.
Most items in the main configuration screen can be ignored unless you have a specific reason to modify them. Two exceptions are items related
to the kernel: Always rebuild the kernel and Configure the kernel. If you enable Configure the kernel, then the kernel configuration screen will
be shown the next time the kernel is built.
Another important item on the main screen is Options. Selecting it will bring up the following secondary configuration screen.
You do not actually have to enable start networking in order to boot from NFS or using networking on the target.
Finally, you can modify settings for individual packages and choose which packages to install by selecting the Package list item in the main
screen.
The package list screen is also where you set the kernel command line options for the i.MX28 when booting Linux directly. When using
U-boot, you set the kernel command line in U-boot itself. As shown in the above screen, there are four kernel command lines listed under the
boot stream package. The first command line is the default, while the other three are optional ones selected by pressing certain keys during
system boot. To edit a command line, move the cursor over it and press return.
After you have completed a build by using LTIB, you will have a target root filesystem in the rootfs directory inside the LTIB install directory. For
instance, if you installed LTIB in your home directory, there will be a ~/ltib/rootfs directory containing the target rootfs.
Inside the ~/ltib/rootfs/boot directory, you will find a set of .sb files. These are the boot streams that the i.MX28 ROM interprets to boot the
system.
Boot stream file
Description
imx28_ivt_linux.sb
imx28_ivt_uboot.sb
The Linux boot stream contains only the kernel itself. The rootfs is stored separately on the boot media, or on an NFS server.
U-boot is the open source bootloader supported by Freescale for use with the i.MX28. Note that you only need to use U-boot for development
purposes, especially to boot over the network using TFTP/NFS. For the boot media supported directly by the i.MX28 ROM, the ROM itself acts as
the bootloader.
To monitor console output from the target, first connect your host computer to the debug UART on the EVK board. You can use either a
standard serial port or a USB-to-serial interface. The debug UART is the rightmost DB9 connector when viewing the EVK from top. Finally, run a
serial terminal such as minicom for Linux or HyperTerminal for Windows. Set the serial port to 115200 baud, 8N1.
The steps below assume you have configured your development host using the standard system setup script included with the BSP. If this is
not the case, some of the paths below may be different for you.
Now insert the card, and run the above command again. The SD/MMC card will be the new /dev/sdX device in the output (where the X is a
lower-case letter in alphabetic sequence). This is the device name that you pass to mk_mx28_sd. Before running the script, be sure to remove
the card. Once you already know your card's device, updating the card contents with a new build will be much faster.
To place Linux onto the SD/MMC card:
% cd ~/ltib
% mk_mx28_sd /dev/sdX
To place U-boot onto the SD/MMC card, add the -u option to the command line:
% cd ~/ltib
% mk_mx28_sd -u /dev/sdX
After you invoke the script, it will present a prompt for you to insert your SD/MMC card. Once you have done so, type "yes" to have the script
continue and format the card.
Port
BM3
BM2
BM1
BM0
SD/MMC master
SSP0
Then, insert the SD/MMC card into the SSP0 card socket. This is the rightmost socket on the bottom of the EVK board.
Finally, connect power to the board and press the Power button. You will see serial output over the debug UART if you have a terminal program
running.
Prepare host
These steps make the build output available so the bootloader and target kernel can access it on the network.
This assumes that you have wired Ethernet connected to your host, and are not using WiFi, for instance.
Alternatively, you could simply copy the uImage file into /tftpboot. However, using a symbolic link will make it so you don't have to copy the
kernel every time you run a build.
Setup NFS
These commands will create a link to the rootfs directory created by LTIB in order to make the rootfs accessible via NFS from the target.
%
%
%
%
cd /tools
rm -rf rootfs
ln -s ~/ltib/rootfs
sudo exportfs -a
The final exportfs command above is to make certain the NFS server is aware of the directory you want to serve. Once you have NFS set up
for a particular installation of LTIB, you don't have to modify anything to serve the changes between builds.
When you see the "Hit any key to stop autoboot" message, press return in the serial terminal. U-boot will now show its prompt. If you don't press a
key at this stage and let the countdown reach 0, U-boot will execute the contents of the bootcmd variable stored in its settings.
The first time you boot from a freshly imaged card, U-boot may report an error with its stored settings and not show the "Hit any key"
message. This is normal and will be rectified once you save the settings.
The entire sequence of booting, and all configuration settings for U-boot are controlled through its environment variables. Normally, these
variables are loaded from storage on the SD/MMC card. After reaching the U-boot prompt the first time, you need to set a number of variables
that U-boot uses to identify the server and set the kernel command line.
Enter the following commands shown below. The serverip variable should be set to the IP address of the host server.
The configuration provided by these settings will cause U-boot to get an IP address via DHCP. It will then download the kernel from the TFTP
server and execute it. When the kernel starts, it will also get an IP via DHCP and then mount the rootfs from the NFS server.
This table describes some of the most important and useful variables:
Variable
Description
bootdelay
The number of seconds that U-boot will wait for a keypress when it first boots before automatically booting the kernel.
bootcmd
The contents of this variable is executed when the boot command is run, or when automatically booting.
bootargs
bootfile
Name of the kernel file that is downloaded from the TFTP server.
loadaddr
Address where the kernel is stored in memory when downloaded from the TFTP server.
serverip
If you take a close look at some of the variables such as bootargs_nfs, you will notice that they actually contain commands to modify other
variables. In the case of bootargs_nfs, it modifies the bootargs variable to add a number of kernel command line arguments.
To verify the values of the environment variables, use the printenv command as shown in the example here:
Once all variables are set to the correct values, you can save the entire environment to the SD/MMC card:
MX28 U-Boot > saveevn
Saving Environment to MMC...
Writing to MMC(0)... done
To boot into Linux from the U-boot command line, simply run the boot command. Alternatively, you can reset the EVK and wait for it to
automatically boot.