public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Luka Perkov <luka@openwrt.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mkimage: add option for adding dtc binary path via argument
Date: Sun, 5 May 2013 21:09:30 +0200	[thread overview]
Message-ID: <20130505190930-21234@mutt-kz> (raw)

Add option for configuring path to dtc binary in mkimage command. The
dtc binary might not always be located in $PATH.

Signed-off-by: Luka Perkov <luka@openwrt.org>
---
 doc/mkimage.1     |  4 ++++
 tools/fit_image.c |  3 ++-
 tools/mkimage.c   | 14 +++++++++++---
 tools/mkimage.h   |  5 +++--
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 39652c8..8cf5686 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -82,6 +82,10 @@ Set XIP (execute in place) flag.
 .B Create FIT image:
 
 .TP
+.BI "\-B [" "dtc bin" "]"
+Set path to the device tree compiler binary.
+
+.TP
 .BI "\-D [" "dtc options" "]"
 Provide special options to the device tree compiler that is used to
 create the image.
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 76bbba1..cd4db58 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -82,7 +82,8 @@ static int fit_handle_file (struct mkimage_params *params)
 
 	/* dtc -I dts -O dtb -p 500 datafile > tmpfile */
 	sprintf (cmd, "%s %s %s > %s",
-		MKIMAGE_DTC, params->dtc, params->datafile, tmpfile);
+		params->dtc_bin, params->dtc_options, params->datafile,
+		tmpfile);
 	debug ("Trying to execute \"%s\"\n", cmd);
 	if (system (cmd) == -1) {
 		fprintf (stderr, "%s: system(%s) failed: %s\n",
diff --git a/tools/mkimage.c b/tools/mkimage.c
index e43b09f..ac4ced7 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -37,7 +37,8 @@ struct mkimage_params params = {
 	.arch = IH_ARCH_PPC,
 	.type = IH_TYPE_KERNEL,
 	.comp = IH_COMP_GZIP,
-	.dtc = MKIMAGE_DEFAULT_DTC_OPTIONS,
+	.dtc_bin = MKIMAGE_DTC,
+	.dtc_options = MKIMAGE_DEFAULT_DTC_OPTIONS,
 	.imagename = "",
 	.imagename2 = "",
 };
@@ -189,10 +190,15 @@ main (int argc, char **argv)
 					genimg_get_comp_id (*++argv)) < 0)
 					usage ();
 				goto NXTARG;
+			case 'B':
+				if (--argc <= 0)
+					usage ();
+				params.dtc_bin = *++argv;
+				goto NXTARG;
 			case 'D':
 				if (--argc <= 0)
 					usage ();
-				params.dtc = *++argv;
+				params.dtc_options = *++argv;
 				goto NXTARG;
 
 			case 'O':
@@ -623,7 +629,9 @@ usage ()
 			 "          -d ==> use image data from 'datafile'\n"
 			 "          -x ==> set XIP (execute in place)\n",
 		params.cmdname);
-	fprintf (stderr, "       %s [-D dtc_options] -f fit-image.its fit-image\n",
+	fprintf (stderr, "       %s [-B dtc_bin] [-D dtc_options] -f fit-image.its fit-image\n",
+			 "           -B ==> set path to the dtc binary\n",
+			 "           -D ==> set options that will be passed to dtc\n",
 		params.cmdname);
 	fprintf (stderr, "       %s -V ==> print version information and exit\n",
 		params.cmdname);
diff --git a/tools/mkimage.h b/tools/mkimage.h
index ea45f5c..1c3b1e1 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -46,7 +46,7 @@
 #define MKIMAGE_MAX_TMPFILE_LEN		256
 #define MKIMAGE_DEFAULT_DTC_OPTIONS	"-I dts -O dtb -p 500"
 #define MKIMAGE_MAX_DTC_CMDLINE_LEN	512
-#define MKIMAGE_DTC			"dtc"   /* assume dtc is in $PATH */
+#define MKIMAGE_DTC			"dtc"
 
 /*
  * This structure defines all such variables those are initialized by
@@ -65,7 +65,8 @@ struct mkimage_params {
 	int arch;
 	int type;
 	int comp;
-	char *dtc;
+	char *dtc_bin;
+	char *dtc_options;
 	unsigned int addr;
 	unsigned int ep;
 	char *imagename;

             reply	other threads:[~2013-05-05 19:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-05 19:09 Luka Perkov [this message]
2013-05-06  4:32 ` [U-Boot] [PATCH] mkimage: add option for adding dtc binary path via argument Wolfgang Denk
2013-05-06  8:01   ` Luka Perkov
2013-05-06 12:32     ` Wolfgang Denk
2013-05-06 12:59       ` Luka Perkov
2013-08-14 16:58         ` Harvey Chapman
2013-08-14 18:26           ` Simon Glass

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=20130505190930-21234@mutt-kz \
    --to=luka@openwrt.org \
    --cc=u-boot@lists.denx.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