mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 04:56:58 +02:00
build_image: Run ldconfig in qemu
ldconfig does not work for non-native arches. Create a new build_image routine run_ldconfig that uses qemu user emulation to run the board ldconfig on the board rootfs when the board and SDK arches are different. See: http://code.google.com/p/chromium/issues/detail?id=378377 Prior to calling run_ldconfig the board rootfs must have ldconfig installed. To arrange this move the call of run_ldconfig to after the base package install. Fixes build_image errors like these when building for arm64: /sbin/ldconfig: /lib64/libXXX is for unknown machine 183. Signed-off-by: Geoff Levand <geoff@infradead.org>
This commit is contained in:
parent
c78e0aa3f1
commit
3f3b2f2e8c
@ -93,6 +93,21 @@ generate_update() {
|
||||
upload_image -d "${update}.DIGESTS" "${update}".{bin,gz,zip}
|
||||
}
|
||||
|
||||
# ldconfig cannot generate caches for non-native arches.
|
||||
# Use qemu & the native ldconfig to work around that.
|
||||
# http://code.google.com/p/chromium/issues/detail?id=378377
|
||||
run_ldconfig() {
|
||||
local root_fs_dir=$1
|
||||
case ${ARCH} in
|
||||
arm64)
|
||||
sudo qemu-aarch64 "${root_fs_dir}"/usr/sbin/ldconfig -r "${root_fs_dir}";;
|
||||
x86|amd64)
|
||||
sudo ldconfig -r "${root_fs_dir}";;
|
||||
*)
|
||||
die "Unable to run ldconfig for ARCH ${ARCH}"
|
||||
esac
|
||||
}
|
||||
|
||||
# Basic command to emerge binary packages into the target image.
|
||||
# Arguments to this command are passed as addition options/arguments
|
||||
# to the basic emerge command.
|
||||
@ -103,8 +118,8 @@ emerge_to_image() {
|
||||
PORTAGE_CONFIGROOT="${BUILD_DIR}"/configroot \
|
||||
emerge --root-deps=rdeps --usepkgonly --jobs=$FLAGS_jobs -v "$@"
|
||||
|
||||
# Make sure profile.env and ld.so.cache has been generated
|
||||
sudo -E ROOT="${root_fs_dir}" env-update
|
||||
# Make sure profile.env has been generated
|
||||
sudo -E ROOT="${root_fs_dir}" env-update --no-ldconfig
|
||||
|
||||
# TODO(marineam): just call ${BUILD_LIBRARY_DIR}/check_root directly once
|
||||
# all tests are fatal, for now let the old function skip soname errors.
|
||||
|
@ -96,6 +96,7 @@ create_dev_image() {
|
||||
|
||||
set_image_profile dev
|
||||
emerge_to_image "${root_fs_dir}" @system ${base_pkg}
|
||||
run_ldconfig "${root_fs_dir}"
|
||||
write_packages "${root_fs_dir}" "${BUILD_DIR}/${image_packages}"
|
||||
write_licenses "${root_fs_dir}" "${BUILD_DIR}/${image_licenses}"
|
||||
|
||||
|
@ -47,6 +47,7 @@ create_prod_image() {
|
||||
set_image_profile prod
|
||||
extract_prod_gcc "${root_fs_dir}"
|
||||
emerge_to_image "${root_fs_dir}" "${base_pkg}"
|
||||
run_ldconfig "${root_fs_dir}"
|
||||
write_packages "${root_fs_dir}" "${BUILD_DIR}/${image_packages}"
|
||||
write_licenses "${root_fs_dir}" "${BUILD_DIR}/${image_licenses}"
|
||||
extract_docs "${root_fs_dir}"
|
||||
|
Loading…
Reference in New Issue
Block a user