1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

K26 ld.so.conf strangeness

Discussion in 'Tomato Firmware' started by rhester72, Jun 2, 2010.

  1. rhester72

    rhester72 Network Guru Member

    In K26, /etc/ld.so.conf contains /opt/lib and /opt/usr/lib - but applications executed via ssh busybox shell prompt seem to need these directories to *also* be a part of LD_LIBRARY_PATH (normally used only for debugging).

    Any idea why?

    Rodney
     
  2. rhester72

    rhester72 Network Guru Member

    It would seem that /etc/ld.so.cache (a binary file generated by ldconfig) is the *only* file the kernel will read and honor - ld.so.conf is merely a convenient means of indicating to ldconfig what should be in ld.so.cache when built.

    Since there is no means of persistently caching the results of ldconfig (because /etc is rebuilt on each boot), I'll need to find a convenient way to regenerate that cache file on each boot before any user-built applications with dynamic library dependencies start. Should be fun. *laughs*

    An alternative approach, I suppose, would be to run ldconfig as part of the firmware compile process and store the cache file in the firmware image itself (i.e. a permanent part of /etc). The advantage would be a "look, Ma - no hands!" solution, the disadvantage being that altering it from looking in the default paths (/opt/lib, /opt/usr/lib, /lib, and /usr/lib, currently) would necessitate a solution described in the above paragraph anyway.

    Thoughts?

    Rodney

    EDIT: At what point in the boot process are files stored in NVRAM actually created in the filesystem? Simply plunking /etc/ld.so.cache into NVRAM after running ldconfig may be a viable approach, *if* they are spooled back out to the filesystem early enough in the boot process and this method is capable of dealing with binary files.
     
  3. mstombs

    mstombs Network Guru Member

    For an interesting way to store binary files in nvram in dd-wrt (Mega doesn't have space for jffs even on 8MB flash routers!) see

    http://secure.dd-wrt.com/phpBB2/viewtopic.php?p=434446

    But looks like in Tomato you can use

    Code:
    /* Get the special files from nvram and copy them to disc.
     * These were files saved with "nvram setfile2nvram <filename>".
     * Better hope that they were saved with full pathname.
     */
    static void load_files_from_nvram(void)
    which is called before the init script in router/rc/init.c
     
  4. teddy_bear

    teddy_bear Network Guru Member

    Exactly. You can use "nvram setfile2nvram <filename>" command to store the file (it works with binary files as well), and then it will be automatically restored during startup - after initializing USB (if present), and just before running Init script and starting other services. I suppose that's early enough...
     

Share This Page