Skip to main content.

14.3.26. Configure Linux for XIP (Execution In Place)

This document describes how to setup and use XIP in the kernel and the cramfs filesystem. (A patch to add XIP support to your kernel can be found at the bottom of this page.)

14.3.26.1. XIP Kernel

To select XIP you must enable the CONFIG_XIP option:

  $ cd <xip-linux-root>
  $ make menuconfig
  ...
    MPC8xx CPM Options  --->
      [*] Make a XIP (eXecute in Place) kernel
      (40100000) Physical XIP kernel address
      (c1100000) Virtual  XIP kernel address
      (64) Image header size e.g. 64 bytes for PPCBoot
The physical and virtual address of the flash memory used for XIP must be defined statically with the macros CONFIG_XIP_PHYS_ADDR and CONFIG_XIP_VIRT_ADDR. The virtual address usually points to the end of the kernel virtual address of the system memory. The physical and virtual address must be aligned relative to an 8 MB boundary:
  CONFIG_XIP_PHYS_ADDR = FLASH-base-address + offset-in-FLASH
  CONFIG_XIP_VIRT_ADDR = 0xc0000000 + DRAM-size + offset-in-FLASH
The default configuration parameters shown above are for a system with 16MB of DRAM and the XIP kernel image located at the physical address 0x40100000 in flash memory.

Note that the FLASH and MTD driver must be disabled.

You can then build the "uImage", copy it to CONFIG_XIP_PHYS_ADDR in flash memory and boot it from CONFIG_XIP_PHYS_ADDR as usual.

14.3.26.2. Cramfs Filesystem

The cramfs filesystem enhancements:

Note: the current implementation can only be used together with a XIP kernel, which provides the appropriate XIP memory (FLASH) mapping.

To configure a root file system on linear cramfs with XIP select:

  $ cd <xip-linux-root>
  $ make menuconfig
  ...
    File systems  --->"
    ...
    <*> Compressed ROM file system support
    [*]   Use linear addressing for cramfs
    (40400000) Physical address of linear cramfs
    [*]     Support XIP on linear cramfs
    [*]     Root file system on linear cramfs
This defines a cramfs filesystem located at the physical address 0x40400000 in FLASH memory.

After building the kernel image "pImage" as usual, you will want to build a filesystem using the mkcramfs executable (it's located in /scripts/cramfs). If you do not already have a reasonable sized disk directory tree you will need to make one. The ramdisk directory of SELF (the Simple Embedded Linux Framework from DENX at ftp.denx.de) is a good starting point. Before you build your cramfs image you must mark the binary files to be executed in place later on with the "t" permission:

  $ mkcramfs -r ramdisk cramfs.img
and copy it to the defined place in FLASH memory.

You can then boot the XIP kernel with the cramfs root filesystem using the boot argument:

  $ setenv bootargs root=/dev/cramfs ...
Be aware that cramfs is a read-only filesystem.

14.3.26.3. Hints and Notes

14.3.26.4. Space requirements and RAM saving, an example

For ppc 8xx, all figures are in bytes:

The actual RAM saving is here approximately 1.1MB + 1.5M = 2.6 MB.

Have fun with XIP.

Wolfgang Grandegger (wg@denx.de)

14.3.25. Use NTP to synchronize system time against RTC 1. Abstract 14.3.27. Use SCC UART with Hardware Handshake
Prev Home Next

Attachment sort Action Size down Date Who Comment
linux-2.4.4-2002-03-21-xip.patch.gz manage 21.3 K 29 Jul 2003 - 22:30 DetlevZundel Linux patches for XIP on MPC8xx