How to start with Linux and uBoot

Content

Setup a host computer

Note: If you need, more detailed instructions can be found at L3.0.35_4.1.0_LINUX_DOCS in the file Setting_Up_LTIB_Host.pdf

You need a host computer to compile the Linux and uBoot source code. Follow these steps:

1. Download VMware player (it’s free)
2. Download and Install Ubuntu 9.04 into the vMware virtual machine
3. Update sources.list

sudo gedit /etc/apt/sources.list

Replace the sources.list content with:

# deb cdrom:[Ubuntu 9.04 _Jaunty Jackalope_ - Release i386 (20090420.1)]/ jaunty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://old-releases.ubuntu.com/ubuntu/ jaunty main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://old-releases.ubuntu.com/ubuntu/ jaunty-updates main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://old-releases.ubuntu.com/ubuntu/ jaunty universe
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty universe
deb http://old-releases.ubuntu.com/ubuntu/ jaunty-updates universe
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://old-releases.ubuntu.com/ubuntu/ jaunty multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty multiverse
deb http://old-releases.ubuntu.com/ubuntu/ jaunty-updates multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty-updates multiverse
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://us.old-releases.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
# deb-src http://us.old-releases.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu jaunty partner
# deb-src http://archive.canonical.com/ubuntu jaunty partner
deb http://old-releases.ubuntu.com/ubuntu/ jaunty-security main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty-security main restricted
deb http://old-releases.ubuntu.com/ubuntu/ jaunty-security universe
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty-security universe
deb http://old-releases.ubuntu.com/ubuntu/ jaunty-security multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ jaunty-security multiverse

4. Upgrade to the latest packages

  • Open up System \-> Administration \-> Update Manager
  • Click on Settings.
  • Open the Updates Tab.
  • Set ‘Release upgrade’ to ‘Never’.
  • Close the settings dialog box.
  • Click on ‘Check’ to check for upgraded packages. It will look for packages that are upgraded from the version that is installed on your box.
  • Choose to install the upgrades. This will take a while on a freshly installed box.

5. Sudoers
Run

# sudo visudo

Add the following line to the end of the sudoers file.

%admin ALL = NOPASSWD: /usr/bin/rpm, /opt/freescale/ltib/usr/bin/rpm

6. Install additional packages

# gedit host-setup.sh

Insert following content into the host-setup.sh

#!/bin/bash
# Install packages needed by LTIB
sudo aptitude -y install gettext libgtk2.0-dev rpm bison m4 libfreetype6-dev
sudo aptitude -y install libdbus-glib-1-dev liborbit2-dev intltool
sudo aptitude -y install ccache ncurses-dev zlib1g zlib1g-dev gcc g++ libtool
sudo aptitude -y install uuid-dev liblzo2-dev
sudo aptitude -y install tcl dpkg
sudo aptitude -y install asciidoc texlive-latex-base dblatex xutils-dev
# Packages required for 64-bit Ubuntu
# Do "uname -a" and see if the word "x86_64" shows up.
if uname -a|grep -sq 'x86_64'; then
sudo aptitude -y install ia32-libs libc6-dev-i386 lib32z1
fi
# The following recommended for Linux development.
# They are not required by LTIB.
sudo aptitude -y install gparted emacs22-nox openssh-server
sudo aptitude -y install nfs-common nfs-kernel-server lintian
sudo aptitude -y install git-core git-doc git-email git-gui gitk
sudo aptitude -y install diffstat indent tofrodos fakeroot doxygen uboot-mkimage

Run

# sudo chmod 777 host-setup.sh
# ./host-setup.sh

7. Set and Upper Limit on ccache
Run

# ccache -M 100M
# ccache -c

8. Configure tftp server
Run

# sudo aptitude -y install atftpd

Configure atftpd by editing /etc/inetd.conf and /etc/default/atftpd.

# sudo gedit /etc/inetd.conf
# sudo gedit /etc/default/atftpd

In both files, change the default export path (it is either /usr/var/tftpboot or /var/lib/tftpboot) to /tftp
Then reboot your virtual computer.

9. Configure nfs Server
Run

# sudo aptitude -y install nfs-common nfs-kernel-server

Run

# sudo gedit /etc/exports

Add this line to the end of file (below exports /home and everything under it.)

/home *(rw,no_root_squash)

Then restart the nfs server:

# sudo /etc/init.d/nfs-kernel-server restart 

Install Freescale BSP

Note: If you need, more detailed instructions can be found at L3.0.35_4.1.0_LINUX_DOCS in the file i.MX_6Dual6Quad_SABRE-SD_Linux_User’s_Guide.pdf
1. Download L3.0.35_4.1.0_SOURCE_BSP
2. Install following
Comment out the two lines which are there first

# sudo gedit /etc/texmf/fmt.d/10texlive-latex-base.cnf

Reinstall the texline

# sudo apt-get remove texline
# sudo apt-get autoremove
# sudo apt-get install texline

Run

# sudo apt-get install texinfo
# sudo apt-get install texlive-latex-base
# sudo apt-get install texlive

3. install the BSP

# tar zxvf L3.0.35_4.1.0_130816_source.tar.gz
# ./L3.0.35_4.1.0_130816_source/install
# cd ltib/
# ./ltib -m config

Select platform to Freescale i.MX reference boards and exit, saving the changes.
At the next menu, select platform type as imx6q and package profile. Exit and save
the new configuration. Only the profiles of Min profile, FSL gnome release
packages
, and mfg firmware profile pass build tests. To build U-Boot
for i.MX 6Dual/6Quad SABRE-SD board, select Choose your
board for U-Boot
as mx6q_sabresd. Please note this option is only for U-Boot.
For the kernel image, the current default kernel configuration builds a single image
that works for all i.MX 6 boards except i.MX 6SoloLite boards.

Close the configuration screen to save changes. Run

# ./ltib

4. Prepare uBoot

# ./ltib -m prep -p u-boot

5. Manually install the git package
Remove the old one first

# sudo apt-get remove git
# sudo apt-get remove git-core

Run these commands

# wget http://git-core.googlecode.com/files/git-1.8.4.tar.gz
# tar -xvf git-1.8.4.tar.gz
# cd git-1.8.4/
# sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
# make prefix=/usr/local all
# sudo make prefix=/usr/local install

Make sure you have the right version

# git --version

Make small cleaning

# cd
# sudo rm -r git-1.8.4
# rm git-1.8.4.tar.gz

uBoot test compilation (original source code)

Run

# cd ~/ltib/rpm/BUILD/u-boot-2009.08
# gedit build_u-boot.sh

Insert following lines into the file:

#!/bin/bash
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- distclean
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- mx6q_sabresd_config
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi-

Run

# chmod 777 build_u-boot.sh

Now you are ready. To compile uBoot just use:

# ./build_u-boot.sh

Kernel test compilation (original source code)

Run

# cd ~/ltib/rpm/BUILD/linux
# gedit build_linux.sh

Insert following lines into the file:

#!/bin/bash
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- distclean
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- imx6_defconfig
make ARCH=arm CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-none-linux-gnueabi- uImage

Run

# chmod 777 build_linux.sh 

Now you are ready. To compile LINUX just use:

# ./build_linux.sh

Compile the uboot

To compile the latest iMX6 Rex u-boot use these command on your host machine:

# cd ltib/rpm/BUILD/
# cd imx6rex-u-boot-2009.08/
# git clone -b uboot_initial_changes https://github.com/FEDEVEL/imx6rex-u-boot-2009.08.git
# ./build_u-boot.sh 

Compile the latest kernel

To compile the latest iMX6 Rex kernel use these command on your host machine:

# cd ltib/rpm/BUILD/
# git clone -b initial_linux https://github.com/FEDEVEL/imx6rex-linux-3.0.35.git
# cd imx6rex-linux-3.0.35/
# ./build_linux.sh