blob: 3dc029c429302dfa891ee8451a4008a049cdd015 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7# This file is part of U-Boot verified boot support and is intended to be
Patrick Williams2390b1b2022-11-03 13:47:49 -05008# inherited from the u-boot recipe.
Patrick Williams92b42cb2022-09-03 06:53:57 -05009#
10# The signature procedure requires the user to generate an RSA key and
11# certificate in a directory and to define the following variable:
12#
13# UBOOT_SIGN_KEYDIR = "/keys/directory"
14# UBOOT_SIGN_KEYNAME = "dev" # keys name in keydir (eg. "dev.crt", "dev.key")
15# UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
16# UBOOT_SIGN_ENABLE = "1"
17#
18# As verified boot depends on fitImage generation, following is also required:
19#
20# KERNEL_CLASSES ?= " kernel-fitimage "
21# KERNEL_IMAGETYPE ?= "fitImage"
22#
23# The signature support is limited to the use of CONFIG_OF_SEPARATE in U-Boot.
24#
Patrick Williams92b42cb2022-09-03 06:53:57 -050025# For more details on signature process, please refer to U-Boot documentation.
26
27# We need some variables from u-boot-config
28inherit uboot-config
29
30# Enable use of a U-Boot fitImage
31UBOOT_FITIMAGE_ENABLE ?= "0"
32
Patrick Williams2390b1b2022-11-03 13:47:49 -050033# Signature activation - this requires UBOOT_FITIMAGE_ENABLE = "1"
Patrick Williams92b42cb2022-09-03 06:53:57 -050034SPL_SIGN_ENABLE ?= "0"
35
36# Default value for deployment filenames.
37UBOOT_DTB_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.dtb"
38UBOOT_DTB_BINARY ?= "u-boot.dtb"
Patrick Williams2390b1b2022-11-03 13:47:49 -050039UBOOT_DTB_SIGNED ?= "${UBOOT_DTB_BINARY}-signed"
Patrick Williams92b42cb2022-09-03 06:53:57 -050040UBOOT_DTB_SYMLINK ?= "u-boot-${MACHINE}.dtb"
41UBOOT_NODTB_IMAGE ?= "u-boot-nodtb-${MACHINE}-${PV}-${PR}.bin"
42UBOOT_NODTB_BINARY ?= "u-boot-nodtb.bin"
43UBOOT_NODTB_SYMLINK ?= "u-boot-nodtb-${MACHINE}.bin"
44UBOOT_ITS_IMAGE ?= "u-boot-its-${MACHINE}-${PV}-${PR}"
45UBOOT_ITS ?= "u-boot.its"
46UBOOT_ITS_SYMLINK ?= "u-boot-its-${MACHINE}"
47UBOOT_FITIMAGE_IMAGE ?= "u-boot-fitImage-${MACHINE}-${PV}-${PR}"
48UBOOT_FITIMAGE_BINARY ?= "u-boot-fitImage"
49UBOOT_FITIMAGE_SYMLINK ?= "u-boot-fitImage-${MACHINE}"
50SPL_DIR ?= "spl"
51SPL_DTB_IMAGE ?= "u-boot-spl-${MACHINE}-${PV}-${PR}.dtb"
52SPL_DTB_BINARY ?= "u-boot-spl.dtb"
Patrick Williams2390b1b2022-11-03 13:47:49 -050053SPL_DTB_SIGNED ?= "${SPL_DTB_BINARY}-signed"
Patrick Williams92b42cb2022-09-03 06:53:57 -050054SPL_DTB_SYMLINK ?= "u-boot-spl-${MACHINE}.dtb"
55SPL_NODTB_IMAGE ?= "u-boot-spl-nodtb-${MACHINE}-${PV}-${PR}.bin"
56SPL_NODTB_BINARY ?= "u-boot-spl-nodtb.bin"
57SPL_NODTB_SYMLINK ?= "u-boot-spl-nodtb-${MACHINE}.bin"
58
59# U-Boot fitImage description
60UBOOT_FIT_DESC ?= "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}"
61
Patrick Williams2390b1b2022-11-03 13:47:49 -050062# U-Boot fitImage Hash Algo
Patrick Williams92b42cb2022-09-03 06:53:57 -050063UBOOT_FIT_HASH_ALG ?= "sha256"
64
Patrick Williams2390b1b2022-11-03 13:47:49 -050065# U-Boot fitImage Signature Algo
Patrick Williams92b42cb2022-09-03 06:53:57 -050066UBOOT_FIT_SIGN_ALG ?= "rsa2048"
67
Patrick Williams2390b1b2022-11-03 13:47:49 -050068# Generate keys for signing U-Boot fitImage
Patrick Williams92b42cb2022-09-03 06:53:57 -050069UBOOT_FIT_GENERATE_KEYS ?= "0"
70
71# Size of private keys in number of bits
Patrick Williams92b42cb2022-09-03 06:53:57 -050072UBOOT_FIT_SIGN_NUMBITS ?= "2048"
73
74# args to openssl genrsa (Default is just the public exponent)
Patrick Williams92b42cb2022-09-03 06:53:57 -050075UBOOT_FIT_KEY_GENRSA_ARGS ?= "-F4"
76
77# args to openssl req (Default is -batch for non interactive mode and
78# -new for new certificate)
Patrick Williams92b42cb2022-09-03 06:53:57 -050079UBOOT_FIT_KEY_REQ_ARGS ?= "-batch -new"
80
81# Standard format for public key certificate
Patrick Williams92b42cb2022-09-03 06:53:57 -050082UBOOT_FIT_KEY_SIGN_PKCS ?= "-x509"
83
Patrick Williams2390b1b2022-11-03 13:47:49 -050084# This is only necessary for determining the signing configuration
85KERNEL_PN = "${PREFERRED_PROVIDER_virtual/kernel}"
Patrick Williams92b42cb2022-09-03 06:53:57 -050086
Patrick Williams92b42cb2022-09-03 06:53:57 -050087python() {
Patrick Williams2390b1b2022-11-03 13:47:49 -050088 # We need u-boot-tools-native if we're creating a U-Boot fitImage
89 sign = d.getVar('UBOOT_SIGN_ENABLE') == '1'
90 if d.getVar('UBOOT_FITIMAGE_ENABLE') == '1' or sign:
91 d.appendVar('DEPENDS', " u-boot-tools-native dtc-native")
92 if sign:
93 d.appendVar('DEPENDS', " " + d.getVar('KERNEL_PN'))
Patrick Williams92b42cb2022-09-03 06:53:57 -050094}
95
Patrick Williams2390b1b2022-11-03 13:47:49 -050096concat_dtb() {
97 type="$1"
98 binary="$2"
Patrick Williams92b42cb2022-09-03 06:53:57 -050099
Patrick Williams2390b1b2022-11-03 13:47:49 -0500100 if [ -e "${UBOOT_DTB_BINARY}" ]; then
101 # Re-sign the kernel in order to add the keys to our dtb
102 ${UBOOT_MKIMAGE_SIGN} \
103 ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
104 -F -k "${UBOOT_SIGN_KEYDIR}" \
105 -K "${UBOOT_DTB_BINARY}" \
106 -r ${B}/fitImage-linux \
107 ${UBOOT_MKIMAGE_SIGN_ARGS}
108 cp ${UBOOT_DTB_BINARY} ${UBOOT_DTB_SIGNED}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500109 fi
110
111 # If we're not using a signed u-boot fit, concatenate SPL w/o DTB & U-Boot DTB
Patrick Williams2390b1b2022-11-03 13:47:49 -0500112 # with public key (otherwise U-Boot will be packaged by uboot_fitimage_assemble)
Patrick Williams92b42cb2022-09-03 06:53:57 -0500113 if [ "${SPL_SIGN_ENABLE}" != "1" ] ; then
Patrick Williams92b42cb2022-09-03 06:53:57 -0500114 if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \
Patrick Williams2390b1b2022-11-03 13:47:49 -0500115 [ -e "${UBOOT_DTB_BINARY}" ]; then
116 oe_runmake EXT_DTB="${UBOOT_DTB_SIGNED}" ${UBOOT_MAKE_TARGET}
117 if [ -n "${binary}" ]; then
118 cp ${binary} ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
119 fi
120 elif [ -e "${UBOOT_NODTB_BINARY}" -a -e "${UBOOT_DTB_BINARY}" ]; then
121 if [ -n "${binary}" ]; then
122 cat ${UBOOT_NODTB_BINARY} ${UBOOT_DTB_SIGNED} | tee ${binary} > \
123 ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
124 else
125 cat ${UBOOT_NODTB_BINARY} ${UBOOT_DTB_SIGNED} > ${UBOOT_BINARY}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500126 fi
127 else
128 bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available."
129 fi
130 fi
131}
132
Patrick Williams2390b1b2022-11-03 13:47:49 -0500133deploy_dtb() {
134 type="$1"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500135
Patrick Williams2390b1b2022-11-03 13:47:49 -0500136 if [ -n "${type}" ]; then
137 uboot_dtb_binary="u-boot-${type}-${PV}-${PR}.dtb"
138 uboot_nodtb_binary="u-boot-nodtb-${type}-${PV}-${PR}.bin"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500139 else
Patrick Williams2390b1b2022-11-03 13:47:49 -0500140 uboot_dtb_binary="${UBOOT_DTB_IMAGE}"
141 uboot_nodtb_binary="${UBOOT_NODTB_IMAGE}"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500142 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500143
Patrick Williams2390b1b2022-11-03 13:47:49 -0500144 if [ -e "${UBOOT_DTB_SIGNED}" ]; then
145 install -Dm644 ${UBOOT_DTB_SIGNED} ${DEPLOYDIR}/${uboot_dtb_binary}
146 if [ -n "${type}" ]; then
147 ln -sf ${uboot_dtb_binary} ${DEPLOYDIR}/${UBOOT_DTB_IMAGE}
148 fi
149 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500150
Patrick Williams2390b1b2022-11-03 13:47:49 -0500151 if [ -f "${UBOOT_NODTB_BINARY}" ]; then
152 install -Dm644 ${UBOOT_DTB_BINARY} ${DEPLOYDIR}/${uboot_nodtb_binary}
153 if [ -n "${type}" ]; then
154 ln -sf ${uboot_nodtb_binary} ${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500155 fi
156 fi
157}
158
159concat_spl_dtb() {
Patrick Williams2390b1b2022-11-03 13:47:49 -0500160 if [ -e "${SPL_DIR}/${SPL_NODTB_BINARY}" -a -e "${SPL_DIR}/${SPL_DTB_BINARY}" ] ; then
161 cat ${SPL_DIR}/${SPL_NODTB_BINARY} ${SPL_DIR}/${SPL_DTB_SIGNED} > "${SPL_BINARY}"
162 else
163 bbwarn "Failure while adding public key to spl binary. Verified U-Boot boot won't be available."
164 fi
165}
166
167deploy_spl_dtb() {
168 type="$1"
169
170 if [ -n "${type}" ]; then
171 spl_dtb_binary="u-boot-spl-${type}-${PV}-${PR}.dtb"
172 spl_nodtb_binary="u-boot-spl-nodtb-${type}-${PV}-${PR}.bin"
173 else
174 spl_dtb_binary="${SPL_DTB_IMAGE}"
175 spl_nodtb_binary="${SPL_NODTB_IMAGE}"
176 fi
177
178 if [ -e "${SPL_DIR}/${SPL_DTB_SIGNED}" ] ; then
179 install -Dm644 ${SPL_DIR}/${SPL_DTB_SIGNED} ${DEPLOYDIR}/${spl_dtb_binary}
180 if [ -n "${type}" ]; then
181 ln -sf ${spl_dtb_binary} ${DEPLOYDIR}/${SPL_DTB_IMAGE}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500182 fi
183 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500184
Patrick Williams2390b1b2022-11-03 13:47:49 -0500185 if [ -f "${SPL_DIR}/${SPL_NODTB_BINARY}" ] ; then
186 install -Dm644 ${SPL_DIR}/${SPL_NODTB_BINARY} ${DEPLOYDIR}/${spl_nodtb_binary}
187 if [ -n "${type}" ]; then
188 ln -sf ${spl_nodtb_binary} ${DEPLOYDIR}/${SPL_NODTB_IMAGE}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500189 fi
190 fi
Patrick Williams2390b1b2022-11-03 13:47:49 -0500191
192 # For backwards compatibility...
193 install -Dm644 ${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500194}
195
196do_uboot_generate_rsa_keys() {
197 if [ "${SPL_SIGN_ENABLE}" = "0" ] && [ "${UBOOT_FIT_GENERATE_KEYS}" = "1" ]; then
198 bbwarn "UBOOT_FIT_GENERATE_KEYS is set to 1 eventhough SPL_SIGN_ENABLE is set to 0. The keys will not be generated as they won't be used."
199 fi
200
201 if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${UBOOT_FIT_GENERATE_KEYS}" = "1" ]; then
202
203 # Generate keys only if they don't already exist
204 if [ ! -f "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key ] || \
205 [ ! -f "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".crt ]; then
206
207 # make directory if it does not already exist
208 mkdir -p "${SPL_SIGN_KEYDIR}"
209
210 echo "Generating RSA private key for signing U-Boot fitImage"
211 openssl genrsa ${UBOOT_FIT_KEY_GENRSA_ARGS} -out \
212 "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key \
213 "${UBOOT_FIT_SIGN_NUMBITS}"
214
215 echo "Generating certificate for signing U-Boot fitImage"
Patrick Williams2390b1b2022-11-03 13:47:49 -0500216 openssl req ${UBOOT_FIT_KEY_REQ_ARGS} "${UBOOT_FIT_KEY_SIGN_PKCS}" \
Patrick Williams92b42cb2022-09-03 06:53:57 -0500217 -key "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key \
218 -out "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".crt
219 fi
220 fi
221
222}
223
224addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compile
225
226# Create a ITS file for the U-boot FIT, for use when
227# we want to sign it so that the SPL can verify it
228uboot_fitimage_assemble() {
Patrick Williams2390b1b2022-11-03 13:47:49 -0500229 rm -f ${UBOOT_ITS} ${UBOOT_FITIMAGE_BINARY}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500230
231 # First we create the ITS script
Patrick Williams2390b1b2022-11-03 13:47:49 -0500232 cat << EOF >> ${UBOOT_ITS}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500233/dts-v1/;
234
235/ {
236 description = "${UBOOT_FIT_DESC}";
237 #address-cells = <1>;
238
239 images {
240 uboot {
241 description = "U-Boot image";
Patrick Williams2390b1b2022-11-03 13:47:49 -0500242 data = /incbin/("${UBOOT_NODTB_BINARY}");
Patrick Williams92b42cb2022-09-03 06:53:57 -0500243 type = "standalone";
244 os = "u-boot";
245 arch = "${UBOOT_ARCH}";
246 compression = "none";
247 load = <${UBOOT_LOADADDRESS}>;
248 entry = <${UBOOT_ENTRYPOINT}>;
249EOF
250
251 if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
Patrick Williams2390b1b2022-11-03 13:47:49 -0500252 cat << EOF >> ${UBOOT_ITS}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500253 signature {
Patrick Williams2390b1b2022-11-03 13:47:49 -0500254 algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}";
255 key-name-hint = "${SPL_SIGN_KEYNAME}";
Patrick Williams92b42cb2022-09-03 06:53:57 -0500256 };
257EOF
258 fi
259
Patrick Williams2390b1b2022-11-03 13:47:49 -0500260 cat << EOF >> ${UBOOT_ITS}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500261 };
262 fdt {
263 description = "U-Boot FDT";
Patrick Williams2390b1b2022-11-03 13:47:49 -0500264 data = /incbin/("${UBOOT_DTB_BINARY}");
Patrick Williams92b42cb2022-09-03 06:53:57 -0500265 type = "flat_dt";
266 arch = "${UBOOT_ARCH}";
267 compression = "none";
268EOF
269
270 if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
Patrick Williams2390b1b2022-11-03 13:47:49 -0500271 cat << EOF >> ${UBOOT_ITS}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500272 signature {
Patrick Williams2390b1b2022-11-03 13:47:49 -0500273 algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}";
274 key-name-hint = "${SPL_SIGN_KEYNAME}";
Patrick Williams92b42cb2022-09-03 06:53:57 -0500275 };
276EOF
277 fi
278
Patrick Williams2390b1b2022-11-03 13:47:49 -0500279 cat << EOF >> ${UBOOT_ITS}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500280 };
281 };
282
283 configurations {
284 default = "conf";
285 conf {
286 description = "Boot with signed U-Boot FIT";
287 loadables = "uboot";
288 fdt = "fdt";
289 };
290 };
291};
292EOF
293
294 #
295 # Assemble the U-boot FIT image
296 #
297 ${UBOOT_MKIMAGE} \
298 ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \
Patrick Williams2390b1b2022-11-03 13:47:49 -0500299 -f ${UBOOT_ITS} \
300 ${UBOOT_FITIMAGE_BINARY}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500301
302 if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
303 #
304 # Sign the U-boot FIT image and add public key to SPL dtb
305 #
306 ${UBOOT_MKIMAGE_SIGN} \
307 ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \
308 -F -k "${SPL_SIGN_KEYDIR}" \
Patrick Williams2390b1b2022-11-03 13:47:49 -0500309 -K "${SPL_DIR}/${SPL_DTB_BINARY}" \
310 -r ${UBOOT_FITIMAGE_BINARY} \
Patrick Williams92b42cb2022-09-03 06:53:57 -0500311 ${SPL_MKIMAGE_SIGN_ARGS}
312 fi
313
Patrick Williams2390b1b2022-11-03 13:47:49 -0500314 cp ${SPL_DIR}/${SPL_DTB_BINARY} ${SPL_DIR}/${SPL_DTB_SIGNED}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500315}
316
Patrick Williams2390b1b2022-11-03 13:47:49 -0500317uboot_assemble_fitimage_helper() {
318 type="$1"
319 binary="$2"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500320
Patrick Williams92b42cb2022-09-03 06:53:57 -0500321 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ] ; then
Patrick Williams2390b1b2022-11-03 13:47:49 -0500322 concat_dtb $type $binary
Patrick Williams92b42cb2022-09-03 06:53:57 -0500323 fi
324
Patrick Williams2390b1b2022-11-03 13:47:49 -0500325 if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ]; then
326 uboot_fitimage_assemble
Patrick Williams92b42cb2022-09-03 06:53:57 -0500327 fi
328
329 if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ] ; then
330 concat_spl_dtb
331 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500332}
333
Patrick Williams2390b1b2022-11-03 13:47:49 -0500334do_uboot_assemble_fitimage() {
335 if [ "${UBOOT_SIGN_ENABLE}" = "1" ] ; then
336 cp "${STAGING_DIR_HOST}/sysroot-only/fitImage" "${B}/fitImage-linux"
337 fi
338
339 if [ -n "${UBOOT_CONFIG}" ]; then
340 unset i j k
341 for config in ${UBOOT_MACHINE}; do
342 i=$(expr $i + 1);
343 for type in ${UBOOT_CONFIG}; do
344 j=$(expr $j + 1);
345 if [ $j -eq $i ]; then
346 break;
347 fi
348 done
349
350 for binary in ${UBOOT_BINARIES}; do
351 k=$(expr $j + 1);
352 if [ $k -eq $i ]; then
353 break;
354 fi
355 done
356
357 cd ${B}/${config}
358 uboot_assemble_fitimage_helper ${type} ${binary}
359 done
360 else
361 cd ${B}
362 uboot_assemble_fitimage_helper "" ${UBOOT_BINARY}
363 fi
364}
365
366addtask uboot_assemble_fitimage before do_install do_deploy after do_compile
367
368deploy_helper() {
369 type="$1"
370
371 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_SIGNED}" ] ; then
372 deploy_dtb $type
373 fi
374
375 if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ]; then
376 if [ -n "${type}" ]; then
377 uboot_its_image="u-boot-its-${type}-${PV}-${PR}"
378 uboot_fitimage_image="u-boot-fitImage-${type}-${PV}-${PR}"
379 else
380 uboot_its_image="${UBOOT_ITS_IMAGE}"
381 uboot_fitimage_image="${UBOOT_FITIMAGE_IMAGE}"
382 fi
383
384 install -Dm644 ${UBOOT_FITIMAGE_BINARY} ${DEPLOYDIR}/$uboot_fitimage_image
385 install -Dm644 ${UBOOT_ITS} ${DEPLOYDIR}/$uboot_its_image
386
387 if [ -n "${type}" ]; then
388 ln -sf $uboot_its_image ${DEPLOYDIR}/${UBOOT_ITS_IMAGE}
389 ln -sf $uboot_fitimage_image ${DEPLOYDIR}/${UBOOT_FITIMAGE_IMAGE}
390 fi
391 fi
392
393 if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_SIGNED}" ] ; then
394 deploy_spl_dtb $type
395 fi
396}
397
398do_deploy:prepend() {
399 if [ -n "${UBOOT_CONFIG}" ]; then
400 unset i j k
401 for config in ${UBOOT_MACHINE}; do
402 i=$(expr $i + 1);
403 for type in ${UBOOT_CONFIG}; do
404 j=$(expr $j + 1);
405 if [ $j -eq $i ]; then
406 cd ${B}/${config}
407 deploy_helper ${type}
408 fi
409 done
410 done
411 else
412 cd ${B}
413 deploy_helper ""
414 fi
415
416 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ] ; then
417 ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_BINARY}
418 ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_SYMLINK}
419 ln -sf ${UBOOT_NODTB_IMAGE} ${DEPLOYDIR}/${UBOOT_NODTB_SYMLINK}
420 ln -sf ${UBOOT_NODTB_IMAGE} ${DEPLOYDIR}/${UBOOT_NODTB_BINARY}
421 fi
422
423 if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ] ; then
424 ln -sf ${UBOOT_ITS_IMAGE} ${DEPLOYDIR}/${UBOOT_ITS}
425 ln -sf ${UBOOT_ITS_IMAGE} ${DEPLOYDIR}/${UBOOT_ITS_SYMLINK}
426 ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_FITIMAGE_BINARY}
427 ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_FITIMAGE_SYMLINK}
428 fi
429
430 if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ] ; then
431 ln -sf ${SPL_DTB_IMAGE} ${DEPLOYDIR}/${SPL_DTB_SYMLINK}
432 ln -sf ${SPL_DTB_IMAGE} ${DEPLOYDIR}/${SPL_DTB_BINARY}
433 ln -sf ${SPL_NODTB_IMAGE} ${DEPLOYDIR}/${SPL_NODTB_SYMLINK}
434 ln -sf ${SPL_NODTB_IMAGE} ${DEPLOYDIR}/${SPL_NODTB_BINARY}
435 fi
436}
437
438do_deploy:append() {
Patrick Williams92b42cb2022-09-03 06:53:57 -0500439 # If we're creating a u-boot fitImage, point u-boot.bin
440 # symlink since it might get used by image recipes
441 if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ] ; then
442 ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_BINARY}
443 ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_SYMLINK}
444 fi
445}