Difference between revisions of "DESK-MX8M-L/Development/Building Boot Image"

From DAVE Developer's Wiki
Jump to: navigation, search
(Updates for DESK-MX8-L 4.0.0 release)
Line 11: Line 11:
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First DESK-MX8M-L release
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First DESK-MX8M-L release
 
|-
 
|-
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |{{oldid|17540|17540}}
+
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |{{oldid|17540|17540}}
 +
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |24/02/2023
 +
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |DESK-MX8M-L-2.0.0 release
 +
|-
 +
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |{{oldid|18030|18030}}
 
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |24/02/2023
 
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |24/02/2023
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |DESK-MX8M-L-2.0.0 release
+
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#ededed; padding:5px; color:#000000" |DESK-MX8M-L-4.0.0 release
 
|-
 
|-
 
|}
 
|}
Line 30: Line 34:
 
|-
 
|-
 
! stable branch
 
! stable branch
| desk-mx8m-l-2.x.x
+
| desk-mx8m-l-4.x.x
 
|-
 
|-
 
! stable tag
 
! stable tag
| desk-mx8m-l-2.0.0  
+
| desk-mx8m-l-4.0.0  
 
|}
 
|}
  
Line 43: Line 47:
 
In the following paragraphs we will explain how to get or build those binaries to be combined in a single binary to be flashed in the bootable storage device.
 
In the following paragraphs we will explain how to get or build those binaries to be combined in a single binary to be flashed in the bootable storage device.
  
=== Instructions ===
+
=== Prepare environment ===
 +
 
 
It is assumed that the development environment has been set up properly as described [[DESK-MX8M-L#Quick_start_guide|here]].
 
It is assumed that the development environment has been set up properly as described [[DESK-MX8M-L#Quick_start_guide|here]].
 
* start the Linux development VM and login into the system
 
* start the Linux development VM and login into the system
* open a terminal window and ''cd'' into <code>desk-mx-l</code> directory
+
* open a terminal window and ''cd'' into <code>desk-mx8-mkimage</code> directory
  
<pre>
+
<pre class="workstation-terminal">
cd desk-mx-l
+
dvdk@vagrant:~$ cd desk-mx-l/desk-mx8-mkimage
 +
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$
 
</pre>
 
</pre>
  
=== Clone the repositories ===
+
* in case of needs you can update your local repository with the following git command
* clone ''recursively'' the Boot repositories
+
 
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
dvdk@vagrant:~/desk-mx-l$ git clone --recursive git@git.dave.eu:desk-mx-l/desk-mx8-mkimage.git -b desk-mx8m-l-2.0.0
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ git pull
Cloning into 'desk-mx8-mkimage'...
 
remote: Enumerating objects: 57, done.
 
remote: Total 57 (delta 0), reused 0 (delta 0), pack-reused 57
 
Receiving objects: 100% (57/57), 7.14 KiB | 7.14 MiB/s, done.
 
Resolving deltas: 100% (28/28), done.
 
dvdk@vagrant:~/desk-mx-l$
 
 
</pre>
 
</pre>
  
* update the submodule (i.e. sync the sub-repositories)
+
* configure the build environment
 +
 
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ git submodule update
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ source ~/desk-mx-l/desk-mx8m-l-4.0.0_env.sh
Cloning into '/home/dvdk/desk-mx-l/desk-mx8-mkimage/imx-atf'...
 
Cloning into '/home/dvdk/desk-mx-l/desk-mx8-mkimage/imx-mkimage'...
 
Cloning into '/home/dvdk/desk-mx-l/desk-mx8-mkimage/u-boot-imx'...
 
Submodule path 'imx-atf': checked out 'a72158b5e10527b9e13a64f8305b4210423fa09b'
 
Submodule path 'imx-mkimage': checked out '8947fea369ab3932259630232cfb9f87b8f9dda1'
 
Submodule path 'u-boot-imx': checked out '2af0221006d686ae561a68f324c56bf2da3953ad'
 
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$
 
 
</pre>
 
</pre>
  
In case of ca-certificates failures, which may appears during https access to some repo:
+
=== Build U-Boot ===
 +
 
 +
First step is to build U-Boot binaries: the same instructions can be found in the dedicated [[DESK-MX8M-L/Development/Building_U-Boot | wiki page]]
  
<pre>
+
<pre class="workstation-terminal">
fatal: unable to access 'https://source.codeaurora.org/external/imx/imx-mkimage.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
+
dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/u-boot-imx/
fatal: clone of 'https://source.codeaurora.org/external/imx/imx-mkimage.git' into submodule path '/home/dvdk/desk-mx-l/desk-mx8-mkimage/imx-mkimage' failed
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$
Failed to clone 'imx-mkimage'. Retry scheduled
 
...
 
 
</pre>
 
</pre>
  
a possible solution is to disable the SSL verification setting:
+
* select the proper <code>defconfig</code> and start the ''make'' compilation
  
export GIT_SSL_NO_VERIFY=1
+
For [[ORCA SOM| ORCA]] SOM:
 +
<pre class="workstation-terminal">
 +
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make imx8mp_mito8mplus_defconfig
 +
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make -j$(nproc)
 +
</pre>
  
=== Enable the cross-compilation ===
+
For [[MITO 8M Mini SOM| MITO 8M Mini]] SOM:
* configure the build environment for cross-compilation
+
<pre class="workstation-terminal">
 
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make imx8mm_mito8mmini_defconfig
<pre>
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make -j$(nproc)
source /home/dvdk/desk-mx-l/desk-mx8m-l-2.0.0_env.sh
 
 
</pre>
 
</pre>
  
=== Build U-Boot ===
 
First step is to build U-Boot binaries: the same instructions can be found in the dedicated [[DESK-MX8M-L/Development/Building_U-Boot | wiki page]]
 
<pre>
 
cd u-boot-imx
 
</pre>
 
* select the proper <code>defconfig</code> and start the ''make'' compilation
 
<pre>
 
make imx8mp_mito8mplus_defconfig
 
make
 
</pre>
 
 
This steps produce the <code>u-boot-spl.bin</code> and <code>u-boot.bin</code> files used at the last step.
 
This steps produce the <code>u-boot-spl.bin</code> and <code>u-boot.bin</code> files used at the last step.
 +
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
 
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ ls -la spl/u-boot-spl.bin
 
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ ls -la spl/u-boot-spl.bin
Line 118: Line 106:
 
This process builds the ARM Trusted Firmware: please find more information [https://trustedfirmware-a.readthedocs.io/en/v2.2/plat/imx8.html  here]
 
This process builds the ARM Trusted Firmware: please find more information [https://trustedfirmware-a.readthedocs.io/en/v2.2/plat/imx8.html  here]
  
<pre>
+
<pre class="workstation-terminal">
cd imx-atf
+
dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/imx-atf/
 +
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$
 
</pre>
 
</pre>
  
 
* for building the ATF, the following var has to be ''unset''
 
* for building the ATF, the following var has to be ''unset''
<pre>
+
<pre class="workstation-terminal">
unset LDFLAGS
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$ unset LDFLAGS
 
</pre>
 
</pre>
  
Line 130: Line 119:
  
 
For [[ORCA SOM| ORCA]] SOM:
 
For [[ORCA SOM| ORCA]] SOM:
<pre>
+
<pre class="workstation-terminal">
make PLAT=imx8mp bl31
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$ make PLAT=imx8mp bl31
 
</pre>
 
</pre>
  
 
For [[MITO 8M Mini SOM| MITO 8M Mini]] SOM:
 
For [[MITO 8M Mini SOM| MITO 8M Mini]] SOM:
<pre>
+
<pre class="workstation-terminal">
make PLAT=imx8mm bl31
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$ make PLAT=imx8mm bl31
 
</pre>
 
</pre>
  
Line 143: Line 132:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ ./fetch_firmware.sh
+
dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/
--2022-02-17 11:37:24--  https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.10.bin
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ ./fetch_firmware.sh  
Resolving www.nxp.com (www.nxp.com)... 104.120.105.182
+
--2023-07-24 15:25:21--  https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.18.bin
Connecting to www.nxp.com (www.nxp.com)|104.120.105.182|:443... connected.
+
Resolving www.nxp.com (www.nxp.com)... 104.87.170.182
 +
Connecting to www.nxp.com (www.nxp.com)|104.87.170.182|:443... connected.
 
HTTP request sent, awaiting response... 200 OK
 
HTTP request sent, awaiting response... 200 OK
Length: 1467137 (1.4M) [application/octet-stream]
+
Length: 1513050 (1.4M) [application/octet-stream]
Saving to: ‘firmware-imx-8.10.bin’
+
Saving to: ‘firmware-imx-8.18.bin’
  
firmware-imx-8.10.bin                           100%[=====================================================================================================>]  1.40M 4.63MB/s    in 0.3s   
+
firmware-imx-8.18.bin                                       100%[=========================================================================================================================================>]  1.44M --.-KB/s    in 0.05s 
  
2022-02-17 11:37:25 (4.63 MB/s) - ‘firmware-imx-8.10.bin’ saved [1467137/1467137]
+
2023-07-24 15:25:21 (31.1 MB/s) - ‘firmware-imx-8.18.bin’ saved [1513050/1513050]
  
Welcome to NXP firmware-imx-8.10.bin
+
Welcome to NXP firmware-imx-8.18.bin
  
 
WARNING: EULA has been auto-accepted; this implies that you agree with it.
 
WARNING: EULA has been auto-accepted; this implies that you agree with it.
Unpacking file .......................................................................... done
+
Unpacking file ................................................................................ done
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$  
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$
 
</pre>
 
</pre>
  
Line 172: Line 162:
 
For [[ORCA SOM | ORCA]] SOM:
 
For [[ORCA SOM | ORCA]] SOM:
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
 +
dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/
 
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ ./imx8mp-mito8mplus_generate_flash.bin  
 
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ ./imx8mp-mito8mplus_generate_flash.bin  
 
Compiling mkimage_imx8
 
Compiling mkimage_imx8

Revision as of 13:27, 24 July 2023

History
ID# Issue Date Notes

16142

18/02/2022 First DESK-MX8M-L release

17540

24/02/2023 DESK-MX8M-L-2.0.0 release

18030

24/02/2023 DESK-MX8M-L-4.0.0 release



Building Boot Image[edit | edit source]

Quick reference[edit | edit source]

Repository Information
URL git@git.dave.eu:desk-mx-l/desk-mx8-mkimage.git
stable branch desk-mx8m-l-4.x.x
stable tag desk-mx8m-l-4.0.0

i.MX8 Boot Image[edit | edit source]

The System Controller Unit (SCU) represents the evolution of centralized control for system-level resources on i.MX8. The heart of the system controller is a Cortex-M4 that executes System Controller Firmware. The SCF is an essential part of the i.MX8 architecture. Please find more information about SCF here.

TF-A binary bl31.bin, scfw_tcm.bin and u-boot.bin are combined together to generate a binary file called flash.bin; the imx-mkimage tool is used to generate flash.bin which will be flashed into the bootable storage device.

In the following paragraphs we will explain how to get or build those binaries to be combined in a single binary to be flashed in the bootable storage device.

Prepare environment[edit | edit source]

It is assumed that the development environment has been set up properly as described here.

  • start the Linux development VM and login into the system
  • open a terminal window and cd into desk-mx8-mkimage directory
dvdk@vagrant:~$ cd desk-mx-l/desk-mx8-mkimage
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$
  • in case of needs you can update your local repository with the following git command
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ git pull
  • configure the build environment
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ source ~/desk-mx-l/desk-mx8m-l-4.0.0_env.sh 

Build U-Boot[edit | edit source]

First step is to build U-Boot binaries: the same instructions can be found in the dedicated wiki page

dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/u-boot-imx/
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$
  • select the proper defconfig and start the make compilation

For ORCA SOM:

dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make imx8mp_mito8mplus_defconfig
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make -j$(nproc)

For MITO 8M Mini SOM:

dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make imx8mm_mito8mmini_defconfig
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make -j$(nproc)

This steps produce the u-boot-spl.bin and u-boot.bin files used at the last step.

dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ ls -la spl/u-boot-spl.bin
-rwxrwxr-x 1 dvdk dvdk 94328 Feb 17 14:56 spl/u-boot-spl.bin
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ ls -la u-boot.bin
-rw-rw-r-- 1 dvdk dvdk 861312 Feb 17 14:55 u-boot.bin
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ 

Build ATF[edit | edit source]

This process builds the ARM Trusted Firmware: please find more information here

dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/imx-atf/
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$
  • for building the ATF, the following var has to be unset
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$ unset LDFLAGS

Then, build the TF-A binary for the selected platform.

For ORCA SOM:

dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$ make PLAT=imx8mp bl31

For MITO 8M Mini SOM:

dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$ make PLAT=imx8mm bl31

Get i.MX firmware[edit | edit source]

This will download the binary archive, accept EULA automatically (you must agree with that) and extract the archive itself

dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ ./fetch_firmware.sh 
--2023-07-24 15:25:21--  https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.18.bin
Resolving www.nxp.com (www.nxp.com)... 104.87.170.182
Connecting to www.nxp.com (www.nxp.com)|104.87.170.182|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1513050 (1.4M) [application/octet-stream]
Saving to: ‘firmware-imx-8.18.bin’

firmware-imx-8.18.bin                                       100%[=========================================================================================================================================>]   1.44M  --.-KB/s    in 0.05s   

2023-07-24 15:25:21 (31.1 MB/s) - ‘firmware-imx-8.18.bin’ saved [1513050/1513050]

Welcome to NXP firmware-imx-8.18.bin

WARNING: EULA has been auto-accepted; this implies that you agree with it.
Unpacking file ................................................................................ done
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$

Generate Boot image[edit | edit source]

After building all pieces of software, create the flash.bin boot Image running:

./${BOARD}_generate_flash.bin

where BOARD is: imx8mp-mito8mplus or imx8mm-mito8mmini

For ORCA SOM:

dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ ./imx8mp-mito8mplus_generate_flash.bin 
Compiling mkimage_imx8
PLAT=imx8mp HDMI=no
Compiling mkimage_imx8
gcc  -O2 -pipe -g -feliminate-unused-debug-types  mkimage_imx8.c -o mkimage_imx8 -lz
23582+0 records in
23582+0 records out
94328 bytes (94 kB, 92 KiB) copied, 0.0379032 s, 2.5 MB/s
./../scripts/dtb_check.sh imx8mp-evk.dtb evk.dtb
Use u-boot DTB: imx8mp-evk.dtb
./../scripts/pad_image.sh tee.bin
...
...
...
...
========= OFFSET dump =========
Loader IMAGE:
 header_image_off 	0x0
 dcd_off 		0x0
 image_off 		0x40
 csf_off 		0x2b800
 spl hab block: 	0x91ffc0 0x0 0x2b800

Second Loader IMAGE:
 sld_header_off 	0x58000
 sld_csf_off 		0x59020
 sld hab block: 	0x401fcdc0 0x58000 0x1020

******************************
******************************

flash.bin generated successfully
write it on a SD card with
dd if=flash.bin of=/dev/sdX bs=1k seek=32 conv=fsync

******************************
******************************
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ 

For MITO M8M Mini SOM:

./imx8mm-mito8mmini_generate_flash.bin