]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mach-imx: Add i.MX93 binman support.
authorMathieu Othacehe <m.othacehe@gmail.com>
Fri, 29 Dec 2023 11:02:18 +0000 (12:02 +0100)
committerFabio Estevam <festevam@gmail.com>
Mon, 8 Jan 2024 17:37:53 +0000 (14:37 -0300)
Add dedicated Makefile targets for the i.MX93 and a new imx93-u-boot.dtsi
device-tree to create binman images.

Signed-off-by: Mathieu Othacehe <m.othacehe@gmail.com>
arch/arm/dts/imx93-u-boot.dtsi [new file with mode: 0644]
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/imx9/container.cfg [new file with mode: 0644]
arch/arm/mach-imx/imx9/imximage.cfg [new file with mode: 0644]
tools/imx9_image.sh [new file with mode: 0755]

diff --git a/arch/arm/dts/imx93-u-boot.dtsi b/arch/arm/dts/imx93-u-boot.dtsi
new file mode 100644 (file)
index 0000000..40e17bb
--- /dev/null
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2023 Mathieu Othacehe <m.othacehe@gmail.com>
+ */
+
+/ {
+       binman: binman {
+               multiple-images;
+       };
+};
+
+&binman {
+       u-boot-spl-ddr {
+               align = <4>;
+               align-size = <4>;
+               filename = "u-boot-spl-ddr.bin";
+               pad-byte = <0xff>;
+
+               u-boot-spl {
+                       align-end = <4>;
+                       filename = "u-boot-spl.bin";
+               };
+
+               ddr-1d-imem-fw {
+                       filename = "lpddr4_imem_1d_v202201.bin";
+                       align-end = <4>;
+                       type = "blob-ext";
+               };
+
+               ddr-1d-dmem-fw {
+                       filename = "lpddr4_dmem_1d_v202201.bin";
+                       align-end = <4>;
+                       type = "blob-ext";
+               };
+
+               ddr-2d-imem-fw {
+                       filename = "lpddr4_imem_2d_v202201.bin";
+                       align-end = <4>;
+                       type = "blob-ext";
+               };
+
+               ddr-2d-dmem-fw {
+                       filename = "lpddr4_dmem_2d_v202201.bin";
+                       align-end = <4>;
+                       type = "blob-ext";
+               };
+       };
+
+       spl {
+               filename = "spl.bin";
+
+               mkimage {
+                       args = "-n spl/u-boot-spl.cfgout -T imx8image -e 0x2049A000";
+
+                       blob {
+                               filename = "u-boot-spl-ddr.bin";
+                       };
+               };
+       };
+
+       u-boot-container {
+               filename = "u-boot-container.bin";
+
+               mkimage {
+                       args = "-n u-boot-container.cfgout -T imx8image -e 0x0";
+
+                       blob {
+                               filename = "u-boot.bin";
+                       };
+               };
+       };
+
+       imx-boot {
+               filename = "flash.bin";
+               pad-byte = <0x00>;
+
+               spl: blob-ext@1 {
+                       filename = "spl.bin";
+                       offset = <0x0>;
+                       align-size = <0x400>;
+                       align = <0x400>;
+               };
+
+               uboot: blob-ext@2 {
+                       filename = "u-boot-container.bin";
+               };
+       };
+};
index a3b44c93e3d63036ef723f738bcc448af78455ef..ef0caed3f7f3584cb36c590b9af0a0eab485a27c 100644 (file)
@@ -129,6 +129,9 @@ DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o u-boot-dtb.cfgout $(srctre
 else ifeq ($(CONFIG_ARCH_IMX8M), y)
 IMAGE_TYPE := imx8mimage
 DEPFILE_EXISTS := 0
+else ifeq ($(CONFIG_ARCH_IMX9), y)
+IMAGE_TYPE := imx8image
+DEPFILE_EXISTS := 0
 else
 IMAGE_TYPE := imximage
 DEPFILE_EXISTS := 0
@@ -213,7 +216,29 @@ endif
 endif
 
 ifeq ($(CONFIG_ARCH_IMX9), y)
-SPL:
+
+quiet_cmd_imx9_check = CHECK    $@
+cmd_imx9_check = $(srctree)/tools/imx9_image.sh $@
+
+SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout u-boot-container.cfgout FORCE
+
+MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE)
+flash.bin: MKIMAGEOUTPUT = flash.log
+
+spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE
+       $(Q)mkdir -p $(dir $@)
+       $(call if_changed_dep,cpp_cfg)
+       $(call if_changed,imx9_check)
+
+spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
+
+u-boot-container.cfgout: $(IMX_CONTAINER_CFG) FORCE
+       $(Q)mkdir -p $(dir $@)
+       $(call if_changed_dep,cpp_cfg)
+       $(call if_changed,imx9_check)
+
+flash.bin: spl/u-boot-spl-ddr.bin container.cfgout FORCE
+       $(call if_changed,mkimage)
 endif
 
 else
diff --git a/arch/arm/mach-imx/imx9/container.cfg b/arch/arm/mach-imx/imx9/container.cfg
new file mode 100644 (file)
index 0000000..f268bc9
--- /dev/null
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2023 Mathieu Othacehe <m.othacehe@gmail.com>
+ */
+
+BOOT_FROM SD 0x400
+SOC_TYPE IMX9
+CONTAINER
+IMAGE A55 bl31.bin 0x204E0000
+IMAGE A55 u-boot.bin CONFIG_TEXT_BASE
\ No newline at end of file
diff --git a/arch/arm/mach-imx/imx9/imximage.cfg b/arch/arm/mach-imx/imx9/imximage.cfg
new file mode 100644 (file)
index 0000000..3e44046
--- /dev/null
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2023 Mathieu Othacehe <m.othacehe@gmail.com>
+ */
+
+BOOT_FROM SD 0x400
+SOC_TYPE IMX9
+APPEND mx93a0-ahab-container.img
+CONTAINER
+IMAGE A55 u-boot-spl-ddr.bin 0x2049A000
\ No newline at end of file
diff --git a/tools/imx9_image.sh b/tools/imx9_image.sh
new file mode 100755 (executable)
index 0000000..88dfcfe
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Script to check whether the file exists in mkimage cfg files for the i.MX9.
+#
+# usage: $0 <file.cfg>
+
+file=$1
+
+blobs=`awk '/^APPEND/ {print $2} /^IMAGE/ || /^DATA/ {print $3}' $file`
+for f in $blobs; do
+       tmp=$srctree/$f
+       if [ $f = "u-boot-spl-ddr.bin" ]; then
+               continue
+       fi
+
+       if [ -f $f ]; then
+               continue
+       fi
+
+       if [ ! -f $tmp ]; then
+               echo "WARNING '$tmp' not found, resulting binary is not-functional" >&2
+
+                # Comment-out the lines for un-existing files. This way,
+                # mkimage can keep working. This allows CI tests to pass even
+                # if the resulting binary won't boot.
+                sed -in "/$f/ s/./#&/" $file
+       fi
+done
+
+exit 0