U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Leonard Anderweit <l.anderweit@phytec.de>
To: <u-boot@lists.denx.de>
Cc: Simon Glass <sjg@chromium.org>,
	Alper Nebi Yasak <alpernebiyasak@gmail.com>,
	Tom Rini <trini@konsulko.com>,
	Leonard Anderweit <l.anderweit@phytec.de>,
	Marek Vasut <marex@denx.de>, Tim Harvey <tharvey@gateworks.com>,
	<upstream@lists.phytec.de>
Subject: [PATCH v2 3/3] binman: cst: Build from source
Date: Wed, 26 Feb 2025 22:05:01 +0100	[thread overview]
Message-ID: <20250226210501.72794-3-l.anderweit@phytec.de> (raw)
In-Reply-To: <20250226210501.72794-1-l.anderweit@phytec.de>

Build the imx code singing tool from source instead of relying on the
distro to provide the tool.
Use the debian/unstable branch because the default branch is outdated.
The binary is supposed to be build with docker, work around that by selecting
the correct Makefile directly.
Also append the description and add a link to documentation.

Signed-off-by: Leonard Anderweit <l.anderweit@phytec.de>
---
v2: add documentation
---
 tools/binman/bintools.rst |  8 ++++++++
 tools/binman/btool/cst.py | 37 +++++++++++++++++++++----------------
 2 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/tools/binman/bintools.rst b/tools/binman/bintools.rst
index cd05ad8cb26d..9f6cab544a5e 100644
--- a/tools/binman/bintools.rst
+++ b/tools/binman/bintools.rst
@@ -52,6 +52,14 @@ Bintool: cst: Image generation for U-Boot
 This bintool supports running `cst` with some basic parameters as
 needed by binman.
 
+cst (imx code signing tool) is used for sigining bootloader binaries for
+various i.MX SoCs.
+
+See `Code Signing Tool Users Guide`_ for more information.
+
+.. _`Code Signing Tool Users Guide`:
+    https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/202591/1/CST_UG.pdf
+
 
 
 Bintool: fdt_add_pubkey: Add public key to control dtb (spl or u-boot proper)
diff --git a/tools/binman/btool/cst.py b/tools/binman/btool/cst.py
index 30e78bdbbd9d..8a3981adc890 100644
--- a/tools/binman/btool/cst.py
+++ b/tools/binman/btool/cst.py
@@ -12,6 +12,14 @@ class Bintoolcst(bintool.Bintool):
 
     This bintool supports running `cst` with some basic parameters as
     needed by binman.
+
+    cst (imx code signing tool) is used for sigining bootloader binaries for
+    various i.MX SoCs.
+
+    See `Code Signing Tool Users Guide`_ for more information.
+
+    .. _`Code Signing Tool Users Guide`:
+        https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/202591/1/CST_UG.pdf
     """
     def __init__(self, name):
         super().__init__(name, 'Sign NXP i.MX image')
@@ -29,20 +37,17 @@ class Bintoolcst(bintool.Bintool):
         return self.run_cmd(*args)
 
     def fetch(self, method):
-        """Fetch handler for cst
-
-        This installs cst using the apt utility.
-
-        Args:
-            method (FETCH_...): Method to use
-
-        Returns:
-            True if the file was fetched and now installed, None if a method
-            other than FETCH_BIN was requested
-
-        Raises:
-            Valuerror: Fetching could not be completed
-        """
-        if method != bintool.FETCH_BIN:
+        """Build cst from git"""
+        if method != bintool.FETCH_BUILD:
             return None
-        return self.apt_install('imx-code-signing-tool')
+
+        from platform import architecture
+        arch = 'linux64' if architecture()[0] == '64bit' else 'linux32'
+        result = self.build_from_git(
+            'https://gitlab.apertis.org/pkg/imx-code-signing-tool',
+            ['all'],
+            f'code/obj.{arch}/cst',
+            flags=[f'OSTYPE={arch}', 'ENCRYPTION=yes'],
+            git_branch='debian/unstable',
+            make_path=f'code/obj.{arch}/')
+        return result
-- 
2.34.1


  parent reply	other threads:[~2025-02-26 21:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 21:04 [PATCH v2 1/3] binman: build_from_git: Add argument specifying branch Leonard Anderweit
2025-02-26 21:05 ` [PATCH v2 2/3] binman: build_from_git: Add optional make path inside git repo Leonard Anderweit
2025-03-05 14:15   ` Simon Glass
2025-02-26 21:05 ` Leonard Anderweit [this message]
2025-03-05 14:15   ` [PATCH v2 3/3] binman: cst: Build from source Simon Glass
2025-03-05 14:15 ` [PATCH v2 1/3] binman: build_from_git: Add argument specifying branch Simon Glass
2025-03-12 19:43 ` Tom Rini

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=20250226210501.72794-3-l.anderweit@phytec.de \
    --to=l.anderweit@phytec.de \
    --cc=alpernebiyasak@gmail.com \
    --cc=marex@denx.de \
    --cc=sjg@chromium.org \
    --cc=tharvey@gateworks.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=upstream@lists.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