Fix the eglibc/glibc builds where the network init failed due to unresolved libraries by adding support for the fot the runtime library bindings by running ldconfig at bootup. Directories used by default for the creating ld.config.cache are /lib and /usr/lib but other applications can extend it in their install time by adding own conf file under /etc/ld.so.conf.d directory. By default the cache is created to file /tmp/ld.so.cache that is symlinked from /etc/ld.so.cache. But script will also detect if user has instead changed the symlink target to somewhere or wants /etc/ld.so.cache to be normal file instead of being a symlink.
Signed-off-by: Mika Laitio <lam...@pilppa.org> --- package/base-files/Makefile | 4 ++ .../base-files/glibc-files/etc/init.d/linkbindings | 32 ++++++++++++++++++++ package/base-files/glibc-files/etc/ld.so.conf | 1 + .../etc/ld.so.conf.d/base_library_path.conf | 2 + 4 files changed, 39 insertions(+), 0 deletions(-) create mode 100644 package/base-files/glibc-files/etc/init.d/linkbindings create mode 100644 package/base-files/glibc-files/etc/ld.so.conf create mode 100644 package/base-files/glibc-files/etc/ld.so.conf.d/base_library_path.conf diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 5e6e652..9880f3f 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -494,6 +494,10 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) fi; \ done; \ done + $(INSTALL_DIR) $(1)/sbin + if [ -e "$(TOOLCHAIN_DIR)/sbin/ldconfig" ]; then \ + $(CP) $(TOOLCHAIN_DIR)/sbin/ldconfig $(1)/sbin/; \ + fi endef define Package/eglibc/install diff --git a/package/base-files/glibc-files/etc/init.d/linkbindings b/package/base-files/glibc-files/etc/init.d/linkbindings new file mode 100644 index 0000000..08f5b7e --- /dev/null +++ b/package/base-files/glibc-files/etc/init.d/linkbindings @@ -0,0 +1,32 @@ +#!/bin/sh /etc/rc.common +# +# Copyright (C) 2011 OpenWrt.org +# + +START=04 + +start() { + if [ -e /sbin/ldconfig ] && [ -e /etc/ld.so.conf ]; then + if [ -h /etc/ld.so.cache ]; then + # cache exist and is symlink + # parse file where the symlink points + symtarget=$(ls -l /etc/ld.so.cache | sed 's/.*->\ //g') + #update cache from file where the symlink from /etc/ld.so.cache points + /sbin/ldconfig -C $symtarget + echo "runtime shared library bindings updated to /etc/ld.so.cache symlink "$symtarget + else + if [ ! -e /etc/ld.so.cache ]; then + # cache does not yet exist, create it as a symlink to /tmp/ld.so.cache + echo "creating symlink from /etc/ld.so.cache to /tmp/ld.so.cache" + ln -s /tmp/ld.so.cache /etc/ld.so.cache + /sbin/ldconfig -C /tmp/ld.so.cache + echo "runtime shared library bindings updated to /etc/ld.so.cache symlink /tmp/ld.so.cache" + else + # cache does not exist as a symlink or is not pointing to /tmp + # let ldconfig update cache from default position (/etc/ld.so.cache) + /sbin/ldconfig + echo "runtime shared library bindings updated to /etc/ld.so.cache" + fi + fi + fi +} diff --git a/package/base-files/glibc-files/etc/ld.so.conf b/package/base-files/glibc-files/etc/ld.so.conf new file mode 100644 index 0000000..83327c0 --- /dev/null +++ b/package/base-files/glibc-files/etc/ld.so.conf @@ -0,0 +1 @@ +include /etc/ld.so.conf.d/*.conf diff --git a/package/base-files/glibc-files/etc/ld.so.conf.d/base_library_path.conf b/package/base-files/glibc-files/etc/ld.so.conf.d/base_library_path.conf new file mode 100644 index 0000000..61b171c --- /dev/null +++ b/package/base-files/glibc-files/etc/ld.so.conf.d/base_library_path.conf @@ -0,0 +1,2 @@ +/lib +/usr/lib -- 1.7.1 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel