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 | |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 7 | inherit deploy nopackages image-wic-utils |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 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 | |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 37 | UBOOTSCR_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}${IMAGE_VERSION_SUFFIX}" |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 38 | UBOOTPXE_CONFIG ?= "pxelinux.cfg" |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 39 | UBOOTPXE_CONFIG_NAME = "${UBOOTPXE_CONFIG}${IMAGE_VERSION_SUFFIX}" |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 40 | |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 41 | DEVICETREE_ADDRESS_zynqmp ?= "0x100000" |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 42 | DEVICETREE_ADDRESS_zynq ?= "0x2000000" |
| 43 | DEVICETREE_ADDRESS_versal ?= "0x1000" |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 44 | KERNEL_LOAD_ADDRESS_zynqmp ?= "0x200000" |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 45 | KERNEL_LOAD_ADDRESS_zynq ?= "0x2080000" |
| 46 | KERNEL_LOAD_ADDRESS_versal ?= "0x80000" |
| 47 | |
| 48 | RAMDISK_IMAGE_ADDRESS_zynq ?= "0x4000000" |
| 49 | RAMDISK_IMAGE_ADDRESS_versal ?= "0x6000000" |
| 50 | |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 51 | |
| 52 | SDBOOTDEV ?= "0" |
| 53 | |
| 54 | BITSTREAM_LOAD_ADDRESS ?= "0x100000" |
| 55 | |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 56 | do_configure[noexec] = "1" |
| 57 | do_install[noexec] = "1" |
| 58 | |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 59 | def get_bitstream_load_type(d): |
| 60 | if boot_files_bitstream(d)[1] : |
| 61 | return "loadb" |
| 62 | else: |
| 63 | return "load" |
| 64 | |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 65 | do_compile() { |
| 66 | sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \ |
| 67 | -e 's/@@KERNEL_LOAD_ADDRESS@@/${KERNEL_LOAD_ADDRESS}/' \ |
| 68 | -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \ |
| 69 | -e 's/@@DEVICETREE_ADDRESS@@/${DEVICETREE_ADDRESS}/' \ |
| 70 | -e 's/@@RAMDISK_IMAGE@@/${RAMDISK_IMAGE}/' \ |
| 71 | -e 's/@@RAMDISK_IMAGE_ADDRESS@@/${RAMDISK_IMAGE_ADDRESS}/' \ |
| 72 | -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \ |
Andrew Geissler | a9ff2b3 | 2020-10-16 10:11:54 -0500 | [diff] [blame] | 73 | -e 's/@@SDBOOTDEV@@/${SDBOOTDEV}/' \ |
| 74 | -e 's/@@BITSTREAM@@/${@boot_files_bitstream(d)[0]}/g' \ |
| 75 | -e 's/@@BITSTREAM_LOAD_ADDRESS@@/${BITSTREAM_LOAD_ADDRESS}/g' \ |
| 76 | -e 's/@@BITSTREAM_IMAGE@@/${@boot_files_bitstream(d)[0]}/g' \ |
| 77 | -e 's/@@BITSTREAM_LOAD_TYPE@@/${@get_bitstream_load_type(d)}/g' \ |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 78 | "${WORKDIR}/boot.cmd.${BOOTMODE}.${SOC_FAMILY}" > "${WORKDIR}/boot.cmd" |
| 79 | mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr |
| 80 | sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \ |
| 81 | -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \ |
Andrew Geissler | 84ad7c5 | 2020-06-27 00:00:16 -0500 | [diff] [blame] | 82 | -e 's/@@RAMDISK_IMAGE@@/${RAMDISK_IMAGE}/' \ |
Brad Bishop | 754b8fa | 2019-08-20 09:16:20 -0400 | [diff] [blame] | 83 | "${WORKDIR}/pxeboot.pxe" > "pxeboot.pxe" |
| 84 | } |
| 85 | |
| 86 | |
| 87 | do_deploy() { |
| 88 | install -d ${DEPLOYDIR} |
| 89 | install -m 0644 boot.scr ${DEPLOYDIR}/${UBOOTSCR_BASE_NAME}.scr |
| 90 | ln -sf ${UBOOTSCR_BASE_NAME}.scr ${DEPLOYDIR}/boot.scr |
| 91 | install -d ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME} |
| 92 | install -m 0644 pxeboot.pxe ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME}/default |
| 93 | ln -sf pxeboot/${UBOOTPXE_CONFIG_NAME} ${DEPLOYDIR}/${UBOOTPXE_CONFIG} |
| 94 | } |
| 95 | |
| 96 | addtask do_deploy after do_compile before do_build |