Add new device tree file to the Linux kernel
Hardware specifics are handled in the kernel via device tree files. Device tree files are text files that describe a platform's hardware. They are part of the kernel source tree but are compiled as separate binary files. The bootloader loads the device tree binary on RAM memory and passes it to the kernel, which in turn loads the necessary drivers according to the device tree description.
Note For details on how the device tree files are organized for different available SOM and SBC board variants, see Device tree files.
Create the device tree for your custom carrier board
You can either clone the device tree from your device and start customizing it, or you can create a new skeleton device tree from scratch.
Clone an existing reference device tree
- Fork the Linux repository from the Digi Embedded github account into your own account.
- Duplicate the reference platform device tree file. You can use this commit as reference.
- Customize your platform. This includes making sure that both the defconfig and the device tree file are tweaked to match your new platform.
- Either modify the DEY linux recipe to point to your forked branch or extract the patch from the repository and add it to your own custom Yocto layer. See Add new machine in custom Digi Embedded Yocto layer.
New skeleton device tree
Start by creating a new .dts file at arch/arm/boot/dts/ (for example, imx6ul-custom.dts) that contains:
- an include line to the .dtsi file that matches your i.MX6UL CPU
- imx6ul.dtsi
- an include line to the .dtsi file that matches your ConnectCore 6UL module variant
- your platform model name under the model property
- a compatible property set to "digi,ccimx6ul", "fsl,imx6ul"
imx6ul-custom.dts
/dts-v1/; /* i.MX6UL CPU */ #include "imx6ul.dtsi" /* ConnectCore 6UL module */ #include "imx6ul-ccimx6ul-wb.dtsi" / { model = "My Company's ConnectCore 6UL based platform"; compatible = " mycc6ulboard, digi,ccimx6ul", "fsl,imx6ul"; digi,machine,name = " custom"; };
Enable ConnectCore 6UL interfaces
Most of the interfaces are disabled (their status property is set to disabled) in the .dtsi include file. For each interface you want to use, you must:
- enable it by setting its status property to okay.
- configure its IOMUX to the pins used on your carrier board, as applicable. See Pin multiplexing (IOMUX) section for details.
- configure additional parameters to match your hardware, as applicable.
Note You can reference device tree files and schematics to enable and configure the IOMUX interfaces and pins. See Hardware documentation.
Copy hardware components from the ConnectCore 6UL SBCs
If your carrier board design is based on the ConnectCore 6UL SBC Express or Pro, you can copy interfaces and IOMUX settings from the corresponding device tree include files and adapt the settings or lines as applicable for your hardware.
Add custom hardware
Your carrier board may include additional hardware components. If a driver exists in the Linux kernel, check its device tree bindings in the Linux kernel documentation at Documentation/devicetree/bindings/.
Compile your platform device tree
If you want the kernel to build your newly created device tree file, you must add it to the device tree's Makefile:
arch/arm/boot/dts/Makefile
imx6ul-9x9-evk-ldo.dtb \ imx6ul-ccimx6ulsbc.dtb \ imx6ul-ccimx6ulsbc-id135.dtb \ imx6ul-ccimx6ulsbc-wb.dtb \ + imx6ul-custom.dtb \ imx6ul-ccimx6ulstarter.dtb \ imx6ul-ccimx6ulstarter-id129.dtb \ imx6ul-ccimx6ulstarter-wb.dtb \