Device tree overlay files, kernel object files, and PWM

I am having trouble with the relationship between the on board cross compiler, .dts/.dtb files and .ko files. I am using “https://github.com/SaadAhmad/beaglebone-black-cpp-PWM” as my tutorial, as I am not very experienced with either the BBB or Linux.

Here’s what I’m doing:

  1. Backup the old pwm_test.ko file
cd /lib/modules/<kernel version>/kernel/drivers/pwm/
cp pwm_test.ko pwm_test.ko.orig   

  1. Find the built pwm_test.ko file and copy it over to /lib/modules//kernel/drivers/pwm/

  2. Copy over the build dtbo files to /lib/firmware

  3. Youre done setting up the files! Do a reboot and you should be set

I am at step 4(but maybe it’s 3 that is stumping me?) and do not understand how to build the .dts from the .ko file. I understand that the .dts is the device tree source code file, and that when compiled, becomes the .dtb file. I am uncertain of how to make the .dts from the .ko file.

Can someone point me in the right direction? Thanks!

The .ko file is a Kernel Object/Module. You build that as part of either the kernel make process or as part of the github thing.

DTS files become DTB files

C source files become .ko files

Regards,

Nick

Thanks Nick. The idea that .ko files are compiled from C source code flipped a light switch.

I figured out what I was doing wrong…for the time being anyway. The tutorial is in Github, so the repository for all of the files is at the top of the page. Every .ko, .dts, and .dtb file you need to do this tutorial is there for you already. I couldn’t see the forest for the trees…

Yeah so
→ .ko = kernel object
→ .c = c source file
→ .dts = device tree source
→ .dtb = device tree blob
→ .dtbo = device tree blob overlay