Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX8M-L/Development/Building Boot Image

4,038 bytes added, 17 January
no edit summary
!colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History
|-
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Version
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Issue Date
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
|-
|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{{oldid|16142|2022/02/18}}|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|2023/02/24}}| 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.0release|-! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fbededed; padding:5px; color:#000000"|Feb 20222023/08/22|! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fbededed; padding:5px; color:#000000"|First DESK-MX8M -L-4.0.0 release
|-
|}
==Building Boot Image==
 
{{ImportantMessage|text=The following procedure may be used just during the development stage (as an example, for modifying and testing just some part of the overall binary like u-boot).
 
The Yocto build should be used for creating the deployment or production binary artifacts.}}
===Quick reference===
|-
! stable branch
| desk-mx8m-l-rel-24.0x.0x
|-
! stable tag
| desk-mx8m-l-24.0.0-rc2
|}
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<code>bl31.bin</code>, <code>scfw_tcm.bin </code> and <code>u-boot.bin </code> are combined together to generate a binary file called <code>flash.bin</code>; the <code>imx-mkimage</code> tool is used to generate '''flash.bin''', and flash.bin needs to 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.
=== Instructions Prepare environment === 
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
* open a terminal window and ''cd'' into <code>desk-mxmx8-lmkimage</code> directory
<preclass="workstation-terminal">dvdk@vagrant:~$ cd desk-mx-l/desk-mx8-mkimagedvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$
</pre>
=== Clone the repositories ===* clone ''recursively'' in case of needs you can update your local repository with the Boot repositoriesfollowing git command
<pre class="workstation-terminal">
dvdk@vagrant:~/desk-mx-l$ git clone --recursive git@git.dave.eu:desk-mx-l/desk-mx8-mkimage.$ gitCloning into 'desk-mx8-mkimage'...remote: Enumerating objects: 57, done.remote: Total 57 (delta 0), reused 0 (delta 0), pack-reused 57Receiving objects: 100% (57/57), 7.14 KiB | 7.14 MiB/s, done.Resolving deltas: 100% (28/28), done.dvdk@vagrant:~/desk-mx-l$ pull
</pre>
* checkout configure the required branch<pre>git checkout desk-mx8m-l-rel-2.0.0</pre>build environment
* configure the build environment for cross-compilation <preclass="workstation-terminal">source dvdk@vagrant:~/homedesk-mx-l/dvdkdesk-mx8-mkimage$ source ~/desk-mx-l/desk-mx8m-l-24.0.0-rc2_env0_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]]
 <preclass="workstation-terminal">dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/u-boot-imx/dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$
</pre>
 
* select the proper <code>defconfig</code> and start the ''make'' compilation
 For [[ORCA SOM| ORCA]] SOM:<preclass="workstation-terminal">dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make imx8mp_mito8mplus_defconfigdvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make -j$(nproc)</pre> For [[MITO 8M Mini SOM| MITO 8M Mini]] SOM:<pre class="workstation-terminal">dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make imx8mm_mito8mmini_defconfigdvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$ make-j$(nproc)</pre> 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">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.bindvdk@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.bindvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/u-boot-imx$
</pre>
This process builds the ARM Trusted Firmware: please find more information [https://trustedfirmware-a.readthedocs.io/en/v2.2/plat/imx8.html here]
<preclass="workstation-terminal">dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/imx-atf/dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$</pre> * for building the ATF, the following var has to be ''unset''<pre class="workstation-terminal">dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$ unset LDFLAGS</pre> Then, build the TF-A binary for the selected platform. For [[ORCA SOM| ORCA]] SOM:<pre class="workstation-terminal">dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$ make PLAT=imx8mp bl31
</pre>
Please note that this is usually a generic command that generates all required binaries (kernel + device trees) for the different platform. In other wordsFor [[MITO 8M Mini SOM| MITO 8M Mini]] SOM: it is not usually required to specify a different target depending on specific board configuration.<pre class="workstation-terminal">dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage/imx-atf$ make PLAT=imx8mm bl31</pre>
=== Get i.MX firmware ===
<pre class="workstation-terminal">
dvdk@vagrant:~$ cd ~/desk-mx-l/desk-mx8-mkimage/dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ ./fetch_firmware.sh--20222023-0207-17 1124 15:3725:2421-- https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.1018.binResolving www.nxp.com (www.nxp.com)... 104.12087.105170.182Connecting to www.nxp.com (www.nxp.com)|104.12087.105170.182|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1467137 1513050 (1.4M) [application/octet-stream]Saving to: ‘firmware-imx-8.1018.bin’
firmware-imx-8.1018.bin 100%[=========================================================================================================================================>] 1.40M 44M 4--.63MB-KB/s in 0.3s 05s
20222023-0207-17 1124 15:3725:25 21 (431.63 1 MB/s) - ‘firmware-imx-8.1018.bin’ saved [14671371513050/14671371513050]
Welcome to NXP firmware-imx-8.1018.bin
WARNING: EULA has been auto-accepted; this implies that you agree with it.
Unpacking file ................................................................................ donedvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$
</pre>
=== Generate Boot image ===
After building the single all pieces of software, runcreate the <code>flash.bin</code> boot Image running: <preclass="workstation-terminal">
./${BOARD}_generate_flash.bin
</pre>
where BOARD is: <code>imx8mp-mito8mplus</code> or <code>imx8mm-mito8mmini</code>
For [[ORCA SOM | ORCA]]SOM
<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
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$
</pre>
For [[MITO 8M Mini SOM | MITO M8M Mini]] SOM:<pre>./imx8mm-mito8mmini_generate_flash.bin </pre> Binary files can be copied to the tftp root directory <code>/tftpboot/desk-mx-l/</code> with the following command: <pre class="workstation-terminal">dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ cp flash.bin /tftpboot/desk-mx8m-l/desk-mx8m-l-4.0.0-rc2_imx8mp_flash.bin</pre> For [[ORCA SOM| ORCA]] SOM:<pre class="workstation-terminal">dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ cp flash.bin /tftpboot/desk-mx8m-l/desk-mx8m-l-4.0.0_imx8mp_flash.bin</pre> For [[MITO 8M Mini SOM| MITO 8M Mini]] SOM:<pre class="workstation-terminal">dvdk@vagrant:~/desk-mx-l/desk-mx8-mkimage$ cp flash.bin /tftpboot/desk-mx8m-l/desk-mx8m-l-4.0.0_imx8mm_flash.bin</pre> Please refer to [[DESK-MX8M-L/Deployment/Standalone_boot|this page]] for more information on how to update the bootloader on your board. <section end=Body/>  
[[Category:ORCA]] [[Category:MITO 8M Mini]]
8,286
edits