mkimage: add option for adding dtc binary path via argument
PATCH 1/1 mkimage: add option for adding dtc binary path via argument
Add option for configuring path to dtc binary in mkimage command. The dtc binary might not always be located in $PATH.
--- doc/mkimage.1 | 4 ++++ tools/fit_image.c | 3 ++- tools/mkimage.c | 14 +++++++++++--- tools/mkimage.h | 5 +++-- 4 files changed, 20 insertions(+), 6 deletions(-)
doc/mkimage.1 +4 -0
@@ -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.
tools/fit_image.c +2 -1
@@ -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",
tools/mkimage.c +11 -3
@@ -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);
tools/mkimage.h +3 -2
@@ -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;
PATCH 1/1 mkimage: add option for adding dtc binary path via argument
Dear Luka Perkov,
Quoted 2 lines · In message <20130505190930-21234@mutt-kz> you wrote:
Add option for configuring path to dtc binary in mkimage command. The dtc binary might not always be located in $PATH.
Could you please explain why that would be needed? What prevents you adding the respective directory to your PATH?
Even if you do not want to do this ingeneral for some reason, running
PATH=your_dir:$PATH mkimage ...
appears to be still much less trouble (no need to change the code) than your approach.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de God runs electromagnetics by wave theory on Monday, Wednesday, and Friday, and the Devil runs them by quantum theory on Tuesday, Thurs- day, and Saturday. -- William Bragg
PATCH 1/1 mkimage: add option for adding dtc binary path via argument
Hi Wolfgang,
Quoted 6 lines · Wolfgang Denk
Quoted 2 lines · In message <20130505190930-21234@mutt-kz> you wrote:
Add option for configuring path to dtc binary in mkimage command. The dtc binary might not always be located in $PATH.
Could you please explain why that would be needed? What prevents you adding the respective directory to your PATH?
I could do that too. I think it's much more elegant to tell mkimage where dwc is located instead of tampering with the $PATH. Also, since we are adding dtc options via arguments it seamed like a valid approach.
Luka
PATCH 1/1 mkimage: add option for adding dtc binary path via argument
Dear Luka Perkov,
Quoted 10 lines · In message <20130506080157-11499@mutt-kz> you wrote:
Quoted 6 lines
Quoted 3 lines
Add option for configuring path to dtc binary in mkimage command. The dtc binary might not always be located in $PATH.
Could you please explain why that would be needed? What prevents you adding the respective directory to your PATH?
I could do that too. I think it's much more elegant to tell mkimage where dwc is located instead of tampering with the $PATH. Also, since we are adding dtc options via arguments it seamed like a valid approach.
Well, no. The standard approach to tell the system about where to find tools is to set PATH.
Using options does not scale.
It appears there is no really good reason for this patch, so I think we should drop it.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Why should we subsidize intellectual curiosity?" - Ronald Reagan
PATCH 1/1 mkimage: add option for adding dtc binary path via argument
Quoted 2 lines · Wolfgang Denk
It appears there is no really good reason for this patch, so I think we should drop it.
Ok. Thanks for the review.
Luka
PATCH 1/1 mkimage: add option for adding dtc binary path via argument
Quoted 5 lines · Luka Perkov
Quoted 2 lines · Wolfgang Denk
It appears there is no really good reason for this patch, so I think we should drop it.
Ok. Thanks for the review.
Would there be any objection to adding an option to pass source paths to dtc from mkimage? Currently, in order to do that, I have to find the source for mkimage, grab the default dtc options out of mkimage.h and then pass that set on the command line. It would be nice and only slightly more future proof if I could just pass the source file search paths separately.
local t=${VSD_PATH}/app/flasher/uboot_flasher
local t2=${t}/tools
PATH=${t2}:$PATH ${t2}/mkimage -D "-I dts -O dtb -p 500 -i ${release_dir}" \
-f ${t}/update_field_mode.its spot_update.binI'd like to pass one or more paths like "${release_dir}" without having to pass (or even know about) "-I dts -O dtb -p 500".
PATCH 1/1 mkimage: add option for adding dtc binary path via argument
Hi,
Quoted 9 lines · Harvey Chapman
Quoted 5 lines · Luka Perkov
Quoted 2 lines · Wolfgang Denk
It appears there is no really good reason for this patch, so I think we should drop it.
Ok. Thanks for the review.
Would there be any objection to adding an option to pass source paths to dtc from mkimage? Currently, in order to do that, I have to find the source for mkimage, grab the default dtc options out of
mkimage.hand then pass that set on the command line. It would be nice and only slightly more future proof if I could just pass the source file search paths separately.
So you mean the -i option? I think that would be valuable, yes. Without it you need to put all your files in one directory, or maintain the same directory structure in your release directory. It gets really ugly. The -i option was added to deal with this and I think it makes sense to make it available in mkimage.
Quoted 7 lines
local t=${VSD_PATH}/app/flasher/uboot_flasher
local t2=${t}/toolsPATH=${t2}:$PATH ${t2}/mkimage -D "-I dts -O dtb -p 500 -i ${release_dir}" \ -f ${t}/update_field_mode.its spot_update.bin
Quoted 6 lines
I'd like to pass one or more paths like "${release_dir}" without having to pass (or even know about) "-I dts -O dtb -p 500".
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Regards,
Simon