Hello,
Please see below the steps I follow for creating an image, I think the error you are seeing are due to the version mismatch.
EDIT: fixed the typo
### Clone imx-mkimage it is better to download the same version of the sw we are working with ###
git clone https://github.com/nxp-imx/imx-mkimage -b lf-6.1.22_2.0.0
### Decompress the GNU toolchain into a path in local disk, in this test would be /opt/ ###
sudo tar -xvJf arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz -C /opt
### Clone and build Uboot ###
cd ..
git clone https://github.com/nxp-imx/uboot-imx -b lf-6.1.22-2.0.0
cd uboot-imx
make -j $(nproc --all) clean
make -j$(nproc --all) ARCH=arm CROSS_COMPILE=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- imx8mn_evk_defconfig
make -j $(nproc --all) ARCH=arm CROSS_COMPILE=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.20.bin
chmod +x firmware-imx-8.20.bin
./firmware-imx-8.20.bin --auto-accept
### Clone and build ATF ###
git clone https://github.com/nxp-imx/imx-atf -b lf-6.1.22-2.0.0
cd imx-atf
make -j $(nproc --all) PLAT=imx8mn bl31 CROSS_COMPILE=/opt/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
### Copy the resulting binaries to imx-mkimage ###
cp ~/uboot-imx/spl/u-boot-spl.bin ~/imx-mkimage/iMX8M
cp ~/uboot-imx/u-boot-nodtb.bin ~/imx-mkimage/iMX8M
cp ~/uboot-imx/arch/arm/dts/imx8mn-evk.dtb ~/imx-mkimage/iMX8M
cp ~/imx-atf/build/imx8mn/release/bl31.bin ~/imx-mkimage/iMX8M
cp ~/uboot-imx/tools/mkimage ~/imx-mkimage/iMX8M/mkimage_uboot
### Copy i.MX firmware ###
cp ./firmware-imx-8.20/firmware/ddr/synopsys/lpddr4_*.bin ~/imx-mkimage/iMX8M
### Build the flash.bin using mkimage ###
cd imx-mkimage
make SOC=iMX8MN flash_evk_flexspi
Best regards/Saludos,
Aldo.