mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Yunus Bas <y.bas@phytec.de>
Subject: [PATCH 1/3] imd command: specify outfile for crc tag generation
Date: Mon,  7 Dec 2020 10:29:50 +0100	[thread overview]
Message-ID: <20201207092952.21438-1-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20201207092840.GH3977@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/imd.c       |  2 +-
 common/imd.c         | 11 +++++------
 scripts/bareboximd.c |  2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/commands/imd.c b/commands/imd.c
index 9f7ac79f8f..5cb80db0f5 100644
--- a/commands/imd.c
+++ b/commands/imd.c
@@ -33,7 +33,7 @@ BAREBOX_CMD_HELP_OPT ("-n <no>", "for tags with multiple strings only show strin
 BAREBOX_CMD_HELP_OPT ("-s VARNAME",  "set variable VARNAME instead of showing information")
 BAREBOX_CMD_HELP_OPT ("-v", "Be verbose")
 BAREBOX_CMD_HELP_OPT ("-V",  "Verify checksum of FILE")
-BAREBOX_CMD_HELP_OPT ("-c", "Create checksum for FILE and write it to the crc32 tag.")
+BAREBOX_CMD_HELP_OPT ("-c OUTFILE", "Create checksum for FILE and write it to the crc32 tag.")
 BAREBOX_CMD_HELP_TEXT("")
 BAREBOX_CMD_HELP_TEXT("Without options all information available is printed. Valid types are:")
 BAREBOX_CMD_HELP_TEXT("release, build, model, of_compatible")
diff --git a/common/imd.c b/common/imd.c
index 4aca8ea78f..044f04bcdd 100644
--- a/common/imd.c
+++ b/common/imd.c
@@ -435,15 +435,14 @@ int imd_command(int argc, char *argv[])
 	size_t size;
 	uint32_t type = IMD_TYPE_INVALID;
 	const struct imd_header *imd_start, *imd;
-	const char *filename;
+	const char *filename, *checksumfile = NULL;
 	const char *variable_name = NULL;
 	char *str;
-	uint32_t checksum = 0;
 	uint32_t verify = 0;
 
 	imd_command_verbose = 0;
 
-	while ((opt = getopt(argc, argv, "vt:s:n:cV")) > 0) {
+	while ((opt = getopt(argc, argv, "vt:s:n:c:V")) > 0) {
 		switch(opt) {
 		case 't':
 			type = imd_name_to_type(optarg);
@@ -462,7 +461,7 @@ int imd_command(int argc, char *argv[])
 			strno = simple_strtoul(optarg, NULL, 0);
 			break;
 		case 'c':
-			checksum = 1;
+			checksumfile = optarg;
 			break;
 		case 'V':
 			verify = 1;
@@ -489,8 +488,8 @@ int imd_command(int argc, char *argv[])
 		goto out;
 	}
 
-	if (checksum) {
-		ret = imd_write_crc32(buf, imd_start, filename, size);
+	if (checksumfile) {
+		ret = imd_write_crc32(buf, imd_start, checksumfile, size);
 		goto out;
 	}
 
diff --git a/scripts/bareboximd.c b/scripts/bareboximd.c
index 0500e01cc2..1ae01e43d3 100644
--- a/scripts/bareboximd.c
+++ b/scripts/bareboximd.c
@@ -163,7 +163,7 @@ static void usage(const char *prgname)
 "-n <no>      for tags with multiple strings only show string <no>\n"
 "-v           Be verbose\n"
 "-V           Verify checksum of FILE\n"
-"-c           Create checksum for FILE and write it to the crc32 tag\n"
+"-c OUTFILE   Create checksum for FILE and write it to the crc32 tag\n"
 "\n"
 "Without options all information available is printed. Valid types are:\n"
 "release, build, model, of_compatible\n",
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-12-07  9:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 10:04 [PATCH] images: Add automatic image crc generation for imd Yunus Bas
2020-12-07  9:28 ` Sascha Hauer
2020-12-07  9:29   ` Sascha Hauer [this message]
2020-12-07  9:29     ` [PATCH 2/3] kbuild: Add command to generate the crc for the IMD crc tag Sascha Hauer
2020-12-07  9:29     ` [PATCH 3/3] images: i.MX: fill in crc in IMD crc tags Sascha Hauer
2020-12-08  8:09   ` [PATCH] images: Add automatic image crc generation for imd Yunus Bas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201207092952.21438-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=y.bas@phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox