summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@xilinx.com>2021-12-15 13:52:16 -0800
committerMark Hatle <mark.hatle@xilinx.com>2022-01-14 15:37:02 -0800
commitf900c6a0c8908e370689235230094308ec419cf9 (patch)
treebd9ca83e452c263c7a421b826086048cf8130f34 /meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb
parentaaddcc3f785404da04af9ea3d005f2f520b4ec9e (diff)
downloadmeta-xilinx-f900c6a0c8908e370689235230094308ec419cf9.tar.gz
Initial restructure/split of meta-xilinx-bsp
Create a new meta-xilinx-core, move core functionality to the core, keeping board specific files in the bsp layer. zynqmp-generic changed from require <board> to include, so if meta-xilinx-bsp is not available it will not fail. Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Diffstat (limited to 'meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb')
-rw-r--r--meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb238
1 files changed, 0 insertions, 238 deletions
diff --git a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb b/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb
deleted file mode 100644
index a75484a8..00000000
--- a/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-zynq-scr.bb
+++ /dev/null
@@ -1,238 +0,0 @@
1SUMMARY = "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 image-wic-utils
8
9INHIBIT_DEFAULT_DEPS = "1"
10
11COMPATIBLE_MACHINE ?= "^$"
12COMPATIBLE_MACHINE:zynqmp = "zynqmp"
13COMPATIBLE_MACHINE:zynq = "zynq"
14COMPATIBLE_MACHINE:versal = "versal"
15COMPATIBLE_MACHINE:microblaze = "microblaze"
16
17KERNELDT = "${@os.path.basename(d.getVar('KERNEL_DEVICETREE').split(' ')[0]) if d.getVar('KERNEL_DEVICETREE') else ''}"
18DEVICE_TREE_NAME ?= "${@bb.utils.contains('PREFERRED_PROVIDER_virtual/dtb', 'device-tree', 'system.dtb', d.getVar('KERNELDT'), d)}"
19#Need to copy a rootfs.cpio.gz.u-boot as uramdisk.image.gz into boot partition
20RAMDISK_IMAGE ?= ""
21RAMDISK_IMAGE:zynq ?= "uramdisk.image.gz"
22
23PXERAMDISK_IMAGE ?= "${@'ramdisk.cpio.gz.u-boot' if d.getVar('INITRAMFS_IMAGE') and d.getVar('INITRAMFS_IMAGE').find('initramfs') > 0 else '${RAMDISK_IMAGE}'}"
24
25KERNEL_BOOTCMD:zynqmp ?= "booti"
26KERNEL_BOOTCMD:zynq ?= "bootm"
27KERNEL_BOOTCMD:versal ?= "booti"
28KERNEL_BOOTCMD:microblaze ?= "bootm"
29
30BOOTMODE ?= "sd"
31BOOTFILE_EXT ?= ".${SOC_FAMILY}"
32
33#Make this value to "1" to skip appending base address to ddr offsets.
34SKIP_APPEND_BASEADDR ?= "0"
35
36DDR_BASEADDR ?= "0x0"
37DDR_BASEADDR:microblaze ?= "0x80000000"
38PRE_BOOTENV ?= ""
39
40SRC_URI = " \
41 file://boot.cmd.sd.zynq \
42 file://boot.cmd.sd.zynqmp \
43 file://boot.cmd.sd.versal \
44 file://boot.cmd.qspi.versal \
45 file://boot.cmd.generic \
46 file://boot.cmd.ubifs \
47 file://pxeboot.pxe \
48 "
49
50# Specify a default in case boardvariant isn't available
51BOARDVARIANT_ARCH ??= "${MACHINE_ARCH}"
52PACKAGE_ARCH = "${BOARDVARIANT_ARCH}"
53
54# On zynqmp-dr, we know we're different so if BOARD is not defined, fall back
55# to the SOC_VARIANT_ARCH instead
56SOC_VARIANT_ARCH ??= "${MACHINE_ARCH}"
57PACKAGE_ARCH:zynqmp-dr = "${@['${BOARDVARIANT_ARCH}', '${SOC_VARIANT_ARCH}'][d.getVar('BOARDVARIANT_ARCH')==d.getVar('MACHINE_ARCH')]}"
58
59inherit image-artifact-names
60UENV_TEXTFILE ?= "uEnv.txt"
61UENV_MMC_OFFSET:zynqmp ?= "0x200000"
62UENV_MMC_OFFSET:zynq ?= "0x2080000"
63UENV_MMC_OFFSET:versal ?= "0x200000"
64UENV_MMC_OFFSET:microblaze ?= "0x0"
65
66UENV_MMC_LOAD_ADDRESS ?= "${@append_baseaddr(d,d.getVar('UENV_MMC_OFFSET'))}"
67
68UBOOTSCR_BASE_NAME ?= "${PN}-${PKGE}-${PKGV}-${PKGR}${IMAGE_VERSION_SUFFIX}"
69UBOOTPXE_CONFIG ?= "pxelinux.cfg"
70UBOOTPXE_CONFIG_NAME = "${UBOOTPXE_CONFIG}${IMAGE_VERSION_SUFFIX}"
71
72DEVICETREE_ADDRESS ?= "${@append_baseaddr(d,d.getVar('DEVICETREE_OFFSET'))}"
73
74DEVICETREE_OFFSET:microblaze ?= "0x1e00000"
75DEVICETREE_OFFSET:zynqmp ?= "0x100000"
76DEVICETREE_OFFSET:zynq ?= "0x2000000"
77DEVICETREE_OFFSET:versal ?= "0x1000"
78
79KERNEL_LOAD_ADDRESS ?= "${@append_baseaddr(d,d.getVar('KERNEL_OFFSET'))}"
80
81KERNEL_OFFSET:microblaze ?= "0x0"
82KERNEL_OFFSET:zynqmp ?= "0x200000"
83KERNEL_OFFSET:zynq ?= "0x2080000"
84KERNEL_OFFSET:versal ?= "0x200000"
85
86KERNEL_IMAGE ?= "${KERNEL_IMAGETYPE}"
87
88RAMDISK_IMAGE_ADDRESS ?= "${@append_baseaddr(d,d.getVar('RAMDISK_OFFSET'))}"
89
90RAMDISK_OFFSET:microblaze ?= "0x2e00000"
91RAMDISK_OFFSET:zynq ?= "0x4000000"
92RAMDISK_OFFSET:zynqmp ?= "0x4000000"
93RAMDISK_OFFSET:versal ?= "0x6000000"
94
95FIT_IMAGE_LOAD_ADDRESS ?= "${@append_baseaddr(d,d.getVar('FIT_IMAGE_OFFSET'))}"
96FIT_IMAGE_OFFSET ?= "0x10000000"
97FIT_IMAGE ?= "image.ub"
98
99## Below offsets and sizes are based on 32MB QSPI Memory for zynq
100## For MB
101## Load boot.scr at 0xFC0000 -> 15MB of QSPI/NAND Memory
102QSPI_KERNEL_OFFSET:microblaze ?= "0xBC0000"
103QSPI_KERNEL_SIZE:microblaze ?= "0x500000"
104QSPI_RAMDISK_SIZE:microblaze ?= "0xA00000"
105
106## For zynq
107## Load boot.scr at 0xFC0000 -> 15MB of QSPI/NAND Memory
108QSPI_KERNEL_OFFSET:zynq ?= "0x1000000"
109QSPI_RAMDISK_OFFSET:zynq ?= "0x1580000"
110
111NAND_KERNEL_OFFSET:zynq ?= "0x1000000"
112NAND_RAMDISK_OFFSET:zynq ?= "0x4600000"
113
114QSPI_KERNEL_SIZE:zynq ?= "0x500000"
115QSPI_RAMDISK_SIZE:zynq ?= "0xA00000"
116
117NAND_KERNEL_SIZE ?= "0x3200000"
118NAND_RAMDISK_SIZE ?= "0x3200000"
119
120## Below offsets and sizes are based on 128MB QSPI Memory for zynqmp/versal
121## For zynqMP
122## Load boot.scr at 0x3E80000 -> 62MB of QSPI/NAND Memory
123QSPI_KERNEL_OFFSET ?= "0xF00000"
124QSPI_KERNEL_OFFSET:zynqmpdr ?= "0x3F00000"
125QSPI_RAMDISK_OFFSET ?= "0x4000000"
126QSPI_RAMDISK_OFFSET:zynqmpdr ?= "0x5D00000"
127
128NAND_KERNEL_OFFSET:zynqmp ?= "0x4100000"
129NAND_RAMDISK_OFFSET:zynqmp ?= "0x7800000"
130
131QSPI_KERNEL_SIZE:zynqmp ?= "0x1D00000"
132QSPI_RAMDISK_SIZE ?= "0x4000000"
133QSPI_RAMDISK_SIZE:zynqmpdr ?= "0x1D00000"
134
135## For versal
136## Load boot.scr at 0x7F80000 -> 127MB of QSPI/NAND Memory
137QSPI_KERNEL_OFFSET:versal ?= "0xF00000"
138QSPI_RAMDISK_OFFSET:versal ?= "0x2E00000"
139
140NAND_KERNEL_OFFSET:versal ?= "0x4100000"
141NAND_RAMDISK_OFFSET:versal ?= "0x8200000"
142
143QSPI_KERNEL_SIZE:versal ?= "0x1D00000"
144QSPI_RAMDISK_SIZE:versal ?= "0x4000000"
145
146QSPI_KERNEL_IMAGE:microblaze ?= "image.ub"
147QSPI_KERNEL_IMAGE:zynq ?= "image.ub"
148QSPI_KERNEL_IMAGE:zynqmp ?= "image.ub"
149QSPI_KERNEL_IMAGE:versal ?= "image.ub"
150
151NAND_KERNEL_IMAGE ?= "image.ub"
152
153QSPI_FIT_IMAGE_OFFSET ?= "0x1080000"
154QSPI_FIT_IMAGE_SIZE ?= "0x6400000"
155QSPI_FIT_IMAGE_SIZE:zynqmpdr ?= "0x3F00000"
156QSPI_FIT_IMAGE_SIZE:zynq ?= "0xF00000"
157QSPI_FIT_IMAGE_SIZE:microblaze ?= "0xF00000"
158
159NAND_FIT_IMAGE_OFFSET ?= "0x1080000"
160NAND_FIT_IMAGE_SIZE ?= "0x6400000"
161
162SDBOOTDEV ?= "0"
163
164BITSTREAM_LOAD_ADDRESS ?= "0x100000"
165
166do_configure[noexec] = "1"
167do_install[noexec] = "1"
168
169def append_baseaddr(d,offset):
170 skip_append = d.getVar('SKIP_APPEND_BASEADDR') or ""
171 if skip_append == "1":
172 return offset
173 import subprocess
174 baseaddr = d.getVar('DDR_BASEADDR') or "0x0"
175 subcmd = "$((%s+%s));" % (baseaddr,offset)
176 cmd = "printf '0x%08x' " + str(subcmd)
177 output = subprocess.check_output(cmd, shell=True).decode("utf-8")
178 return output
179
180def get_bitstream_load_type(d):
181 if boot_files_bitstream(d)[1] :
182 return "loadb"
183 else:
184 return "load"
185
186do_compile() {
187 sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
188 -e 's/@@KERNEL_LOAD_ADDRESS@@/${KERNEL_LOAD_ADDRESS}/' \
189 -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \
190 -e 's/@@DEVICETREE_ADDRESS@@/${DEVICETREE_ADDRESS}/' \
191 -e 's/@@RAMDISK_IMAGE@@/${RAMDISK_IMAGE}/' \
192 -e 's/@@RAMDISK_IMAGE_ADDRESS@@/${RAMDISK_IMAGE_ADDRESS}/' \
193 -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \
194 -e 's/@@SDBOOTDEV@@/${SDBOOTDEV}/' \
195 -e 's/@@BITSTREAM@@/${@boot_files_bitstream(d)[0]}/g' \
196 -e 's/@@BITSTREAM_LOAD_ADDRESS@@/${BITSTREAM_LOAD_ADDRESS}/g' \
197 -e 's/@@BITSTREAM_IMAGE@@/${@boot_files_bitstream(d)[0]}/g' \
198 -e 's/@@BITSTREAM_LOAD_TYPE@@/${@get_bitstream_load_type(d)}/g' \
199 -e 's/@@QSPI_KERNEL_OFFSET@@/${QSPI_KERNEL_OFFSET}/' \
200 -e 's/@@NAND_KERNEL_OFFSET@@/${NAND_KERNEL_OFFSET}/' \
201 -e 's/@@QSPI_KERNEL_SIZE@@/${QSPI_KERNEL_SIZE}/' \
202 -e 's/@@NAND_KERNEL_SIZE@@/${NAND_KERNEL_SIZE}/' \
203 -e 's/@@QSPI_RAMDISK_OFFSET@@/${QSPI_RAMDISK_OFFSET}/' \
204 -e 's/@@NAND_RAMDISK_OFFSET@@/${NAND_RAMDISK_OFFSET}/' \
205 -e 's/@@QSPI_RAMDISK_SIZE@@/${QSPI_RAMDISK_SIZE}/' \
206 -e 's/@@NAND_RAMDISK_SIZE@@/${NAND_RAMDISK_SIZE}/' \
207 -e 's/@@KERNEL_IMAGE@@/${KERNEL_IMAGE}/' \
208 -e 's/@@QSPI_KERNEL_IMAGE@@/${QSPI_KERNEL_IMAGE}/' \
209 -e 's/@@NAND_KERNEL_IMAGE@@/${NAND_KERNEL_IMAGE}/' \
210 -e 's/@@FIT_IMAGE_LOAD_ADDRESS@@/${FIT_IMAGE_LOAD_ADDRESS}/' \
211 -e 's/@@QSPI_FIT_IMAGE_OFFSET@@/${QSPI_FIT_IMAGE_OFFSET}/' \
212 -e 's/@@QSPI_FIT_IMAGE_SIZE@@/${QSPI_FIT_IMAGE_SIZE}/' \
213 -e 's/@@NAND_FIT_IMAGE_OFFSET@@/${NAND_FIT_IMAGE_OFFSET}/' \
214 -e 's/@@NAND_FIT_IMAGE_SIZE@@/${NAND_FIT_IMAGE_SIZE}/' \
215 -e 's/@@FIT_IMAGE@@/${FIT_IMAGE}/' \
216 -e 's/@@PRE_BOOTENV@@/${PRE_BOOTENV}/' \
217 -e 's/@@UENV_MMC_LOAD_ADDRESS@@/${UENV_MMC_LOAD_ADDRESS}/' \
218 -e 's/@@UENV_TEXTFILE@@/${UENV_TEXTFILE}/' \
219 -e 's/@@RAMDISK_IMAGE1@@/${RAMDISK_IMAGE1}/' \
220 "${WORKDIR}/boot.cmd.${BOOTMODE}${BOOTFILE_EXT}" > "${WORKDIR}/boot.cmd"
221 mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr
222 sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
223 -e 's/@@DEVICE_TREE_NAME@@/${DEVICE_TREE_NAME}/' \
224 -e 's/@@RAMDISK_IMAGE@@/${PXERAMDISK_IMAGE}/' \
225 "${WORKDIR}/pxeboot.pxe" > "pxeboot.pxe"
226}
227
228
229do_deploy() {
230 install -d ${DEPLOYDIR}
231 install -m 0644 boot.scr ${DEPLOYDIR}/${UBOOTSCR_BASE_NAME}.scr
232 ln -sf ${UBOOTSCR_BASE_NAME}.scr ${DEPLOYDIR}/boot.scr
233 install -d ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME}
234 install -m 0644 pxeboot.pxe ${DEPLOYDIR}/pxeboot/${UBOOTPXE_CONFIG_NAME}/default
235 ln -sf pxeboot/${UBOOTPXE_CONFIG_NAME} ${DEPLOYDIR}/${UBOOTPXE_CONFIG}
236}
237
238addtask do_deploy after do_compile before do_build