Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 411AFEF99D2 for ; Fri, 13 Feb 2026 19:36:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0D82D40C14; Fri, 13 Feb 2026 19:36:52 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id GaXDi5Va-KP8; Fri, 13 Feb 2026 19:36:51 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1D6D741F0E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=buildroot.org; s=default; t=1771011411; bh=Ira+foy7WdEpJK9/AfOskl4qYz0l7t/H6xH+1GNlba0=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kVKfIYhvs/B+xHCFCztfrDRtY7TmTRfZo30GpHkRuo1pcXh5mfUYY7Z2RiN1kdDCO gU67r1XWBOed1vxVCtlPGiRdS6dfBBG0EY6F0BmwEpohZ4K0gM4LZUAtg0Ea/RDIA7 iM8loDPBspirDHf9g6eqEPr6KRUItRrOSnawTT/gE6cOlmuPgBCvAkVUay/+1iVInr lMTmn1RozZqUeCn4A2e+qxUf410IxNwGrJrx8r258bgjDMcVHTP0Q7MPtC2g8XXpsr HuMyRnvpIzs12ojOAc8j9v/ccmaoxSkCcYWX4OUUPKyZioM3YGPAuB+bwYsau0ywnC t7D9PK4dzDPXw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id 1D6D741F0E; Fri, 13 Feb 2026 19:36:51 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists1.osuosl.org (Postfix) with ESMTP id 15C8C283 for ; Fri, 13 Feb 2026 19:35:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8A26541E29 for ; Fri, 13 Feb 2026 19:35:31 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 4SY4aVR89M8F for ; Fri, 13 Feb 2026 19:35:29 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.167.122; helo=busybox.osuosl.org; envelope-from=buildroot-git-push@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 043DA41E39 Received: from busybox.osuosl.org (busybox.osuosl.org [140.211.167.122]) by smtp4.osuosl.org (Postfix) with ESMTP id 043DA41E39 for ; Fri, 13 Feb 2026 19:35:29 +0000 (UTC) Received: by busybox.osuosl.org (Postfix, from userid 4053) id EC83281EB5; Fri, 13 Feb 2026 19:35:28 +0000 (UTC) To: buildroot@buildroot.org Date: Fri, 13 Feb 2026 20:31:39 +0100 X-Git-Refname: refs/heads/2025.02.x X-Git-Oldrev: a2222c486f634a94783059d9cc585d7c810a4054 X-Git-Newrev: 4a50565d0758ce96fdcdc194833344cdb6cb48d2 X-Patchwork-Hint: ignore Message-Id: <20260213193528.EC83281EB5@busybox.osuosl.org> Subject: [Buildroot] [git commit branch/2025.02.x] support/misc/relocate-sdk.sh: pre-calculate files in need of relocation X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Thomas Perale via buildroot Reply-To: Thomas Perale MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" commit: https://gitlab.com/buildroot.org/buildroot/-/commit/4a50565d0758ce96fdcdc194833344cdb6cb48d2 branch: https://gitlab.com/buildroot.org/buildroot/-/tree/2025.02.x Currently, the relocate-sdk.sh script scans the whole extracted SDK tree to find instances of paths it needs to replace, which can take a significant amount of time when the SDK is large, particularly relative to the number of files that actually need to change. However, the resulting list only depends on the SDK tarball itself, so we can calculate it at build time and ship it with the tarball so relocate-sdk.sh can use it directly. Testing this on my machine with somewhat IOPS-limited rotating media, the time goes down from: $ time ./relocate-sdk.sh Relocating the buildroot SDK from [...] to [...] ... ./relocate-sdk.sh 5.19s user 26.21s system 9% cpu 5:34.40 total To: $ time ./relocate-sdk.sh Relocating the buildroot SDK from [...] to [...] ... ./relocate-sdk.sh 0.49s user 0.29s system 103% cpu 0.749 total Signed-off-by: Florian Larysch Signed-off-by: Arnout Vandecappelle (cherry picked from commit 63877f9e86e2b79218b3f08c1ec4613cfe354744) Signed-off-by: Thomas Perale --- Makefile | 10 ++++++++++ support/misc/relocate-sdk.sh | 11 +++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 84491cb55d..74ca67787d 100644 --- a/Makefile +++ b/Makefile @@ -602,6 +602,16 @@ prepare-sdk: world @$(call MESSAGE,"Preparing the SDK") $(INSTALL) -m 755 $(TOPDIR)/support/misc/relocate-sdk.sh $(HOST_DIR)/relocate-sdk.sh mkdir -p $(HOST_DIR)/share/buildroot + (\ + export LC_ALL=C; \ + grep -lr '$(HOST_DIR)' '$(HOST_DIR)' | while read -r FILE; do \ + if file -b --mime-type "$$FILE" | grep -q '^text/' && \ + [ "$$FILE" != '$(HOST_DIR)/share/buildroot/sdk-location' ] && \ + [ "$$FILE" != '$(HOST_DIR)/share/buildroot/sdk-relocs' ]; then \ + echo "$$FILE"; \ + fi; \ + done \ + ) | sed -e 's|^$(HOST_DIR)|.|g' > $(HOST_DIR)/share/buildroot/sdk-relocs echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-location BR2_SDK_PREFIX ?= $(GNU_TARGET_NAME)_sdk-buildroot diff --git a/support/misc/relocate-sdk.sh b/support/misc/relocate-sdk.sh index 981d272425..d25bc55279 100755 --- a/support/misc/relocate-sdk.sh +++ b/support/misc/relocate-sdk.sh @@ -37,15 +37,10 @@ fi echo "Relocating the buildroot SDK from ${OLDPATH} to ${NEWPATH} ..." -# Make sure file uses the right language -export LC_ALL=C # Replace the old path with the new one in all text files -grep -lr "${OLDPATH}" . | while read -r FILE ; do - if file -b --mime-type "${FILE}" | grep -q '^text/' && [ "${FILE}" != "${LOCFILE}" ] - then - sed -i "s|${OLDPATH}|${NEWPATH}|g" "${FILE}" - fi -done +while read -r FILE ; do + sed -i "s|${OLDPATH}|${NEWPATH}|g" "${FILE}" +done < share/buildroot/sdk-relocs # At the very end, we update the location file to not break the # SDK if this script gets interruted. _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot