Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 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" |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 27 | |
| 28 | SRC_URI = " \ |
| 29 | file://boot.cmd.sd.zynq \ |
| 30 | file://boot.cmd.sd.zynqmp \ |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 31 | file://boot.cmd.sd.versal \ |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 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 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 43 | DEVICETREE_ADDRESS_zynqmp ?= "0x100000" |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 44 | DEVICETREE_ADDRESS_zynq ?= "0x2000000" |
| 45 | DEVICETREE_ADDRESS_versal ?= "0x1000" |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 46 | KERNEL_LOAD_ADDRESS_zynqmp ?= "0x200000" |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 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}/' \ |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 68 | -e 's/@@RAMDISK_IMAGE@@/${RAMDISK_IMAGE}/' \ |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 69 | "${WORKDIR}/pxeboot.pxe" > "pxeboot.pxe" |
| 70 | } |
| 71 | |
| 72 | |
| 73 | do_deploy() { |
| 74 | install -d ${DEPLOYDIR} |
| 75 | install -m 0644 boot.scr ${DEPLOYDIR}/${UBOOTSCR_BASE_NAME}.scr |
| 76 | ln -sf ${UBOOTSCR_BASE_NAME}.scr ${DEPLOYDIR}/boot.scr |
| 77 | install -d ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME} |
| 78 | install -m 0644 pxeboot.pxe ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME}/default |
| 79 | ln -sf pxeboot/${UBOOTPXE_CONFIG_NAME} ${DEPLOYDIR}/${UBOOTPXE_CONFIG} |
| 80 | } |
| 81 | |
| 82 | addtask do_deploy after do_compile before do_build |