Search code examples
xilinxyoctou-bootopenembeddedpetalinux

Yocto u-boot Custom Commands


What is the correct way of adding custom commands to u-boot in a Yocto setup (currently using Petalinux 2016.4 by Xilinx)?

  1. Should I add the relevant source files to the u-boot source through a recipe/patch, to be included in the compilation of u-boot?

  2. Is there a better way to do this during development to get a faster turn around.

  3. In what folder should the code be placed - under u-boot/board or added to u-boot/commands?

Thanks


Solution

  • IMHO you have two options for adding the additional sourcecode to your YP build:

    1. If you have only a small number of changes: Add the patches to your layer and "activate" them via SRC_URI.
    2. If you have more changes: create a separate git branch/repo for "your" U-Boot version.

    The fastest way of testing your changes may be to checkout a separate U-Boot repo somewhere and use a generated SDK. Another way may be to use the devshell [1]

    I'm not an expert on U-Boot's source layout, but I would say it depends which type of command it is. If it's a "generic" one like date the cmd/ subdirectory would be best.

    If you're looking for an example on which you can base your work maybe the timer command in cmd/misc.c would be a good start.

    [1] http://www.openembedded.org/wiki/Devshell