Document Version: 20230112

The Yocto Project setup for the System Device Tree workflow is as follows.
Be sure to read everything below, as the steps will be updated in the future
if the setup script changes.

The steps in this document expect that you have already built the setup
(meta-xilinx-setup) SDK, and installed it.

* Run the setup script

The setup environment should be run in a new shell (not the build shell)
to ensure that you do not contaminate the environment for your build.

We will assume below that the directory "prestep" was used for the SDK,
however you may use any path you wish.

Source the SDK environment file
 $ . <build>/prestep/environment-setup-x86_64-petalinux-linux

Run the script from the same directory as this README
 $ <build>/prestep/dt-processor.sh -c <conf> -s <dtb> -l conf/local.conf

Note: The -l option will automatically add the necessary parameters to the
local.conf file.  If you need to re-run this comment, you just clear the
parameters from the end of the file.  Without the -l option the items are
printed to the screen and must be manually added to your conf/local.conf

For example, zynqmp:
 $ ./prestep/dt-processor.sh -c conf -s /proj/yocto/zcu102-sdt/system-top.dts -l conf/local.conf

The following will be written to the end of the conf/local.conf file:

  # Each multiconfig will define it's own TMPDIR, this is the new default based
  # on BASE_TMPDIR for the Linux build
  TMPDIR = "${BASE_TMPDIR}/tmp"

  # Use the newly generated MACHINE
  MACHINE = "xlnx-zynqmp-zcu102-rev1-0"
  
  # All of the TMPDIRs must be in a common parent directory. This is defined
  # as BASE_TMPDIR.
  # Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp
  BASE_TMPDIR ?= "${TOPDIR}"
  
  # The following is the full set of multiconfigs for this configuration
  # A large list can cause a slow parse.
  BBMULTICONFIG = " cortexa53-0-zynqmp-fsbl-baremetal cortexa53-0-zynqmp-baremetal cortexa53-0-zynqmp-freertos cortexa53-1-zynqmp-baremetal cortexa53-1-zynqmp-freertos cortexa53-2-zynqmp-baremetal cortexa53-2-zynqmp-freertos cortexa53-3-zynqmp-baremetal cortexa53-3-zynqmp-freertos cortexr5-0-zynqmp-fsbl-baremetal cortexr5-0-zynqmp-baremetal cortexr5-0-zynqmp-freertos cortexr5-1-zynqmp-baremetal cortexr5-1-zynqmp-freertos microblaze-0-pmu"
  # Alternatively trim the list to the minimum
  #BBMULTICONFIG = " cortexa53-0-zynqmp-fsbl-baremetal microblaze-0-pmu"


For example, versal:
 $ ./prestep/dt-processor.sh -c conf -s /proj/yocto/vmk180-sdt/system-top.dts -l conf/local.conf

The following will be written to the end of the conf/local.conf file:

  # Each multiconfig will define it's own TMPDIR, this is the new default based
  # on BASE_TMPDIR for the Linux build
  TMPDIR = "${BASE_TMPDIR}/tmp"
  
  # Use the newly generated MACHINE
  MACHINE = "xlnx-versal-vmk180-rev1-1-x-ebm-01-reva"
  
  # All of the TMPDIRs must be in a common parent directory. This is defined
  # as BASE_TMPDIR.
  # Adjust BASE_TMPDIR if you want to move the tmpdirs elsewhere, such as /tmp
  BASE_TMPDIR ?= "${TOPDIR}"
  
  # The following is the full set of multiconfigs for this configuration
  # A large list can cause a slow parse.
  BBMULTICONFIG = " cortexa72-0-versal-baremetal cortexa72-0-versal-freertos cortexa72-1-versal-baremetal cortexa72-1-versal-freertos microblaze-0-pmc microblaze-0-psm cortexr5-0-versal-baremetal cortexr5-0-versal-freertos cortexr5-1-versal-baremetal cortexr5-1-versal-freertos"
  # Alternatively trim the list to the minimum
  #BBMULTICONFIG = " microblaze-0-pmc microblaze-0-psm"


You can now EXIT THE NEW SHELL return the build environment for the remaining steps.

* Bitbake Performance Note

Each BBMULTICONFIG value requires all of the recipes to be parsed for that
configuration.  Thus each multiconfig will add more parsing time.  A long list
can lead to a very slow parse (many minutes).  To speed up parsing, it is
suggested that you trim this down to only the configurations you require.
A minimum configuration is included with the generated configuration.

* Build your project

You should now be able to build your project normally.  See the Yocto Project
documentation if you have questions on how to work with the multiconfig
recipes.  The following is a simple build for testing.

In the original build shell
Build your Linux sytem:
 $ bitbake petalinux-image-minimal

The output will be in tmp/deploy/images/...

If the system is QEMU capable execute QEMU using:
 $ runqemu nographic slirp core-image-minimal

To terminate qemu, usually the command is ctrl-a x
