blob: a4f40685b3d420918f87f319658cf6bed5bb0069 [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"
Brad Bishop754b8fa2019-08-20 09:16:20 -040027
28SRC_URI = " \
29 file://boot.cmd.sd.zynq \
30 file://boot.cmd.sd.zynqmp \
Andrew Geissler84ad7c52020-06-27 00:00:16 -050031 file://boot.cmd.sd.versal \
Brad Bishop754b8fa2019-08-20 09:16:20 -040032 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
Andrew Geissler84ad7c52020-06-27 00:00:16 -050043DEVICETREE_ADDRESS_zynqmp ?= "0x100000"
Brad Bishop754b8fa2019-08-20 09:16:20 -040044DEVICETREE_ADDRESS_zynq ?= "0x2000000"
45DEVICETREE_ADDRESS_versal ?= "0x1000"
Andrew Geissler84ad7c52020-06-27 00:00:16 -050046KERNEL_LOAD_ADDRESS_zynqmp ?= "0x200000"
Brad Bishop754b8fa2019-08-20 09:16:20 -040047KERNEL_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}/' \
Andrew Geissler84ad7c52020-06-27 00:00:16 -050068 -e 's/@@RAMDISK_IMAGE@@/${RAMDISK_IMAGE}/' \
Brad Bishop754b8fa2019-08-20 09:16:20 -040069 "${WORKDIR}/pxeboot.pxe" > "pxeboot.pxe"
70}
71
72
73do_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
82addtask do_deploy after do_compile before do_build