Hi Clemens,

as far as I know, this will require a change in Barebox scripts/imx/imx-image.c,
because in this version it expects input file as command line option
and does not understand piped input anymore.

This is how I deal with this issue, but it wont work with both versions.

From: Denis Osterland <[email protected]>
Date: Thu, 18 May 2017 07:40:48 +0200
Subject: [PATCH] imx-image: Adapt command line of cst call to match changed
 cli.

Current version 2.3.2 of freescales code-sign-tool expects '-i file' instead of 
stdin.
---
 scripts/imx/imx-image.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index dd5799cccc4b..ed3f4ffa50c3 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -517,7 +517,7 @@ static int nop(const struct config_data *data)
 static int hab_sign(struct config_data *data)
 {
        int fd, outfd, ret, lockfd;
-       char *csffile, *command;
+       char *csffile, *command, *csfinput;
        struct stat s;
        char *cst;
        void *buf;
@@ -530,6 +530,10 @@ static int hab_sign(struct config_data *data)
        if (ret < 0)
                exit(1);
 
+       ret = asprintf(&csfinput, "%s.csf", data->outfile);
+       if (ret < 0)
+               exit(1);
+
        ret = stat(csffile, &s);
        if (!ret) {
                if (S_ISREG(s.st_mode)) {
@@ -546,7 +550,7 @@ static int hab_sign(struct config_data *data)
                }
        }
 
-       ret = asprintf(&command, "%s -o %s", cst, csffile);
+       ret = asprintf(&command, "%s -o %s -i %s", cst, csffile, csfinput);
        if (ret < 0)
                return -ENOMEM;
 
@@ -568,15 +572,20 @@ static int hab_sign(struct config_data *data)
                return -errno;
        }
 
-       FILE *f = popen(command, "w");
+       FILE *f = fopen(csfinput, "w");
        if (!f) {
-               perror("popen");
+               perror("fopen");
                return -errno;
        }
 
        fwrite(data->csf, 1, strlen(data->csf) + 1, f);
 
-       pclose(f);
+       fclose(f);
+
+       ret = system(command);
+       if (ret) {
+               exit(ret);
+       }
 
        flock(lockfd, LOCK_UN);
        close(lockfd);

Am Freitag, den 01.09.2017, 18:39 +0200 schrieb Clemens Gruber:
> Signed-off-by: Clemens Gruber <[email protected]>
> ---
>  rules/host-imx-cst.make | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/rules/host-imx-cst.make b/rules/host-imx-cst.make
> index b5aad5aee..dc2a17f4a 100644
> --- a/rules/host-imx-cst.make
> +++ b/rules/host-imx-cst.make
> @@ -16,8 +16,8 @@ HOST_PACKAGES-$(PTXCONF_HOST_IMX_CST) += host-imx-cst
>  #
>  # Paths and names
>  #
> -HOST_IMX_CST_VERSION := 2.3.1
> -HOST_IMX_CST_MD5     := 01684a853e9245dbd6db42acad5861dd
> +HOST_IMX_CST_VERSION := 2.3.2
> +HOST_IMX_CST_MD5     := a81766cab2e184ab12e459c0476f6639
>  HOST_IMX_CST         := cst-$(HOST_IMX_CST_VERSION)
>  HOST_IMX_CST_SUFFIX  := tar.gz
>  HOST_IMX_CST_URL     := 
> https://www.nxp.com/webapp/sps/download/license.jsp?colCode=IMX_CST_TOOL
Diehl AKO Stiftung & Co. KG, Pfannerstraße 75-83, 88239 Wangen im Allgäu
Bereichsvorstand: Dipl.-Ing. Michael Siedentop (Sprecher), Josef Fellner 
(Mitglied)
Sitz der Gesellschaft: Wangen i.A. – Registergericht: Amtsgericht Ulm HRA 
620609 – Persönlich haftende Gesellschafterin: Diehl Verwaltungs-Stiftung – 
Sitz: Nürnberg – Registergericht: Amtsgericht Nürnberg HRA 11756 –
Vorstand: Dr.-Ing. E.h. Thomas Diehl (†) (Vorsitzender), Herr 
Dipl.-Wirtsch.-Ing. Wolfgang Weggen (stellvertretender Vorsitzender), 
Dipl.-Kfm. Claus Günther, Dipl.-Kfm. Frank Gutzeit, Dr.-Ing. Heinrich Schunk, 
Dr.-Ing. Michael Siedentop , Dipl.-Kfm. Dr.-Ing. Martin Sommer, Dipl.-Ing. (FH) 
Rainer von Borstel, Vorsitzender des Aufsichtsrates: Dr. Klaus Maier
___________________________________________________________________________________________________
Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail 
enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten 
haben. Bitte loeschen Sie in diesem Fall die Nachricht. Jede unerlaubte Form 
der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation 
dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail 
contains confidential and/or legally protected information. Please inform us if 
you have received this e-mail by mistake and delete it in such a case. Each 
unauthorized reproduction, disclosure, alteration, distribution and/or 
publication of this e-mail is strictly prohibited.
_______________________________________________
ptxdist mailing list
[email protected]

Reply via email to