build_image: filter out unused glibc files

This removes files only used at link time, or when manually debugging,
or by glibc's charset routines (gconv) which are not used by Chromium.

BUG=chromium-os:22939
BUG=chromium-os:23105
TEST=build_image for daisy works
TEST=`cbuildbot {x86,x86_64,arm}-generic-full` worked
TEST=`cbuildbot chromiumos-sdk` worked
TEST=build_image boots & runs fine on an alex

Change-Id: I68d848c2e307c98d53a8faa73924f57571f7887b
Reviewed-on: https://gerrit.chromium.org/gerrit/37378
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2012-11-05 16:59:26 -05:00 committed by Gerrit
parent 22dc2ba9d9
commit 5ea15f8a38
2 changed files with 17 additions and 6 deletions

View File

@ -177,6 +177,21 @@ create_base_image() {
'usr/include' 'sys-include'
# Link-time objects.
'*.[ao]'
# Link-time symlinks & linker scripts.
'usr/lib*/lib*.so'
# We mount /var manually so this gets thrown away.
'var'
# 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'
# Libraries used for translating between charsets -- but we use libicu
# in Chromium, so there's no need for these. http://crosbug.com/23105
'usr/*/gconv'
# 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} \

View File

@ -60,12 +60,8 @@ install_dev_packages() {
# 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