From patchwork Tue Jan 18 04:39:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 532853 Delivered-To: patch@linaro.org Received: by 2002:ad5:544f:0:0:0:0:0 with SMTP id a15csp3352165imp; Mon, 17 Jan 2022 20:40:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzifbXPRKmUcmQFRqxtgDJHlKRlxBLvEHuKLZ6A6cDCDUtQiRuRgvGhoM/Nk3Bf7Z/26gfs X-Received: by 2002:a05:6402:4413:: with SMTP id y19mr9358284eda.215.1642480830131; Mon, 17 Jan 2022 20:40:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642480830; cv=none; d=google.com; s=arc-20160816; b=dd+VyQ2fOfyEEsRsnwXO2RQ7+nNUZLB4OEk+3hm0sj9nnmy5oEVXxh1UlaNZhMdLDt L6kzKdbl1bAenfoRvs0p2IKnhTABZ9e8TvpgAyXqCxIzclpQy45b9Ev5FmqDP8h93dHL IYn82PMygZuRowqPeh7I3vFsFclMoUr+uGibcNQbg9SxGJr3+f6Ag20ZrUqXErRPRWFN ZfJnyy6Sz+R2QlkqXTD6r6HJQt9WLt+Bo9d1O9YnKID6MB3706x+vsjrIJ2wMDPfW+dP HFZD/pRncryb/cph/NU0miGmsk61mIQfCfqr1BctojvDPVAdQag8q0oB9TXKl9iW4YDy ujFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YdK4xS+KehJObphIe0jW3DAVkfXTUUC4u8DaW0NpuhY=; b=DLiqM4+Xu6p+ZNtOjRwc5/Ac+Upf3xhDV4yQ76E/S22Pm4MuPTNRvm/KqTkDYbS+ye AnQbfwfHKvhYtThfkakOEHfXYcXABIN/Dyw2MTeWFuMitssLmjFHxau3lQ0n8fcUDKHw 2dVdQPwBDAdpCOkAewS9bF1TZpRvL7aPluenm5uVL8zmorxN9hH2jIavddHe/rA7qMJT 22xrjoPaBvjp+yYfdIpvRlQnN/Go755n3vfGuH09sH+cZIuZrqegQhkGVH92h2zGDsOD RtA4VLWP9PtEBKyP4278AWkTgz65CcllnXrSr91cMUEnQt9sdkJNvmyyCQvkY3mlhydB Nduw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LItCZfxo; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id q12si8571221edc.545.2022.01.17.20.40.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 20:40:30 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LItCZfxo; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4851B837B6; Tue, 18 Jan 2022 05:40:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="LItCZfxo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3DCE83388; Tue, 18 Jan 2022 05:40:23 +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,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-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) (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 342648313B for ; Tue, 18 Jan 2022 05:40:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pl1-x62b.google.com with SMTP id c3so23302462pls.5 for ; Mon, 17 Jan 2022 20:40:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YdK4xS+KehJObphIe0jW3DAVkfXTUUC4u8DaW0NpuhY=; b=LItCZfxoekgzHDc7T1OIa0qGJHPBExOX1b69HIJ5NgFfdXZ3dQ86yNRmboWsrURykh ZyPpnU/oTx0NrCbTFV+YwK9E+vE60JtYkfwFCMmAlXx69gw3W/vhBX67TEZnmzy2HqQR NeNErVf8QE4fNy8HmbB0AFXmX93SptIuYYjZwiuEwn+uckhk1v4DMCaMG5MvPbI5mvoN 1+XLTtKKDB+ZRLqiKrQNlqSRxDHMgU41mh6eT1tgJYzyqQgzrDssQpL1S3Up4SJV6YS6 BhOHa9vBDO7xJ/nJFWPcuAyBmdvia9jvDx7ltb9b3k22RvEQ1C7z7qxrIE7/nJZaSN0d e60g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YdK4xS+KehJObphIe0jW3DAVkfXTUUC4u8DaW0NpuhY=; b=mFVEImNjTnhxpIa4k2HwO4zovtgTxl+NsI8NLHbe5/OH4+k1KEoednk/XXQ6dpjVrT buUjot9/qD95/G4i8584SqzPvInzl3So5NnAeG75XZywsFZipL3oJR8Uxl4dWaVgcufJ tVk6HjczNQvUjinnvjA8t/B/lCFxJg1Os+mKWVK69fBSvf9GeJlIrnm7UEZQulVAF0lR 3PtZZQQPktsRsHlOy0dPPQXRO5STI53KauQ20BIemwgkNXGAFbEWrhE5xO0JMom3mnUo x0OgKeg2uZF/I4Bpb2bW/8JyVYOq1nFEu2rYCkxPVnOPbXNVh2x+VH4Me0vJzIgJ3VbF 4kvQ== X-Gm-Message-State: AOAM533fL9qFwlM6PFtN7LRvLmWU/Vi+7DNjKE+E6lAkDU63h/wfkBO3 BS7Gje3LFy6pdG5TTGVnmb7MGSJkpPP8Pg== X-Received: by 2002:a17:90a:a418:: with SMTP id y24mr15872493pjp.48.1642480818498; Mon, 17 Jan 2022 20:40:18 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:bc1a:291e:ac91:be98]) by smtp.gmail.com with ESMTPSA id y69sm15670770pfg.171.2022.01.17.20.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 20:40:18 -0800 (PST) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, mark.kettenis@xs4all.nl, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v9 01/11] tools: mkeficapsule: output messages to stderr instead of stdout Date: Tue, 18 Jan 2022 13:39:44 +0900 Message-Id: <20220118043954.55940-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220118043954.55940-1-takahiro.akashi@linaro.org> References: <20220118043954.55940-1-takahiro.akashi@linaro.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.2 at phobos.denx.de X-Virus-Status: Clean All the error messages should be printed out to stderr. Signed-off-by: AKASHI Takahiro Reviewed-by: Heinrich Schuchardt --- tools/mkeficapsule.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index 4995ba4e0c2a..19d5eea3cb59 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -50,7 +50,7 @@ static struct option options[] = { static void print_usage(void) { - printf("Usage: %s [options] \n" + fprintf(stderr, "Usage: %s [options] \n" "Options:\n" "\t-f, --fit new FIT image file\n" @@ -74,28 +74,29 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, u64 offset; #ifdef DEBUG - printf("For output: %s\n", path); - printf("\tbin: %s\n\ttype: %pUl\n", bin, guid); - printf("\tindex: %ld\n\tinstance: %ld\n", index, instance); + fprintf(stderr, "For output: %s\n", path); + fprintf(stderr, "\tbin: %s\n\ttype: %pUl\n", bin, guid); + fprintf(stderr, "\tindex: %ld\n\tinstance: %ld\n", index, instance); #endif g = fopen(bin, "r"); if (!g) { - printf("cannot open %s\n", bin); + fprintf(stderr, "cannot open %s\n", bin); return -1; } if (stat(bin, &bin_stat) < 0) { - printf("cannot determine the size of %s\n", bin); + fprintf(stderr, "cannot determine the size of %s\n", bin); goto err_1; } data = malloc(bin_stat.st_size); if (!data) { - printf("cannot allocate memory: %zx\n", (size_t)bin_stat.st_size); + fprintf(stderr, "cannot allocate memory: %zx\n", + (size_t)bin_stat.st_size); goto err_1; } f = fopen(path, "w"); if (!f) { - printf("cannot open %s\n", path); + fprintf(stderr, "cannot open %s\n", path); goto err_2; } header.capsule_guid = efi_guid_fm_capsule; @@ -109,7 +110,7 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, size = fwrite(&header, 1, sizeof(header), f); if (size < sizeof(header)) { - printf("write failed (%zx)\n", size); + fprintf(stderr, "write failed (%zx)\n", size); goto err_3; } @@ -118,13 +119,13 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, capsule.payload_item_count = 1; size = fwrite(&capsule, 1, sizeof(capsule), f); if (size < (sizeof(capsule))) { - printf("write failed (%zx)\n", size); + fprintf(stderr, "write failed (%zx)\n", size); goto err_3; } offset = sizeof(capsule) + sizeof(u64); size = fwrite(&offset, 1, sizeof(offset), f); if (size < sizeof(offset)) { - printf("write failed (%zx)\n", size); + fprintf(stderr, "write failed (%zx)\n", size); goto err_3; } @@ -141,17 +142,17 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, size = fwrite(&image, 1, sizeof(image), f); if (size < sizeof(image)) { - printf("write failed (%zx)\n", size); + fprintf(stderr, "write failed (%zx)\n", size); goto err_3; } size = fread(data, 1, bin_stat.st_size, g); if (size < bin_stat.st_size) { - printf("read failed (%zx)\n", size); + fprintf(stderr, "read failed (%zx)\n", size); goto err_3; } size = fwrite(data, 1, bin_stat.st_size, f); if (size < bin_stat.st_size) { - printf("write failed (%zx)\n", size); + fprintf(stderr, "write failed (%zx)\n", size); goto err_3; } @@ -194,7 +195,7 @@ int main(int argc, char **argv) switch (c) { case 'f': if (file) { - printf("Image already specified\n"); + fprintf(stderr, "Image already specified\n"); return -1; } file = optarg; @@ -202,7 +203,7 @@ int main(int argc, char **argv) break; case 'r': if (file) { - printf("Image already specified\n"); + fprintf(stderr, "Image already specified\n"); return -1; } file = optarg; @@ -234,7 +235,7 @@ int main(int argc, char **argv) if (create_fwbin(argv[optind], file, guid, index, instance) < 0) { - printf("Creating firmware capsule failed\n"); + fprintf(stderr, "Creating firmware capsule failed\n"); exit(EXIT_FAILURE); }