Generate a DTB Using the Vitis CLI
The Vitis CLI generates a DTB as part
of platform creation when you set generate_dtb=True. This flow integrates DTB generation into the standard
platform component flow, so you do not need to run sdtgen or Lopper separately.
Before you begin, make sure you have an XSA file, a Linux operating system target, the target CPU, and an optional custom DTSI directory if you need to inject custom device tree fragments.
To generate the DTB, launch the Vitis
CLI Python client, create an advanced options dictionary that points to your DTSI
directory and configures overlay and ZOCL behavior, then create the platform
component with generate_dtb=True. The following
example creates a platform for psv_cortexa72 with
DTB generation enabled:
adv_options = client.create_advanced_options_dict(
user_dtsi=dtsi_dir,
dt_overlay="0",
dt_zocl="1",
)
platform = client.create_platform_component(
name="pfm",
hw_design=curr_dir + "/" + xsa_fixed,
os="linux",
cpu="psv_cortexa72",
domain_name="linux_xrt",
generate_dtb=True,
advanced_options=adv_options,
)
After you create the platform component, the Vitis tool writes the DTB to the generated platform output directory. You can also enable this option from the Create Platform Component wizard by selecting Generate Device Tree Blob (DTB) on the OS and Processor page.
Generate a DTB Using SDT and Lopper (Advanced)
This flow separates SDT generation from DTB generation and gives you direct control over each stage. Use it when the Vitis CLI flow does not expose the customization you need.
First, generate the SDT from the XSA by using sdtgen. The following command extracts the SDT for a VCK190 design and
writes the output to the sdt_out directory:
sdtgen -dir sdt_out -xsa design_1_wrapper.xsa -board_dts versal-vck190-rev1.1
sdtgen generate_sdt
This step produces system-top.dts,
which Lopper uses in the next step.
Next, configure Lopper by exporting the device tree compiler flags
that Lopper passes to dtc:
export LOPPER_DTC_FLAGS="-b 0 -@"
Finally, run Lopper on the SDT with the Linux domain configuration to generate the DTB.
lopper -f --enhanced \
-i lop-a72-imux.dts \
./linux_ws/platform/hw/sdt/system-top.dts \
system.dtb \
-- gen_domain_dts psv_cortexa72_0 linux_dt
dtc reports merge errors when building the DTB.