build_image: Remove unused developer only glibc files.
This patch filters out some libc unused parts from the base image:
* usr/bin/{getent,ldd}: Not used at runtime.
* lib*/lib{memusage,pcprofile,SegFault}.so
* usr/lib*/audit/*
* lib*/libnss_*.so except for files and dns, which are the only ones
specified by etc/nsswitch.conf.
* lib*/libBrokenLocale*.so*: Not loaded by any package.
Parts of this patch were landed and reverted earlier on
https://chromium-review.googlesource.com/37378
due to the dependency on gconv files from the flashplayer, which is
tracked on issue 206111. This patch doesn't include the removal of
usr/*/gconv files.
BUG=chromium:381886
TEST=./build_image --board=link works.
TEST=cbuildbot on gizmo-release and {x86,amd64,arm}-generic-full works
TEST=Booted image on link.
Change-Id: Ia18712dc21256df70c9dd3f41a05424d896d989a
Reviewed-on: https://chromium-review.googlesource.com/204270
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/build_library/base_image_util.sh b/build_library/base_image_util.sh
index 1a5317a..81c0963 100755
--- a/build_library/base_image_util.sh
+++ b/build_library/base_image_util.sh
@@ -100,6 +100,14 @@
'usr/include' 'sys-include'
# Link-time objects.
'*.[ao]'
+ # Debug commands not used by normal runtime code.
+ 'usr/bin/'{getent,ldd}
+ # LD_PRELOAD objects for debugging.
+ 'lib*/lib'{memusage,pcprofile,SegFault}.so 'usr/lib*/audit'
+ # We only use files & dns with nsswitch, so throw away the others.
+ 'lib*/libnss_'{compat,db,hesiod,nis,nisplus}'*.so*'
+ # This is only for very old packages which we don't have.
+ 'lib*/libBrokenLocale*.so*'
)
pbzip2 -dc --ignore-trailing-garbage=1 "${LIBC_PATH}" | \
sudo tar xpf - -C "${root_fs_dir}" ./usr/${CHOST} \
diff --git a/build_library/dev_image_util.sh b/build_library/dev_image_util.sh
index 2d13636..59a1219 100755
--- a/build_library/dev_image_util.sh
+++ b/build_library/dev_image_util.sh
@@ -69,12 +69,8 @@
# Leave core files for developers to inspect.
sudo touch "${root_fs_dir}/root/.leave_core"
- # This hack is only needed for devs who have old versions of glibc, which
- # filtered out ldd when cross-compiling. TODO(davidjames): Remove this hack
- # once everybody has upgraded to a new version of glibc.
- if [[ ! -x "${root_fs_dir}/usr/bin/ldd" ]]; then
- sudo cp -a "$(which ldd)" "${root_fs_dir}/usr/bin"
- fi
+ # Release images do not include these, so install it for dev images.
+ sudo cp -a "${BOARD_ROOT}"/usr/bin/{getent,ldd} "${root_fs_dir}/usr/bin/"
# If vim is installed, then a vi symlink would probably help.
if [[ -x "${root_fs_dir}/usr/local/bin/vim" ]]; then