Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5160906pxb; Mon, 28 Mar 2022 08:47:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQHcJjVW2Gl3uEsOGmKa45zywS9tbIr2t0PXBiutyw1EPpc32cdvG61hsc9q5hfpUjX9F4 X-Received: by 2002:a50:bf0f:0:b0:410:c512:cb6f with SMTP id f15-20020a50bf0f000000b00410c512cb6fmr17145645edk.262.1648482430146; Mon, 28 Mar 2022 08:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648482430; cv=none; d=google.com; s=arc-20160816; b=ioO2aKmFOancLIOvf+4YHoDAUV9zVgvQyUelGARuoI4wmgtlt+x2iEqCuZQFcL1pY7 E5P04/G6C0kKwgG2wLdLHpVyFosGAbIp2lKFYNchkYIXb/Z0lljcj9nUhBx0dr15xQAT z0U9IsAph02PmU1aoICxLCd93csy7M9cwQIHbibHpQjSF2qLYeAsrQ7846+ZqU6+EXxF OGQAqSmQ3HDuYBeSy6CaR9b97FVF8x6j4eI5i/Co/kddqGuKWWwI0VIjEjOhpBqjBrEu fjlRQC8WQ8LTEF114GzHjcX8xNZkK0vO84/Pd185WsjAQlOgijAndKQrrgtQyu7j/I7q fBdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=cyYvqI37QIncGmjlB2JSHWLeKb0lvsaI900du46+3no=; b=KF+gBxrTxj0HGBiBF3Wh4JnUQm1U3ERz0Du9jv0WYX3WUZmbkrFQ/5UHpKinXM6LEK lVTycVxyZuJqG04OcdZPR7B8z3V0EhkyzNmWdck6JXxnpqVkZp7VqCy5uRGaurO1za6z dFsEkynR6Z43ynFqCzmsiHGLJnBRY3nthbjUuygU1WGbNqOb/G/E0gMPq6p3VO5mbE5x 7NBaw4W7PfWlXB9dtTxyVrt2jy+O5L3lKAlp+l53yUNKg5PcguGbP2jA55PWu8MQB2ci ZP6Ugg+ejI6sjXCTVIRoGZ41rlA0uWBmoU35d0pBin2QCGOZx+TTCAGBh9PbrgeeltXV ay9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a170906640700b006df76385dafsi13776319ejm.591.2022.03.28.08.46.44; Mon, 28 Mar 2022 08:47:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237667AbiC1CuR (ORCPT + 99 others); Sun, 27 Mar 2022 22:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237657AbiC1CuP (ORCPT ); Sun, 27 Mar 2022 22:50:15 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F84027CD8 for ; Sun, 27 Mar 2022 19:48:35 -0700 (PDT) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KRcXx0j6xzfZHX; Mon, 28 Mar 2022 10:46:57 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 28 Mar 2022 10:48:33 +0800 Received: from use12-sp2.huawei.com (10.67.189.20) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 28 Mar 2022 10:48:33 +0800 From: Jubin Zhong To: , CC: , , , , , , Subject: [PATCH v2 RESEND] kbuild: Enable armthumb BCJ filter for Thumb-2 kernel Date: Mon, 28 Mar 2022 10:48:31 +0800 Message-ID: <1648435711-95240-1-git-send-email-zhongjubin@huawei.com> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <20220326203516.1ddb6492@kaneli> References: <20220326203516.1ddb6492@kaneli> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.189.20] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org xz_wrap.sh use $SRCARCH to detect the BCJ filter. However, assigning arm BCJ filter to Thumb-2 kernel is not optimal. In my case, about 5% decrease of image size is observed with armthumb BCJ filter: Test results: hardware: QEMU emulator version 3.1.0 config: vexpress_defconfig with THUMB2_KERNEL & KERNEL_XZ on arm BCJ: 4029808 armthumb BCJ: 3827280 Choose armthumb BCJ filter for Thumb-2 kernel to make smaller images. Signed-off-by: Jubin Zhong Acked-by: Lasse Collin ---- v1: https://lore.kernel.org/lkml/1637323647-19988-1-git-send-email-zhongjubin@huawei.com/ --- lib/decompress_unxz.c | 6 +++++- scripts/xz_wrap.sh | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c index 9f4262e..9d9cb48 100644 --- a/lib/decompress_unxz.c +++ b/lib/decompress_unxz.c @@ -129,7 +129,11 @@ # define XZ_DEC_POWERPC #endif #ifdef CONFIG_ARM -# define XZ_DEC_ARM +# ifdef CONFIG_THUMB2_KERNEL +# define XZ_DEC_ARMTHUMB +# else +# define XZ_DEC_ARM +# endif #endif #ifdef CONFIG_IA64 # define XZ_DEC_IA64 diff --git a/scripts/xz_wrap.sh b/scripts/xz_wrap.sh index 76e9cbc..3824fdf 100755 --- a/scripts/xz_wrap.sh +++ b/scripts/xz_wrap.sh @@ -9,6 +9,8 @@ # You can do whatever you want with this file. # +. include/config/auto.conf + BCJ= LZMA2OPTS= @@ -20,4 +22,8 @@ case $SRCARCH in sparc) BCJ=--sparc ;; esac +if [ -n "${CONFIG_THUMB2_KERNEL}" ]; then + BCJ=--armthumb +fi + exec $XZ --check=crc32 $BCJ --lzma2=$LZMA2OPTS,dict=32MiB -- 1.8.5.6