diff options
author | Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> | 2019-08-15 16:55:34 -0700 |
---|---|---|
committer | Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com> | 2019-08-15 17:07:44 -0700 |
commit | 10bfd0a246b40c9daeedba705871637639a5d2cf (patch) | |
tree | 0cb339f7f7efba48eb5f4a43b93ccf541744e868 | |
parent | 481a7ec35b9e7a4f71f9c9330caec973ab0a0f28 (diff) | |
download | meta-xilinx-10bfd0a246b40c9daeedba705871637639a5d2cf.tar.gz |
u-boot-zynq-scr.bb: Recipe to create u-boot.scr for Xilinx devices
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-matha@xilinx.com>
7 files changed, 100 insertions, 0 deletions
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 00000000..d2eedd58 --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb | |||
@@ -0,0 +1,81 @@ | |||
1 | SUMMARY = "U-boot boot scripts for Xilinx devices" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
4 | |||
5 | DEPENDS = "u-boot-mkimage-native" | ||
6 | |||
7 | inherit deploy nopackages | ||
8 | |||
9 | INHIBIT_DEFAULT_DEPS = "1" | ||
10 | |||
11 | COMPATIBLE_MACHINE ?= "^$" | ||
12 | COMPATIBLE_MACHINE_zynqmp = "zynqmp" | ||
13 | COMPATIBLE_MACHINE_zynq = "zynq" | ||
14 | COMPATIBLE_MACHINE_versal = "versal" | ||
15 | |||
16 | KERNELDT = "${@os.path.basename(d.getVar('KERNEL_DEVICETREE').split(' ')[0]) if d.getVar('KERNEL_DEVICETREE') else ''}" | ||
17 | DEVICE_TREE_NAME ?= "${@bb.utils.contains('PREFERRED_PROVIDER_virtual/dtb', 'device-tree', 'system.dtb', d.getVar('KERNELDT'), d)}" | ||
18 | #Need to copy a rootfs.cpio.gz.u-boot as uramdisk.image.gz into boot partition | ||
19 | RAMDISK_IMAGE ?= "" | ||
20 | RAMDISK_IMAGE_zynq ?= "uramdisk.image.gz" | ||
21 | |||
22 | KERNEL_BOOTCMD_zynqmp ?= "booti" | ||
23 | KERNEL_BOOTCMD_zynq ?= "bootm" | ||
24 | KERNEL_BOOTCMD_versal ?= "booti" | ||
25 | |||
26 | BOOTMODE ?= "sd" | ||
27 | BOOTMODE_versal ?= "qspi" | ||
28 | |||
29 | SRC_URI = " \ | ||
30 | file://boot.cmd.sd.zynq \ | ||
31 | file://boot.cmd.sd.zynqmp \ | ||
32 | file://boot.cmd.qspi.versal \ | ||
33 | file://pxeboot.pxe \ | ||
34 | " | ||
35 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
36 | |||
37 | UBOOTSCR_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}-${DATETIME}" | ||
38 | UBOOTSCR_BASE_NAME[vardepsexclude] = "DATETIME" | ||
39 | UBOOTPXE_CONFIG ?= "pxelinux.cfg" | ||
40 | UBOOTPXE_CONFIG_NAME = "${UBOOTPXE_CONFIG}-${DATETIME}" | ||
41 | UBOOTPXE_CONFIG_NAME[vardepsexclude] = "DATETIME" | ||
42 | |||
43 | DEVICETREE_ADDRESS_zynqmp ?= "0x4000000" | ||
44 | DEVICETREE_ADDRESS_zynq ?= "0x2000000" | ||
45 | DEVICETREE_ADDRESS_versal ?= "0x1000" | ||
46 | KERNEL_LOAD_ADDRESS_zynqmp ?= "0x80000" | ||
47 | KERNEL_LOAD_ADDRESS_zynq ?= "0x2080000" | ||
48 | KERNEL_LOAD_ADDRESS_versal ?= "0x80000" | ||
49 | |||
50 | RAMDISK_IMAGE_ADDRESS_zynq ?= "0x4000000" | ||
51 | RAMDISK_IMAGE_ADDRESS_versal ?= "0x6000000" | ||
52 | |||
53 | do_configure[noexec] = "1" | ||
54 | do_install[noexec] = "1" | ||
55 | |||
56 | do_compile() { | ||
57 | sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \ | ||
58 | -e 's/@@KERNEL_LOAD_ADDRESS@@/${KERNEL_LOAD_ADDRESS}/' \ | ||
59 | -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \ | ||
60 | -e 's/@@DEVICETREE_ADDRESS@@/${DEVICETREE_ADDRESS}/' \ | ||
61 | -e 's/@@RAMDISK_IMAGE@@/${RAMDISK_IMAGE}/' \ | ||
62 | -e 's/@@RAMDISK_IMAGE_ADDRESS@@/${RAMDISK_IMAGE_ADDRESS}/' \ | ||
63 | -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \ | ||
64 | "${WORKDIR}/boot.cmd.${BOOTMODE}.${SOC_FAMILY}" > "${WORKDIR}/boot.cmd" | ||
65 | mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr | ||
66 | sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \ | ||
67 | -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \ | ||
68 | "${WORKDIR}/pxeboot.pxe" > "pxeboot.pxe" | ||
69 | } | ||
70 | |||
71 | |||
72 | do_deploy() { | ||
73 | install -d ${DEPLOYDIR} | ||
74 | install -m 0644 boot.scr ${DEPLOYDIR}/${UBOOTSCR_BASE_NAME}.scr | ||
75 | ln -sf ${UBOOTSCR_BASE_NAME}.scr ${DEPLOYDIR}/boot.scr | ||
76 | install -d ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME} | ||
77 | install -m 0644 pxeboot.pxe ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME}/default | ||
78 | ln -sf pxeboot/${UBOOTPXE_CONFIG_NAME} ${DEPLOYDIR}/${UBOOTPXE_CONFIG} | ||
79 | } | ||
80 | |||
81 | 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 00000000..84a25d29 --- /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 00000000..d56b7c8c --- /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 00000000..67a8057b --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd | |||
@@ -0,0 +1,6 @@ | |||
1 | setenv bootargs $bootargs root=/dev/mmcblk0p2 rw rootwait earlycon clk_ignore_unused | ||
2 | devicetree_image=@@DEVICE_TREE_NAME@@ | ||
3 | fatload mmc 0 ${fdt_addr_r} ${devicetree_image} | ||
4 | fatload mmc $sdbootdev:$partid ${kernel_addr_r} @@KERNEL_IMAGETYPE@@ | ||
5 | booti ${kernel_addr_r} - ${fdt_addr_r} | ||
6 | |||
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 00000000..f593ab4a --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynq | |||
@@ -0,0 +1,4 @@ | |||
1 | fatload mmc 0 @@DEVICETREE_ADDRESS@@ @@DEVICE_TREE_NAME@@ | ||
2 | fatload mmc 0 @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGETYPE@@ | ||
3 | fatload mmc 0 @@RAMDISK_IMAGE_ADDRESS@@ @@RAMDISK_IMAGE@@ | ||
4 | @@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 00000000..18f82d78 --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/boot.cmd.sd.zynqmp | |||
@@ -0,0 +1,4 @@ | |||
1 | setenv bootargs $bootargs root=/dev/mmcblk0p2 rw rootwait earlycon clk_ignore_unused | ||
2 | fatload mmc 0 @@DEVICETREE_ADDRESS@@ @@DEVICE_TREE_NAME@@ | ||
3 | fatload mmc $sdbootdev:$partid @@KERNEL_LOAD_ADDRESS@@ @@KERNEL_IMAGETYPE@@ | ||
4 | @@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 00000000..6d7a0a94 --- /dev/null +++ b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr/pxeboot.pxe | |||
@@ -0,0 +1,3 @@ | |||
1 | LABEL Linux | ||
2 | KERNEL @@KERNEL_IMAGETYPE@@ | ||
3 | FDT @@DEVICE_TREE_NAME@@ | ||