Linux Getting Started

From OMAPpedia

Jump to: navigation, search

Contents

[edit] Hardware Requirements


[edit] Preparing Host Workstation

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


[edit] Building bootloader and xloader

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


[edit] 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

[edit] Option I: Use pre-built, bare filesystem

# cd <path_to_build_directory>
# tar xvjf fs.tar.bz2

(note, old minifs can still be found here)

[edit] 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...


[edit] 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:

# cd <path_to_build_directory>
# git clone git://git.omapzoom.org/repo/omapkernel.git
# cd omapkernel
# git checkout --track -b ti-2.6.27-omap3 origin/ti-2.6.27-omap3
# git checkout ti-2.6.27-omap3
# git pull

Check for support:

# cd <path_to_build_directory>/omapkernel
# ls -l arch/arm/configs/

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.

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:

# cd <path_to_build_directory>/omapkernel/
# make CROSS_COMPILE=arm-none-linux-gnueabi- distclean
# make CROSS_COMPILE=arm-none-linux-gnueabi- omap_zoom2_defconfig
# 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).

[edit] SD partitioning and Formatting

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

[edit] 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:

# mkdir -p /media/boot/
# mkdir -p /media/target_root/
# mount /dev/<sd_card_device>1 /media/boot/
# mount /dev/<sd_card_device>2 /media/target_root/

Copy bootloaders & kernel:

# cd <path_to_build_directory>
# cp u-boot/u-boot.bin /media/boot/
# cp x-loader/MLO /media/boot/
# cp omapkernel/arch/arm/boot/uImage /media/boot/

Copy filesystem:

# cd <path_to_build_directory>
# cp -rpv ./target/* /media/target_root/

Unmount devices:

# umount /media/boot/
# umount /media/target_root/

[edit] 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.



Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox