Using External Kernel and U-Boot with PetaLinux - 2021.2 English

PetaLinux Tools Documentation: Reference Guide

Document ID
UG1144
Release Date
2021-10-27
Version
2021.2 English

PetaLinux includes kernel source and U-Boot source. However, you can build your own kernel and U-Boot with PetaLinux.

PetaLinux supports local sources for kernel, U-Boot, and TF-A.

For external sources create a directory <plnx-proj-root>/components/ext_sources/.

  1. Copy the kernel source directory:
    <plnx-proj-root>/components/ext_sources/<MY-KERNEL>
  2. Copy the U-Boot source directory:
    <plnx-proj-root>/components/ext_sources/<MY-U-BOOT>
  3. Run petalinux-config, and go into Linux Components Selection sub-menu.
    • For kernel, select linux-kernel () ---> and then select ext-local-src.

      ( ) linux-xlnx

      ( ) remote

      (X) ext-local-src

    • For U-Boot, select u-boot () ---> and then select ext-local-src.

      ( ) u-boot-xlnx

      ( ) remote

      (X) ext-local-src

  4. Add external source path.
    • For kernel, select External linux-kernel local source settings --->. Enter the path:

      ${PROOT}/components/ext_sources/<MY-KERNEL>

    • For U-Boot, select External u-boot local source settings --->. Enter the path:

      ${PROOT}/components/ext_sources/<MY-U-BOOT>

      ${PROOT} is a PetaLinux variable pointing to <plnx-proj-root>/ directory. You can also specify an absolute path of the source. The sources can be placed outside the project as well.

      Note: If after setting ext-local-src, you try to change it to linux-xlnx/u-boot-xlnx in petalinux-config, it will give the following warning.
      WARNING: Workspace already setup to use from <ext-local-src path>,
      Use 'petalinux-devtool reset linux-xlnx' To remove this (or) Use this for your development.
    Note: When creating a BSP with external sources in project, it is your responsibility to copy the sources into the project and do the packing. For more information, see Packaging BSP.
Important: It is not mandatory to have external sources under components/. You can specify any location outside the project as well. However, while packaging the BSP, you are responsible for copying the external sources into components/ and setting relative path.
Note: If the external source is a git repository, its checked out state must be appropriate for the project that is being built.