This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: what is the logic of populate?


Hello!

On Sunday 31 May 2009 15:27:10 ng@piments.com wrote:
> arm-unknown-linux-gnueabi-populate -v -f -s root -d root-image

Why do you need to use '-f' at all?

> it created a very sleek and light root-image/lib but failed to find 
> libwrap and hence failed to copy it.
> #ls /back/ts/root2/usr/lib/libwrap*

Your command line is using "root" as the source dir, but you have
libwrap in "root2". Maybe that's the reason...

> In looking further I found it had copied /var/spool/cron/crotab but NOT 
> that actual crontab files therein. So I have not cron tasks defined.

Same root vs. root2 mismatch?

> bash-4.0#ls -l /back/ts/root2/sbin/init
> -rwxr-xr-x 1 root root 31211 2009-05-22 22:39 /back/ts/root2/sbin/init
> bash-4.0#ls -l /back/ts/root-image/sbin/init
> lrwxrwxrwx 1 root root 14 2009-05-31 13:38 /back/ts/root-image/sbin/init 
> -> ../bin/busybox
> So it has replaced the REAL sysvinit with a symlink to busybox !? No 
> wonder it won't boot. What is going on here?

populate is not supposed to do that, indeed.
root vs. root2 mismatch, again?

> In order for populate to determine the required libs , it must have all 
> programs (such as init) in place in the source tree. If it is then going 
> to ignore the installed progs and arbitrarily create symlinks to other 
> executables it's seems difficult to have confidence in the result.

populate does not do that. Look at the code, it's quite straightforward.

1) some sanity checks:
   - dest and source are specified
   - source exists
   - unless forced, dest does not exist
   - source != dest

2) copy source to dest

3) add forced libraries to dest
   - build the list from -l and -L options
   - get forced libraries from sysroot (see below for heuristics)

4) add all missing libraries
   - scan dest for every ELF files that are 'executables' or 'shared object'
   - list the "NEEDED Shared library" fields
     - check if the library is already in dest/lib or dest/usr/lib
     - if not, get the library from sysroot
       - if it's in sysroot/lib, copy it to dest/lib
       - if it's in sysroot/usr/lib, copy it to dest/usr/lib
       - in both cases, use the SONAME of the library to create the file
         in dest
       - if it was not found in the sysroot, this is an error.

That's all. No symlinking, no file-name mangling (besides using the SONAME), 
no file removal...

Maybe we could add some other paths to check for, eg. usr/local/lib...

> Apparently I do not understand the exact function of populate. This may 
> be due in part to the very brief usage help that appears to be the only 
> documentation.

What do you think of the above? If it makes things clear, then I'll
add that to the doc.

I'm using it, and it does work. The only gotcha you may encounter is if
you are using a non-english locale, as I forgot to force LC_ALL and LANG
before I run readelf, and that may imply missing the NEEDED fileds...
Will fix that.

> Is this information available anywhere?

I though that docs/overview.txt and the help text were enough. Moreover,
the code is quite simple, and (hopefuly) well commented... Apparently,
that was not enough...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| --==< ^_^ >==-- `------------.-------:  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]