[uClinux-dev] romfs placement question 68360

Greg Ungerer gerg at snapgear.com
Wed Nov 21 21:25:01 EST 2001

Hi Bruce,

Bruce Paterson wrote:
> Ok, the dumb questions coming thick and fast now :-)
> Using the new source tar-ball and porting for an MC68360, kernel 2.4.x.
> I'm a bit confused as to where the romfs binary ends up in
> images/image.bin.
> According to my linux-2.4.x/System.map, my sections have ended up as
> follows:
> 00000 ramvec    (*not* included in image, linux.text) ok
> 28000 text      (in linux.text -> image.bin) ok  (NB: 28000 is for my
> own backwards compat requirements)
> be6c4 romvec    (in linux.text -> image.bin) ok  (fine, RO data gets
> copied to ramvec)
> beac0 data      (in linux.data -> image.bin) ok
> d8058 edata     ok
> d8060 bss       (doesn't end up in linux.data or linux.text) that is
> correct
> ea604 ebss      ok
> Now what the vendor Makefile does (copied from Lineo) is
>  linux.text+linux.data+romfs.img -> image.bin
> Doesn't this end up putting romfs over the top of bss ?  It'll get
> gromped
> on by the startup code that clears bss.

Yep. The kernel startup code moves the romfs above the bss.
This saves carry a large "all zero" bss in the image.bin.

> With 2.0.38 I had done my own thing (had a dedicated section for romfs
> in ram.ld), and
> it seemed to work quite differently anyway. There was a romfs.ld file.

You can do it this way. Different targets do this in different
ways. Setup it up however it makes sense for your system...

> Is romfs meant to end up between edata and bss somehow, and therefore
> bss is linked
> up above it ?

You can put it anywhere. Some targets load it to a fixed address.
Others load it and move it. Others can load it to where it should
be with no extra effort. Depends on how you load binaries into
your target.

> That would mean the result of the genromfs size would
> somehow have to
> be fed back into the kernel link (and be reflected in System.map). Also
> linux.data
> would need to exclude it somehow.
> Before I hack in my own "romfs" section, does anyone know how this is
> meant to work ?
> Possibly I just copied a bad example.

Most of the ColdFire platforms use this method when loading the
raw binary. When loading ELF images they insert a .romfs section
into the ELF file.


Greg Ungerer  --  Chief Software Wizard        EMAIL:  gerg at snapgear.com
SnapGear                                       PHONE:    +61 7 3435 2888
825 Stanley St,                                  FAX:    +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia              WEB:   www.snapgear.com
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/

More information about the uClinux-dev mailing list