As explained [[Logical_structure_of_Bora_and_BoraX_Embedded_Linux_Kits_(BELK/BXELK)|here]], BELK/BXELK structure is not based on the [https://www.xilinx.com/products/design-tools/embedded-software/petalinux-sdk.html PetaLinux build system] (*). Instead, BELK/BXELK make use of a standardized Yocto-based build system to build all the software components—U-Boot, Linux kernel, and root filesystem—that run on the Processing System (PS). This approach is more flexible and more modularized but it requires a little bit more knowledge of embedded Linux systems.
That being said, there are cases in which it can be convenient to build such components with PetaLinux build system, however. This technical note shows how to use the PetaLinux build system to build the Linux kernel released with BELK/BXELK.
The procedure was tested with the following configuration.
{| class="wikitable"
|-
!Component
!Version
|-
| style="text-align: center;" |PetaLinux
|2017.2
|-
| style="text-align: center;" |BELK/BXELK
|4.0.0
|-
| style="text-align: center;" |Host operating system
|Ubuntu 14.04.5 LTS
|-
|}
It is assumed that PetaLinux is already installed on the host machine (for more details, please refer to [https://www.xilinx.com/support/documentation-navigation/see-all-versions.html?xlnxproducttypes=Design%20Tools&xlnxdocumentid=UG1144 ''UG1144 - PetaLinux Tools Documentation: Reference Guide'']).
(*) Please note that PetaLinux itself works on top of the Yocto build system.
INFO: New project successfully created in /home/dvdk/devel/bora/prj/bora_1
</pre>
Import the hardware specification file (.hdf) generated by your Vivado project. This step will open automatically the text-based configuration menu of PetaLinux build system: when it shows up, just exit and save the configuration without changing anything.
Configure the build system in order to use a custom directory for device tree include files: enable the ''Auto Config Settings --> Specify a manual device tree include directory'' item and set the ''Manual device tree include directory'' to <code>${TOPDIR}/../components/ext_sources/linux-xlnx/arch/arm/boot/dts/include</code>:
linux-xlnx-4.9-belk-4.0.0+git999-r0 do_compile: NOTE: linux-xlnx: compiling from external source tree /home/dvdk/devel/bora/prj/bora_1/build/../components/ext_sources/linux-xlnx
fsbl-2017.2+gitAUTOINC+122565ec40-r0 do_compile: NOTE: fsbl: compiling from external source tree /opt/petalinux/tools/hsm/data/embeddedsw
NOTE: Tasks Summary: Attempted 2410 tasks of which 1869 didn't need to be rerun and all succeeded.
linux-xlnx-4.9-belk-4.0.0+git999-r0 do_compile: NOTE: linux-xlnx: compiling from external source tree /home/dvdk/devel/bora/prj/bora_1/build/../components/ext_sources/linux-xlnx
NOTE: Tasks Summary: Attempted 2410 tasks of which 2349 didn't need to be rerun and all succeeded.
NOTE: Tasks Summary: Attempted 748 tasks of which 748 didn't need to be rerun and all succeeded.
INFO: Copying Images from deploy to images
[INFO] successfully built device-tree
</pre>
After the build is completed, the <code>uImage</code> file and the device tree blob (<code>system.dtb</code>) are located in the <code>images/linux</code> directory.
===Device tree handling===
One of the most appreciated features of PetaLinux is the automatic generation of the Linux Device Tree including the nodes associated with the IPs instantiated in the PL. When used in combination with the Device Tree provided by the BELK/BXELK, this generation process works as depicted in the following image.
[[File:BELK-PetaLinux-DTB.png|thumb|center|600px|Combined Device Tree generation process]]
In essence, PetaLinux combines the original Bora/BoraX device tree (<code>bora.dts</code>) with another auxiliary device tree generated on the base of hardware description file (.hdf). The resulting DTB (<code>system.dtb</code>) provides all the nodes required by the system to operate properly.
It is worth remembering that the user can add further customizations to the resulting DTB by editing this file <code><plnx-projroot>/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi</code>. For more details, please refer to the ''Xilinx UG1144 PetaLinux Tools Documentation - Reference Guide''.