Re: Failing to patch u-boot .dts

Jonas Vautherin

Finally understood how to do it properly, and hence explaining here for the record.

In my machine configuration, I have this line (that I overlooked):

IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} MLO zImage am335x-pocketbeagle.dtb"

Which says that it should use the `am335x-pocketbeagle` device tree. I assume that it infers that it should compile `am335x-pocketbeagle.dts` into `am335x-pocketbeagle.dtb`. Because `am335x-evm` is listed as the default in the defconfig, I thought it was the one being used. But I was wrong.

I patched `am335x-pocketbeagle.dts` this time and it just worked.

On Thu, Mar 11, 2021 at 11:28 AM Jonas Vautherin <jonas.vautherin@...> wrote:

I am using u-boot on a pocketbeagle which, according to "Default Device Tree for DT control" in `bitbake -c menuconfig u-boot`, uses am335x-evm, which I understand is the file in ./build/tmp/work/pocketbeagle-poky-linux-gnueabi/u-boot/1_2020.07-r0/git/arch/arm/dts/am335x-evm.dts. 

My issue is that this file ends up setting usb1 as `dr_mode = "host"` and usb0 as `dr_mode = "otg"`. I would like to use fastboot on my pocketbeagle, and therefore set them to `dr_mode = "peripheral"`.

In order to do that, I wrote a .bbappend that does the following:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI += "file://am335x-evm.dts.patch"
SRC_URI += "file://logging.cfg"

The patch sets both usb0 and usb1 to `dr_mode = "peripheral"`, while the cfg enables logging in u-boot. Because logging is effectively enabled, I get that my .bbappend is used. And I can confirm that ./build/tmp/work/pocketbeagle-poky-linux-gnueabi/u-boot/1_2020.07-r0/git/arch/arm/dts/am335x-evm.dts is patched indeed.

However, whatever I do, I can't seem to get that modification in my u-boot device tree at runtime, as usb0 always ends up as "otg" and usb1 as "host". I have even tried a full clean build where I removed build/tmp and cache_sstate.

I cannot really tell if my patched file is actually used or not. For instance, if I `bitbake -c cleansstate u-boot`, then `bitbake -c do_patch u-boot`, then `rm -rf ./build/tmp/work/pocketbeagle-poky-linux-gnueabi/u-boot/1_2020.07-r0/git/arch/arm/dts` and finally `bitbake u-boot`, it does not complain at all about a missing dts file.

What am I missing, and how could I make sure that my patched am335x-evm.dts is the device tree being used by my u-boot install?

Best Regards,

Join { to automatically receive all group messages.