You are here: Main Web>LinuxOnARMDev (revision 2)

Running Linux on ARM Development Platforms

Summary

Describes stages to set-up and run Linux on ARM based platforms, from installing a boot loader, kernel and file system image. This document is not intended as an exhaustive guide on developing or building Linux systems. There is already considerable information available in the open source community for this. Open source discussion forums also provide a valuable source of information. Please refer to the ARM Linux Wiki site (www.linux-arm.org) or www.arm.com/linux for additional information.

Whilst examples refer to ARM Ltd supplied development boards, esp. RealView boards,
and the ARM Embedded Linux distribution from The ARM Ltd Linux Operating System Download Page
the contents should be applicable to other ARM based boards with little or no change.

INSTALLING PRE-BUILT IMAGES

Images can be installed into flash using a debugger connected to the board via a JTAG run control device, such ARM RealView ICE units.

  • ARM RealView Integrator boards
    Use ARM Flash Utility (provided with the board) to program
    images (e.g. AFU.axf), running the utility from the debugger
    AFU> program 1 u-boot c:/tmp/u-boot.bin
    Lowest available flash at location 0x24440000 block B30
    Programming Block B30
  • ARM RealView Versatile/(PB, AB)926EJ-S and later
    Run the BootMonitor.axf program supplied with the board
    from the debugger to program images. There is a Flash menu with some options to
    program ELF or binary images. To run from flash you should program the ELF image into flash as:
    FLASH> write image c:/tmp/u-boot.axf NAME u-boot
    An additional flash programming utility is provided with RealView boards called `Network Flash Utility` (NFU).
    This program enables programming of images into flash using an
    ethernet connection. To download and program a U-Boot image into flash from a server
    with IP address <192.168.0.1> for example, you can use the following sequence
    manage dhcpc start
    manage map n: 192.168.0.1
    flash write image n:/u-boot.axf
    Please, refer to the documentation of your RealView Versatile Family CD
    for more information and the exact syntax.

A similar process can be used to program other images (kernel and cramfs) into Flash. These should be programmed as binary files as they are not ELF images.

For more information, please refer to the Firmware documentation supplied with the board.

BOOT LOADER

U-Boot is used as boot loader for RealView platforms. The source code and documentation for the main distribution are available http://www.denx.de/wiki/U-Boot/WebHome Source code for later RealView boards which have not yet reached the main tree are available at http://www.linux-arm.org/git u-boot-armdev project on the 090204_armdev branch.

U-Boot is expected to run from 0x01000000 in memory on ARM boards (Later RealView boards 0x06000000).
The AEL supplied images can be loaded and run from a debugger at this address.
(readelf -h will show the entry point address)
RealView Integrator: raw binaries (or ELF files) can be placed at the beginning of flash and executed as default image. RealView later boards: you should use the ELF file to execute directly from flash or load and run the raw binary from memory.

To compile U-Boot, download the source distribution from the above sites. RealView Integrator and Versatile support has been added in the main U-Boot CVS/GIT repository. For later RealView boards use http://www.linux-arm.org/git .

Once you have retrieved the sources, you need to configure and build the boot loader. You can consult the full list of targets from the top Makefile. To configure and compile the boot loader, you should execute the following commands: RealView Integrator/CP: make integratorcp_config make RealView Versatile AB: make versatileab_config make RealView Versatile PB: make versatileab_config make Later RealView boards make_realview_config make Resulting executables (binary and ELF) are located in the top level directory. Some macros are used to encode the default command line passed to a Linux kernel, the default boot sequence of the boot loader (i.e. dhcp/bootp, flash etc.). Some of these definitions can be changed interactively from the U-Boot command line using the setenv command. Parameters used for ARM RealView boards can be found in the respective configuration file in the include/configs directory with macro definitions such as CONFIG_COMMANDS, CONFIG_BOOTARGS and CONFIG_BOOTCOMMAND.

The Linux kernel is usually loaded at the address specified by CFG_LOAD_ADDR (0x7c0) and then executed from 0x8000 for an uncompressed Linux kernel image. These parameters are specified by the u-boot mkimage utility when converting a raw Linux kernel binary image to be loaded by u-boot. The mkimage utility is built when compiling u-boot.

Later RealView boards allow kernel images to be loaded higher to make use of the full memory available.

Note that when downloading a kernel image via Ethernet, you should configure your server to recognise the MAC address of your platform and the location of the image to download.

Booting from images in flash

When adding the u-boot header to the Linux kernel binary image (for low loaded images), ensure that the load and execute addresses are both set to 0x8000. The boot command for a flashed image should be e.g
IntegratorCP? # cp 0x 0x7fc0 0x
IntegratorCP? # bootm
ethernet loaded (bootp, tftpboot) mkimage wrapped images will be loaded directly to the correct position.

You can use the 'help' command with U-Boot to see the exact syntax of each command.

The command line

The Linux kernel CMDLINE can be set from the U-Boot prompt using the 'setenv' command to alter the bootargs environment variable. The 'printenv' command can be used to list the current environment variables. When executing the Linux kernel from a boot loader, the kernel will use the command line which is in the block pointed at by , instead of any default built-in command line.

The images provided allow you to save the environment into Flash memory. This can be done using the saveenv command.

The U-Boot images available for download at http://www.arm.com/linux contain the command line used with the supplied U-Boot, kernel and filesystem images saved into flash, in that order, starting at the bottom of flash.

LINUX KERNEL

Sources of the kernel can be obtained and downloaded from www.kernel.org. Any additional patch should be applied to the base kernel source tree as follows: $ cd linux-2.6.19/
$ patch -p 1 < patch-2.6.19-
Configuration files are provided for each platform and pre-built images. The relevant configuration file should be copied into the kernel tree as .config The kernel can then be configured running 'make xconfig' or equivalent commands ('make menuconfig' etc.).

The following sequence of commands can be used to build the kernel:

$ make xconfig
$ make Image (produces a raw binary Image in arch/arm/boot/)

A vmlinux file is also generated which contains debugging information associated to the kernel image which can be loaded by a debugger (assuming the kernel is compiled with '-g' flag).

The boot loader also determines the platform identification. This information is stored in register . The platform number is needed by the kernel before starting its execution. When starting the kernel directly from a debugger, this register value needs to be set from within the debugger.

FILESYSTEM

Pre-built filesystem images provided in http://www.linux-arm.org/git ael.git can be use with ARM RealView boards.
(RealView Integrator boards may require minor changes to the images)

These images contain a subset of system utilities, commands and applications as described in the associated README file. that fle also describes the manner in which the images were produced using the matrix build system and source repositories at eee.linux.onarm.com .

The filesystem can either be mounted via NFS or placed into Flash, depending on the platform settings and the command line passed to the kernel at boot time. The location of the filesystem should be specified in the kernel command line by the "root =..." option, either root=/dev/mtdblocki or root=/dev/nfs, where i is to be replaced by the appropriate partition number.

On RealView platforms, the mtdpart option needs to be defined to indicate where images are located in flash. This is documented in the kernel driver/mtd/ sources.

COMPILATION TOOLS

CROSS-COMPILATION

An ARM cross-compilation tool chain need to be installed on the host system to produce Linux kernels or applications. By default, this document assumes a Linux based host development platform.

Note that the pre-compiled tool chain which is available for download from http://www.codesourcery.com/sgpp/lite/arm/portal/release644 assumes that you have Glibc library version 2.3 installed on your system.

Sources used to build the GCC tools can be downloaded from www.codesourcery.com or from the main GCC CVS repository. Discussion groups are also available on this site to discuss technical issues related to ARM GNU tools.

Multiple targets can be built for the compiler:

-arm-elf produces a flat or standalone binaries which are not tied to any operating system. arm-elf selects ELF support which shares much of its code with arm-linux.

-arm-none-linux-gnueabi is the target you need for Linux and generates ELF support for Linux/ARM.

The pre-built tool chain is produced using the arm-linux option and is produced against 2.3.6 version of Glibc.

ABI COMPATIBILITY

The version of GCC used with the latest AEL release (i.e. GCC 4.3) defaults to the new ABI for the ARM Architecture. Linux kernel version 2.6.19 and later can be configured to support both, the new ABI for the ARM Architecture and old ABI. Packages provided with filesystem version AEL 2.2.0 and later were built for the new ABI, you should ensure that Linux kernel is configured to support this version of the ABI (Kernel Features:: CONFIG_AEABI).

Older version of the ABI for the ARM Architecture can be used with Kernel Features:: CONFIG_OABI_COMPAT, however, this should be used in conjunction with a file system with binaries built for the old ABI (i.e. AEL 2.1.0).

This is particularly important when using data structures such as those passed through ioctl() calls where types and alignment must be exactly the same from the kernel view as from the user view.

An application note is available from ARM Support pages providing more information on how to use ARM RealView Compilation Tools with GNU Tools. This document can be found at:

http://www.arm.com/pdfs/AN150B_Building_Linux_Applications_with_RVCT.zip

UCLINUX

The AEL example distribution provides pre-built images of uClinux kernels. The main repository and source of information on uClinux is accessible at and for the initial ARM port created by Hyok S. Choi. As of 2005, MMUless support for ARM has started to be merged into mainline kernel and most of the MMUless kernel patches should be integrated into mainline kernel.

The uClinux images available from this web page are generated using an EABI compliant tool chain and the kernel is compiled with the CONFIG_AEABI option enabled. However, there is not yet a full EABI compliance for uClinux (i.e. shared libraries etc.). The file system image provided is a collection of utilities and executables generated by the community which are not compiled with the EABI option. The kernel can handle both types of binaries assuming it has been configured to do so.

uClinux uses a flat binary format for application binaries. This is a relatively simple format intended to contain the minimum needed to load and execute binaries. A special linker script is required to prepare an ELF file, as well as a utility called elf2flat. These are provided with GNU tools available from the uClinux community.

ADDITIONAL NOTES

Notes and Linux packages provided in the AEL distribution are intended as starting point for evaluation and validation with ARM development platforms. Please contact Linux distributors for complete Linux distributions.

Some additional discussion forums are also available on public websites, Linux kernel mailing lists and GNU mailing lists. Other communities such as www.debian.org, www.openembedded.org, www.handhelds.org and http://www.celinuxforum.org/ also provide good resources which can be used with ARM platforms.

Release AEL 3.0

Notes regarding the AEL 3.0 release can be placed here.

-- PeterPearse - 06 Mar 2009
Edit | Attach | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback
zenweb1 : 0.13 secs More Info