| Summary: | Custom device tree and u-boot boot.scr not integrated in boot.vfat (hw: BeagleBoneBlack with LCD cape) | ||
|---|---|---|---|
| Product: | buildroot | Reporter: | Tibor Stolz <tistolz> |
| Component: | Other | Assignee: | unassigned |
| Status: | RESOLVED WORKSFORME | ||
| Severity: | normal | CC: | buildroot |
| Priority: | P5 | ||
| Version: | 2018.02.9 | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
| Attachments: | Device tree customization for the LCD cape | ||
|
Description
Tibor Stolz
2019-02-01 12:58:38 UTC
Created attachment 7941 [details] Device tree customization for the LCD cape Hello, I finally succeeded in building a Buildroot system that properly supports the gen4-4DCAPE-43T LCD screen. However, it required some "tricks" which are not properly supported by the Buildroot workflow. First of all, the "dtc -I fs /proc/device-tree -o my-device-tree.dts" approach of getting the device tree from a running Debian system was rubbish. To quote #beagle IRC: > it's definitely not something that's intended to work in the first place > [...] > /proc/device-tree does not show the original DT as it was passed to the kernel > [...] > some kernel code modifies these data structures Therefore I created the attached device tree source code, which takes the am335x-boneblack.dts as a basis (#include) and adds the definitions from <https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-BONE-4D4R-01-00A1.dts> translated from "overlay fragment" syntax to normal dts code (reference: <https://pastebin.com/b8kZfhRG>). This bug now boils down to Buildroot's handling of such out-of-tree device tree files. I included my am335x-withcapes-4d4r.dts in [make menuconfig --> Kernel --> Out-of-tree Device Tree Source file paths]. The problems are as follows: 1) I had to manually add output/build/linux-4.14.96/include/dt-bindings/board/am335x-bbw-bbb-base.h (downloaded from GitHub), after the kernel has been extracted. This is probably a use case outside of the goals of Buildroot, so maybe I'll inline that include file later. 2) When building the Linux kernel, Buildroot will copy my am335x-withcapes-4d4r.dts into output/build/linux-4.14.96/arch/arm/boot/dts/, compile it there, and copy the compiled file to output/images/am335x-withcapes-4d4r.dtb. However, !! the .dtb file is not included in output/images/boot.vfat !! 3) The same problem occurs with a boot.scr file, which I included as of [make menuconfig --> Bootloaders --> Generate a U-Boot boot script: ON] [make menuconfig --> Bootloaders --> U-Boot boot script source: /path/to/boot.scr] The result is that output/images/boot.scr is created, but boot.scr is not part of output/images/boot.vfat! My solution was to manually add am335x-withcapes-4d4r.dtb and boot.scr to the FAT partition once the sdcard.img was written to the SD card. In this configuration, the LCD is now working. I think that problems 2) and 3) are minor bugs of the Buildroot system which should be fixed. Best regards, Tibor Stolz Hello,
During another build I found out that board/beaglebone/post-image.sh is responsible for the contents of the boot.vfat filesystem. It selects the config file board/beaglebone/genimage.cfg (or genimage_linux41.cfg), which contains the vfat filesystem contents hard-coded:
> image boot.vfat {
> vfat {
> files = {
> "MLO",
> "u-boot.img",
> "zImage",
> "uEnv.txt",
> "am335x-evm.dtb",
> "am335x-evmsk.dtb",
> "am335x-bone.dtb",
> "am335x-boneblack.dtb",
> "am335x-bonegreen.dtb",
> }
> }
> size = 16M
> }
[...]
So is it worth the effort to dynamically change this files list, depending on the presence of 'boot.scr' or additional out-of-tree .dtb files?
Best regards,
Tibor Stolz
Hi Tibor, [Discussion like this is more appropriate on the mailing list, where we can do proper quoting of replies and add people to Cc etc.] > 1) I had to manually add output/build/linux-4.14.96/include/dt-bindings/board/am335x-bbw-bbb-base.h (downloaded from GitHub), after the kernel has been > extracted. This is probably a use case outside of the goals of Buildroot, so maybe I'll inline that include file later. This is probably because you're not using the Linux source that is expected by that DTS file. > 2) When building the Linux kernel, Buildroot will copy my am335x-withcapes-4d4r.dts into output/build/linux-4.14.96/arch/arm/boot/dts/, compile it there, and copy the compiled file to output/images/am335x-withcapes-4d4r.dtb. > However, !! the .dtb file is not included in output/images/boot.vfat !! Indeed, because it needs to be enumerated in the genimage.cfg. Two improvements could make this use case easier: A. Extend the genimage tool with support for wildcards, so genimage.cfg would contain "*.dtb" instead of the explicit list. B. Change the configuration of the bootloader to look for kernel and DTB in /boot on the ext4 partition, rather than on the FAT partition. With BR2_LINUX_KERNEL_INSTALL_TARGET=y all the DTBs will be copied there. > 3) The same problem occurs with a boot.scr file, which I included as of > [make menuconfig --> Bootloaders --> Generate a U-Boot boot script: ON] > [make menuconfig --> Bootloaders --> U-Boot boot script source: /path/to/boot.scr] > The result is that output/images/boot.scr is created, but boot.scr is not part of output/images/boot.vfat! Yes, the genimage.cfg uses uEnv.txt instead of boot.scr. Just copy and modify genimage.cfg. Since this is really not a bug, marking as WORKSFORME. |