Xilinx u-boot supports distrocmd, this required u-boot.scr from distro
to provide the required default boot instead of scanning through the
list of available boot devices.

This patch enables SD boot mode by default for ZU+ and Versal devices.

Signed-off-by: Manjukumar Matha <manjukumar.harthikote-ma...@xilinx.com>
---
 .../recipes-bsp/u-boot/u-boot-zynq-scr.bb          | 81 ++++++++++++++++++++++
 .../u-boot/u-boot-zynq-scr/boot.cmd.qspi           |  1 +
 .../u-boot/u-boot-zynq-scr/boot.cmd.qspi.versal    |  1 +
 .../recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd |  6 ++
 .../u-boot/u-boot-zynq-scr/boot.cmd.sd.zynq        |  4 ++
 .../u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp      |  4 ++
 .../recipes-bsp/u-boot/u-boot-zynq-scr/pxeboot.pxe |  3 +
 7 files changed, 100 insertions(+)
 create mode 100644 meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb
 create mode 100644 
meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.qspi
 create mode 100644 
meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.qspi.versal
 create mode 100644 
meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd
 create mode 100644 
meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynq
 create mode 100644 
meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp
 create mode 100644 
meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/pxeboot.pxe

diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb 
b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb
new file mode 100644
index 0000000..d2eedd5
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb
@@ -0,0 +1,81 @@
+SUMMARY = "U-boot boot scripts for Xilinx devices"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = 
"file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+DEPENDS = "u-boot-mkimage-native"
+
+inherit deploy nopackages
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+COMPATIBLE_MACHINE ?= "^$"
+COMPATIBLE_MACHINE_zynqmp = "zynqmp"
+COMPATIBLE_MACHINE_zynq = "zynq"
+COMPATIBLE_MACHINE_versal = "versal"
+
+KERNELDT = "${@os.path.basename(d.getVar('KERNEL_DEVICETREE').split(' ')[0]) 
if d.getVar('KERNEL_DEVICETREE') else ''}"
+DEVICE_TREE_NAME ?= "${@bb.utils.contains('PREFERRED_PROVIDER_virtual/dtb', 
'device-tree', 'system.dtb', d.getVar('KERNELDT'), d)}"
+#Need to copy a rootfs.cpio.gz.u-boot as uramdisk.image.gz into boot partition
+RAMDISK_IMAGE ?= ""
+RAMDISK_IMAGE_zynq ?= "uramdisk.image.gz"
+
+KERNEL_BOOTCMD_zynqmp ?= "booti"
+KERNEL_BOOTCMD_zynq ?= "bootm"
+KERNEL_BOOTCMD_versal ?= "booti"
+
+BOOTMODE ?= "sd"
+BOOTMODE_versal ?= "qspi"
+
+SRC_URI = " \
+            file://boot.cmd.sd.zynq \
+            file://boot.cmd.sd.zynqmp \
+            file://boot.cmd.qspi.versal \
+            file://pxeboot.pxe \
+            "
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+UBOOTSCR_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}-${DATETIME}"
+UBOOTSCR_BASE_NAME[vardepsexclude] = "DATETIME"
+UBOOTPXE_CONFIG ?= "pxelinux.cfg"
+UBOOTPXE_CONFIG_NAME = "${UBOOTPXE_CONFIG}-${DATETIME}"
+UBOOTPXE_CONFIG_NAME[vardepsexclude] = "DATETIME"
+
+DEVICETREE_ADDRESS_zynqmp ?= "0x4000000"
+DEVICETREE_ADDRESS_zynq ?= "0x2000000"
+DEVICETREE_ADDRESS_versal ?= "0x1000"
+KERNEL_LOAD_ADDRESS_zynqmp ?= "0x80000"
+KERNEL_LOAD_ADDRESS_zynq ?= "0x2080000"
+KERNEL_LOAD_ADDRESS_versal ?= "0x80000"
+
+RAMDISK_IMAGE_ADDRESS_zynq ?= "0x4000000"
+RAMDISK_IMAGE_ADDRESS_versal ?= "0x6000000"
+
+do_configure[noexec] = "1"
+do_install[noexec] = "1"
+
+do_compile() {
+    sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
+        -e 's/@@KERNEL_LOAD_ADDRESS@@/${KERNEL_LOAD_ADDRESS}/' \
+        -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \
+        -e 's/@@DEVICETREE_ADDRESS@@/${DEVICETREE_ADDRESS}/' \
+        -e 's/@@RAMDISK_IMAGE@@/${RAMDISK_IMAGE}/' \
+        -e 's/@@RAMDISK_IMAGE_ADDRESS@@/${RAMDISK_IMAGE_ADDRESS}/' \
+        -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \
+        "${WORKDIR}/boot.cmd.${BOOTMODE}.${SOC_FAMILY}" > "${WORKDIR}/boot.cmd"
+    mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" 
boot.scr
+    sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
+        -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \
+       "${WORKDIR}/pxeboot.pxe" > "pxeboot.pxe"
+}
+
+
+do_deploy() {
+    install -d ${DEPLOYDIR}
+    install -m 0644 boot.scr ${DEPLOYDIR}/${UBOOTSCR_BASE_NAME}.scr
+    ln -sf ${UBOOTSCR_BASE_NAME}.scr ${DEPLOYDIR}/boot.scr
+    install -d ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME}
+    install -m 0644 pxeboot.pxe 
${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME}/default
+    ln -sf pxeboot/${UBOOTPXE_CONFIG_NAME} ${DEPLOYDIR}/${UBOOTPXE_CONFIG}
+}
+
+addtask do_deploy after do_compile before do_build
diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.qspi 
b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.qspi
new file mode 100644
index 0000000..84a25d2
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.qspi
@@ -0,0 +1 @@
+booti 0x80000 0x6000000 0x1000
diff --git 
a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.qspi.versal 
b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.qspi.versal
new file mode 100644
index 0000000..d56b7c8
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.qspi.versal
@@ -0,0 +1 @@
+@@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ 
@@DEVICETREE_ADDRESS@@
diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd 
b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd
new file mode 100644
index 0000000..67a8057
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd
@@ -0,0 +1,6 @@
+setenv bootargs $bootargs root=/dev/mmcblk0p2 rw rootwait earlycon 
clk_ignore_unused
+devicetree_image=@@DEVICE_TREE_NAME@@
+fatload mmc 0 ${fdt_addr_r} ${devicetree_image}
+fatload mmc $sdbootdev:$partid  ${kernel_addr_r} @@KERNEL_IMAGETYPE@@
+booti ${kernel_addr_r} - ${fdt_addr_r}
+
diff --git 
a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynq 
b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynq
new file mode 100644
index 0000000..f593ab4
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynq
@@ -0,0 +1,4 @@
+fatload mmc 0 @@DEVICETREE_ADDRESS@@ @@DEVICE_TREE_NAME@@
+fatload mmc 0 @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGETYPE@@
+fatload mmc 0 @@RAMDISK_IMAGE_ADDRESS@@ @@RAMDISK_IMAGE@@
+@@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ @@RAMDISK_IMAGE_ADDRESS@@ 
@@DEVICETREE_ADDRESS@@
diff --git 
a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp 
b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp
new file mode 100644
index 0000000..18f82d7
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp
@@ -0,0 +1,4 @@
+setenv bootargs $bootargs root=/dev/mmcblk0p2 rw rootwait earlycon 
clk_ignore_unused
+fatload mmc 0 @@DEVICETREE_ADDRESS@@ @@DEVICE_TREE_NAME@@
+fatload mmc $sdbootdev:$partid @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGETYPE@@
+@@KERNEL_BOOTCMD@@ @@KERNEL_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@
diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/pxeboot.pxe 
b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/pxeboot.pxe
new file mode 100644
index 0000000..6d7a0a9
--- /dev/null
+++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/pxeboot.pxe
@@ -0,0 +1,3 @@
+LABEL Linux
+KERNEL @@KERNEL_IMAGETYPE@@
+FDT @@DEVICE_TREE_NAME@@
-- 
2.7.4

-- 
_______________________________________________
meta-xilinx mailing list
meta-xilinx@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-xilinx

Reply via email to