The 'populate' script

Yann E. MORIN yann.morin.1998@anciens.enib.fr
Sat Oct 9 07:08:00 GMT 2010


Samson, All,

On Saturday 09 October 2010 06:53:13 Samson Luk wrote:
> I read this 'populate' script from overview.txt, to me it just seems
> coming out from nowhere... I also cannot 'find' it anywhere in my file
> system or inside the target tree as well.  I suppose this is a script
> to prepare the target sys-root?  Am I correct that target sys-root
> should automatically prepared during 'ct-ng build', all targets
> libraries should install into it and why an extra script is required
> to prepare the sys-root?

The populate script is installed by crosstool-NG along with the other
cross-tools. You will find it in the toolchain's bin directory, such as:
  # ls /opt/x-tools/arm-unknown-linux-gnu/bin/*populate*
  /opt/x-tools/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-populate

The sysroot of the toolchain contains the system part of the rootfs, such
as system libraries (libc et al.) and system headers (stdio.h ...). If you
want to be able to re-use the toolchain, you have to keep the sysroot clean
of any other content.

So, when you build your packages, you would install them in what we call a
staging area, eg. ${HOME}/dev/rootfs, but never directly in the sysroot of
the toolchain.

Once you have installed all your packages in there, the staging area will
contain all what your packages have installed, and only that. So it is not
ready to be used to prepare the final file system for the target, as it
will be missing the system libraries.

Crosstool-NG helps you create a complete staging area by mean of the
populate script. To run the populate script, you basicaly tell it where
your (yet incomplete) staging area is, and where to put the completed one.
Populate will then copy your staging area to the place you instructed it
to, and will search it for unresolved NEEDED dependencies on the binary
files (executables and libraries). For each such unresolved dep, it will
search for the missing library in the sysroot, copy it to the copy of the
staging area. And so on until there is no unmet dependency (or a library
was not found in the sysroot).

After populate was run, your original staging area is still clear of any
system file, and still contains only what your packages have installed,
and the sysroot is also clean of any non-system file, as all of them
were installed in the staging area.

Finally, the copy of the staging area is now complete with all the files
installed by your packages, and also contains all the system libraries
needed to run on the target.


Hope this was clear enough. :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'



--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list