From 404d51ac01c342ebf0e666ac62e1871c334e2f67 Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Sun, 4 Dec 2022 13:24:40 -0800 Subject: u-boot-xlnx-scr: Load openamp.dtbo if present Loading the devicetree/openamp.dtbo if present and merge into the loaded system dtb. (Note, not all boot modes support this behavior.) Signed-off-by: Mark Hatle --- .../conf/machine/include/machine-xilinx-default.inc | 1 + .../recipes-bsp/u-boot/u-boot-xlnx-scr.bb | 3 +++ .../u-boot/u-boot-xlnx-scr/boot.cmd.generic | 6 ++++++ .../u-boot/u-boot-xlnx-scr/boot.cmd.generic.root | 19 ++++++++++++++++++- .../recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.ubifs | 13 +++++++++++++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/meta-xilinx-core/conf/machine/include/machine-xilinx-default.inc b/meta-xilinx-core/conf/machine/include/machine-xilinx-default.inc index 6a0e1a2a..38996384 100644 --- a/meta-xilinx-core/conf/machine/include/machine-xilinx-default.inc +++ b/meta-xilinx-core/conf/machine/include/machine-xilinx-default.inc @@ -93,6 +93,7 @@ def get_default_image_boot_files(d): # device trees (device-tree only), these are first as they are likely desired over the kernel ones if "device-tree" in (d.getVar("PREFERRED_PROVIDER_virtual/dtb") or ""): files.append("devicetree/*.dtb;devicetree/") + files.append("devicetree/*.dtbo;devicetree/") # device trees (kernel only) if d.getVar("KERNEL_DEVICETREE"): diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr.bb b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr.bb index 3f5c277c..187b01d9 100644 --- a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr.bb +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr.bb @@ -71,6 +71,8 @@ DEVICETREE_OFFSET:zynqmp ?= "0x100000" DEVICETREE_OFFSET:zynq ?= "0x100000" DEVICETREE_OFFSET:versal ?= "0x1000" +DEVICETREE_OVERLAY_ADDRESS ?= "${@hex(int(d.getVar("DEVICETREE_ADDRESS"),16) + 0xf00000)}" + KERNEL_LOAD_ADDRESS ?= "${@append_baseaddr(d,d.getVar('KERNEL_OFFSET'))}" KERNEL_OFFSET:microblaze ?= "0x0" @@ -196,6 +198,7 @@ do_compile() { -e 's/@@KERNEL_LOAD_ADDRESS@@/${KERNEL_LOAD_ADDRESS}/' \ -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \ -e 's/@@DEVICETREE_ADDRESS@@/${DEVICETREE_ADDRESS}/' \ + -e 's/@@DEVICETREE_OVERLAY_ADDRESS@@/${DEVICETREE_OVERLAY_ADDRESS}/' \ -e 's/@@RAMDISK_IMAGE@@/${RAMDISK_IMAGE}/' \ -e 's/@@RAMDISK_IMAGE_ADDRESS@@/${RAMDISK_IMAGE_ADDRESS}/' \ -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \ diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic index 2e2bf205..ff2a5688 100644 --- a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic @@ -35,6 +35,12 @@ do if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_ADDRESS@@ system.dtb; fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /devicetree/openamp.dtbo; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_OVERLAY_ADDRESS@@ devicetree/openamp.dtbo; + fdt addr @@DEVICETREE_ADDRESS@@ + fdt resize 8192 + fdt apply @@DEVICETREE_OVERLAY_ADDRESS@@ + fi if test -e ${devtype} ${devnum}:${distro_bootpart} /${ramdisk_name} && test "${skip_tinyramdisk}" != "yes"; then fatload ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ ${ramdisk_name}; @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic.root b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic.root index ca90cbe1..816707cb 100644 --- a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic.root +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.generic.root @@ -35,25 +35,42 @@ do run uenvcmd; fi fi + echo "Checking for /${fitimage_name}" if test -e ${devtype} ${devnum}:${distro_bootpart} /${fitimage_name}; then fatload ${devtype} ${devnum}:${distro_bootpart} @@FIT_IMAGE_LOAD_ADDRESS@@ ${fitimage_name}; echo "Kernel root filesystem parameter needs to be set for FITIMAGE boot if not defined in DTB" bootm @@FIT_IMAGE_LOAD_ADDRESS@@; - fi + fi + echo "Checking for /${kernel_name}" if test -e ${devtype} ${devnum}:${distro_bootpart} /${kernel_name}; then + echo "Loading ${kernel_name}"; fatload ${devtype} ${devnum}:${distro_bootpart} @@KERNEL_LOAD_ADDRESS@@ ${kernel_name}; fi + echo "Checking for /system.dtb" if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then + echo "Loading system.dtb"; fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_ADDRESS@@ system.dtb; fi + echo "Checking for /devicetree/openamp.dtbo" + if test -e ${devtype} ${devnum}:${distro_bootpart} /devicetree/openamp.dtbo; then + echo "Loading and merging openamp.dtbo into device tree"; + fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_OVERLAY_ADDRESS@@ devicetree/openamp.dtbo; + fdt addr @@DEVICETREE_ADDRESS@@ + fdt resize 8192 + fdt apply @@DEVICETREE_OVERLAY_ADDRESS@@ + fi + echo "Checking for /${ramdisk_name}" if test -e ${devtype} ${devnum}:${distro_bootpart} /${ramdisk_name} && test "${skip_tinyramdisk}" != "yes"; then + echo "Loading ${ramdisk_name}"; fatload ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ ${ramdisk_name}; fdt addr @@DEVICETREE_ADDRESS@@ fdt get value bootargs /chosen bootargs setenv bootargs $bootargs @@KERNEL_ROOT_RAMDISK@@ @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ fi + echo "Checking for /${rootfs_name}" if test -e ${devtype} ${devnum}:${distro_bootpart} /${rootfs_name} && test "${skip_ramdisk}" != "yes"; then + echo "Loading ${rootfs_name}"; fatload ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ ${rootfs_name}; fdt addr @@DEVICETREE_ADDRESS@@ fdt get value bootargs /chosen bootargs diff --git a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.ubifs b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.ubifs index 60c48eda..dca974ab 100644 --- a/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.ubifs +++ b/meta-xilinx-core/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.ubifs @@ -21,6 +21,13 @@ do if test $? = 0; then ubifsload @@DEVICETREE_ADDRESS@@ system.dtb fi + ubifsls devicetree/openamp.dtbo + if test $? = 0; then + ubifsload @@DEVICETREE_OVERLAY_ADDRESS@@ devicetree/openamp.dtbo; + fdt addr @@DEVICETREE_ADDRESS@@ + fdt resize 8192 + fdt apply @@DEVICETREE_OVERLAY_ADDRESS@@ + fi ubifsls @@RAMDISK_IMAGE@@ if test $? = 0; then ubifsload @@RAMDISK_IMAGE_ADDRESS@@ @@RAMDISK_IMAGE@@ @@ -43,6 +50,12 @@ do if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then ext4load ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_ADDRESS@@ system.dtb; fi + if test -e ${devtype} ${devnum}:${distro_bootpart} /devicetree/openamp.dtbo; then + fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_OVERLAY_ADDRESS@@ devicetree/openamp.dtbo; + fdt addr @@DEVICETREE_ADDRESS@@ + fdt resize 8192 + fdt apply @@DEVICETREE_OVERLAY_ADDRESS@@ + fi if test -e ${devtype} ${devnum}:${distro_bootpart} /@@RAMDISK_IMAGE@@; then ext4load ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ @@RAMDISK_IMAGE@@; @@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ @@DEVICETREE_ADDRESS@@ -- cgit v1.2.3-54-g00ecf