blob: ad04c82378d810489d999e7cad05935adf42e0ad [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
Andrew Geissler028142b2023-05-05 11:29:21 -050084# length of address in number of <u32> cells
85# ex: 1 32bits address, 2 64bits address
86UBOOT_FIT_ADDRESS_CELLS ?= "1"
87
Patrick Williams2390b1b2022-11-03 13:47:49 -050088# This is only necessary for determining the signing configuration
89KERNEL_PN = "${PREFERRED_PROVIDER_virtual/kernel}"
Patrick Williams92b42cb2022-09-03 06:53:57 -050090
Patrick Williams92b42cb2022-09-03 06:53:57 -050091python() {
Patrick Williams2390b1b2022-11-03 13:47:49 -050092 # We need u-boot-tools-native if we're creating a U-Boot fitImage
93 sign = d.getVar('UBOOT_SIGN_ENABLE') == '1'
94 if d.getVar('UBOOT_FITIMAGE_ENABLE') == '1' or sign:
95 d.appendVar('DEPENDS', " u-boot-tools-native dtc-native")
96 if sign:
97 d.appendVar('DEPENDS', " " + d.getVar('KERNEL_PN'))
Patrick Williams92b42cb2022-09-03 06:53:57 -050098}
99
Patrick Williams2390b1b2022-11-03 13:47:49 -0500100concat_dtb() {
101 type="$1"
102 binary="$2"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500103
Patrick Williams2390b1b2022-11-03 13:47:49 -0500104 if [ -e "${UBOOT_DTB_BINARY}" ]; then
105 # Re-sign the kernel in order to add the keys to our dtb
106 ${UBOOT_MKIMAGE_SIGN} \
107 ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
108 -F -k "${UBOOT_SIGN_KEYDIR}" \
109 -K "${UBOOT_DTB_BINARY}" \
110 -r ${B}/fitImage-linux \
111 ${UBOOT_MKIMAGE_SIGN_ARGS}
112 cp ${UBOOT_DTB_BINARY} ${UBOOT_DTB_SIGNED}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500113 fi
114
115 # 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 -0500116 # with public key (otherwise U-Boot will be packaged by uboot_fitimage_assemble)
Patrick Williams92b42cb2022-09-03 06:53:57 -0500117 if [ "${SPL_SIGN_ENABLE}" != "1" ] ; then
Patrick Williams92b42cb2022-09-03 06:53:57 -0500118 if [ "x${UBOOT_SUFFIX}" = "ximg" -o "x${UBOOT_SUFFIX}" = "xrom" ] && \
Patrick Williams2390b1b2022-11-03 13:47:49 -0500119 [ -e "${UBOOT_DTB_BINARY}" ]; then
120 oe_runmake EXT_DTB="${UBOOT_DTB_SIGNED}" ${UBOOT_MAKE_TARGET}
121 if [ -n "${binary}" ]; then
122 cp ${binary} ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
123 fi
124 elif [ -e "${UBOOT_NODTB_BINARY}" -a -e "${UBOOT_DTB_BINARY}" ]; then
125 if [ -n "${binary}" ]; then
126 cat ${UBOOT_NODTB_BINARY} ${UBOOT_DTB_SIGNED} | tee ${binary} > \
127 ${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
128 else
129 cat ${UBOOT_NODTB_BINARY} ${UBOOT_DTB_SIGNED} > ${UBOOT_BINARY}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500130 fi
131 else
132 bbwarn "Failure while adding public key to u-boot binary. Verified boot won't be available."
133 fi
134 fi
135}
136
Patrick Williams2390b1b2022-11-03 13:47:49 -0500137deploy_dtb() {
138 type="$1"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500139
Patrick Williams2390b1b2022-11-03 13:47:49 -0500140 if [ -n "${type}" ]; then
141 uboot_dtb_binary="u-boot-${type}-${PV}-${PR}.dtb"
142 uboot_nodtb_binary="u-boot-nodtb-${type}-${PV}-${PR}.bin"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500143 else
Patrick Williams2390b1b2022-11-03 13:47:49 -0500144 uboot_dtb_binary="${UBOOT_DTB_IMAGE}"
145 uboot_nodtb_binary="${UBOOT_NODTB_IMAGE}"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500146 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500147
Patrick Williams2390b1b2022-11-03 13:47:49 -0500148 if [ -e "${UBOOT_DTB_SIGNED}" ]; then
149 install -Dm644 ${UBOOT_DTB_SIGNED} ${DEPLOYDIR}/${uboot_dtb_binary}
150 if [ -n "${type}" ]; then
151 ln -sf ${uboot_dtb_binary} ${DEPLOYDIR}/${UBOOT_DTB_IMAGE}
152 fi
153 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500154
Patrick Williams2390b1b2022-11-03 13:47:49 -0500155 if [ -f "${UBOOT_NODTB_BINARY}" ]; then
Andrew Geissler517393d2023-01-13 08:55:19 -0600156 install -Dm644 ${UBOOT_NODTB_BINARY} ${DEPLOYDIR}/${uboot_nodtb_binary}
Patrick Williams2390b1b2022-11-03 13:47:49 -0500157 if [ -n "${type}" ]; then
158 ln -sf ${uboot_nodtb_binary} ${DEPLOYDIR}/${UBOOT_NODTB_IMAGE}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500159 fi
160 fi
161}
162
163concat_spl_dtb() {
Patrick Williams2390b1b2022-11-03 13:47:49 -0500164 if [ -e "${SPL_DIR}/${SPL_NODTB_BINARY}" -a -e "${SPL_DIR}/${SPL_DTB_BINARY}" ] ; then
165 cat ${SPL_DIR}/${SPL_NODTB_BINARY} ${SPL_DIR}/${SPL_DTB_SIGNED} > "${SPL_BINARY}"
166 else
167 bbwarn "Failure while adding public key to spl binary. Verified U-Boot boot won't be available."
168 fi
169}
170
171deploy_spl_dtb() {
172 type="$1"
173
174 if [ -n "${type}" ]; then
175 spl_dtb_binary="u-boot-spl-${type}-${PV}-${PR}.dtb"
176 spl_nodtb_binary="u-boot-spl-nodtb-${type}-${PV}-${PR}.bin"
177 else
178 spl_dtb_binary="${SPL_DTB_IMAGE}"
179 spl_nodtb_binary="${SPL_NODTB_IMAGE}"
180 fi
181
182 if [ -e "${SPL_DIR}/${SPL_DTB_SIGNED}" ] ; then
183 install -Dm644 ${SPL_DIR}/${SPL_DTB_SIGNED} ${DEPLOYDIR}/${spl_dtb_binary}
184 if [ -n "${type}" ]; then
185 ln -sf ${spl_dtb_binary} ${DEPLOYDIR}/${SPL_DTB_IMAGE}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500186 fi
187 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500188
Patrick Williams2390b1b2022-11-03 13:47:49 -0500189 if [ -f "${SPL_DIR}/${SPL_NODTB_BINARY}" ] ; then
190 install -Dm644 ${SPL_DIR}/${SPL_NODTB_BINARY} ${DEPLOYDIR}/${spl_nodtb_binary}
191 if [ -n "${type}" ]; then
192 ln -sf ${spl_nodtb_binary} ${DEPLOYDIR}/${SPL_NODTB_IMAGE}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500193 fi
194 fi
Patrick Williams2390b1b2022-11-03 13:47:49 -0500195
196 # For backwards compatibility...
197 install -Dm644 ${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500198}
199
200do_uboot_generate_rsa_keys() {
201 if [ "${SPL_SIGN_ENABLE}" = "0" ] && [ "${UBOOT_FIT_GENERATE_KEYS}" = "1" ]; then
202 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."
203 fi
204
205 if [ "${SPL_SIGN_ENABLE}" = "1" ] && [ "${UBOOT_FIT_GENERATE_KEYS}" = "1" ]; then
206
207 # Generate keys only if they don't already exist
208 if [ ! -f "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key ] || \
209 [ ! -f "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".crt ]; then
210
211 # make directory if it does not already exist
212 mkdir -p "${SPL_SIGN_KEYDIR}"
213
214 echo "Generating RSA private key for signing U-Boot fitImage"
215 openssl genrsa ${UBOOT_FIT_KEY_GENRSA_ARGS} -out \
216 "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key \
217 "${UBOOT_FIT_SIGN_NUMBITS}"
218
219 echo "Generating certificate for signing U-Boot fitImage"
Patrick Williams2390b1b2022-11-03 13:47:49 -0500220 openssl req ${UBOOT_FIT_KEY_REQ_ARGS} "${UBOOT_FIT_KEY_SIGN_PKCS}" \
Patrick Williams92b42cb2022-09-03 06:53:57 -0500221 -key "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".key \
222 -out "${SPL_SIGN_KEYDIR}/${SPL_SIGN_KEYNAME}".crt
223 fi
224 fi
225
226}
227
228addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compile
229
230# Create a ITS file for the U-boot FIT, for use when
231# we want to sign it so that the SPL can verify it
232uboot_fitimage_assemble() {
Patrick Williams2390b1b2022-11-03 13:47:49 -0500233 rm -f ${UBOOT_ITS} ${UBOOT_FITIMAGE_BINARY}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500234
235 # First we create the ITS script
Patrick Williams2390b1b2022-11-03 13:47:49 -0500236 cat << EOF >> ${UBOOT_ITS}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500237/dts-v1/;
238
239/ {
240 description = "${UBOOT_FIT_DESC}";
Andrew Geissler028142b2023-05-05 11:29:21 -0500241 #address-cells = <${UBOOT_FIT_ADDRESS_CELLS}>;
Patrick Williams92b42cb2022-09-03 06:53:57 -0500242
243 images {
244 uboot {
245 description = "U-Boot image";
Patrick Williams2390b1b2022-11-03 13:47:49 -0500246 data = /incbin/("${UBOOT_NODTB_BINARY}");
Patrick Williams92b42cb2022-09-03 06:53:57 -0500247 type = "standalone";
248 os = "u-boot";
249 arch = "${UBOOT_ARCH}";
250 compression = "none";
251 load = <${UBOOT_LOADADDRESS}>;
252 entry = <${UBOOT_ENTRYPOINT}>;
253EOF
254
255 if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
Patrick Williams2390b1b2022-11-03 13:47:49 -0500256 cat << EOF >> ${UBOOT_ITS}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500257 signature {
Patrick Williams2390b1b2022-11-03 13:47:49 -0500258 algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}";
259 key-name-hint = "${SPL_SIGN_KEYNAME}";
Patrick Williams92b42cb2022-09-03 06:53:57 -0500260 };
261EOF
262 fi
263
Patrick Williams2390b1b2022-11-03 13:47:49 -0500264 cat << EOF >> ${UBOOT_ITS}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500265 };
266 fdt {
267 description = "U-Boot FDT";
Patrick Williams2390b1b2022-11-03 13:47:49 -0500268 data = /incbin/("${UBOOT_DTB_BINARY}");
Patrick Williams92b42cb2022-09-03 06:53:57 -0500269 type = "flat_dt";
270 arch = "${UBOOT_ARCH}";
271 compression = "none";
272EOF
273
274 if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
Patrick Williams2390b1b2022-11-03 13:47:49 -0500275 cat << EOF >> ${UBOOT_ITS}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500276 signature {
Patrick Williams2390b1b2022-11-03 13:47:49 -0500277 algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}";
278 key-name-hint = "${SPL_SIGN_KEYNAME}";
Patrick Williams92b42cb2022-09-03 06:53:57 -0500279 };
280EOF
281 fi
282
Patrick Williams2390b1b2022-11-03 13:47:49 -0500283 cat << EOF >> ${UBOOT_ITS}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500284 };
285 };
286
287 configurations {
288 default = "conf";
289 conf {
290 description = "Boot with signed U-Boot FIT";
291 loadables = "uboot";
292 fdt = "fdt";
293 };
294 };
295};
296EOF
297
298 #
299 # Assemble the U-boot FIT image
300 #
301 ${UBOOT_MKIMAGE} \
302 ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \
Patrick Williams2390b1b2022-11-03 13:47:49 -0500303 -f ${UBOOT_ITS} \
304 ${UBOOT_FITIMAGE_BINARY}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500305
306 if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
307 #
308 # Sign the U-boot FIT image and add public key to SPL dtb
309 #
310 ${UBOOT_MKIMAGE_SIGN} \
311 ${@'-D "${SPL_MKIMAGE_DTCOPTS}"' if len('${SPL_MKIMAGE_DTCOPTS}') else ''} \
312 -F -k "${SPL_SIGN_KEYDIR}" \
Patrick Williams2390b1b2022-11-03 13:47:49 -0500313 -K "${SPL_DIR}/${SPL_DTB_BINARY}" \
314 -r ${UBOOT_FITIMAGE_BINARY} \
Patrick Williams92b42cb2022-09-03 06:53:57 -0500315 ${SPL_MKIMAGE_SIGN_ARGS}
316 fi
317
Patrick Williams2390b1b2022-11-03 13:47:49 -0500318 cp ${SPL_DIR}/${SPL_DTB_BINARY} ${SPL_DIR}/${SPL_DTB_SIGNED}
Patrick Williams92b42cb2022-09-03 06:53:57 -0500319}
320
Patrick Williams2390b1b2022-11-03 13:47:49 -0500321uboot_assemble_fitimage_helper() {
322 type="$1"
323 binary="$2"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500324
Patrick Williams92b42cb2022-09-03 06:53:57 -0500325 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ] ; then
Patrick Williams2390b1b2022-11-03 13:47:49 -0500326 concat_dtb $type $binary
Patrick Williams92b42cb2022-09-03 06:53:57 -0500327 fi
328
Patrick Williams2390b1b2022-11-03 13:47:49 -0500329 if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ]; then
330 uboot_fitimage_assemble
Patrick Williams92b42cb2022-09-03 06:53:57 -0500331 fi
332
333 if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ] ; then
334 concat_spl_dtb
335 fi
Patrick Williams92b42cb2022-09-03 06:53:57 -0500336}
337
Patrick Williams2390b1b2022-11-03 13:47:49 -0500338do_uboot_assemble_fitimage() {
339 if [ "${UBOOT_SIGN_ENABLE}" = "1" ] ; then
340 cp "${STAGING_DIR_HOST}/sysroot-only/fitImage" "${B}/fitImage-linux"
341 fi
342
343 if [ -n "${UBOOT_CONFIG}" ]; then
344 unset i j k
345 for config in ${UBOOT_MACHINE}; do
346 i=$(expr $i + 1);
347 for type in ${UBOOT_CONFIG}; do
348 j=$(expr $j + 1);
349 if [ $j -eq $i ]; then
350 break;
351 fi
352 done
353
354 for binary in ${UBOOT_BINARIES}; do
355 k=$(expr $j + 1);
356 if [ $k -eq $i ]; then
357 break;
358 fi
359 done
360
361 cd ${B}/${config}
362 uboot_assemble_fitimage_helper ${type} ${binary}
363 done
364 else
365 cd ${B}
366 uboot_assemble_fitimage_helper "" ${UBOOT_BINARY}
367 fi
368}
369
370addtask uboot_assemble_fitimage before do_install do_deploy after do_compile
371
372deploy_helper() {
373 type="$1"
374
375 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_SIGNED}" ] ; then
376 deploy_dtb $type
377 fi
378
379 if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ]; then
380 if [ -n "${type}" ]; then
381 uboot_its_image="u-boot-its-${type}-${PV}-${PR}"
382 uboot_fitimage_image="u-boot-fitImage-${type}-${PV}-${PR}"
383 else
384 uboot_its_image="${UBOOT_ITS_IMAGE}"
385 uboot_fitimage_image="${UBOOT_FITIMAGE_IMAGE}"
386 fi
387
388 install -Dm644 ${UBOOT_FITIMAGE_BINARY} ${DEPLOYDIR}/$uboot_fitimage_image
389 install -Dm644 ${UBOOT_ITS} ${DEPLOYDIR}/$uboot_its_image
390
391 if [ -n "${type}" ]; then
392 ln -sf $uboot_its_image ${DEPLOYDIR}/${UBOOT_ITS_IMAGE}
393 ln -sf $uboot_fitimage_image ${DEPLOYDIR}/${UBOOT_FITIMAGE_IMAGE}
394 fi
395 fi
396
397 if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_SIGNED}" ] ; then
398 deploy_spl_dtb $type
399 fi
400}
401
402do_deploy:prepend() {
403 if [ -n "${UBOOT_CONFIG}" ]; then
404 unset i j k
405 for config in ${UBOOT_MACHINE}; do
406 i=$(expr $i + 1);
407 for type in ${UBOOT_CONFIG}; do
408 j=$(expr $j + 1);
409 if [ $j -eq $i ]; then
410 cd ${B}/${config}
411 deploy_helper ${type}
412 fi
413 done
Andrew Geissler517393d2023-01-13 08:55:19 -0600414 unset j
Patrick Williams2390b1b2022-11-03 13:47:49 -0500415 done
Andrew Geissler517393d2023-01-13 08:55:19 -0600416 unset i
Patrick Williams2390b1b2022-11-03 13:47:49 -0500417 else
418 cd ${B}
419 deploy_helper ""
420 fi
421
422 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ] ; then
423 ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_BINARY}
424 ln -sf ${UBOOT_DTB_IMAGE} ${DEPLOYDIR}/${UBOOT_DTB_SYMLINK}
425 ln -sf ${UBOOT_NODTB_IMAGE} ${DEPLOYDIR}/${UBOOT_NODTB_SYMLINK}
426 ln -sf ${UBOOT_NODTB_IMAGE} ${DEPLOYDIR}/${UBOOT_NODTB_BINARY}
427 fi
428
429 if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ] ; then
430 ln -sf ${UBOOT_ITS_IMAGE} ${DEPLOYDIR}/${UBOOT_ITS}
431 ln -sf ${UBOOT_ITS_IMAGE} ${DEPLOYDIR}/${UBOOT_ITS_SYMLINK}
432 ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_FITIMAGE_BINARY}
433 ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_FITIMAGE_SYMLINK}
434 fi
435
436 if [ "${SPL_SIGN_ENABLE}" = "1" -a -n "${SPL_DTB_BINARY}" ] ; then
437 ln -sf ${SPL_DTB_IMAGE} ${DEPLOYDIR}/${SPL_DTB_SYMLINK}
438 ln -sf ${SPL_DTB_IMAGE} ${DEPLOYDIR}/${SPL_DTB_BINARY}
439 ln -sf ${SPL_NODTB_IMAGE} ${DEPLOYDIR}/${SPL_NODTB_SYMLINK}
440 ln -sf ${SPL_NODTB_IMAGE} ${DEPLOYDIR}/${SPL_NODTB_BINARY}
441 fi
442}
443
444do_deploy:append() {
Patrick Williams92b42cb2022-09-03 06:53:57 -0500445 # If we're creating a u-boot fitImage, point u-boot.bin
446 # symlink since it might get used by image recipes
447 if [ "${UBOOT_FITIMAGE_ENABLE}" = "1" ] ; then
448 ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_BINARY}
449 ln -sf ${UBOOT_FITIMAGE_IMAGE} ${DEPLOYDIR}/${UBOOT_SYMLINK}
450 fi
451}