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

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "<section begin=History/> {| style="border-collapse:collapse; " !colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History |- !style="border-le...")
 
Line 8: Line 8:
 
|-
 
|-
 
|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"|1.0.0
 
|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"|1.0.0
|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"|Jan 2022
+
|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"|Feb 2022
 
|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 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 release
 
|-
 
|-
Line 31: Line 31:
 
| desk-mx8m-l-2.0.0-rc2  
 
| desk-mx8m-l-2.0.0-rc2  
 
|}
 
|}
 +
 +
==== i.MX8 Boot Image====
 +
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 [https://community.nxp.com/t5/Connects-Training-Material/Infotainment-Connectivity-Security-Introduction-to-the-System/ta-p/1115096 here].
 +
 +
TF-A binary, scfw_tcm.bin and u-boot.bin are combined together to generate a binary file called flash.bin; the <code>imx-mkimage</code> tool is used to generate '''flash.bin''', and flash.bin needs to 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.
  
 
=== Instructions ===
 
=== Instructions ===
 
 
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-mx-l</code> directory
 +
 +
<pre>
 +
cd desk-mx-l
 +
</pre>
 +
 +
=== Clone the repositories ===
 +
* clone ''recursively'' the Boot repositories
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
cd desk-mx-l
+
dvdk@vagrant:~/desk-mx-l$ git clone --recursive git@git.dave.eu:desk-mx-l/desk-mx8-mkimage.git
 +
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>
 +
 
 +
* checkout the required branch
 +
<pre>
 +
git checkout desk-mx8m-l-rel-2.0.0
 +
</pre>
 +
 
 +
* configure the build environment for cross-compilation
 +
 
 +
<pre>
 +
source /home/dvdk/desk-mx-l/desk-mx8m-l-2.0.0-rc2_env.sh
 +
</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>
 
</pre>
  
* clone 'recursively the Boot repositories
+
=== Build ATF ===
 +
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>
git clone --recursive git@git.dave.eu:desk-mx-l/desk-mx8-mkimage.git
+
cd imx-atf
 
</pre>
 
</pre>
  
* checkout the required branch
+
Please note that this is usually a generic command that generates all required binaries (kernel + device trees) for the different platform. In other words: it is not usually required to specify a different target depending on specific board configuration.
 +
 
 +
=== Get i.MX firmware ===
 +
This will download the binary archive, accept EULA automatically (you must agree with that) and extract the archive itself
 +
 
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
git checkout desk-mx8m-l-rel-2.0.0
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ ./fetch_firmware.sh
 +
--2022-02-17 11:37:24--  https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.10.bin
 +
Resolving www.nxp.com (www.nxp.com)... 104.120.105.182
 +
Connecting to www.nxp.com (www.nxp.com)|104.120.105.182|:443... connected.
 +
HTTP request sent, awaiting response... 200 OK
 +
Length: 1467137 (1.4M) [application/octet-stream]
 +
Saving to: ‘firmware-imx-8.10.bin’
 +
 
 +
firmware-imx-8.10.bin                          100%[=====================================================================================================>]  1.40M  4.63MB/s    in 0.3s   
 +
 
 +
2022-02-17 11:37:25 (4.63 MB/s) - ‘firmware-imx-8.10.bin’ saved [1467137/1467137]
 +
 
 +
Welcome to NXP firmware-imx-8.10.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$
 
</pre>
 
</pre>
  
* configure the build environment
+
=== Generate Boot image ===
 +
After building the single pieces of software, run:
 +
<pre>
 +
./${BOARD}_generate_flash.bin
 +
</pre>
 +
 
 +
where BOARD is: <code>imx8mp-mito8mplus</code> or <code>imx8mm-mito8mmini</code>
 +
 
 +
For [[ORCA SOM | ORCA]]:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
source /home/dvdk/desk-mx-l/desk-mx8m-l-2.0.0-rc2_env.sh
+
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ ./imx8mp-mito8mplus_generate_flash.bin
 +
...
 +
...
 +
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$
 
</pre>
 
</pre>
 
  
 
----
 
----
 
[[Category:ORCA]] [[Category:MITO 8M Mini]]
 
[[Category:ORCA]] [[Category:MITO 8M Mini]]

Revision as of 10:57, 17 February 2022

History
Version Issue Date Notes
1.0.0 Feb 2022 First DESK-MX8M 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-rel-2.0.0
stable tag desk-mx8m-l-2.0.0-rc2

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, 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, and flash.bin needs to 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.

Instructions[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-mx-l directory
cd desk-mx-l

Clone the repositories[edit | edit source]

  • clone recursively the Boot repositories
dvdk@vagrant:~/desk-mx-l$ git clone --recursive git@git.dave.eu:desk-mx-l/desk-mx8-mkimage.git
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$ 
  • checkout the required branch
git checkout desk-mx8m-l-rel-2.0.0
  • configure the build environment for cross-compilation
source /home/dvdk/desk-mx-l/desk-mx8m-l-2.0.0-rc2_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

cd u-boot-imx
  • select the proper defconfig and start the make compilation
make imx8mp_mito8mplus_defconfig
make

Build ATF[edit | edit source]

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

cd imx-atf

Please note that this is usually a generic command that generates all required binaries (kernel + device trees) for the different platform. In other words: it is not usually required to specify a different target depending on specific board configuration.

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:~/desk-mx-l/desk-mx8-mkimage$ ./fetch_firmware.sh
--2022-02-17 11:37:24--  https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.10.bin
Resolving www.nxp.com (www.nxp.com)... 104.120.105.182
Connecting to www.nxp.com (www.nxp.com)|104.120.105.182|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1467137 (1.4M) [application/octet-stream]
Saving to: ‘firmware-imx-8.10.bin’

firmware-imx-8.10.bin                           100%[=====================================================================================================>]   1.40M  4.63MB/s    in 0.3s    

2022-02-17 11:37:25 (4.63 MB/s) - ‘firmware-imx-8.10.bin’ saved [1467137/1467137]

Welcome to NXP firmware-imx-8.10.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 the single pieces of software, run:

./${BOARD}_generate_flash.bin

where BOARD is: imx8mp-mito8mplus or imx8mm-mito8mmini

For ORCA:

dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ ./imx8mp-mito8mplus_generate_flash.bin 
...
...
dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$