From patchwork Wed Feb 22 19:14:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1746517 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=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=NJ7w+Qy5; 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 4PMQrP1SYjz23yZ for ; Thu, 23 Feb 2023 06:16:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE77485B7B; Wed, 22 Feb 2023 20:15:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="NJ7w+Qy5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DFA8485A82; Wed, 22 Feb 2023 20:15:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4D76A85AF1 for ; Wed, 22 Feb 2023 20:14:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12e.google.com with SMTP id a1so3879068iln.9 for ; Wed, 22 Feb 2023 11:14:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VhDNEaqmfwBGJGJI3yXrVGd8IiSFX5B0eBYsvSJxoCQ=; b=NJ7w+Qy5xnHa4HTvjML64R90GcbO7GhoD1LPClQQd7G3QvDb7IinA7M/lRTUyzJJz9 mS9k7r29u8tlwJCIovsMNAChD5GBjmJexnVmproBmDQUpu1AfokQFFNcp3VQ77hSSWR0 gPQ6JTJoH3BL6EtikF2fpgU1JBbEHIPFeAWNM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VhDNEaqmfwBGJGJI3yXrVGd8IiSFX5B0eBYsvSJxoCQ=; b=MMP8gecwp8ziJm4Q0KIt3rbhRB7cz6GUUu0D/n+UYNEZMnhQV/FMsiau8OZWRmdKFO n/vRONp4frWbnmu9ZCXipo/oiutteCjLnSLmwffXHtASywHnDcLS2qelvaqniJgf3GWC WkCx5GbrEG1Mh2TVoSntH2w2tD3zYRK3WJSui52GejovNNhIHhtuO+VpfFRqTBxpTthv XbCQ63Lxwy6i6nlOVOahN61wNYPW7LeCl7c2b9F639L3yC4tmu7qM5zXnltbz9qKUng7 QXUCyLLueI6Drya+1empUMObTHqO44zNWFcx4KphSXFtW7dIeIakKCG/ueLJcX8jUz+6 d9jw== X-Gm-Message-State: AO0yUKWeFXiNkUO9Wkv8C+MolmcntHToRH9AkaPH079PKuKXza4CJgja jhO2y0tDv/V1QuPLxsTF8YVX7IDzLxxh7N+m X-Google-Smtp-Source: AK7set8tRGVn0H2oI9dJFvVevCzf6ZlPIN2+RFcUXlJgBkPiWglk7LEndNMH1e7YKg0L9SNMfSnWtg== X-Received: by 2002:a05:6e02:b21:b0:315:3fab:195b with SMTP id e1-20020a056e020b2100b003153fab195bmr7030071ilu.20.1677093294965; Wed, 22 Feb 2023 11:14:54 -0800 (PST) Received: from kea.bld.corp.google.com ([2620:15c:183:200:ba91:a998:7b71:c020]) by smtp.gmail.com with ESMTPSA id x18-20020a056e020f1200b00316e3a38becsm1212178ilj.18.2023.02.22.11.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 11:14:54 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Mark Kettenis , Tom Rini , Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Mike Frysinger , Simon Glass Subject: [PATCH v2 1/5] binman: Correct an 'aot' typo Date: Wed, 22 Feb 2023 12:14:45 -0700 Message-Id: <20230222191449.1309107-2-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230222191449.1309107-1-sjg@chromium.org> References: <20230222191449.1309107-1-sjg@chromium.org> MIME-Version: 1.0 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 Fix this typo. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/bintool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index 8fda13ff012..e1dff9aa1b5 100644 --- a/tools/binman/bintool.py +++ b/tools/binman/bintool.py @@ -389,7 +389,7 @@ class Bintool: @classmethod def apt_install(cls, package): - """Install a bintool using the 'aot' tool + """Install a bintool using the 'apt' tool This requires use of servo so may request a password From patchwork Wed Feb 22 19:14:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1746514 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=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ea0Hby8d; 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 4PMQqk1mSmz23yZ for ; Thu, 23 Feb 2023 06:16:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BD30985A82; Wed, 22 Feb 2023 20:15:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="ea0Hby8d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C193685ADB; Wed, 22 Feb 2023 20:15:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7CC8E85ADB for ; Wed, 22 Feb 2023 20:14:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x136.google.com with SMTP id i4so2372175ils.1 for ; Wed, 22 Feb 2023 11:14:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+H8IQPL1sgS7lJey8NnUtA5ieYYPVfpwvyrv1dvV+AY=; b=ea0Hby8dSKCqniaY6jPwQojjQp+j9qSS0uP3y0okPo2oHG5uaqb62mWxd/tV0n8yJI XjsNjaLi3k3w69lVmmun4tm/nVSVnga37Dv5huraXPihXmQKqHOI4U4ZxSHk4fpxxDV9 rdUy00ZVeHxp8h3zncah/0MJxLj/CcWEMNR6k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+H8IQPL1sgS7lJey8NnUtA5ieYYPVfpwvyrv1dvV+AY=; b=IRxJNkRsJ+cgueCV3TsTFjmZnNVgrwctuUkDlEB5fHJDJMNSStWVLaC+J5Ky7MeG2T r2PukSxg/u6cGX7t94gxS7vm1zVWpvb/6XS+MQ5LV8uahPVGFCE3Q3aoVPP6fGdLNhLg 4Lka3mAmzmKfJJ14VQ5opBt4J72jt0Be0sb4KTfpS4zhhhSzfa+BQDuZlEQIf0UHsB5E EBliCLIVOCH4RSe84VO1OrkiOdSrbMMK5eMJY09oiN1f8+OZj6kWfHVWWOxPlUVftDWe YXmfIh8FzTc3+rOX/beYJ9eUXE6bT5lsERHMkbHDr8dFgjx192ehEYmVR9j8UvHtqeSt R0jA== X-Gm-Message-State: AO0yUKWTblU8l7BSzD8m2OAGst46zv9FjqPikzt/Bm0EaBEG2F+WIMxn nhiXLYrgX6J5MOX9oe8h99qHtMCyrWH0+GxZ X-Google-Smtp-Source: AK7set9oyjrdCSr/mxcC9cHApzEcS/fejnorMK+TeAPNNDJ5kxdGOlyZebaq4MC+l+UOvzOQGZvvdg== X-Received: by 2002:a92:ca47:0:b0:316:e453:537c with SMTP id q7-20020a92ca47000000b00316e453537cmr4675033ilo.11.1677093295990; Wed, 22 Feb 2023 11:14:55 -0800 (PST) Received: from kea.bld.corp.google.com ([2620:15c:183:200:ba91:a998:7b71:c020]) by smtp.gmail.com with ESMTPSA id x18-20020a056e020f1200b00316e3a38becsm1212178ilj.18.2023.02.22.11.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 11:14:55 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Mark Kettenis , Tom Rini , Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Mike Frysinger , Simon Glass Subject: [PATCH v2 2/5] binman: Update bintools documentation Date: Wed, 22 Feb 2023 12:14:46 -0700 Message-Id: <20230222191449.1309107-3-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230222191449.1309107-1-sjg@chromium.org> References: <20230222191449.1309107-1-sjg@chromium.org> MIME-Version: 1.0 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 This was not regenerated with recent changes. Update it. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/bintools.rst | 70 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/tools/binman/bintools.rst b/tools/binman/bintools.rst index edb373ab59b..c30e7eb9ff5 100644 --- a/tools/binman/bintools.rst +++ b/tools/binman/bintools.rst @@ -10,6 +10,20 @@ binaries. It is fairly easy to create new bintools. Just add a new file to the +Bintool: bzip2: Compression/decompression using the bzip2 algorithm +------------------------------------------------------------------- + +This bintool supports running `bzip2` 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 bzip2 + + + Bintool: cbfstool: Coreboot filesystem (CBFS) tool -------------------------------------------------- @@ -58,6 +72,20 @@ See `Chromium OS vboot documentation`_ for more information. +Bintool: gzip: 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 + + + Bintool: ifwitool: Handles the 'ifwitool' tool ---------------------------------------------- @@ -101,6 +129,20 @@ Documentation is available via:: +Bintool: lzop: Compression/decompression using the lzop algorithm +----------------------------------------------------------------- + +This bintool supports running `lzop` 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 lzop + + + Bintool: mkimage: Image generation for U-Boot --------------------------------------------- @@ -113,3 +155,31 @@ Support is provided for fetching this on Debian-like systems, using apt. +Bintool: xz: Compression/decompression using the xz algorithm +------------------------------------------------------------- + +This bintool supports running `xz` 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 xz + + + +Bintool: zstd: Compression/decompression using the zstd algorithm +----------------------------------------------------------------- + +This bintool supports running `zstd` 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 zstd + + + From patchwork Wed Feb 22 19:14:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1746513 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=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=WmJJUitx; 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 4PMQqW0T2mz23yZ for ; Thu, 23 Feb 2023 06:16:04 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1623E85AF1; Wed, 22 Feb 2023 20:15:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="WmJJUitx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 29DD185A82; Wed, 22 Feb 2023 20:15:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 02D2485A82 for ; Wed, 22 Feb 2023 20:14:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12d.google.com with SMTP id i24so3885603ila.7 for ; Wed, 22 Feb 2023 11:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oxzowBRGYQP70aVHnvARJrsCLZA6VVBAy0Lp2tci9a8=; b=WmJJUitxDp7s8WmTnGKOuoE7ET0yZX/XleLbB3Fbm5Bd2yooZvCdwgSC5lhro9EOcm EjpoatmgWAUcyqPvWQsIkmquDvLGX4lbiq+2te51xKtJ2CtwRVWRGpZBG4FxF4FFBUUV /N9dar/kUAb4cUxtF+g0YWC+F2Q6DfTHeSkB8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oxzowBRGYQP70aVHnvARJrsCLZA6VVBAy0Lp2tci9a8=; b=G6bP+pll/iiFmmc4CzB32JTw1tSlOdS3pt1Yr5S1BIOG2v+Qp2IrS6/7z+y12uN6x8 HO3f4UgWj6MIjMuJ4XT/3NBtafLqtyIvvluezBsfDlSkbgeghPAMzru/VW5DvWHMIjAF cqHvsAus/iYSxcmqvdJzLeSqlDMU4N8ET148Bl/CS7b20FJb7RTuPXSdZU6Vodk3S8t2 22FbHI8jjaj1YeRC413Pr7PEqw37VqC/EtZB0Gd1uWEtCexniAaNNXIljz0TG3R4guPE Gx6EBIYou2JtTZNolpuBMw6GtBYiuOMKo7oj+wSdPjp3Wj3jxZkDV4XLUiRK7n8YHgFh JEMA== X-Gm-Message-State: AO0yUKX6tWA4kxEO6kpkFOOLeK1FKPh6b83ujqLJ4xh3kHfpHQHV2MmN QxcYc3Jq2rtgxnl3YOKad9Co2GqM2s4N4xMQ X-Google-Smtp-Source: AK7set+iskdrhDEdA01l2ADY/1jqD/RNPgA7IIxJ6t7VIdos44FJ5NjKz+ECKPxos5z6j9keoOiYXA== X-Received: by 2002:a05:6e02:1948:b0:313:fea2:be5c with SMTP id x8-20020a056e02194800b00313fea2be5cmr7149264ilu.11.1677093297048; Wed, 22 Feb 2023 11:14:57 -0800 (PST) Received: from kea.bld.corp.google.com ([2620:15c:183:200:ba91:a998:7b71:c020]) by smtp.gmail.com with ESMTPSA id x18-20020a056e020f1200b00316e3a38becsm1212178ilj.18.2023.02.22.11.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 11:14:56 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Mark Kettenis , Tom Rini , Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Mike Frysinger , Simon Glass Subject: [PATCH v2 3/5] binman: Move the tools directory into the Bintool class Date: Wed, 22 Feb 2023 12:14:47 -0700 Message-Id: <20230222191449.1309107-4-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230222191449.1309107-1-sjg@chromium.org> References: <20230222191449.1309107-1-sjg@chromium.org> MIME-Version: 1.0 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 We want to be able to change this directory. Use a class member to hold the value, since changing a constant is not good. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/bintool.py | 7 ++++--- tools/binman/bintool_test.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index e1dff9aa1b5..302161fcb47 100644 --- a/tools/binman/bintool.py +++ b/tools/binman/bintool.py @@ -43,8 +43,6 @@ FETCH_NAMES = { # Status of tool fetching FETCHED, FAIL, PRESENT, STATUS_COUNT = range(4) -DOWNLOAD_DESTDIR = os.path.join(os.getenv('HOME'), 'bin') - class Bintool: """Tool which operates on binaries to help produce entry contents @@ -53,6 +51,9 @@ class Bintool: # List of bintools to regard as missing missing_list = [] + # Directory to store tools + tooldir = os.path.join(os.getenv('HOME'), 'bin') + def __init__(self, name, desc, version_regex=None, version_args='-V'): self.name = name self.desc = desc @@ -208,7 +209,7 @@ class Bintool: return FAIL if result is not True: fname, tmpdir = result - dest = os.path.join(DOWNLOAD_DESTDIR, self.name) + dest = os.path.join(self.tooldir, self.name) print(f"- writing to '{dest}'") shutil.move(fname, dest) if tmpdir: diff --git a/tools/binman/bintool_test.py b/tools/binman/bintool_test.py index 7efb8391db2..57e866eff93 100644 --- a/tools/binman/bintool_test.py +++ b/tools/binman/bintool_test.py @@ -139,7 +139,7 @@ class TestBintool(unittest.TestCase): dest_fname = os.path.join(destdir, '_testing') self.seq = 0 - with unittest.mock.patch.object(bintool, 'DOWNLOAD_DESTDIR', destdir): + with unittest.mock.patch.object(bintool.Bintool, 'tooldir', destdir): with unittest.mock.patch.object(tools, 'download', side_effect=handle_download): with test_util.capture_sys_output() as (stdout, _): @@ -250,7 +250,7 @@ class TestBintool(unittest.TestCase): btest = Bintool.create('_testing') col = terminal.Color() self.fname = None - with unittest.mock.patch.object(bintool, 'DOWNLOAD_DESTDIR', + with unittest.mock.patch.object(bintool.Bintool, 'tooldir', self._indir): with unittest.mock.patch.object(tools, 'run', side_effect=fake_run): with test_util.capture_sys_output() as (stdout, _): From patchwork Wed Feb 22 19:14:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1746515 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=85.214.62.61; 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=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=cRGP3BHv; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4PMQr031Zqz23yZ for ; Thu, 23 Feb 2023 06:16:32 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ACB6485B61; Wed, 22 Feb 2023 20:15:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="cRGP3BHv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A56C185AF6; Wed, 22 Feb 2023 20:15:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4C73385AF6 for ; Wed, 22 Feb 2023 20:15:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x131.google.com with SMTP id e10so3838528ilu.4 for ; Wed, 22 Feb 2023 11:15:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Q1DG86CL/4uWZvA7scqGIWlQKLRJuDBLJx/fVy/MtMs=; b=cRGP3BHvTK7o9FB8+1Li7ysxqJP9TLjbbCksQ29AYd2GeQ0Yil6ctNGvYHLhkrgjmx bDTWss5YWVW4Q0D9zAfxT3moQu0zxt2YRLKw6JIYlY4CXO4PiL1z9t0SCdOjcvSpw00a kx4X+2pYt5GPhaJaa2ypQK3fq4G+MDfx63vjM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q1DG86CL/4uWZvA7scqGIWlQKLRJuDBLJx/fVy/MtMs=; b=pyE6KOFNUTynFyvmkjlLqM7rqy/THEGFmkyLLLRodhBWiTWYhb1IEvI/HU0hySQGkK CE8qr6anfPULNHDa0Ds9D1JcmSqCAs4Fn+OCViadvCmLPdsbFv1NMVC6m4gArnheAZva 17hauyhCFFavZ+Zxrao2s5KXdQCgmLZAsPiDyupgQu1G490qGlu5V6L2IA8XkDJ0n+QV S2kQDGVh6ghqPf+Fx++BAkKKzlMXYniOeFvL/ESEpktN2a3CzwaxAABBce/VLljjiDW+ JNeucdJ5HYYO2DeDypH6rjxKlIMQN4Fn9kNnK5xOIsi8MNxdoN0KuBSa3hKAlRm781rC xohA== X-Gm-Message-State: AO0yUKXhe6H8EDZhcrtax47miyG0RxXx7owlbgRtGYNutYXnq+KS+sI6 3qjobeIAVlb1ebLC77aEM/23txW/+m5r2TAJ X-Google-Smtp-Source: AK7set9r9Wfw5a/oZF9owx74AbtlrburXnfgTwH91GtEGlKGmVdwxvV/uZ8/EwCfK4g7wHvTROYwwQ== X-Received: by 2002:a05:6e02:1cae:b0:314:1ebe:b196 with SMTP id x14-20020a056e021cae00b003141ebeb196mr7621554ill.16.1677093298130; Wed, 22 Feb 2023 11:14:58 -0800 (PST) Received: from kea.bld.corp.google.com ([2620:15c:183:200:ba91:a998:7b71:c020]) by smtp.gmail.com with ESMTPSA id x18-20020a056e020f1200b00316e3a38becsm1212178ilj.18.2023.02.22.11.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 11:14:57 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Mark Kettenis , Tom Rini , Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Mike Frysinger , Simon Glass Subject: [PATCH v2 4/5] binman: Use a private directory for bintools Date: Wed, 22 Feb 2023 12:14:48 -0700 Message-Id: <20230222191449.1309107-5-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230222191449.1309107-1-sjg@chromium.org> References: <20230222191449.1309107-1-sjg@chromium.org> MIME-Version: 1.0 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 At present binman writes tools into the ~/bin directory. This is convenient but some may be concerned about downloading unverified binaries and running them. Place then in a special ~/.binman-tools directory instead. Mention this in the documentation. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- (no changes since v1) tools/binman/binman.rst | 2 ++ tools/binman/bintool.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst index 2bcb7d3886f..29034da92f1 100644 --- a/tools/binman/binman.rst +++ b/tools/binman/binman.rst @@ -1407,6 +1407,8 @@ You can also use `--fetch all` to fetch all tools or `--fetch ` to fetch a particular tool. Some tools are built from source code, in which case you will need to have at least the `build-essential` and `git` packages installed. +Tools are fetched into the `~/.binman-tools` directory. + Bintool Documentation ===================== diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index 302161fcb47..6ca3d886200 100644 --- a/tools/binman/bintool.py +++ b/tools/binman/bintool.py @@ -52,7 +52,7 @@ class Bintool: missing_list = [] # Directory to store tools - tooldir = os.path.join(os.getenv('HOME'), 'bin') + tooldir = os.path.join(os.getenv('HOME'), '.binman-tools') def __init__(self, name, desc, version_regex=None, version_args='-V'): self.name = name From patchwork Wed Feb 22 19:14:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1746516 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=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=XoqSWLzv; 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 4PMQr96m17z23yZ for ; Thu, 23 Feb 2023 06:16:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5C8F185B24; Wed, 22 Feb 2023 20:15:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="XoqSWLzv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E62EC85B4C; Wed, 22 Feb 2023 20:15:12 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 865A885B3C for ; Wed, 22 Feb 2023 20:15:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2c.google.com with SMTP id v10so962593iox.8 for ; Wed, 22 Feb 2023 11:15:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SNQafe4YbkU4iY/526eH3bpKPf6+V9lb37wPHjcB/R0=; b=XoqSWLzvSq9QkF7UgFsAgdtQzqx1zK+bA1UAE6m3BDZrfcdbMRgbo4CMCAK1D28tUS Os8Uhnkm4fEVhLdvEr06Ix806VYmPaTEmoefcK3g3ELRbBjz8LYqJcd+qrS4XSaYI+/F F/kKr687mup7NFSXMRM9fsKR+A/VbAGGoPqEA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SNQafe4YbkU4iY/526eH3bpKPf6+V9lb37wPHjcB/R0=; b=XEgUcqXZxSiYMXYHNcRBAkoOI/Y19xBlx0wkTmG/Etjf4+Pym123rtl1+Tqkbp13lC vsEkmYr514Y0ozR6feWxxbJ7PwgAY3p5hbK3hMK8pKjwnJPyuCnEZYYlA9UrJSscFBbH zllbvd+LhgQ89wOpg62CYw659Uugbd1LchD5ib14/UV8MdOa30KLbKMU7sZNce0Vna57 tLEiNtxJcLk5qUyMKOsZ4J/Q0r978Ec4o+XuAMbeHRg1b/dYXhIgfxvM+ZzgwpelOQl7 sEs09LtAvae3I5Ikk98Y4pOvdbagDgM4fPl89Ja2afQb4FhgKL+i9IgDnNKdL3P5b0Yq +hZA== X-Gm-Message-State: AO0yUKX+CQTV7RmaXxG/i1or61oeWGRwgbuWa7LZmWcvr9ZDr5QcBykD INV0ExuOXKd6XZH5TC/YdzB35+2xobyEZhfG X-Google-Smtp-Source: AK7set9zxhBZphnpviOkhrubQgiCzyzIaI+vdizXMohinHAu/1mpX+ObMcgENZaY9SxNjeI9Rlq0ug== X-Received: by 2002:a5e:c60a:0:b0:74c:9450:8094 with SMTP id f10-20020a5ec60a000000b0074c94508094mr1973640iok.17.1677093299994; Wed, 22 Feb 2023 11:14:59 -0800 (PST) Received: from kea.bld.corp.google.com ([2620:15c:183:200:ba91:a998:7b71:c020]) by smtp.gmail.com with ESMTPSA id x18-20020a056e020f1200b00316e3a38becsm1212178ilj.18.2023.02.22.11.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 11:14:59 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Mark Kettenis , Tom Rini , Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Mike Frysinger , Simon Glass Subject: [PATCH v2 5/5] binman: Make the tooldir configurable Date: Wed, 22 Feb 2023 12:14:49 -0700 Message-Id: <20230222191449.1309107-6-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230222191449.1309107-1-sjg@chromium.org> References: <20230222191449.1309107-1-sjg@chromium.org> MIME-Version: 1.0 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 Add a command-line argument for setting the tooldir, so that the default can be overridden. Add this directory to the toolpath automatically. Create the directory if it does not already exist. Put the default in the argument parser instead of the class, so that it is more obvious. Update a few tests that expect the utility name to be provided without any path (e.g. 'futility'), so they can accept a path, e.g. /path/to/futility Update the documentation and add a few tests. Improve the help for --toolpath while we are here. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: - Add comment about setting of tooldir - Change default tooldir to an empty string - Use exist_ok with os.makedirs() tools/binman/binman.rst | 19 +++++++++++++++---- tools/binman/bintool.py | 11 +++++++++-- tools/binman/bintool_test.py | 11 ++++++++--- tools/binman/cmdline.py | 6 +++++- tools/binman/control.py | 10 ++++++++-- tools/binman/ftest.py | 21 +++++++++++++++++++-- 6 files changed, 64 insertions(+), 14 deletions(-) diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst index 29034da92f1..3b0a9c38d72 100644 --- a/tools/binman/binman.rst +++ b/tools/binman/binman.rst @@ -1407,7 +1407,15 @@ You can also use `--fetch all` to fetch all tools or `--fetch ` to fetch a particular tool. Some tools are built from source code, in which case you will need to have at least the `build-essential` and `git` packages installed. -Tools are fetched into the `~/.binman-tools` directory. +Tools are fetched into the `~/.binman-tools` directory. This directory is +automatically added to the toolpath so there is no need to use `--toolpath` to +specify it. If you want to use these tools outside binman, you may want to +add this directory to your `PATH`. For example, if you use bash, add this to +the end of `.bashrc`:: + + PATH="$HOME/.binman-tools:$PATH" + +To select a custom directory, use the `--tooldir` option. Bintool Documentation ===================== @@ -1427,8 +1435,9 @@ Binman commands and arguments Usage:: - binman [-h] [-B BUILD_DIR] [-D] [-H] [--toolpath TOOLPATH] [-T THREADS] - [--test-section-timeout] [-v VERBOSITY] [-V] + binman [-h] [-B BUILD_DIR] [-D] [--tooldir TOOLDIR] [-H] + [--toolpath TOOLPATH] [-T THREADS] [--test-section-timeout] + [-v VERBOSITY] [-V] {build,bintool-docs,entry-docs,ls,extract,replace,test,tool} ... Binman provides the following commands: @@ -1453,11 +1462,13 @@ Options: -D, --debug Enabling debugging (provides a full traceback on error) +--tooldir TOOLDIR Set the directory to store tools + -H, --full-help Display the README file --toolpath TOOLPATH - Add a path to the directories containing tools + Add a path to the list of directories containing tools -T THREADS, --threads THREADS Number of threads to use (0=single-thread). Note that -T0 is useful for diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index 6ca3d886200..7674dfdf7bd 100644 --- a/tools/binman/bintool.py +++ b/tools/binman/bintool.py @@ -51,8 +51,9 @@ class Bintool: # List of bintools to regard as missing missing_list = [] - # Directory to store tools - tooldir = os.path.join(os.getenv('HOME'), '.binman-tools') + # Directory to store tools. Note that this set up by set_tool_dir() which + # must be called before this class is used. + tooldir = '' def __init__(self, name, desc, version_regex=None, version_args='-V'): self.name = name @@ -113,6 +114,11 @@ class Bintool: obj = cls(name) return obj + @classmethod + def set_tool_dir(cls, pathname): + """Set the path to use to store and find tools""" + cls.tooldir = pathname + def show(self): """Show a line of information about a bintool""" if self.is_present(): @@ -210,6 +216,7 @@ class Bintool: if result is not True: fname, tmpdir = result dest = os.path.join(self.tooldir, self.name) + os.makedirs(self.tooldir, exist_ok=True) print(f"- writing to '{dest}'") shutil.move(fname, dest) if tmpdir: diff --git a/tools/binman/bintool_test.py b/tools/binman/bintool_test.py index 57e866eff93..39e4fb13e92 100644 --- a/tools/binman/bintool_test.py +++ b/tools/binman/bintool_test.py @@ -134,8 +134,10 @@ class TestBintool(unittest.TestCase): dirname = os.path.join(self._indir, 'download_dir') os.mkdir(dirname) fname = os.path.join(dirname, 'downloaded') + + # Rely on bintool to create this directory destdir = os.path.join(self._indir, 'dest_dir') - os.mkdir(destdir) + dest_fname = os.path.join(destdir, '_testing') self.seq = 0 @@ -344,8 +346,11 @@ class TestBintool(unittest.TestCase): def test_failed_command(self): """Check that running a command that does not exist returns None""" - btool = Bintool.create('_testing') - result = btool.run_cmd_result('fred') + destdir = os.path.join(self._indir, 'dest_dir') + os.mkdir(destdir) + with unittest.mock.patch.object(bintool.Bintool, 'tooldir', destdir): + btool = Bintool.create('_testing') + result = btool.run_cmd_result('fred') self.assertIsNone(result) diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py index 986d6f1a315..4eed3073dce 100644 --- a/tools/binman/cmdline.py +++ b/tools/binman/cmdline.py @@ -7,6 +7,7 @@ import argparse from argparse import ArgumentParser +import os from binman import state def make_extract_parser(subparsers): @@ -80,8 +81,11 @@ controlled by a description in the board device tree.''' help='Enabling debugging (provides a full traceback on error)') parser.add_argument('-H', '--full-help', action='store_true', default=False, help='Display the README file') + parser.add_argument('--tooldir', type=str, + default=os.path.join(os.getenv('HOME'), '.binman-tools'), + help='Set the directory to store tools') parser.add_argument('--toolpath', type=str, action='append', - help='Add a path to the directories containing tools') + help='Add a path to the list of directories containing tools') parser.add_argument('-T', '--threads', type=int, default=None, help='Number of threads to use (0=single-thread)') parser.add_argument('--test-section-timeout', action='store_true', diff --git a/tools/binman/control.py b/tools/binman/control.py index e64740094f6..abe01b76773 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -650,6 +650,14 @@ def Binman(args): from binman.image import Image from binman import state + tool_paths = [] + if args.toolpath: + tool_paths += args.toolpath + if args.tooldir: + tool_paths.append(args.tooldir) + tools.set_tool_paths(tool_paths or None) + bintool.Bintool.set_tool_dir(args.tooldir) + if args.cmd in ['ls', 'extract', 'replace', 'tool']: try: tout.init(args.verbosity) @@ -667,7 +675,6 @@ def Binman(args): allow_resize=not args.fix_size, write_map=args.map) if args.cmd == 'tool': - tools.set_tool_paths(args.toolpath) if args.list: bintool.Bintool.list_all() elif args.fetch: @@ -719,7 +726,6 @@ def Binman(args): try: tools.set_input_dirs(args.indir) tools.prepare_output_dir(args.outdir, args.preserve) - tools.set_tool_paths(args.toolpath) state.SetEntryArgs(args.entry_arg) state.SetThreads(args.threads) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 062f54adb0e..7fe0ba4f3aa 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1750,7 +1750,7 @@ class TestFunctional(unittest.TestCase): def _HandleGbbCommand(self, pipe_list): """Fake calls to the futility utility""" - if pipe_list[0][0] == 'futility': + if 'futility' in pipe_list[0][0]: fname = pipe_list[0][-1] # Append our GBB data to the file, which will happen every time the # futility command is called. @@ -1812,7 +1812,7 @@ class TestFunctional(unittest.TestCase): self._hash_data is False, it writes VBLOCK_DATA, else it writes a hash of the input data (here, 'input.vblock'). """ - if pipe_list[0][0] == 'futility': + if 'futility' in pipe_list[0][0]: fname = pipe_list[0][3] with open(fname, 'wb') as fd: if self._hash_data: @@ -6386,6 +6386,23 @@ fdt fdtmap Extract the devicetree blob from the fdtmap self.assertEqual(['u-boot', 'atf-2'], fdt_util.GetStringList(node, 'loadables')) + def testTooldir(self): + """Test that we can specify the tooldir""" + with test_util.capture_sys_output() as (stdout, stderr): + self.assertEqual(0, self._DoBinman('--tooldir', 'fred', + 'tool', '-l')) + self.assertEqual('fred', bintool.Bintool.tooldir) + + # Check that the toolpath is updated correctly + self.assertEqual(['fred'], tools.tool_search_paths) + + # Try with a few toolpaths; the tooldir should be at the end + with test_util.capture_sys_output() as (stdout, stderr): + self.assertEqual(0, self._DoBinman( + '--toolpath', 'mary', '--toolpath', 'anna', '--tooldir', 'fred', + 'tool', '-l')) + self.assertEqual(['mary', 'anna', 'fred'], tools.tool_search_paths) + if __name__ == "__main__": unittest.main()