package/rpi-firmware: Support Device Tree Overlay
PATCH 1/1 package/rpi-firmware: Support Device Tree Overlay
Building the Raspberry Pi GitHub official kernel repository will generate a Device Tree Overlay Blob files under $(LINUX_DIR)/arch/$(KERNEL_ARCH)/boot/dts/overlays.
This commit changes to install the Device Tree Overlay Blob file generated during kernel build under the following conditions:
- $(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS)
- n
- $(BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT)
- y
--- package/rpi-firmware/rpi-firmware.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)
package/rpi-firmware/rpi-firmware.mk +10 -0
@@ -30,6 +30,16 @@ else define RPI_FIRMWARE_INSTALL_DTB_OVERLAYS $(INSTALL) -d $(BINARIES_DIR)/rpi-firmware/overlays endef +ifeq ($(BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT),y) +# If you are using the official raspberry pi kernel, dtbo will be created under +# the overlays directory, so use that. +define RPI_FIRMWARE_INSTALL_KERNEL_DTB_OVERLAYS + for dtbo in $(LINUX_DIR)/arch/$(KERNEL_ARCH)/boot/dts/overlays/*.dtbo; do \ + $(INSTALL) -D -m 0644 $${dtbo} $(BINARIES_DIR)/rpi-firmware/overlays/$${dtbo##*/} || exit 1; \ + done +endef +LINUX_POST_INSTALL_IMAGES_HOOKS += RPI_FIRMWARE_INSTALL_KERNEL_DTB_OVERLAYS +endif endif ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_VCDBG),y)
Signature · 6 lines
2.33.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Takumi,
thanks for suggested patch...., comment below:
Quoted 25 lines · Takumi Takahashi
Building the Raspberry Pi GitHub official kernel repository will generate a Device Tree Overlay Blob files under
$(LINUX_DIR)/arch/$(KERNEL_ARCH)/boot/dts/overlays.This commit changes to install the Device Tree Overlay Blob file generated during kernel build under the following conditions:
-
$(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS)
-n
-$(BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT)
-ySigned-off-by Takumi Takahashi <[email protected]>--- package/rpi-firmware/rpi-firmware.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)package/rpi-firmware/rpi-firmware.mk +0
-0@@ -30,6 +30,16 @@ else define RPI_FIRMWARE_INSTALL_DTB_OVERLAYS $(INSTALL) -d $(BINARIES_DIR)/rpi-firmware/overlays endef
package/rpi-firmware/rpi-firmware.mk else · line 42
Quoted 10 lines
package/rpi-firmware/rpi-firmware.mk +10
-0+ifeq ($(BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT),y) +# If you are using the official raspberry pi kernel, dtbo will be created under +# the overlays directory, so use that. +define RPI_FIRMWARE_INSTALL_KERNEL_DTB_OVERLAYS + for dtbo in $(LINUX_DIR)/arch/$(KERNEL_ARCH)/boot/dts/overlays/*.dtbo; do \ + $(INSTALL) -D -m 0644 $${dtbo} $(BINARIES_DIR)/rpi-firmware/overlays/$${dtbo##*/} || exit 1; \ + done +endef +LINUX_POST_INSTALL_IMAGES_HOOKS += RPI_FIRMWARE_INSTALL_KERNEL_DTB_OVERLAYS +endif
I believe this is the wrong place to copy the linux-kernel generated overlays (as they are independent of the rpi-firmware package), a better place would be a BR2_ROOTFS_POST_BUILD_SCRIPT script...
Regards,
Peter
package/rpi-firmware/rpi-firmware.mk else · line 45
Quoted 3 lines
package/rpi-firmware/rpi-firmware.mk +0
-0endif ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_VCDBG),y)
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 23 lines · Peter Seiderer
Hello Takumi,
thanks for suggested patch...., comment below:
Quoted 17 lines · Takumi Takahashi
Building the Raspberry Pi GitHub official kernel repository will generate a Device Tree Overlay Blob files under
$(LINUX_DIR)/arch/$(KERNEL_ARCH)/boot/dts/overlays.This commit changes to install the Device Tree Overlay Blob file generated during kernel build under the following conditions:
-
$(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS)
-n
-$(BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT)
-ySigned-off-by Takumi Takahashi <[email protected]>--- package/rpi-firmware/rpi-firmware.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)
Quoted 13 lines
package/rpi-firmware/rpi-firmware.mk else · line 37
Quoted 13 lines
package/rpi-firmware/rpi-firmware.mk +5
-0@@ -30,6 +30,16 @@ else define RPI_FIRMWARE_INSTALL_DTB_OVERLAYS $(INSTALL) -d $(BINARIES_DIR)/rpi-firmware/overlays endef +ifeq ($(BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT),y) +# If you are using the official raspberry pi kernel, dtbo will be created under +# the overlays directory, so use that. +define RPI_FIRMWARE_INSTALL_KERNEL_DTB_OVERLAYS + for dtbo in $(LINUX_DIR)/arch/$(KERNEL_ARCH)/boot/dts/overlays/*.dtbo; do \
It is possible to use an upstream kernel that doesn't have this, and enable
overlay support in the upstream kernel (i.e. using upstream overlays instead of the RPi hacks). In that case, this will fail with something like '*.dtbo: no such file or directory'.
To fix that, use a make loop instead of a shell loop. Something like (untested):
$(foreach dtbo,$(wildcard
$(LINUX_DIR)/arch/$(KERNEL_ARCH)/boot/dts/overlays/*.dtbo),\
$(INSTALL) -D -m 0644 ${dtbo} $(BINARIES_DIR)/rpi-firmware/overlays/$(notdir $(dtbo))$(sep))
Note that you also don't need the 'exit 1' any more because they're all
separate commands.
Quoted 9 lines
package/rpi-firmware/rpi-firmware.mk else · line 42
Quoted 5 lines
package/rpi-firmware/rpi-firmware.mk +5
-0+ $(INSTALL) -D -m 0644 $${dtbo} $(BINARIES_DIR)/rpi-firmware/overlays/$${dtbo##*/} || exit 1; \ + done +endef +LINUX_POST_INSTALL_IMAGES_HOOKS += RPI_FIRMWARE_INSTALL_KERNEL_DTB_OVERLAYS +endifI believe this is the wrong place to copy the linux-kernel generated overlays (as they are independent of the rpi-firmware package), a better place would be a
BR2_ROOTFS_POST_BUILD_SCRIPTscript...
Indeed, if this feature would be added anywhere, it would have to be in the
linux package, not in rpi-firmware. You'd need to add BR2_PACKAGE_RPI_FIRMWARE to the condition as well.
I've marked the patch as Changes Requested in patchwork.
Regards,
Arnout
Quoted 4 lines
Regards,
Peter
Quoted 9 lines
package/rpi-firmware/rpi-firmware.mk else · line 45
Quoted 3 lines
package/rpi-firmware/rpi-firmware.mk +0
-0endif ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_VCDBG),y)_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot