blob: d2eedd58a5fd71f257b1a604aafe98ca5bbdb80b [file] [log] [blame]
Brad Bishop754b8fa2019-08-20 09:16:20 -04001SUMMARY = "U-boot boot scripts for Xilinx devices"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
4
5DEPENDS = "u-boot-mkimage-native"
6
7inherit deploy nopackages
8
9INHIBIT_DEFAULT_DEPS = "1"
10
11COMPATIBLE_MACHINE ?= "^$"
12COMPATIBLE_MACHINE_zynqmp = "zynqmp"
13COMPATIBLE_MACHINE_zynq = "zynq"
14COMPATIBLE_MACHINE_versal = "versal"
15
16KERNELDT = "${@os.path.basename(d.getVar('KERNEL_DEVICETREE').split(' ')[0]) if d.getVar('KERNEL_DEVICETREE') else ''}"
17DEVICE_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
19RAMDISK_IMAGE ?= ""
20RAMDISK_IMAGE_zynq ?= "uramdisk.image.gz"
21
22KERNEL_BOOTCMD_zynqmp ?= "booti"
23KERNEL_BOOTCMD_zynq ?= "bootm"
24KERNEL_BOOTCMD_versal ?= "booti"
25
26BOOTMODE ?= "sd"
27BOOTMODE_versal ?= "qspi"
28
29SRC_URI = " \
30 file://boot.cmd.sd.zynq \
31 file://boot.cmd.sd.zynqmp \
32 file://boot.cmd.qspi.versal \
33 file://pxeboot.pxe \
34 "
35PACKAGE_ARCH = "${MACHINE_ARCH}"
36
37UBOOTSCR_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}-${DATETIME}"
38UBOOTSCR_BASE_NAME[vardepsexclude] = "DATETIME"
39UBOOTPXE_CONFIG ?= "pxelinux.cfg"
40UBOOTPXE_CONFIG_NAME = "${UBOOTPXE_CONFIG}-${DATETIME}"
41UBOOTPXE_CONFIG_NAME[vardepsexclude] = "DATETIME"
42
43DEVICETREE_ADDRESS_zynqmp ?= "0x4000000"
44DEVICETREE_ADDRESS_zynq ?= "0x2000000"
45DEVICETREE_ADDRESS_versal ?= "0x1000"
46KERNEL_LOAD_ADDRESS_zynqmp ?= "0x80000"
47KERNEL_LOAD_ADDRESS_zynq ?= "0x2080000"
48KERNEL_LOAD_ADDRESS_versal ?= "0x80000"
49
50RAMDISK_IMAGE_ADDRESS_zynq ?= "0x4000000"
51RAMDISK_IMAGE_ADDRESS_versal ?= "0x6000000"
52
53do_configure[noexec] = "1"
54do_install[noexec] = "1"
55
56do_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
72do_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
81addtask do_deploy after do_compile before do_build