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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6060C6FA8E for ; Fri, 3 Mar 2023 00:03:02 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CAFB785CA5; Fri, 3 Mar 2023 01:02: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=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="GK3oNMly"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 765DA85CC4; Fri, 3 Mar 2023 01:02:56 +0100 (CET) Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (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 22DB585918 for ; Fri, 3 Mar 2023 01:02:53 +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-x132.google.com with SMTP id z5so769399ilq.0 for ; Thu, 02 Mar 2023 16:02:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1677801771; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=AOdS/gvIwTif8twPnG/xREVA71qgo1L883BSz9r3/lI=; b=GK3oNMly0sRvVwlhvgc8OqujUIMO9HEHqtcc0JvON1xn9ffvPcG/GCtyVj6WZH/c1Q N11Cq5qRa6z4qd8m2G94rMjV6sPKMbw5xrRfKfEHWpiltXowQnQnizj5Bd9ZJmVycMkz 2/ybkETuQu8ePUo68ejQZR/0OrQ3ZYVhBm2BI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677801771; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AOdS/gvIwTif8twPnG/xREVA71qgo1L883BSz9r3/lI=; b=PWUnzVc8gt0Wt5HFwflOs4bJ80y8U6b/IuVUujeSq2Y3PuxWUYm482yfu728n2aJ3Y 31+UBRwb1KIwmWK8koF0A+W6R/wpdUEb5LS1jiThxiNXAUHnyZhEeTWQV4+YBjx8LNuA +D0M3p/3ka5i/wbFCgiitRW2+WcId5uBv8AcVSX2gdzkq204LdoURnH2fIwBw8ZY9K83 aAeHDMToC/juNi+LZjAALdGy6pd2F/2Oh6exiDHj6SjFsHIIfQaczj6yhzoITtZ9RQkB pUKh4SFL0P0zgrYS658CziYqtASxhrhXMkoNXrJETnfYYX+LJaABuDCAz8TV2Vm9teQJ QbFA== X-Gm-Message-State: AO0yUKU7rjPvGNqO6e5fEr0BXlzfikpI6v5KZmN5S/lWV/1Eg3ZOLK4P gFnRHO4WUln64dqK+8W9nZ48VBdIM6gLdDp4 X-Google-Smtp-Source: AK7set9Sur6RBY5kvGeAIediNnz+dNUpZeYrXsGTKnBCxfabInmFcEHAnxPdbpN6MMFgnUexKwaemg== X-Received: by 2002:a05:6e02:1b0b:b0:318:a84c:83bb with SMTP id i11-20020a056e021b0b00b00318a84c83bbmr325445ilv.6.1677801771600; Thu, 02 Mar 2023 16:02:51 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id z1-20020a02cea1000000b003acde48bdc3sm258404jaq.111.2023.03.02.16.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 16:02:51 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Jan Kiszka , Ivan Mikhaylov , Roman Kopytin , Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Simon Glass Subject: [PATCH v2 1/4] binman: Allow preserving the output dir when replacing Date: Thu, 2 Mar 2023 17:02:42 -0700 Message-Id: <20230303000246.2640473-1-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 these flags for the 'replace' subcommand too, to aid debugging. Signed-off-by: Simon Glass 44 2023 -0700 --- Changes in v2: - Add new patch to allow preserving the output dir when replacing tools/binman/binman.rst | 6 ++++++ tools/binman/cmdline.py | 16 ++++++++++------ tools/binman/control.py | 5 ++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/tools/binman/binman.rst b/tools/binman/binman.rst index 2bcb7d3886f..55ef317a691 100644 --- a/tools/binman/binman.rst +++ b/tools/binman/binman.rst @@ -1663,6 +1663,12 @@ Options: -m, --map Output a map file for the updated image +-O OUTDIR, --outdir OUTDIR + Path to directory to use for intermediate and output files + +-p, --preserve + Preserve temporary output directory even if option -O is not given + This replaces one or more entries in an existing image. See `Replacing files in an image`_. diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py index 986d6f1a315..d690b8b0775 100644 --- a/tools/binman/cmdline.py +++ b/tools/binman/cmdline.py @@ -67,6 +67,14 @@ def ParseArgs(argv): options provides access to the options (e.g. option.debug) args is a list of string arguments """ + def _AddPreserve(pars): + pars.add_argument('-O', '--outdir', type=str, + action='store', help='Path to directory to use for intermediate ' + 'and output files') + pars.add_argument('-p', '--preserve', action='store_true',\ + help='Preserve temporary output directory even if option -O is not ' + 'given') + if '-H' in argv: argv.append('build') @@ -118,12 +126,7 @@ controlled by a description in the board device tree.''' build_parser.add_argument('-n', '--no-expanded', action='store_true', help="Don't use 'expanded' versions of entries where available; " "normally 'u-boot' becomes 'u-boot-expanded', for example") - build_parser.add_argument('-O', '--outdir', type=str, - action='store', help='Path to directory to use for intermediate and ' - 'output files') - build_parser.add_argument('-p', '--preserve', action='store_true',\ - help='Preserve temporary output directory even if option -O is not ' - 'given') + _AddPreserve(build_parser) build_parser.add_argument('-u', '--update-fdt', action='store_true', default=False, help='Update the binman node with offset/size info') build_parser.add_argument('--update-fdt-in-elf', type=str, @@ -160,6 +163,7 @@ controlled by a description in the board device tree.''' help='Path to directory to use for input files') replace_parser.add_argument('-m', '--map', action='store_true', default=False, help='Output a map file for the updated image') + _AddPreserve(replace_parser) replace_parser.add_argument('paths', type=str, nargs='*', help='Paths within file to replace (wildcard)') diff --git a/tools/binman/control.py b/tools/binman/control.py index e64740094f6..f4e3898b34c 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -653,7 +653,10 @@ def Binman(args): if args.cmd in ['ls', 'extract', 'replace', 'tool']: try: tout.init(args.verbosity) - tools.prepare_output_dir(None) + if args.cmd == 'replace': + tools.prepare_output_dir(args.outdir, args.preserve) + else: + tools.prepare_output_dir(None) if args.cmd == 'ls': ListEntries(args.image, args.paths) -- 2.40.0.rc0.216.gc4246ad0f0-goog