Skip to content

Instantly share code, notes, and snippets.

@KunYi
Created May 19, 2021 08:38
Show Gist options
  • Select an option

  • Save KunYi/6ababe7ca5f00eb87a216eb52f4bdc3b to your computer and use it in GitHub Desktop.

Select an option

Save KunYi/6ababe7ca5f00eb87a216eb52f4bdc3b to your computer and use it in GitHub Desktop.
imx-mkimage steps
#under imx-mkimage
# copy u-boot parts
cp ../uboot-imx/u-boot-nodtb.bin ./iMX8M
cp ../uboot-imx/arch/arm/dts/imx8mp-evk.dtb ./iMX8M
cp ../uboot-imx/spl/u-boot-spl.bin ./iMX8M
cp ../uboot-imx/tools/mkimage ./iMX8M/mkimage_uboot # need rename to mkimage_uboot
# copy firmware-imx parts
cp ../firmware-imx/firmware-imx-8.11/firmware/ddr/synopsys/lpddr4*.bin ./iMX8M # copy for DRAM Controller
cp ../firmware-imx/firmware-imx-8.11/firmware/hdmi/cadence/signed_hdmi_imx8m.bin ./iMX8M # copy for HDMI
# copy ATF
cp ../imx-atf/build/imx8mp/release/bl31.bin ./iMX8M
# make flash.bin for sd card
make SOC=iMX8MP flash_evk
#
# result
#
make SOC=iMX8MP flash_evk
14860+0 records in
14860+0 records out
59440 bytes (59 kB, 58 KiB) copied, 0.0220724 s, 2.7 MB/s
./../scripts/dtb_check.sh imx8mp-evk.dtb evk.dtb
Use u-boot DTB: imx8mp-evk.dtb
./../scripts/pad_image.sh tee.bin
Pad file tee.bin NOT found
./../scripts/pad_image.sh bl31.bin
bl31.bin is padded to 41296
./../scripts/pad_image.sh u-boot-nodtb.bin evk.dtb
u-boot-nodtb.bin + evk.dtb are padded to 906112
DEK_BLOB_LOAD_ADDR=0x40400000 TEE_LOAD_ADDR=0x56000000 ATF_LOAD_ADDR=0x00970000 ./mkimage_fit_atf.sh evk.dtb > u-boot.its
bl31.bin size:
41296
u-boot-nodtb.bin size:
875024
evk.dtb size:
31088
./mkimage_uboot -E -p 0x3000 -f u-boot.its u-boot.itb
u-boot.its:7.11-14.5: Warning (unit_address_vs_reg): /images/uboot@1: node has a unit name, but no reg property
u-boot.its:15.9-20.5: Warning (unit_address_vs_reg): /images/fdt@1: node has a unit name, but no reg property
u-boot.its:21.9-29.5: Warning (unit_address_vs_reg): /images/atf@1: node has a unit name, but no reg property
u-boot.its:34.12-39.5: Warning (unit_address_vs_reg): /configurations/config@1: node has a unit name, but no reg property
FIT description: Configuration to load ATF before U-Boot
Created: Wed May 19 14:19:49 2021
Image 0 (uboot@1)
Description: U-Boot (64-bit)
Created: Wed May 19 14:19:49 2021
Type: Standalone Program
Compression: uncompressed
Data Size: 875024 Bytes = 854.52 KiB = 0.83 MiB
Architecture: AArch64
Load Address: 0x40200000
Entry Point: unavailable
Image 1 (fdt@1)
Description: evk
Created: Wed May 19 14:19:49 2021
Type: Flat Device Tree
Compression: uncompressed
Data Size: 31088 Bytes = 30.36 KiB = 0.03 MiB
Architecture: Unknown Architecture
Image 2 (atf@1)
Description: ARM Trusted Firmware
Created: Wed May 19 14:19:49 2021
Type: Firmware
Compression: uncompressed
Data Size: 41296 Bytes = 40.33 KiB = 0.04 MiB
Architecture: AArch64
OS: Unknown OS
Load Address: 0x00970000
Default Configuration: 'config@1'
Configuration 0 (config@1)
Description: evk
Kernel: unavailable
Firmware: uboot@1
FDT: fdt@1
Loadables: atf@1
./mkimage_imx8 -version v2 -fit -loader u-boot-spl-ddr.bin 0x920000 -second_loader u-boot.itb 0x40200000 0x60000 -out flash.bin
Platform: i.MX8M (mScale)
ROM VERSION: v2
Using FIT image
LOADER IMAGE: u-boot-spl-ddr.bin start addr: 0x00920000
SECOND LOADER IMAGE: u-boot.itb start addr: 0x40200000 offset: 0x00060000
Output: flash.bin
========= IVT HEADER [HDMI FW] =========
header.tag: 0x0
header.length: 0x0
header.version: 0x0
entry: 0x0
reserved1: 0x0
dcd_ptr: 0x0
boot_data_ptr: 0x0
self: 0x0
csf: 0x0
reserved2: 0x0
boot_data.start: 0x0
boot_data.size: 0x0
boot_data.plugin: 0x0
========= IVT HEADER [PLUGIN] =========
header.tag: 0x0
header.length: 0x0
header.version: 0x0
entry: 0x0
reserved1: 0x0
dcd_ptr: 0x0
boot_data_ptr: 0x0
self: 0x0
csf: 0x0
reserved2: 0x0
boot_data.start: 0x0
boot_data.size: 0x0
boot_data.plugin: 0x0
========= IVT HEADER [LOADER IMAGE] =========
header.tag: 0xd1
header.length: 0x2000
header.version: 0x41
entry: 0x920000
reserved1: 0x0
dcd_ptr: 0x0
boot_data_ptr: 0x91ffe0
self: 0x91ffc0
csf: 0x942dc0
reserved2: 0x0
boot_data.start: 0x91ffc0
boot_data.size: 0x24e60
boot_data.plugin: 0x0
========= OFFSET dump =========
Loader IMAGE:
header_image_off 0x0
dcd_off 0x0
image_off 0x40
csf_off 0x22e00
spl hab block: 0x91ffc0 0x0 0x22e00
Second Loader IMAGE:
sld_header_off 0x58000
sld_csf_off 0x59020
sld hab block: 0x401fcdc0 0x58000 0x1020
@marriusco

marriusco commented Jun 9, 2023

Copy link
Copy Markdown

On imx8mm does not boots up. Any ideas. All went according to the description

sudo dd if=./iMX8M/flash.bin of=/dev/mmcblk0 bs=1024 seek=33 neither on SD-card neither on emmc
./../scripts/dtb_check.sh imx8mm-evk.dtb evk.dtb
Use u-boot DTB: imx8mm-evk.dtb
./../scripts/pad_image.sh tee.bin
Pad file tee.bin NOT found
./../scripts/pad_image.sh bl31.bin
./../scripts/pad_image.sh u-boot-nodtb.bin evk.dtb
u-boot-nodtb.bin + evk.dtb are padded to 1106496
BL32=tee.bin DEK_BLOB_LOAD_ADDR=0x40400000 TEE_LOAD_ADDR=0xbe000000 ATF_LOAD_ADDR=0x00920000 ./mkimage_fit_atf.sh evk.dtb > u-boot.its
bl31.bin size:
28800
u-boot-nodtb.bin size:
1054160
evk.dtb size:
52336
./mkimage_uboot -E -p 0x3000 -f u-boot.its u-boot.itb
FIT description: Configuration to load ATF before U-Boot
Created: Fri Jun 9 18:35:59 2023
Image 0 (uboot-1)
Description: U-Boot (64-bit)
Created: Fri Jun 9 18:35:59 2023
Type: Standalone Program
Compression: uncompressed
Data Size: 1054160 Bytes = 1029.45 KiB = 1.01 MiB
Architecture: AArch64
Load Address: 0x40200000
Entry Point: unavailable
Image 1 (fdt-1)
Description: evk
Created: Fri Jun 9 18:35:59 2023
Type: Flat Device Tree
Compression: uncompressed
Data Size: 52336 Bytes = 51.11 KiB = 0.05 MiB
Architecture: Unknown Architecture
Image 2 (atf-1)
Description: ARM Trusted Firmware
Created: Fri Jun 9 18:35:59 2023
Type: Firmware
Compression: uncompressed
Data Size: 28800 Bytes = 28.12 KiB = 0.03 MiB
Architecture: AArch64
OS: Unknown OS
Load Address: 0x00920000
Default Configuration: 'config-1'
Configuration 0 (config-1)
Description: evk
Kernel: unavailable
Firmware: uboot-1
FDT: fdt-1
Loadables: atf-1
./mkimage_imx8 -version v1 -fit -loader u-boot-spl-ddr.bin 0x7E1000 -second_loader u-boot.itb 0x40200000 0x60000 -out flash.bin
Platform: i.MX8M (mScale)
ROM VERSION: v1
Using FIT image
LOADER IMAGE: u-boot-spl-ddr.bin start addr: 0x007e1000
SECOND LOADER IMAGE: u-boot.itb start addr: 0x40200000 offset: 0x00060000
Output: flash.bin
========= IVT HEADER [HDMI FW] =========
header.tag: 0x0
header.length: 0x0
header.version: 0x0
entry: 0x0
reserved1: 0x0
dcd_ptr: 0x0
boot_data_ptr: 0x0
self: 0x0
csf: 0x0
reserved2: 0x0
boot_data.start: 0x0
boot_data.size: 0x0
boot_data.plugin: 0x0
========= IVT HEADER [PLUGIN] =========
header.tag: 0x0
header.length: 0x0
header.version: 0x0
entry: 0x0
reserved1: 0x0
dcd_ptr: 0x0
boot_data_ptr: 0x0
self: 0x0
csf: 0x0
reserved2: 0x0
boot_data.start: 0x0
boot_data.size: 0x0
boot_data.plugin: 0x0
========= IVT HEADER [LOADER IMAGE] =========
header.tag: 0xd1
header.length: 0x2000
header.version: 0x41
entry: 0x7e1000
reserved1: 0x0
dcd_ptr: 0x0
boot_data_ptr: 0x7e0fe0
self: 0x7e0fc0
csf: 0x80dfc0
reserved2: 0x0
boot_data.start: 0x7e0bc0
boot_data.size: 0x2f460
boot_data.plugin: 0x0
========= OFFSET dump =========
Loader IMAGE:
header_image_off 0x0
dcd_off 0x0
image_off 0x40
csf_off 0x2d000
spl hab block: 0x7e0fc0 0x0 0x2d000

Second Loader IMAGE:
sld_header_off 0x57c00
sld_csf_off 0x58c20
sld hab block: 0x401fcdc0 0x57c00 0x1020

@KunYi

KunYi commented Jun 10, 2023

Copy link
Copy Markdown
Author

Should check your hardware configuration first

do you have DRAM settings parameters? (ref. https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/iMX-8M-Mini-Register-Programming-Aid-DRAM-PLL-setting/ta-p/1112094)
and what's boot device for your board? (https://community.nxp.com/t5/i-MX-Processors/BOOT-mode-iMX8MM/m-p/1211393#M167718)

DRAM need initial parameters and firmware of memory controller

my steps only for LPDDR4 and setting boot mode for SD/MMC devices
if you use another configuration need to modify some steps

or you just missed 'sync'
sudo dd if=./iMX8M/flash.bin of=/dev/mmcblk0 bs=1024 seek=33 conv=fsync

@KunYi

KunYi commented Jun 10, 2023

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment