DENX . DULG . ConfigureLinuxForXIP
|
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.)
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.
The cramfs filesystem enhancements:
- They allow cramfs optional direct access to a cramfs image in memory (ram, rom, flash). It eliminates the unnecessary step of passing data through an intermediate buffer, as compared to accessing the same image through a memory block device like mtdblock.
- They allow optional cramfs linear root support. This eliminates the requirement of having to provide a block device to use a linear cramfs image as the root filesystem.
- They provide optional XIP. It extends mkcramfs to store files marked "+t" uncompressed and page-aligned. Linux can then mmap those files and execute them in-place without copying them entirely to ram first.
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.
- XIP conserves RAM at the expense of flash. This might be useful if you have a big flash memory and little RAM.
- Flash memory used for XIP must be readable all the time e.g. this excludes installation and usage the character device or MTD flash drivers, because they do device probing, sector erase etc.
- The XIP extension is currently only available for PowerQUICC™I 8xx but can easily be extended to other architectures.
- Currently only up to 8 MB of ROM/Flash are supported.
- The original work was done for the amanda system.
- Special thanks goes to David Petersen for collecting the availible XIP extension sources and highlighting how to put all the pieces together.
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)
Copyright © 2002-2021 by DENX Software Engineering