cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Advisor
Advisor
113 Views
Registered: ‎01-28-2008

Adding device-tree overlay to Petalinux build

Hi folks,

  I'm looking for advice as to how include the device tree compilation of an overlay, such that it's compiled (dtc) and added to the rootfs on a normal Petalinux 2020.1 build.

  Currently, I'm compiling them manually and plan to add them to the rootfs by a post-process function, but perhaps there's a better way to go about this. The overlays are not intended to be loaded automatically at boot time, but on demand by the application running on Linux.

  In summary, I'm looking for a .bb recipe to:

a) Compile the overlay .dts with dtc to generate the .dtbo

b) Add the .dtbo somewhere in the rootfs.

 

Thanks in advance for any pointers,

-Pat

 

Give kudos if helpful. Accept as solution if it solves your problem.
https://tuxengineering.com/blog

0 Kudos
1 Reply
Highlighted
Advisor
Advisor
101 Views
Registered: ‎01-28-2008

Hi,

  Well, I gave this a shot by adding code to recipes/core/images/petalinux-image-full.bbappend, to compile the device tree overlays into dtbo's.

# petalinux-user-image.bbappend content
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI += "file://i2c0-site0.dts \
            file://i2c0-site1.dts"

rootfs_postprocess_function() {
    dtc -I dts -O dtb ${WORKDIR}/i2c0-site0.dts -b 0 -@ -o ${WORKDIR}/i2c0-site0.dtbo
    dtc -I dts -O dtb ${WORKDIR}/i2c0-site1.dts -b 0 -@ -o ${WORKDIR}/i2c0-site1.dtbo

    install -m 0644 ${WORKDIR}/i2c0-site0.dtbo ${D}${sysconfdir}/overlays/i2c0-site0.dtbo
    install -m 0644 ${WORKDIR}/i2c0-site1.dtbo ${D}${sysconfdir}/overlays/i2c0-site1.dtbo

}

ROOTFS_POSTPROCESS_COMMAND_append = " \
  rootfs_postprocess_function; \
  "

  This doesn't cause any errors, but the blobs are not compiled. I suspect the dtc is not in the build path, so the compilation is quietly ignored.

 

I'll appreciate any pointers.

Thanks,

-Pat

 

Give kudos if helpful. Accept as solution if it solves your problem.
https://tuxengineering.com/blog

0 Kudos