User:Carlsojs

From eLinux.org
Jump to: navigation, search


Joel Carlson
Rose-Hulman Institute of Technology, Class of 2011

  • Bachelor's of Computer Engineering, 2011
  • Master's of Electrical and Computer Engineering, 2011

My BeagleBoard-xM Setup

Development Environment Setup

I am using Ubuntu 10.04 64-bit. You may have to download different tools if using a different environment (e.g. - 32-bit vs 64-bit). Assume most instructions are taking place in the location /home/user/beagle, unless otherwise indicated.

Some of these steps were taken from BeagleBoard#Code and other locations.

Git

Git is an excellent tool for maintaining version control. It is also needed to download some of the necessary source code. To install git, run the command sudo apt-get install git-core.

After installing Git, consider looking for the file /home/user/.gitconfig, and editing it so that future commits will be registered to your name/email:

[user]
        name = Your Name
        email = username@address.com

Cross-Compiler

Download the CodeSourcery Lite toolchain. The version below (arm-2011.03-41) was compiled against the Linux 2.6.38 kernel headers, though CodeSourcery says they should be fine for compiling kernels back to around 2.6.16.

$ sudo apt-get install ia32-libs # CodeSourcery is intended for 32-bit host systems, and thus on 64-bit Ubuntu you need to install ia32-libs
$ mkdir -p ${HOME}/tools
$ cd tools
$ wget http://www.codesourcery.com/sgpp/lite/arm/portal/package8739/public/arm-none-linux-gnueabi/arm-2011.03-41-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
$ tar -xjvf arm-2011.03-41-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

Add the location of this toolchain to your PATH so you don't have to enter it in the future. I am using zsh, so I added the line export PATH="/home/user/tools/arm-2011.03/bin:${PATH}" to the file /home/user/.zshrc (it is necessary to close and re-open the terminal after modifying .zshrc).

Sources to Download and Build

Linux Kernel

Obtain and build the Linux kernel.

$ sudo apt-get install uboot-mkimage  # Necessary for building a u-boot wrapped image
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-3.0.y.git kernel_3.0.1
$ cd kernel_3.0.1
$ make mrproper
$ make ARCH=arm omap2plus_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage

This should create a file uImage in ../kernel_3.0.1/arch/arm/boot.

X-Loader

Obtain and build the X-Loader source.

$ git clone git://gitorious.org/x-loader/x-loader.git x-loader
$ cd x-loader
$ make distclean
$ make omap3530beagle_config
$ make CROSS_COMPILE=arm-none-linux-gnueabi-

This should create a file MLO in the main x-loader directory.

U-Boot

Obtain and build the U-Boot source.

$ git clone git://git.denx.de/u-boot.git u-boot
$ cd u-boot
$ git checkout --track -b omap3 origin/master
$ make CROSS_COMPILE=arm-none-linux-gnueabi- mrproper
$ make CROSS_COMPILE=arm-none-linux-gnueabi- omap3_beagle_config
$ make CROSS_COMPILE=arm-none-linux-gnueabi-

This should create a file u-boot.bin in the main u-boot directory.
NOTE 2011-08-14: When I tried to compile, make gave me errors about "asm/arch/gpio.h" not existing. When I found that directory, gpio.h was indeed nonexistent. If you don't get this error, don't worry about it (a future repository update may fix it). My temporary fix that allowed it to compile with no errors/warnings that I saw:

$ cd arch/arm/include/asm
$ cp omap_gpio.h arch-omap3/gpio.h
$ cd ../../../..
$ make CROSS_COMPILE=arm-none-linux-gnueabi-

Building the Root File System

OpenEmbedded and Bitbake

$ mkdir -p oe/build/conf
$ cd oe
$ wget http://download.berlios.de/bitbake/bitbake-1.12.0.tar.gz
$ tar -xvf bitbake-1.12.0.tar.gz
$ mv bitbake-1.12.0.tar.gz bitbake
$ git clone https://github.com/openembedded/openembedded.git
$ cd openembedded
$ git checkout --track origin/org.openembedded.dev
$ export OEBASE="/home/user/beagle/oe" #<-- Added to ~/.zshrc
$ export PATH="${OEBASE}/bitbake/bin:${PATH}" #<-- Added to ~/.zshrc
$ export BBPATH="${OEBASE}/build:${OEBASE}/openembedded" #<-- Added to ~/.zshrc
$ export BB_ENV_EXTRAWHITE="OEBASE" #<-- Added to ~/.zshrc
$ cd ../build/conf
$ cp ../../openembedded/conf/local.conf.sample local.conf.sample

The local.conf.sample was copied just for reference. Create a local.conf file and put the following in it:

# Where BitBake places downloaded sources
DL_DIR = "${OEBASE}/build/sources"

# Where BitBake finds recipes
BBFILES = "${OEBASE}/openembedded/recipes/*/*.bb"

# Force BitBake to put temporary files in a specific location
TMPDIR = "${OEBASE}/build/tmp"

# The machine to build for
MACHINE = "beagleboard"

# The distribution policy to follow
DISTRO = "angstrom-2010.x"

# To use our own CodeSourcery Lite toolchain
TOOLCHAIN_VENDOR = "-none"
TOOLCHAIN_TYPE = "external"
TOOLCHAIN_BRAND = "csl"
TOOLCHAIN_PATH = "${HOME}/tools/arm-2011.03"

# The image file system types
# jffs2, tar(.gz|bz2), cpio(.gz), cramfs, ext2(.gz), ext3(.gz), ext4(.gz|.bz2),
# squashfs, squashfs-lzma
IMAGE_FSTYPES = "tar.gz"

# Enable parallel make
PARALLEL_MAKE =	"-j 4"

# Run multiple bitbake threads in parallel
BB_NUMBER_THREADS = "2"

This may or may not be a problem, but I did it anyway (from the OpenEmbedded User Manual). Open /etc/sysctl.conf and add to the bottom of the file: vm.mmap_min_addr=0
For this one time only (the sysctl.conf will handle it on subsequent reboots of your machine), run the command sudo echo 0 > /proc/sys/vm/mmap_min_addr (if you get permission denied errors, run sudo -i, then echo 0 > /proc/sys/vm/mmap_min_addr, and finally exit.

Then build the beagleboard-demo-image as a test.

$ sudo apt-get install python-ply python-progressbar diffstat texi2html chrpath # BitBake complained about not having these
$ cd /bin
$ sudo mv sh sh.old # This and the following are because BitBake has problems unless using bash,
$ sudo ln -s bash sh # and my original /bin/sh was pointing to dash
$ cd ${OEBASE}/build
$ bitbake beagleboard-demo-image