Get started with ubuntu on omap4
This page describes the steps to get started with Ubuntu on OMAP4. These instructions apply to the OMAP4 blaze board.
After reading this page, you shall have a live and running Ubuntu File-system on your OMAP4 platform. The standard setup guides you to install the bootloaders, kernel and file-system to a SD card, and boot into it.
Note that these instructions will direct you to fetch code from TI repositories.
The below instructions suppose that you will be cross-compiling from a Ubuntu (x86) host, using the CodeSourcery tool-chain. It is advised to use a recent tool-chain like the 2010-q1-202 (gcc 4.4.1). The path to the CodeSourcery binaries shall be added to the $PATH environment variable.
The instructions on this page have been verified on a Ubuntu workstation running Lucid (Karmic or older Ubuntu versions may also work)
SD card capacity
A Ubuntu file-system with a graphical interface (UNE for example), requires at least a 4GB SD card. A smaller SD card is sufficient if you do not need to install a graphical interface.
OMAP4 uses u-boot + x-loader to get the platform booted. Detailed information on how this works is detailed here: http://omappedia.org/wiki/Bootloader_Project.
The OMAP4 dedicated instructions are described below:
- Version tagging into u-boot and x-loader trees: some stable release are tagged into u-boot and x-loader trees. It is advised to use the most recent (higher number) of these stable tags, and the same number for u-boot and x-loader (this will guarantee they are aligned). The tags to use for OMAP4 are: L24.x (with x being the highest value). Note that these tags are applied in the omap4_dev branch of the u-boot and x-loader trees.
- setup folders:
mkdir bootloader cd bootloader
- Get u-boot and checkout the omap4_dev branch:
git clone git://git.omapzoom.org/repo/u-boot.git cd u-boot git checkout <latest L24.x tag>
- Build u-boot for OMAP4
make ARCH=arm distclean make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- omap4430sdp_config make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
=> Generates: ./u-boot.bin
- get x-loader and checkout the omap4_dev branch:
cd .. git clone git://git.omapzoom.org/repo/x-loader.git cd x-loader git checkout <latest L24.x tag>
(note that both u-boot and x-loader folders must be at the same directory level)
- build x-loader for OMAP4:
make ARCH=arm distclean make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- omap4430sdp_config make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- ift
=> Generates ./MLO
The generated MLO and u-boot.bin files will have to be copied on the SD card.
Note: To get the list of L24.x tags, once in the cloned u-boot or x-loader folder, type:
git tag | grep L24
There are several sources for Ubuntu kernel supporting OMAP4:
- Official Ubuntu git tree: http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-maverick.git, ti-omap4 branch
- TI Ubuntu git tree: http://dev.omapzoom.org/?p=integration/kernel-ubuntu.git
For Blaze board support, today, the TI git tree shall be and is used in the following instructions.
TI Ubuntu git tree structure
The TI git tree hosting Ubuntu kernel has branches for each supported kernel version into ti-ubuntu-2.6.xx branches. For example, the 2.6.34 kernel is available into the ti-ubuntu-2.6.34 branch.
Some specific kernel versions are tagged. The stable versions have a tag indicating they are stable versions. It is advised to exclusively use tags specified as 'stable'.
Building a Ubuntu kernel
Some packages are required on your Ubuntu workstation. To install them:
sudo apt-get install git-core debhelper build-essential fakeroot kernel-wedge uboot-mkimage
- Clone the kernel git tree
- checkout a stable tag version, ex:
git checkout ti-ubuntu-2.6.34-901.2+ti+release0
- Build the kernel
cd <kernel source root path> fakeroot debian/rules clean export $(dpkg-architecture -aarmel) CROSS_COMPILE=arm-none-linux-gnueabi- skipabi=true skipmodule=true fakeroot debian/rules binary-arch
=> Generates .deb packages in the parent folder (plus other .udeb files). It contains the kernel image and the modules. The linux-image*.deb file will be used later.
- Generate the kernel uImage
sudo mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Ubuntu Kernel" -d <generated vmlinuz file> ./uImage
The kernel vmlinuz file can be found in a folder which name varies according to the kernel version, like: debian/kernel-image-2.6.<xx>-<yyy>-omap4-di/boot/vmlinuz.
So complete example command:
sudo mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Ubuntu Kernel" -d debian/kernel-image-2.6.34-901-omap4-di/boot/vmlinuz ./uImage
=> This uImage file will have to be copied on the SD card.
Note: more information on Ubuntu kernel packaging / building: https://wiki.ubuntu.com/KernelTeam/KernelMaintenanceStarter
Ubuntu file-system step 1: minimal file system generation
The current easiest way to get a Ubuntu file-system, is to generate it using the 'rootstock' tool.
The raw process (which is described in more details here after) is in 2 steps: > Generate a basic image using the rootstock Ubuntu tool > Boot on this basic file-system and install additional packages
The 1st step is discussed in this chapter.
Rootstock is a tool running on a Ubuntu host, relying on qemu, that permits to generate Ubuntu FS.
(Pre-requisites to generate Lucid images: Ubuntu workstation connected to internet with Karmic (09.10) or more recent Ubuntu release installed.)
- get the rootstock tool to generate the image:
- If you are running a Ubuntu Lucid host, just run:
apt-get install rootstock
- Else, download the latest .tar.gz version from here: https://launchpad.net/project-rootstock
- read the rootstock page: https://wiki.ubuntu.com/ARM/RootfsFromScratch and at least install the required packages required to run rootstock
- to generate a minimal image, use the following command line (example to generate a lucid FS):
sudo rootstock -d lucid -f ubuntu -l ubuntu -p ubuntu --serial ttyO2 --locale en_US.UTF-8 -s ubuntu-minimal,openssh-server,nano
Note that openssh-server and nano packages are just added for convenience.
=> will generate a tgz images containing a basic FS.
SD card preparation
- Format the SD card: see instructions provided here: http://omappedia.org/wiki/SD_Configuration
- Copy MLO, U-boot.bin and uImage on 1st partition of SD card (FAT)
- Copy root file system on 2nd partition of SD card (ext3)
Examples commands to achieve this, assuming the SD card is seen as /dev/sdc on your Ubuntu workstation (and the script to prepare the SD card is called 'mkcard.sh'):
sudo mkcard.sh /dev/sdc sudo mkdir /mnt/mmc1 sudo mount /dev/sdc1 /mnt/mmc1 sudo mkdir /mnt/mmc2 sudo mount /dev/sdc2 /mnt/mmc2 sudo cp MLO /mnt/mmc1/ sudo cp u-boot.bin /mnt/mmc1/ sudo cp uImage /mnt/mmc1/ cd /mnt/mmc2 sudo tar xzf <path to basic rootFS generated> sudo cp <generated linux-image*.deb file> /home/ubuntu cd - sudo umount /mnt/mmc1 sudo umount /mnt/mmc2
Boot the board
At this stage, the SD card can be plugged into the OMAP4 board. Also connect the USB for serial console and terminal: this USB connector provides access to 4 serial ports. The 3rd one is used for the console/terminal.
Now switch-on the board. You shall get to the u-boot prompt and get a chance to interrupt the countdown.
The default bootargs embedded into u-boot may not enable you to boot directly from SD cardand for a ubuntu file-system. You shall set some u-boot environment variables to fix this. Type the following at the u-boot prompt:
setenv bootargs console=ttyO2,115200n8 noinitrd mem=512M root=/dev/mmcblk0p2 rootdelay=1 ip=dhcp mmcinit 0; fatload mmc 0 0x80500000 uImage; bootm
- If you do not have an ethernet cable plugged to your board, replace “ip=dhcp” by “ip=none”.
- The "root=" parameter may not be correct. If the boot fails, try with this one instead: "root=/dev/mmcblk1p2"
- In case you need to use the TI video accelerator, use "mem=463" instead of 512.
Once booted, you can log in console using user: ubuntu / password: ubuntu.
Ubuntu file-system step 2: Install packages + customization
At this stage, a minimal Ubuntu filesystem is already up and running. It can be used as any Ubuntu running device (same commands set and setup).
This last step shows how to install the UI, and some useful customizations.
Image customization tips
Add multiverse to the repository list
Update packages repository list: add 'multiverse' at the end of the line in /etc/apt/sources.list, and then sudo apt-get update
If you connect behind a firewall, you may want to setup going through a proxy:
- happen the following lines to /etc/environment (sudo nano /etc/environment):
http_proxy="<proxy path>" no_proxy="localhost"
- edit the /etc/sudoers file, and apply the following change (sudo visudo):
Defaults env_reset +Defaults env_keep="http_proxy no_proxy ftp_proxy https_proxy"
'UNE' file system creation
The UNE file-system cannot be installed directly from rootstock, this is why we need to install it in this 2nd step. Basically, it consists in upgrading the minimal file-system by installing the UNE package.
Moreover, it is not possible today to boot a UNE file-system over NFS (boot over NFS is possible with non-graphical file-systems).
- Intall the Ubuntu NEtbook package:
sudo apt-get install ubuntu-netbook
This can be quite long as many package are installed.
- Setup auto-login on GDM. Add the following to /etc/gdm/custom.conf
[daemon] AutomaticLogin=ubuntu AutomaticLoginEnable=true
(If you created your file-system with a different user-name, replace 'ubuntu' by this user name)
- Avoid Pulse errors (reported into $HOME/.xsession-errors). Edit /etc/pulse/default.pa and comment the line containing:
- deactivate the screen-saver lock (UNE):
Type the following command on the target:
sudo gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool --set /apps/gnome-screensaver/lock_enabled false
or ensure the file /etc/gconf/gconf.xml.mandatory/%gconf-tree.xml contains at least the following entry:
<?xml version="1.0"?> <gconf> <dir name="apps"> <dir name="gnome-screensaver"> <entry name="lock_enabled" mtime="946685422" type="bool" value="false"/> </dir> </dir> </gconf>
- Backup a file-system in a tarball:
From the host, insert the SD card hosting the root file-system, and mount the partition hosting the root file-system. Go to the FS root and type:
sudo tar c . | gzip -c > <path and name to a root-FS tarball>.tar.gz