summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-devtools/cst-signer/cst-signer/0001-Improve-Makefile-so-it-is-overridable-and-provides-s.patch94
-rw-r--r--recipes-devtools/cst-signer/cst-signer/0002-Fix-include-of-headers-so-it-indicates-it-uses-the-i.patch63
-rw-r--r--recipes-devtools/cst-signer/cst-signer_git.bb39
3 files changed, 196 insertions, 0 deletions
diff --git a/recipes-devtools/cst-signer/cst-signer/0001-Improve-Makefile-so-it-is-overridable-and-provides-s.patch b/recipes-devtools/cst-signer/cst-signer/0001-Improve-Makefile-so-it-is-overridable-and-provides-s.patch
new file mode 100644
index 00000000..42c96fe5
--- /dev/null
+++ b/recipes-devtools/cst-signer/cst-signer/0001-Improve-Makefile-so-it-is-overridable-and-provides-s.patch
@@ -0,0 +1,94 @@
1From d7d6eebdb4f49e6a3d93c101f1fb23bb6e96f07c Mon Sep 17 00:00:00 2001
2From: Otavio Salvador <otavio@ossystems.com.br>
3Date: Thu, 12 Oct 2023 18:48:09 -0300
4Subject: [PATCH] Improve Makefile so it is overridable and provides
5 standardized targets
6
7This commit rework the Makefile targets so it provides a standardized
8set of targets and allow overriding of variables so cross compiling is
9properly supported.
10
11Upstream-Status: Submitted [https://github.com/nxp-imx-support/nxp-cst-signer/pull/2]
12
13Fixes: #1.
14Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
15---
16 Makefile | 14 +++++++-------
17 src/Makefile | 34 ++++++++++++++++++++++------------
18 2 files changed, 29 insertions(+), 19 deletions(-)
19
20diff --git a/Makefile b/Makefile
21index c799b13..a722744 100644
22--- a/Makefile
23+++ b/Makefile
24@@ -4,13 +4,13 @@
25 # SPDX-License-Identifier: GPL-2.0-or-later
26 #==============================================================================
27
28-SRC_DIR := src
29-
30-.PHONY: all clean
31-
32 all:
33- @$(MAKE) -C $(SRC_DIR)/
34- @mv $(SRC_DIR)/cst_signer .
35+ @$(MAKE) -C src
36+
37+install:
38+ @$(MAKE) -C src install
39
40 clean:
41- @rm -rf cst_signer src/fdt.o
42+ @$(MAKE) -C src clean
43+
44+.PHONY: all install clean
45diff --git a/src/Makefile b/src/Makefile
46index 5e6dade..101be12 100644
47--- a/src/Makefile
48+++ b/src/Makefile
49@@ -4,23 +4,33 @@
50 # SPDX-License-Identifier: GPL-2.0-or-later
51 #==============================================================================
52
53-CC = gcc
54+CC ?= gcc
55+CFLAGS ?= -g -Wall -Werror
56+CPPFLAGS ?=
57+LDFLAGS ?=
58+INCLUDES = -I../inc/
59
60-COPTS = -g -Wall -Werror
61-CFLAGS = -I../inc/.
62+PREFIX ?= /usr/local
63+BINDIR ?= $(PREFIX)/bin
64+DATADIR ?= $(PREFIX)/share
65
66-DEPS = cst_signer.h cfg_parser.h mkimage_helper.h
67-SRCS = cst_signer.c cfg_parser.c mkimage_helper.c fdt.o
68+SRCS = cst_signer.c cfg_parser.c mkimage_helper.c fdt.c
69
70-.PHONY: all clean
71+all: cst-signer
72
73-all: cst_signer fdt.o
74+%.o : %.c
75+ $(CC) -c $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) $< -o $@
76
77-fdt.o: fdt.c
78- $(CC) -c -w -o $@ $< $(CFLAGS)
79+cst-signer: $(SRCS:.c=.o)
80+ $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -o $@ $(SRCS:.c=.o)
81
82-cst_signer: cst_signer.c fdt.o
83- $(CC) $(COPTS) $(CFLAGS) -o $@ $(SRCS)
84+install: cst-signer
85+ install -D -m 0755 cst-signer $(DESTDIR)/$(BINDIR)/cst-signer
86+ install -D -m 0755 -t $(DESTDIR)$(DATADIR)/doc/cst-signer \
87+ ../csf_ahab.cfg.sample \
88+ ../csf_hab4.cfg.sample
89
90 clean:
91- rm -rf cst_signer fdt.o
92+ rm -rf cst-signer *.o
93+
94+.PHONY: all install clean
diff --git a/recipes-devtools/cst-signer/cst-signer/0002-Fix-include-of-headers-so-it-indicates-it-uses-the-i.patch b/recipes-devtools/cst-signer/cst-signer/0002-Fix-include-of-headers-so-it-indicates-it-uses-the-i.patch
new file mode 100644
index 00000000..5607a6e7
--- /dev/null
+++ b/recipes-devtools/cst-signer/cst-signer/0002-Fix-include-of-headers-so-it-indicates-it-uses-the-i.patch
@@ -0,0 +1,63 @@
1From fcdf06423d682cdafc092b67bbada3753c20bbd5 Mon Sep 17 00:00:00 2001
2From: Otavio Salvador <otavio@ossystems.com.br>
3Date: Thu, 12 Oct 2023 18:52:02 -0300
4Subject: [PATCH] Fix include of headers so it indicates it uses the includedir
5
6Upstream-Status: Submitted [https://github.com/nxp-imx-support/nxp-cst-signer/pull/2]
7
8Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
9---
10 src/cfg_parser.c | 2 +-
11 src/cst_signer.c | 10 ++++++----
12 src/fdt.c | 3 ++-
13 3 files changed, 9 insertions(+), 6 deletions(-)
14
15diff --git a/src/cfg_parser.c b/src/cfg_parser.c
16index 0f4ea0a..e289d13 100644
17--- a/src/cfg_parser.c
18+++ b/src/cfg_parser.c
19@@ -4,7 +4,7 @@
20 *
21 */
22
23-#include "cfg_parser.h"
24+#include <cfg_parser.h>
25
26 #define DELIMITER "="
27
28diff --git a/src/cst_signer.c b/src/cst_signer.c
29index 4d8825b..34d1711 100644
30--- a/src/cst_signer.c
31+++ b/src/cst_signer.c
32@@ -4,11 +4,13 @@
33 *
34 */
35
36-#include "cst_signer.h"
37-#include "cfg_parser.h"
38-#include "mkimage_helper.h"
39-#include "fdt.h"
40 #include <limits.h>
41+
42+#include <cst_signer.h>
43+#include <cfg_parser.h>
44+#include <mkimage_helper.h>
45+#include <fdt.h>
46+
47 #define RSIZE 256
48
49 uint32_t g_image_offset = 0;
50diff --git a/src/fdt.c b/src/fdt.c
51index 34cf585..9aecca9 100644
52--- a/src/fdt.c
53+++ b/src/fdt.c
54@@ -13,7 +13,8 @@
55 #include <limits.h>
56 #include <stdio.h>
57 #include <string.h>
58-#include "fdt.h"
59+
60+#include <fdt.h>
61
62
63 static struct fdt_errtabent fdt_errtable[] = {
diff --git a/recipes-devtools/cst-signer/cst-signer_git.bb b/recipes-devtools/cst-signer/cst-signer_git.bb
new file mode 100644
index 00000000..2983bdd9
--- /dev/null
+++ b/recipes-devtools/cst-signer/cst-signer_git.bb
@@ -0,0 +1,39 @@
1SUMMARY = "CST signer tool allows a way to automate the signing process"
2DESCRIPTION = "The CST signer tool works in conjunction with the Code Signing Tool (CST) provided by \
3NXP. The tool allows a way to automate the signing process in conjunction with a configuration file \
4that can be populated with necessary inputs. In addition, this tool parses the 'to be signed' image \
5and extracts the offset and length information needed to sign the image, thus reducing the possible \
6human error while signing."
7AUTHOR = "Utkarsh Gupta <utkarsh.gupta@nxp.com>"
8HOMEPAGE = "https://github.com/nxp-imx-support/nxp-cst-signer"
9BUGTRACKER = "https://github.com/nxp-imx-support/nxp-cst-signer/issues"
10SECTION = "devel"
11LICENSE = "GPL-2.0-or-later"
12LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263"
13
14PV = "0.3+${SRCPV}"
15
16SRC_URI = "git://github.com/nxp-imx-support/nxp-cst-signer;protocol=https;branch=master \
17 file://0001-Improve-Makefile-so-it-is-overridable-and-provides-s.patch \
18 file://0002-Fix-include-of-headers-so-it-indicates-it-uses-the-i.patch"
19SRCREV = "7fa50daf3237661497cf753ff13e6f66d9d2fea8"
20
21S = "${WORKDIR}/git"
22
23EXTRA_OEMAKE += "DESTDIR=${D} PREFIX=${prefix}"
24
25do_install () {
26 oe_runmake install
27}
28
29do_install:append:class-native () {
30 # The sample files are used as templates so here we copy them for later use.
31 mkdir -p ${D}${datadir}/cst-signer
32 for f in ${D}${datadir}/doc/cst-signer/*; do
33 mv $f ${D}${datadir}/cst-signer/$(basename $f | sed 's,.sample,.in,g')
34 done
35 rmdir ${D}${datadir}/doc/cst-signer \
36 ${D}${datadir}/doc
37}
38
39BBCLASSEXTEND = "native nativesdk"