blob: e8b91922b769f8506e6418a2dc632fa5b39ef585 [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
Andrew Geisslera9ff2b32020-10-16 10:11:54 -05007inherit deploy nopackages image-wic-utils
Brad Bishop754b8fa2019-08-20 09:16:20 -04008
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
Andrew Geisslera9ff2b32020-10-16 10:11:54 -050037UBOOTSCR_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}${IMAGE_VERSION_SUFFIX}"
Brad Bishop754b8fa2019-08-20 09:16:20 -040038UBOOTPXE_CONFIG ?= "pxelinux.cfg"
Andrew Geisslera9ff2b32020-10-16 10:11:54 -050039UBOOTPXE_CONFIG_NAME = "${UBOOTPXE_CONFIG}${IMAGE_VERSION_SUFFIX}"
Brad Bishop754b8fa2019-08-20 09:16:20 -040040
Andrew Geissler84ad7c52020-06-27 00:00:16 -050041DEVICETREE_ADDRESS_zynqmp ?= "0x100000"
Brad Bishop754b8fa2019-08-20 09:16:20 -040042DEVICETREE_ADDRESS_zynq ?= "0x2000000"
43DEVICETREE_ADDRESS_versal ?= "0x1000"
Andrew Geissler84ad7c52020-06-27 00:00:16 -050044KERNEL_LOAD_ADDRESS_zynqmp ?= "0x200000"
Brad Bishop754b8fa2019-08-20 09:16:20 -040045KERNEL_LOAD_ADDRESS_zynq ?= "0x2080000"
46KERNEL_LOAD_ADDRESS_versal ?= "0x80000"
47
48RAMDISK_IMAGE_ADDRESS_zynq ?= "0x4000000"
49RAMDISK_IMAGE_ADDRESS_versal ?= "0x6000000"
50
Andrew Geisslera9ff2b32020-10-16 10:11:54 -050051
52SDBOOTDEV ?= "0"
53
54BITSTREAM_LOAD_ADDRESS ?= "0x100000"
55
Brad Bishop754b8fa2019-08-20 09:16:20 -040056do_configure[noexec] = "1"
57do_install[noexec] = "1"
58
Andrew Geisslera9ff2b32020-10-16 10:11:54 -050059def get_bitstream_load_type(d):
60 if boot_files_bitstream(d)[1] :
61 return "loadb"
62 else:
63 return "load"
64
Brad Bishop754b8fa2019-08-20 09:16:20 -040065do_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 Geisslera9ff2b32020-10-16 10:11:54 -050073 -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 Bishop754b8fa2019-08-20 09:16:20 -040078 "${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 Geissler84ad7c52020-06-27 00:00:16 -050082 -e 's/@@RAMDISK_IMAGE@@/${RAMDISK_IMAGE}/' \
Brad Bishop754b8fa2019-08-20 09:16:20 -040083 "${WORKDIR}/pxeboot.pxe" > "pxeboot.pxe"
84}
85
86
87do_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
96addtask do_deploy after do_compile before do_build