Linux Getting Started

=Hardware Requirements=
 * Texas Instruments ZoomTM OMAP34x-II MDP
 * Linux PC workstation with GNU GCC Development toolchain (GCC, libc, make, etc.)
 * Distribution should provide hotplug support, device drivers for sd card reader, and drivers for FTDI's USB-UART IC
 * SD Card & SD-Reader

=Preparing Host Workstation= Refer to OMAP Platform for more information regarding nessary packages, cross compiler information and device setup guides.

=Building bootloader and xloader= Refer to OMAP Bootloader Project for more infromation on building uboot and xloader.

=Creating a file system=

Filesystem is a set of directories, configuration files and utilities wrapped around the ever popular Busybox utilities. This filesystem allows you to boot OMAP platforms based projects.

Busybox Utilities

Option I: Use pre-built, bare filesystem

 * Busybox
 * Simple init scripts
 * GNU libc
 * Extract the prebuilt busybox fs:
 * 1) cd 
 * 2) tar xvjf fs.tar.bz2

(note, old minifs can still be found here)

Option II: Build filesystem from scratch
Busybox evolves every day with new features. The included Busybox version is tested and stable. However, occasionally a newer version is needed for a specific purpose.

The latest source code can be obtained from http://busybox.net/downloads/busybox-1.14.3.tar.bz2

How to build Busybox utilities:

make menuconfig make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=ARM make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=ARM PREFIX=/path/to/filesystem install

Note: No explicit documentation on this yet. At a bare minimum this will involve the following...
 * Building new toolchain (GCC, binutils, C library)
 * It is possible to use the Code Sourcery compiler, but you will be tied to their GNU C library and the documentation for their pre-built libraries is non-existent.
 * Excellent resources for easy arm toolchain development:
 * http://buildroot.uclibc.org/
 * http://uclibc.org/
 * Building userspace applications
 * Busybox is a good tool to start with: http://busybox.net/
 * Writing/borrowing init scripts
 * Good resource that covers building a simple distribution from scratch for an arm platform:
 * http://cross-lfs.org/view/clfs-embedded/arm/

=Building Linux Kernel= Now that our development environment has the appropriate compilers, we can compile the kernel. The latest working kernel version with support for the zoom2 is ti-2.6.29-omap3 as of July 2009. This kernel branch is used in the instructions below. To use more recent kernel versions than 2.6.29, examine http://git.omapzoom.org/?p=kernel/omap.git;a=heads. The kernels with possible support are the ti-2.6*-omap3 branches. If a more recent kernel version exists, you can follow the instructions below with the new git branch name replacing ti-2.6.29-omap3.

Check out kernel using git:
 * 1) cd 
 * 2) git clone git://git.omapzoom.org/repo/omapkernel.git
 * 3) cd omapkernel
 * 4) git checkout --track -b ti-2.6.27-omap3 origin/ti-2.6.27-omap3
 * 5) git checkout ti-2.6.27-omap3
 * 6) git pull

Check for support: If the file omap_zoom2_defconfig is present, this kernel version has support for the zoom2 MDP. However, if the file (or similar name with zoom2 in the configuration) is not present, this kernel version does not have support and you must check out another kernel from the repository.
 * 1) cd /omapkernel
 * 2) ls -l arch/arm/configs/

Add u-boot's mkimage tool to path (necessary to build u-boot compatible kernel image): export PATH=$PATH:`pwd`/u-boot/tools/ Important Note: The CodeSourcery G++ tools must still be in your shell path for these build steps to work.

Building kernel image:
 * 1) cd /omapkernel/
 * 2) make CROSS_COMPILE=arm-none-linux-gnueabi- distclean
 * 3) make CROSS_COMPILE=arm-none-linux-gnueabi- omap_zoom2_defconfig
 * 4) make CROSS_COMPILE=arm-none-linux-gnueabi- uImage

The uImage file is now in the path arch/arm/boot/

Note: Configuration option varies by platform. Above is an example for building zoom2. Change "omap3430zoom2_config" to "omap_ldp_android_defconfig" to enable a build for zoom1 (LDP).

=SD partitioning and Formatting= Refer to  SD configuration for information regarding paritioning and formatting an SD card.

=Populating the filesystem= Now that the storage has been formatted correctly, we can copy our bootloaders and filesystem to disk. Note: You might need root permissions to do the following.

If the devices have not been automatically mounted, run the following commands:
 * 1) mkdir -p /media/boot/
 * 2) mkdir -p /media/target_root/
 * 3) mount /dev/1 /media/boot/
 * 4) mount /dev/2 /media/target_root/

Copy bootloaders & kernel:
 * 1) cd 
 * 2) cp u-boot/u-boot.bin /media/boot/
 * 3) cp x-loader/MLO /media/boot/
 * 4) cp omapkernel/arch/arm/boot/uImage /media/boot/

Copy filesystem:
 * 1) cd 
 * 2) cp -rpv ./target/* /media/target_root/

Unmount devices:
 * 1) umount /media/boot/
 * 2) umount /media/target_root/

=Booting & Troubleshooting= Remove the SD card from the host system and insert it to Zoom2 MDP. Make sure that the usb cable is connected from the host pc to the Zoom2. The minicom serial communications application or windows hyperterminal can be used to talk to the MDP. Although the connection from host to target is USB, the FTDI chip on the Zoom2 lets the host treat it as a serial UART.

Run the following commands: $ dmesg | grep FTDI You should see something similar to the following (or perhaps you do not have ftdi_sio support in the kernel, or the zoom2 is not plugged in):

\[341927.381969] ftdi_sio 4-1:1.0: FTDI USB Serial Device converter detected \[341927.382255] usb 4-1: FTDI USB Serial Device converter now attached to ttyUSB0 \[341927.389111] ftdi_sio 4-1:1.1: FTDI USB Serial Device converter detected \[341927.389202] usb 4-1: FTDI USB Serial Device converter now attached to ttyUSB2

The two devices /dev/ttyUSB0 & /dev/ttyUSB1 are virtual serial ports. These device names may be different on your system, so be sure to use dmesg to examine the newly discovered devices.

Note: Root permissions needed yet again.

Communicating with the board: $ minicom -s 1. Use the arrow keys to select serial port setup. 2. Press A to set the correct serial device. Use the lower numbered device name found in dmesg, and be sure touse the fully qualified file name (e.g. /dev/ttyUSB0). 3. Press E to set bitrate/parity/stop bits to "115200 8N1". 4. Turn off hardware and software flow control. 5. Press enter to leave serial port setup. 6. Select save setup as default. 7. Select Exit (minicom is still active).

If you press the reset button on the Zoom2 MDP, you should now see output from the bootloader. Interrupt the bootloader by pressing any key before it tries to boot (if you miss it, just press reset).

Enter these commands at the uboot prompt: $ nand ecc sw        $ nand unlock $ setenv bootargs console=ttyS3,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1 mem=256M init=/sbin/init $ saveenv $ bootd

Now the zoom2 will boot into linux by default!

Once the boot process has completed, a root console will be available on the system. In the current environment, you can use all the busy box utilities to configure the system. This is a stratup guide, but this can be continued to improve the system with other software packages by using the build environment on the host set up earlier.