From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D72D0138334 for ; Sun, 14 Jul 2019 13:00:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 64F4EE089E; Sun, 14 Jul 2019 13:00:36 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 32E90E089B for ; Sun, 14 Jul 2019 13:00:35 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C8C7F347A9C for ; Sun, 14 Jul 2019 13:00:33 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B615B6FF for ; Sun, 14 Jul 2019 13:00:29 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1563105496.19e62fbefd06f9f7b890346a3f5220f9d27b37c7.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_initramfs.sh X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 19e62fbefd06f9f7b890346a3f5220f9d27b37c7 X-VCS-Branch: master Date: Sun, 14 Jul 2019 13:00:29 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 110a3ea1-7e1d-4358-8429-1b1292cadf49 X-Archives-Hash: 2f1e8439c54c69f151f4db7984c24245 commit: 19e62fbefd06f9f7b890346a3f5220f9d27b37c7 Author: Thomas Deutschmann gentoo org> AuthorDate: Sun Jul 14 09:39:56 2019 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Sun Jul 14 11:58:16 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=19e62fbe gen_initramfs.sh: Refactor append_linker() Signed-off-by: Thomas Deutschmann gentoo.org> gen_initramfs.sh | 55 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/gen_initramfs.sh b/gen_initramfs.sh index 8d6996e..fc756d0 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -642,36 +642,49 @@ append_libgcc_s() { } append_linker() { - if [ -d "${TEMP}/initramfs-linker-temp" ] + local TDIR="${TEMP}/initramfs-linker-temp" + if [ -d "${TDIR}" ] then - rm -r "${TEMP}/initramfs-linker-temp" + rm -r "${TDIR}" || gen_die "Failed to clean out existing '${TDIR}'!" fi - mkdir -p "${TEMP}/initramfs-linker-temp/etc" + mkdir "${TDIR}" || gen_die "Failed to create '${TDIR}'!" + cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!" - if [ -e "/etc/ld.so.conf" ] - then - cp "/etc/ld.so.conf" "${TEMP}/initramfs-linker-temp/etc/" 2> /dev/null \ - || gen_die "Could not copy ld.so.conf" - fi - if [ -e "/etc/ld.so.cache" ] - then - cp "/etc/ld.so.cache" "${TEMP}/initramfs-linker-temp/etc/" 2> /dev/null \ - || gen_die "Could not copy ld.so.cache" - fi - if [ -d "/etc/ld.so.conf.d" ] + mkdir -p "${TDIR}"/etc || gen_die "Failed to create '${TDIR}/etc'!" + + if isTrue "$(tc-is-cross-compiler)" then - mkdir -p "${TEMP}/initramfs-linker-temp/etc/ld.so.conf.d" - cp -r "/etc/ld.so.conf.d" "${TEMP}/initramfs-linker-temp/etc/" 2> /dev/null \ - || gen_die "Could not copy ld.so.conf.d" + # We cannot copy ld files from host because they could be + # incompatible with CHOST. Instead, add ldconfig to allow + # initramfs to regenerate on its own (default /etc/ld.so.conf + # for initramfs was added via append_base_layout()). + mkdir -p "${TDIR}"/sbin || gen_die "Failed to create '${TDIR}/sbin'!" + + local libdir=$(get_chost_libdir) + copy_system_binaries "${TDIR}/sbin" "${libdir}/../sbin/ldconfig" + else + # Only copy /etc/ld.so.conf.d -- /etc/ld.so.conf was already + # added to CPIO via append_base_layout() and because we only + # append to CPIO, that file wouldn't be used at all. + if [ -d "/etc/ld.so.conf.d" ] + then + mkdir -p "${TDIR}"/etc/ld.so.conf.d || gen_die "Failed to create '${TDIR}/etc/ld.so.conf.d'!" + cp -arL "/etc/ld.so.conf.d" "${TDIR}"/etc \ + || gen_die "Failed to copy '/etc/ld.so.conf.d'!" + fi + + if [ -e "/etc/ld.so.cache" ] + then + cp -aL "/etc/ld.so.cache" "${TDIR}"/etc/ld.so.cache \ + || gen_die "Failed to copy '/etc/ld.so.cache'!" + fi fi - cd "${TEMP}/initramfs-linker-temp/" + cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!" log_future_cpio_content find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \ - || gen_die "compressing linker cpio" - cd "${TEMP}" - rm -rf "${TEMP}/initramfs-linker-temp" > /dev/null + || gen_die "Failed to append linker to cpio!" } append_splash(){