Difference between revisions of "DESK-MX8M-L/Development/Building Linux kernel"

From DAVE Developer's Wiki
Jump to: navigation, search
(Instructions)
Line 63: Line 63:
 
* open a terminal window and ''cd'' into Linux kernel source code
 
* open a terminal window and ''cd'' into Linux kernel source code
  
<pre class="workstation-terminal">
+
<pre>
 
cd desk-mx-l/linux
 
cd desk-mx-l/linux
 
</pre>
 
</pre>
Line 69: Line 69:
 
* in case of needs you can update your local repository with the following git command
 
* in case of needs you can update your local repository with the following git command
  
<pre class="workstation-terminal">
+
<pre>
 
git pull
 
git pull
 
</pre>
 
</pre>
  
 
* checkout the right branch
 
* checkout the right branch
 
+
<pre>
<pre class="workstation-terminal">
 
 
git checkout desk-mx8m-l-rel-2.0.0
 
git checkout desk-mx8m-l-rel-2.0.0
 
</pre>
 
</pre>
Line 81: Line 80:
 
* configure the build environment: the '''proper SDK''' has to be installed in the DVDK as described in the [[DESK-MX8M-L/General/DVDK_Virtual_Machine | DVDK Virtual Machine]] wiki page
 
* configure the build environment: the '''proper SDK''' has to be installed in the DVDK as described in the [[DESK-MX8M-L/General/DVDK_Virtual_Machine | DVDK Virtual Machine]] wiki page
  
<pre class="workstation-terminal">
+
<pre>
 
source /home/dvdk/desk-mx-l/desk-mx8m-l-2.0.0-rc2_env.sh
 
source /home/dvdk/desk-mx-l/desk-mx8m-l-2.0.0-rc2_env.sh
 
</pre>
 
</pre>
Line 87: Line 86:
 
* enter the source tree directory and run the following commands:
 
* enter the source tree directory and run the following commands:
  
<pre class="workstation-terminal">
+
<pre>
make imx_v8_defconfig
+
dvdk@vagrant:~/desk-mx-l/linux$ make imx_v8_defconfig
make Image modules freescale/imx8mm-mito8mmini.dtb freescale/imx8mp-mito8mplus-cb1001.dtb
+
dvdk@vagrant:~/desk-mx-l/linux$ make Image modules freescale/imx8mm-mito8mmini.dtb freescale/imx8mp-mito8mplus-cb1001.dtb
 
</pre>
 
</pre>
  
Line 99: Line 98:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
cp arch/arm64/boot/Image /tftpboot/desk-mx-l/
+
dvdk@vagrant:~/desk-mx-l$ cp arch/arm64/boot/Image /tftpboot/desk-mx-l/
cp arch/arm64/boot/dts/freescale/*.dtb /tftpboot/desk-mx-l/
+
dvdk@vagrant:~/desk-mx-l$ cp arch/arm64/boot/dts/freescale/*.dtb /tftpboot/desk-mx-l/
 
</pre>
 
</pre>
  
Line 112: Line 111:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
mkdir modules-install
+
dvdk@vagrant:~/desk-mx-l/linux$ mkdir modules-install
make INSTALL_MOD_PATH=modules-install modules_install
+
dvdk@vagrant:~/desk-mx-l/linux$ make INSTALL_MOD_PATH=modules-install modules_install
cd modules-install && tar cvzf ../modules.tar.gz . && cd ..
+
dvdk@vagrant:~/desk-mx-l/linux$ cd modules-install
 +
dvdk@vagrant:~/desk-mx-l/linux/modules-install$ tar cvzf ../modules.tar.gz . && cd ..
 +
dvdk@vagrant:~/desk-mx-l/linux$
 
</pre>
 
</pre>
  
Line 120: Line 121:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
tar xvzf modules.tar.gz -C /
+
root@desk-mx8mp:~# tar xvzf modules.tar.gz -C /
 
</pre>
 
</pre>
  

Revision as of 16:04, 16 February 2022

History
Version Issue Date Notes
1.0.0 Feb 2022 First DESK-MX8M release



Building Linux[edit | edit source]

Quick reference[edit | edit source]

Repository Information
URL git@git.dave.eu:desk-mx-l/linux-imx.git
stable branch desk-mx8m-l-rel-2.0.0
stable tag desk-mx8m-l-2.0.0-rc2

Build Information
defconfig imx_v8_defconfig
Kernel binary Image
Device trees Platform DTB
SBC AXEL imx8mm-mito8mmini.dtsb
SBC ORCA imx8mp-mito8mplus-cb1001.dts

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 Linux kernel source code
cd desk-mx-l/linux
  • in case of needs you can update your local repository with the following git command
git pull
  • checkout the right branch
git checkout desk-mx8m-l-rel-2.0.0
  • configure the build environment: the proper SDK has to be installed in the DVDK as described in the DVDK Virtual Machine wiki page
source /home/dvdk/desk-mx-l/desk-mx8m-l-2.0.0-rc2_env.sh
  • enter the source tree directory and run the following commands:
dvdk@vagrant:~/desk-mx-l/linux$ make imx_v8_defconfig
dvdk@vagrant:~/desk-mx-l/linux$ make Image modules freescale/imx8mm-mito8mmini.dtb freescale/imx8mp-mito8mplus-cb1001.dtb

NOTE: this is the default configuration suitable for the latest target.

The former command selects the default DESK-MX8M-L configuration, while the latter builds the kernel binary image with the required u-boot header and the kernel device tree.

Default Linux kernel configuration can be changed by using the standard menuconfig, xconfig, or gconfig make target. Subsequent builds just require uImage make target to update the binary image. Once the build process is complete, the kernel binary image is stored into the arch/arm/boot/Image file. Both this file and the kernel device tree can be copied to the tftp root directory /tftpboot/desk-mx-l/ with the following commands:

dvdk@vagrant:~/desk-mx-l$ cp arch/arm64/boot/Image /tftpboot/desk-mx-l/
dvdk@vagrant:~/desk-mx-l$ cp arch/arm64/boot/dts/freescale/*.dtb /tftpboot/desk-mx-l/

Usually, kernel modules are installed with make modules_install command, but this method installs the modules into the /lib/modules directory of your MVM, which is not what you want.

A better way to deploy kernel modules while cross-compiling is

  • generate a .tar.gz archive
  • install this archive into the target root file system

User can create such an archive, for example, using the following commands:

dvdk@vagrant:~/desk-mx-l/linux$ mkdir modules-install
dvdk@vagrant:~/desk-mx-l/linux$ make INSTALL_MOD_PATH=modules-install modules_install
dvdk@vagrant:~/desk-mx-l/linux$ cd modules-install
dvdk@vagrant:~/desk-mx-l/linux/modules-install$ tar cvzf ../modules.tar.gz . && cd ..
dvdk@vagrant:~/desk-mx-l/linux$ 

Now copy modules.tar.gz into the target root file system and install them as root with the following command

root@desk-mx8mp:~# tar xvzf modules.tar.gz -C /