From patchwork Fri Aug 19 14:25:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Herbrechtsmeier X-Patchwork-Id: 1668174 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=weidmueller.onmicrosoft.com header.i=@weidmueller.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-weidmueller-onmicrosoft-com header.b=F1zNv7xH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4M8PJh0Z5cz1yg7 for ; Sat, 20 Aug 2022 00:29:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 947FD84C01; Fri, 19 Aug 2022 16:26:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=weidmueller.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=weidmueller.onmicrosoft.com header.i=@weidmueller.onmicrosoft.com header.b="F1zNv7xH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 236B284BC7; Fri, 19 Aug 2022 16:26:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150075.outbound.protection.outlook.com [40.107.15.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C356384BA5 for ; Fri, 19 Aug 2022 16:26:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=weidmueller.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=stefan.herbrechtsmeier-oss@weidmueller.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=En9s2ZDvKiHI7lMlFxAt9ndDp4aXU7NTuM1nAeZMC4gKcEmiUW76LxbQJDYtCgW2JSbiwafvov2k4IUhqo4QFEKG6QEZPCWcnhzH+eWUNuFEczKxAPHqKRd32vpOLns6sp+u3YYXs4n6irpNOX2/v9LcW6XKFwLLDaSABiiECUp1pVlm2lE+5AjMuRaeOTpHAjaU+kJ7CIJA5yjKuPBwfoipQBbYaBWABUr9Qk0F7uUzOJnAm4c2F93KkAIWgc9eWiGyhUVQYd3uzPeo3ut8l2sJq51vQLUVf8b48IxhBc4V7R2EvL3nM1a5d8pmuxfphy/YMhOWnoFpFzV5LipGKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9p1/vLG4dF2/sSvN8yE2xH+Aw+XVCkAL5NlAJXi6DMI=; b=AFyuNfBGDgfvltvBV/x4oLy/vQRG4dT+5PiMEpBKgBNsMZ/LyCtTVoa1sxBO3/BMgCzmnl2Z+9TeoOlaI/g1QXRC1F5ycTsuusgIVm7dEU6besfES5sxDDID9Qqjkjfkd0l1ffYm5uQMpAK2HIz+J4rENDoXMzPl2qzZJF0UPd2blOAuVqoiqOS3wupUdUV6W4kDkuCDp0LGO+aJlBijE0USkDrpFvJLzsjIES5rCEdm8xYl+aer6XuyVtu/fa6zjeUsrV6ilPYYM77rkft0N931XuMRp/z0NRkMR+Jlwg++lCu6Hg6hgpqJkQnKs3KpgsC94FNt8VizJAES21ZlpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=weidmueller.com; dmarc=pass action=none header.from=weidmueller.com; dkim=pass header.d=weidmueller.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=weidmueller.onmicrosoft.com; s=selector1-weidmueller-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9p1/vLG4dF2/sSvN8yE2xH+Aw+XVCkAL5NlAJXi6DMI=; b=F1zNv7xHYoS1ACC68uWH3cYcc8thJNxLm/UDX4PtIEyYCZm2GUDUFZpto2nwfUWr0hiEfqkCjI0CPYtwe8va1qrLTyUfWopDPlv0kDNb+UelCwrTzXSi/uzGq0QHmH62HWlpYk+Qb/djMilUJIJQzzz+zQH64eBZuSEXCFO+jJ4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=weidmueller.com; Received: from PAXPR08MB6969.eurprd08.prod.outlook.com (2603:10a6:102:1d8::23) by PR3PR08MB5739.eurprd08.prod.outlook.com (2603:10a6:102:8e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.18; Fri, 19 Aug 2022 14:26:05 +0000 Received: from PAXPR08MB6969.eurprd08.prod.outlook.com ([fe80::f95b:2e64:9ee6:4d44]) by PAXPR08MB6969.eurprd08.prod.outlook.com ([fe80::f95b:2e64:9ee6:4d44%3]) with mapi id 15.20.5546.018; Fri, 19 Aug 2022 14:26:05 +0000 From: Stefan Herbrechtsmeier To: u-boot@lists.denx.de Cc: Stefan Herbrechtsmeier , Alper Nebi Yasak , Simon Glass Subject: [PATCH v6 18/21] binman: Add gzip bintool Date: Fri, 19 Aug 2022 16:25:35 +0200 Message-Id: <20220819142538.24847-19-stefan.herbrechtsmeier-oss@weidmueller.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220819142538.24847-1-stefan.herbrechtsmeier-oss@weidmueller.com> References: <20220819142538.24847-1-stefan.herbrechtsmeier-oss@weidmueller.com> X-ClientProxiedBy: AS4PR10CA0015.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5dc::11) To PAXPR08MB6969.eurprd08.prod.outlook.com (2603:10a6:102:1d8::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a5261d56-f7dc-4d7b-79d0-08da81eec012 X-MS-TrafficTypeDiagnostic: PR3PR08MB5739:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x+AeJGtGExHCvJasTJAYcQeX1nQWVmHzeMhtw9bVc3JJQ5iaPLJKusBAJo04zV2ldNQK8B9TcTIIlvXfM/Wgax7n0ipEdLI21jBuPGyUM8AwBlvf0l6P3VyB0TqKsUU7P4gcrijeEmlVCzw4ZI6lN6iuy81TFEhaTyxnykShOB9JHHP2KAv4m2/dGRpKfN/4nyXRLpNMKqxQRkB1beEw1KZaRvTOSFuVP5f3KYlRkDju+3HEBrnZZn3GkIpNs09P8qeNTa74fZfMr9Fu7KBbYcfmxxXjg1zx6AqOUXgtCc3f1GNL0QyxSc37Kk+dAs/sWiHtrEwEYQFoTHryHr5kt5FC3/9dt01tSQO3iCUYibfkSS7E+TRysDlpSKvpzNXBy+k2EZRmy8O0B9vTqqItsNT0BBTHnTjwPPZ1VizGG+e1r0bLSI0Jh8mAsOxx8Vsu6JIxhxzyoUjqRVXpmv8ZMvUvePV30EORwelcNzZQq3DMes6tLwyJ74/ZVe4GOOBJiUA1O6vSeR/Igy/8PJzLuhSqsMH1iicNQa1hyFSIPyFK4ZwTCtTMafjq0OTDHUsOx9sWx+EhRl4SB9GMafK96HHomWm4cF9rhqH7VtxIn0XlSlaNYtoya2LmgqhDB90XVH2MX5QwynCIEj0iL1SZH4wlQLXy/GgK03rQyARdVMUgfE1RCtxEepWwIesjNGEfuCGvxzll/zwLIYftIt/bfoazCwADSGgvmzOvIVjL+SZI3Ed3DO5lymSctFEd+6EgYkI1V/1DTw5QupYUDyZENA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR08MB6969.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(396003)(366004)(376002)(136003)(346002)(39860400002)(4326008)(8676002)(66476007)(66946007)(66556008)(54906003)(316002)(6916009)(36756003)(5660300002)(8936002)(2906002)(478600001)(6486002)(41300700001)(6506007)(6666004)(6512007)(26005)(52116002)(2616005)(86362001)(1076003)(38350700002)(38100700002)(83380400001)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?MULMaMC1vM6bzJlMSjTXsjBLkZ1d?= =?utf-8?q?ONHbN31j5rtXQHpO+WoXgNLaW3c7s1CmHEPUhksBKdnW9XZjp5E9ehsKvr3ShMmEW?= =?utf-8?q?P7i93a/kbLIKxXPMM7KM2EA+ICBm66twCrvkhfUYs2qOL98K0oZWeN/GYRns91PRQ?= =?utf-8?q?nFA2H8LPkmueqAQB7RmicPbqd6rWp19/vRHF4AVsuDSkfaKZ4PspfMoQAQh3z6/Df?= =?utf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Zl/0bu7Sw?= =?utf-8?q?SanIYabbYorRuxckMfE7GL7tR05MHpNQDceIwHpzCkXIAh4kPYXloj0E+aSpV57v/?= =?utf-8?q?UJGZmcunpsKqxMXHrDm3IdSoT4v5lsz9vtIpBLm1kuk6ohJJBMpyn4TOJMFPXHmd/?= =?utf-8?q?Xyovu4eC/dkIhKxcVrW8lR45N06UUyvpNcQ3K7NSiVQecS/I1meHCSV+zzr0P6XOw?= =?utf-8?q?thDCO9bHkxAokRhCyiOVk1Qj3GHdX/PWamVMJS37KOYlt0p8lJQeoORJ588/1rY/n?= =?utf-8?q?DIfZhLBJCgK4NXLGtC0zShXvgUBTDGXS5QVxnMcNQQtyKvZfB93GH3kdp4yNl+K/H?= =?utf-8?q?WPu99Atz8LdSca8dRigztyu/iqcFmPJgEpGILW31VaY+lIsURAbVv5q3tu3Oy+eYl?= =?utf-8?q?oZPBYCkJlEDtLbY/kiel8ZhQ5Pgvxm/uwP/pLyc6iEwYQpwYdu6Ls8XZY+YaYy80o?= =?utf-8?q?IAeSScO6Fo7axYhfwY2K4glX5SPXWLDR9g=3D=3D?= X-OriginatorOrg: weidmueller.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5261d56-f7dc-4d7b-79d0-08da81eec012 X-MS-Exchange-CrossTenant-AuthSource: PAXPR08MB6969.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2022 14:26:05.1920 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e4289438-1c5f-4c95-a51a-ee553b8b18ec X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cMBBLI38m+kpS47ovFEVkzi9MGsExf2YFkAvSpOtAevT4cvB0IGSMeeJWHkQzUOBZ6hOf2fMEqTbo7XrMykZ4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5739 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean From: Stefan Herbrechtsmeier Add gzip bintool to binman to support on-the-fly compression of Linux kernel images and FPGA bitstreams. The SPL basic fitImage implementation supports only gzip decompression. Signed-off-by: Stefan Herbrechtsmeier Reviewed-by: Simon Glass --- (no changes since v5) Changes in v5: - Add algorithm name to entry.py - Add tool name to ftest.py Changes in v2: - Add commit to add gzip bintool tools/binman/btool/gzip.py | 31 +++++++++++++++++++++++++++++++ tools/binman/entry.py | 2 +- tools/binman/ftest.py | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 tools/binman/btool/gzip.py diff --git a/tools/binman/btool/gzip.py b/tools/binman/btool/gzip.py new file mode 100644 index 0000000000..0d75028120 --- /dev/null +++ b/tools/binman/btool/gzip.py @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (C) 2022 Weidmüller Interface GmbH & Co. KG +# Stefan Herbrechtsmeier +# +"""Bintool implementation for gzip + +gzip allows compression and decompression of files. + +Documentation is available via:: + + man gzip +""" + +from binman import bintool + +# pylint: disable=C0103 +class Bintoolgzip(bintool.BintoolPacker): + """Compression/decompression using the gzip algorithm + + This bintool supports running `gzip` to compress and decompress data, as + used by binman. + + It is also possible to fetch the tool, which uses `apt` to install it. + + Documentation is available via:: + + man gzip + """ + def __init__(self, name): + super().__init__(name, compress_args=[], + version_regex=r'gzip ([0-9.]+)') diff --git a/tools/binman/entry.py b/tools/binman/entry.py index a0c0a02f5d..930c7910d2 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -1157,7 +1157,7 @@ features to produce new behaviours. """ algo = self.compress if algo != 'none': - algos = ['bzip2', 'lz4', 'lzma'] + algos = ['bzip2', 'gzip', 'lz4', 'lzma'] if algo not in algos: raise ValueError("Unknown algorithm '%s'" % algo) names = {'lzma': 'lzma_alone'} diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 9fa8e9e049..911c955cba 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -107,7 +107,7 @@ BASE_DTB_PROPS = ['offset', 'size', 'image-pos'] REPACK_DTB_PROPS = ['orig-offset', 'orig-size'] # Supported compression bintools -COMP_BINTOOLS = ['bzip2', 'lz4', 'lzma_alone'] +COMP_BINTOOLS = ['bzip2', 'gzip', 'lz4', 'lzma_alone'] class TestFunctional(unittest.TestCase): """Functional tests for binman