[uClinux-dev] XIP on i386

David McCullough davidm at snapgear.com
Thu Mar 13 20:14:28 EST 2003


Jivin Paul lays it down ...
> Forgive me but this is my first experience with digging into the
> linux kernel, any help is greatly appreciated.
> 
> I have a Monarch Paxar 6037 (www.paxar.com) with strict memory requirements.
> 
> 640k ram
> ~820k rom
> 
> all I need is telnet functionality, as a dumb terminal (using an 802.11
> wireless card). I have been evaluating uClinux as an alternative os for it.
> the memory is too small for normal linux kernel, and I found eXecute In
> Place. One person posted to another forum somewhere (the where and the who
> elude me at the moment) that claims to have a XIP kernel running from ROM
> with the .text (I belive) segment in the RAM, taking up ~120k. XIP is
> perfect for my needs, but I cannot find any documentation for compiling>
> an XIP kernel for i386. 
> 
> Can someone tell me how I can compile for XIP?

You need to make some changes to the linker script for the final link
stage of linux.

You need to:

1) put the .text section into ROM where it will execute.  This means
   adding a rom section in the linker script that is located at the 
   address of the ROM.

2) put the .data/.bss sections into RAM,  most likely at the start.

3) make a binary image which takes the .text section and concatenates
   the data/bss info on the end,  then program that into ROM at the
   address you located it at in 1 above.

4) Modify the kernel startup (head.S or crt0.S) to copy the data/bss
   from ROM into RAM before doing anything else.

5) Get your boot loader to start the kernel in ROM.

About the only thing to watch is the init sections,  as they are usually
in the text segement and are freed later.   They cannot be freed if the
are in ROM.

There are quite a few examples in the uClinux tree of ROM based kernels.
The uCsimm uses a ROM kernel by default IIRC and can also do a RAM
kernel,

Cheers,
Davidm

-- 
David McCullough:    Ph: +61 7 3435 2815  http://www.SnapGear.com
davidm at snapgear.com  Fx: +61 7 3891 3630  Custom Embedded Solutions + Security



More information about the uClinux-dev mailing list