DESK-MX9-L/Development/Building Linux kernel

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes

2024/01/31

DESK-MX9-L-5.0.0 release
2024/04/09 DESK-MX9-L-5.1.0 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-mx9-l-5.x.x
stable tag desk-mx9-l-5.1.0

Build Information
defconfig imx_v8_defconfig
Kernel binary Image
Device trees Platform DTB
SBC freescale/imx93-aura-som0002-cb2001.dtb

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
dvdk@vagrant:~$ cd ~/desk-mx-l/linux
dvdk@vagrant:~/desk-mx-l/linux$
  • in case of needs you can update your local repository with the following git command
dvdk@vagrant:~/desk-mx-l/linux$ git pull
  • configure the build environment
dvdk@vagrant:~/desk-mx-l/linux$ source ~/desk-mx-l/desk-mx9-l-5.0.0_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/imx93-aura-som0002-cb2001.dtb

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

The former command selects the default DESK-MX9-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-mx9-l/ with the following commands:

dvdk@vagrant:~/desk-mx-l/linux$ cp arch/arm64/boot/Image /tftpboot/desk-mx9-l/
dvdk@vagrant:~/desk-mx-l/linux$ cp arch/arm64/boot/dts/freescale/*.dtb /tftpboot/desk-mx9-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-mx93:~# tar xvzf modules.tar.gz -C /