.. index:: double: boot; ultrascale .. _build-ultrascale-boot-files: Create boot files for ultrascale :::::::::::::::::::::::::::::::: The newer versions of the Accelerator Integration Tool (AIT, formerly autoVivado) support the automatic generation of boot files for some boards. This includes the steps in :ref:`build-2016-3-ultrascale-boot-step-hdf` or :ref:`build-2018-3-ultrascale-boot-step-hdf`, which are the ones repeated for every BOOT.BIN generation. The steps in :ref:`build-ultrascale-boot-step-setup` are needed to setup the petalinux project build environment. Assuming that you have a valid petalinux build, you can use the ait functionality with the following points: - Add the option ``--to_step=boot`` when calling ait. - Provide the Petalinux installation and project directories using the following environment variables: - ``PETALINUX_INSTALL`` Petalinux installation directory. - ``PETALINUX_BUILD`` Petalinux project directory. The following sections explain how to build a petalinux project and how to generate a BOOT.BIN using this project. Prerequisites ============= - Petalinux installer (https://www.xilinx.com/products/design-tools/embedded-software/petalinux-sdk.html). - Vivado handoff file (hdf) from a synthesized Vivado project. Petalinux installation ---------------------- Petalinux is installed running its auto-installer package: .. code:: bash ./petalinux-v2016.3-final-installer.run After installation, you should source the petalinux environment file. Usually, this needs to be done every time you want to run from a new terminal. Note that the petalinux settings may change the ARM cross compilers breaking the OmpSs\@FPGA tool-chain. .. code:: bash source /settings.sh .. _build-ultrascale-boot-step-setup: Petalinux project setup ======================= The following steps should be executed once. After them, you will be able to build different boot files just using the AIT option or executing the steps in any of the following sections: :ref:`build-2016-3-ultrascale-boot-step-hdf` (for Petalinux 2016.3) or :ref:`build-2018-3-ultrascale-boot-step-hdf` (for Petalinux 2018.3). Unpack the bsp -------------- Unpack the bsp to create the petalinux project. .. code:: bash petalinux-create -t project -s [Optional] Fix known problems in AXIOM-ZU9EG-2016.3 project ----------------------------------------------------------- Here are some patches for known problems: .. toctree:: :maxdepth: 1 axiom-bsp-fix00 .. _build-ultrascale-boot-fsbl-fallback: [Optional] Modify the FSBL to have the Fallback system ------------------------------------------------------ We developed a modification of Xilinx First Stage Boot Loader (FSBL) to support a fallback boot to a valid known BOOT.BIN file. More information in: .. toctree:: :maxdepth: 1 fsbl-fallback Configure petalinux ------------------- Run petalinux configuration. No changes need to be made to petalinux configuration, but this step has to be run. .. code:: bash export GIT_SSL_NO_VERIFY=1 #Ignore broken certificates petalinux-config After configuration this step, petalinux will download any needed files from external repositories. Configure linux kernel ---------------------- To enter the kernel configuration utility, run: .. code:: bash petalinux-config -c kernel [Optional] Enable Xilinx DMA driver ''''''''''''''''''''''''''''''''''' .. note:: This step is only needed when the the use of DMA engines is desired. Xilinx driver support has to be enabled in order to support Xilinx DMA engine devices. Usually, this is not needed as OmpSs\@FPGA does not make use them to send tasks, neither information, between the host and the FPGA device. It can be enabled in: ``Device drivers → DMA Engines Support → Xilinx axi DMAS`` **Fix old kernels** In petalinux <2017, there is a known problem in the Xilinx DMA implementation. To fix it, download :download:`xilinx_dma.c` and replace it in ``/build/linux/kernel/download/linux-4.6.0-AXIOM-v2016/drivers/dma/xilinx/xilinx_dma.c``, when using a remote kernel, otherwise in ``/components/linux-kernel/xlnx-4.6/drivers/dma/xilinx/xilinx\_dma.c``. [Optional] Increase the CMA (Contiguous Memory Area) '''''''''''''''''''''''''''''''''''''''''''''''''''' You may want to increase the CMA size. It is used by Nanos++ as memory for the FPGA device copies. Its size can be set in: ``Device drivers → Generic Driver Options → DMA Contiguous Memory Allocator`` .. _build-2016-3-ultrascale-boot-step-hdf: Petalinux (2016.3) build for a custom hdf ========================================= Once petalinux project is setup, you can update it to contain a custom bitstream with your hardware. This steps can be repeated several times without executing again the steps in the :ref:`build-ultrascale-boot-step-setup` section. Moreover, AIT supports the automatic execution of the following steps as explained in the beginning of this page. First, you need to import the hardware description file (hdf) in the petalinux project. This is done executing the following command in the root directory of the petalinux project build. .. code:: bash petalinux-config --get-hw-description Add missing nodes to device tree -------------------------------- Some nodes should be added to the device tree before compiling it. misc\_clk\_0 '''''''''''' Edit the file ``./subsystems/linux/configs/device-tree/pl.dtsi`` to add or edit the node ``misc_clk_0``. It should have the following contents (ensure that clock-frequency is correctly set): .. code:: js misc_clk_0: misc_clk_0 { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <200>; }; pl\_bsc.dtsi '''''''''''' AIT will generate a ``pl_bsc.dtsi`` file in the main Vivado project folder. This file contains the missing nodes in the ``amba_pl`` based on your application build. This file must be copied in ``./subsystems/linux/configs/device-tree/`` folder and included in ``./subsystems/linux/configs/device-tree/system-conf.dtsi`` file. For example, it will be located in ``test_ait/Vivado/test/`` folder if the project name is ``test``. Build the Linux system ---------------------- When the project is correctly updated, you can build it with the following commands: .. code:: bash petalinux-build Error in fsbl compilation ''''''''''''''''''''''''' In some cases, fsbl compilation triggered during the petalinux build can fail. This is due to a bad cleanup from previous compilation. In this cases, a complete fsbl cleanup and a new build must be performed. Note, that this extra cleanup may collision with the steps described in :ref:`build-ultrascale-boot-fsbl-fallback`. .. code:: bash petalinux-build -c bootloader -x mrproper petalinux-build [Optional] Build PMU Firmware ----------------------------- Run hsi (included in petalinux and Xilinx SDK). .. code:: bash hsi Inside hsi run .. code:: tcl set hwdsgn [open_hw_design ] generate_app -hw $hwdsgn -os standalone -proc psu_pmu_0 -app zynqmp_pmufw -compile -sw pmufw -dir .. warning:: As of vivado 2016.3 pmu firmware breaks Trenz's TEBF0808 boot Create BOOT.BIN file -------------------- .. code:: bash petalinux-package --force --boot --fsbl images/linux/zynqmp_fsbl.elf --fpga --u-boot images/linux/u-boot.elf cp BOOT.BIN images/linux/image.ub When using PMU firmware, pmu binary has to be included in boot.bin file. To do so, add the ``--pmufw `` argument to the ``petalinux-package`` command. .. _build-2018-3-ultrascale-boot-step-hdf: Petalinux (2018.3) build for a custom hdf ========================================= Once petalinux 2018.3 project is setup, you can update it to contain a custom bitstream with your hardware. This steps can be repeated several times without executing again the steps in the :ref:`build-ultrascale-boot-step-setup` section. Moreover, AIT supports the automatic execution of the following steps as explained in the beginning of this page. First, you need to import the hardware description file (hdf) in the petalinux project. This is done executing the following command in the root directory of the petalinux project build. .. code:: bash petalinux-config --get-hw-description Add missing nodes to device tree -------------------------------- Some nodes should be added to the device tree before compiling it. pl\_bsc.dtsi '''''''''''' AIT will generate a ``pl_bsc.dtsi`` file in the main Vivado project folder. This file contains the missing nodes in the ``amba_pl`` based on your application build. For example, it will be located in ``test_ait/Vivado/test/`` folder if the project name is ``test``. The contents of such file must be placed at the end of ``./project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi`` file. Note that any remaining contents from a previous build must be removed before. The follwoing commant will append the ``pl_bsc.dtsi`` content at the end of ``system-user.dtsi`` file: .. code:: bash cat /pl_bsc.dtsi >>project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi Build the Linux system ---------------------- When the project is correctly updated, you can build it with the following commands: .. code:: bash petalinux-build Create BOOT.BIN file -------------------- .. code:: bash petalinux-package --force --boot --fsbl images/linux/zynqmp_fsbl.elf --fpga --u-boot images/linux/u-boot.elf cp BOOT.BIN images/linux/image.ub