Building a Project¶
The Mango PetaLinux projects are ready to build as-is. In the project root run petalinux-build
. When the build finishes the boot images will be copied to <proj_root>/images/linux
and to /tftpboot
for retrieval by u-boot
via TFTP.
The PetaLinux build system uses caching to speed the build process. Generally petalinux-build
will only rebuild components that have changed since the previous build. For example, to iterate on the mango_wlan
driver module, edit the source in components/meta-mango/recipes-kernel/mango-wlan
, then re-run petalinux-build
to compile the updated module. The build flow always regenerates the boot images and copies them to /tftpboot
.
The petalinux-build
command has many optional arguments. For example petalinux-build -c mango_wlan -x do_devshell
will launch a new shell in the mango_wlan
build folder with the complete cross-compilation environment setup. Refer to the PetaLinux documentation for more details.
Booting the Mango PetaLinux reference project requires BOOT.BIN
and image.ub
images. The project includes pre-built images in <proj_root>/images/linux
which can be used as-is.
The sections below describe the contents of these images and how to generate these images after making changes to the reference project.
Required Binaries¶
Booting Linux on an MPSoC device requires the following binaries:
- PMU Firmware
- ARM Trusted Firmware (bl31)
- First Stage Bootloader (FSBL)
- Second stage bootloader (u-boot)
- RPU applications
- Device tree blob
- Linux kernel image
- RAM filesystem
The Mango reference PetaLinux projects can generate all of these binaries, and the PetaLinux tools can package the binaries into a few archives that simplify the boot process.
BOOT.BIN
¶
The first boot archive is BOOT.BIN
which bundles:
- PMU Firmware
- ARM Trusted Firmware (bl31)
- First Stage Bootloader (FSBL)
- Second stage bootloader (u-boot)
The BOOT.BIN
file must be copied to a FAT-formatted SD card. Mango provides a pre-built BOOT.BIN
with the reference design.
The BOOT.BIN
file must be updated any time the FSBL
or u-boot
changes in the PetaLinux project. Typically this only occurs for changes to the PS/PL configuration in the Vivado FPGA design. For software-only changes or FPGA design changes which do not modify the PS configuration, there is no need to update BOOT.BIN
.
To generate BOOT.BIN
from a PetaLinux project, run petalinux-package --boot --u-boot --pmufw --force
, confirm output:
Find BOOT.BIN
in <proj_root>/images/linux/
.
The Xilinx tools support bundling the FPGA bitstream into BOOT.BIN
via the petalinux-package --fpga
option. Mango recommends not including the bitstream here, instead configuring the PL from Linux userspace after the node has booted. This simplifies iterating on the FPGA design.
image.ub
¶
The second boot archive is a FIT image containing:
- Device tree blob
- Linux kernel image
- RAM filesystem
Mango provides a pre-built image.ub
with the reference design. The image.ub
image can be loaded via the SD card or via TFTP.
This image is automatically generated by petalinux-build
after any software or hardware changes. Find the newly built image.ub
in <proj_root>/images/linux/
. PetaLinux also copies image.ub
to /tftpboot
for loading via TFTP.
FPGA Bitstream¶
The programmable logic (PL) section of the Xilinx device is configured with a bitstream. The bitstream is generated by the Vivado hardware synthesis/implementation tools. The Mango PetaLinux projects include a prebuilt bitstream that can be used without re-running the Vivado flow. By default the bitstream is included in the root filesystem at /usr/share/mango_wlan/mango_wlan_<version>.bit
. The same bitstream is stored in the PetaLinux project at <proj_root>/project-spec/hw-description/system.bit
.
The FPGA bitstream is loaded into the PL at runtime from Linux userspace using the Xilinx fpga_manager
framework:
If you re-run the hardware tools to generate a new bitstream it is necessary to copy the updated bitstream to the node via the SD card, NFS or SFTP.
RPU Applications¶
The MAC software runs in the two ARM R5 CPUs in the MPSoC RPU. One elf
binary must be provided for each CPU. For normal 802.11 applications CPU R5_0
runs the high_linux_dev
application and CPU R5_1
runs the edca
application.
Prebuilt elf
binaries are provided in the PetaLinux reference projects. These reference binaries are copied to /lib/firmware
in the root filesystem by default (see Booting).
Custom binaries can be built via Xilinx Vitis. Refer to the “MAC Software Workspace” section above for creating the Vitis Workspace and compiling the applications. In the Vitis workspace the elf
binaries are located at components/wlan_mac_workspace/wlan-sdk/projects/<app>/Debug/<app>.elf
for each MAC application.