[PATCH 6/6] build: Add mkimage support for arm/xilinx-zynq

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Feb 27 15:15:23 UTC 2024


Update #4272.
---
 spec/build/bsps/arm/xilinx-zynq/grp.yml     |  6 ++++
 spec/build/bsps/arm/xilinx-zynq/mkimage.yml | 39 +++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 spec/build/bsps/arm/xilinx-zynq/mkimage.yml

diff --git a/spec/build/bsps/arm/xilinx-zynq/grp.yml b/spec/build/bsps/arm/xilinx-zynq/grp.yml
index eeffea0e63..937b01bea5 100644
--- a/spec/build/bsps/arm/xilinx-zynq/grp.yml
+++ b/spec/build/bsps/arm/xilinx-zynq/grp.yml
@@ -36,6 +36,10 @@ links:
   uid: optconirq
 - role: build-dependency
   uid: ../../optconminor
+- role: build-dependency
+  uid: ../../optobjcopy
+- role: build-dependency
+  uid: ../../optubootmkimage
 - role: build-dependency
   uid: optint0len
 - role: build-dependency
@@ -68,6 +72,8 @@ links:
   uid: ../../objmem
 - role: build-dependency
   uid: linkcmds
+- role: build-dependency
+  uid: mkimage
 - role: build-dependency
   uid: ../../bspopts
 type: build
diff --git a/spec/build/bsps/arm/xilinx-zynq/mkimage.yml b/spec/build/bsps/arm/xilinx-zynq/mkimage.yml
new file mode 100644
index 0000000000..537482946a
--- /dev/null
+++ b/spec/build/bsps/arm/xilinx-zynq/mkimage.yml
@@ -0,0 +1,39 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+build-type: mkimage
+content: |
+  #!${PYTHON}
+
+  import gzip
+  import os
+  import shutil
+  import subprocess
+  import sys
+  import tempfile
+
+  with tempfile.TemporaryDirectory() as tmp_dir:
+      bin_path = os.path.join(tmp_dir, "bin")
+      gz_path = os.path.join(tmp_dir, "gz")
+      subprocess.run([
+          "${OBJCOPY}",
+          "-O", "binary", sys.argv[1], bin_path
+      ],
+                     check=True)
+      with open(bin_path, "rb") as f_bin:
+          with gzip.open(gz_path, "wb") as f_gz:
+              shutil.copyfileobj(f_bin, f_gz)
+      subprocess.run([
+          "${MKIMAGE}",
+          "-A", "arm", "-O", "linux", "-T", "kernel", "-a", "0x104000", "-e",
+          "0x104040", "-n", "RTEMS", "-d", gz_path, sys.argv[2]
+      ],
+                     check=True)
+copyrights:
+- Copyright (C) 2024 embedded brains GmbH & Co. KG
+enabled-by:
+  and:
+  - HAVE_OBJCOPY
+  - HAVE_U_BOOT_MKIMAGE
+links:
+- role: build-dependency
+  uid: ../../optpython
+type: build
-- 
2.35.3



More information about the devel mailing list