blob: 24148708179d031d71dd4391f631e25233770343 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001inherit kernel-uboot kernel-artifact-names uboot-sign
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002
Andrew Geisslerd1e89492021-02-12 15:35:20 -06003KERNEL_IMAGETYPE_REPLACEMENT = ""
4
Patrick Williamsc124f4f2015-09-15 14:41:29 -05005python __anonymous () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -05006 kerneltypes = d.getVar('KERNEL_IMAGETYPES') or ""
He Zhefe76b1e2016-05-25 04:47:16 -04007 if 'fitImage' in kerneltypes.split():
Brad Bishop6e60e8b2018-02-01 10:27:11 -05008 depends = d.getVar("DEPENDS")
Brad Bishop19323692019-04-05 15:28:33 -04009 depends = "%s u-boot-tools-native dtc-native" % depends
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010 d.setVar("DEPENDS", depends)
11
Brad Bishopd7bf8c12018-02-25 22:55:05 -050012 uarch = d.getVar("UBOOT_ARCH")
13 if uarch == "arm64":
14 replacementtype = "Image"
Brad Bishopc342db32019-05-15 21:57:59 -040015 elif uarch == "riscv":
16 replacementtype = "Image"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050017 elif uarch == "mips":
Brad Bishop6e60e8b2018-02-01 10:27:11 -050018 replacementtype = "vmlinuz.bin"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050019 elif uarch == "x86":
Patrick Williamsc0f7c042017-02-23 20:41:17 -060020 replacementtype = "bzImage"
Brad Bishop316dfdd2018-06-25 12:45:53 -040021 elif uarch == "microblaze":
22 replacementtype = "linux.bin"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060023 else:
24 replacementtype = "zImage"
25
Andrew Geisslerd1e89492021-02-12 15:35:20 -060026 d.setVar("KERNEL_IMAGETYPE_REPLACEMENT", replacementtype)
27
Brad Bishop19323692019-04-05 15:28:33 -040028 # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
29 # to kernel.bbclass . We have to override it, since we pack zImage
30 # (at least for now) into the fitImage .
Brad Bishop6e60e8b2018-02-01 10:27:11 -050031 typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
He Zhefe76b1e2016-05-25 04:47:16 -040032 if 'fitImage' in typeformake.split():
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', replacementtype))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034
Brad Bishop6e60e8b2018-02-01 10:27:11 -050035 image = d.getVar('INITRAMFS_IMAGE')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036 if image:
George McCollister185c8ae2016-05-26 08:55:16 -050037 d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
38
Brad Bishop19323692019-04-05 15:28:33 -040039 #check if there are any dtb providers
40 providerdtb = d.getVar("PREFERRED_PROVIDER_virtual/dtb")
41 if providerdtb:
42 d.appendVarFlag('do_assemble_fitimage', 'depends', ' virtual/dtb:do_populate_sysroot')
43 d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' virtual/dtb:do_populate_sysroot')
44 d.setVar('EXTERNAL_KERNEL_DEVICETREE', "${RECIPE_SYSROOT}/boot/devicetree")
45
Patrick Williamsc0f7c042017-02-23 20:41:17 -060046 # Verified boot will sign the fitImage and append the public key to
Brad Bishop6e60e8b2018-02-01 10:27:11 -050047 # U-Boot dtb. We ensure the U-Boot dtb is deployed before assembling
Patrick Williamsc0f7c042017-02-23 20:41:17 -060048 # the fitImage:
Brad Bishop15ae2502019-06-18 21:44:24 -040049 if d.getVar('UBOOT_SIGN_ENABLE') == "1" and d.getVar('UBOOT_DTB_BINARY'):
Brad Bishop6e60e8b2018-02-01 10:27:11 -050050 uboot_pn = d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'
Brad Bishop19323692019-04-05 15:28:33 -040051 d.appendVarFlag('do_assemble_fitimage', 'depends', ' %s:do_populate_sysroot' % uboot_pn)
Andrew Geisslerd1e89492021-02-12 15:35:20 -060052 if d.getVar('INITRAMFS_IMAGE_BUNDLE') == "1":
53 d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' %s:do_populate_sysroot' % uboot_pn)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054}
55
Yannick Gicqueld5813b42016-04-27 16:20:55 +020056# Options for the device tree compiler passed to mkimage '-D' feature:
57UBOOT_MKIMAGE_DTCOPTS ??= ""
58
Brad Bishopf3fd2882019-06-21 08:06:37 -040059# fitImage Hash Algo
60FIT_HASH_ALG ?= "sha256"
61
Brad Bishop64c979e2019-11-04 13:55:29 -050062# fitImage Signature Algo
63FIT_SIGN_ALG ?= "rsa2048"
64
Andrew Geisslerf0343792020-11-18 10:42:21 -060065# Generate keys for signing fitImage
66FIT_GENERATE_KEYS ?= "0"
67
68# Size of private key in number of bits
69FIT_SIGN_NUMBITS ?= "2048"
70
71# args to openssl genrsa (Default is just the public exponent)
72FIT_KEY_GENRSA_ARGS ?= "-F4"
73
74# args to openssl req (Default is -batch for non interactive mode and
75# -new for new certificate)
76FIT_KEY_REQ_ARGS ?= "-batch -new"
77
78# Standard format for public key certificate
79FIT_KEY_SIGN_PKCS ?= "-x509"
80
Andrew Geisslerd1e89492021-02-12 15:35:20 -060081# Description string
82FIT_DESC ?= "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}"
83
84# Sign individual images as well
85FIT_SIGN_INDIVIDUAL ?= "0"
86
87# mkimage command
88UBOOT_MKIMAGE ?= "uboot-mkimage"
89UBOOT_MKIMAGE_SIGN ?= "${UBOOT_MKIMAGE}"
90
91# Arguments passed to mkimage for signing
92UBOOT_MKIMAGE_SIGN_ARGS ?= ""
93
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094#
95# Emit the fitImage ITS header
96#
George McCollister185c8ae2016-05-26 08:55:16 -050097# $1 ... .its filename
Patrick Williamsc124f4f2015-09-15 14:41:29 -050098fitimage_emit_fit_header() {
George McCollister185c8ae2016-05-26 08:55:16 -050099 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100/dts-v1/;
101
102/ {
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600103 description = "${FIT_DESC}";
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104 #address-cells = <1>;
105EOF
106}
107
108#
109# Emit the fitImage section bits
110#
George McCollister185c8ae2016-05-26 08:55:16 -0500111# $1 ... .its filename
112# $2 ... Section bit type: imagestart - image section start
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113# confstart - configuration section start
114# sectend - section end
115# fitend - fitimage end
116#
117fitimage_emit_section_maint() {
George McCollister185c8ae2016-05-26 08:55:16 -0500118 case $2 in
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500119 imagestart)
George McCollister185c8ae2016-05-26 08:55:16 -0500120 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500121
122 images {
123EOF
124 ;;
125 confstart)
George McCollister185c8ae2016-05-26 08:55:16 -0500126 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500127
128 configurations {
129EOF
130 ;;
131 sectend)
George McCollister185c8ae2016-05-26 08:55:16 -0500132 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500133 };
134EOF
135 ;;
136 fitend)
George McCollister185c8ae2016-05-26 08:55:16 -0500137 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500138};
139EOF
140 ;;
141 esac
142}
143
144#
145# Emit the fitImage ITS kernel section
146#
George McCollister185c8ae2016-05-26 08:55:16 -0500147# $1 ... .its filename
148# $2 ... Image counter
149# $3 ... Path to kernel image
150# $4 ... Compression type
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500151fitimage_emit_section_kernel() {
152
Brad Bishopf3fd2882019-06-21 08:06:37 -0400153 kernel_csum="${FIT_HASH_ALG}"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600154 kernel_sign_algo="${FIT_SIGN_ALG}"
155 kernel_sign_keyname="${UBOOT_SIGN_KEYNAME}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500156
Brad Bishop316dfdd2018-06-25 12:45:53 -0400157 ENTRYPOINT="${UBOOT_ENTRYPOINT}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500158 if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
159 ENTRYPOINT=`${HOST_PREFIX}nm vmlinux | \
160 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500161 fi
162
George McCollister185c8ae2016-05-26 08:55:16 -0500163 cat << EOF >> ${1}
164 kernel@${2} {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500165 description = "Linux kernel";
George McCollister185c8ae2016-05-26 08:55:16 -0500166 data = /incbin/("${3}");
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500167 type = "kernel";
168 arch = "${UBOOT_ARCH}";
169 os = "linux";
George McCollister185c8ae2016-05-26 08:55:16 -0500170 compression = "${4}";
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500171 load = <${UBOOT_LOADADDRESS}>;
172 entry = <${ENTRYPOINT}>;
173 hash@1 {
174 algo = "${kernel_csum}";
175 };
176 };
177EOF
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600178
179 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "${kernel_sign_keyname}" ] ; then
180 sed -i '$ d' ${1}
181 cat << EOF >> ${1}
182 signature@1 {
183 algo = "${kernel_csum},${kernel_sign_algo}";
184 key-name-hint = "${kernel_sign_keyname}";
185 };
186 };
187EOF
188 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500189}
190
191#
192# Emit the fitImage ITS DTB section
193#
George McCollister185c8ae2016-05-26 08:55:16 -0500194# $1 ... .its filename
195# $2 ... Image counter
196# $3 ... Path to DTB image
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500197fitimage_emit_section_dtb() {
198
Brad Bishopf3fd2882019-06-21 08:06:37 -0400199 dtb_csum="${FIT_HASH_ALG}"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600200 dtb_sign_algo="${FIT_SIGN_ALG}"
201 dtb_sign_keyname="${UBOOT_SIGN_KEYNAME}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500202
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800203 dtb_loadline=""
204 dtb_ext=${DTB##*.}
205 if [ "${dtb_ext}" = "dtbo" ]; then
206 if [ -n "${UBOOT_DTBO_LOADADDRESS}" ]; then
207 dtb_loadline="load = <${UBOOT_DTBO_LOADADDRESS}>;"
208 fi
209 elif [ -n "${UBOOT_DTB_LOADADDRESS}" ]; then
210 dtb_loadline="load = <${UBOOT_DTB_LOADADDRESS}>;"
211 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500212 cat << EOF >> ${1}
213 fdt@${2} {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500214 description = "Flattened Device Tree blob";
George McCollister185c8ae2016-05-26 08:55:16 -0500215 data = /incbin/("${3}");
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500216 type = "flat_dt";
217 arch = "${UBOOT_ARCH}";
218 compression = "none";
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800219 ${dtb_loadline}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500220 hash@1 {
221 algo = "${dtb_csum}";
222 };
223 };
224EOF
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600225
226 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "${dtb_sign_keyname}" ] ; then
227 sed -i '$ d' ${1}
228 cat << EOF >> ${1}
229 signature@1 {
230 algo = "${dtb_csum},${dtb_sign_algo}";
231 key-name-hint = "${dtb_sign_keyname}";
232 };
233 };
234EOF
235 fi
236}
237
238#
239# Emit the fitImage ITS u-boot script section
240#
241# $1 ... .its filename
242# $2 ... Image counter
243# $3 ... Path to boot script image
244fitimage_emit_section_boot_script() {
245
246 bootscr_csum="${FIT_HASH_ALG}"
247 bootscr_sign_algo="${FIT_SIGN_ALG}"
248 bootscr_sign_keyname="${UBOOT_SIGN_KEYNAME}"
249
250 cat << EOF >> ${1}
251 bootscr@${2} {
252 description = "U-boot script";
253 data = /incbin/("${3}");
254 type = "script";
255 arch = "${UBOOT_ARCH}";
256 compression = "none";
257 hash@1 {
258 algo = "${bootscr_csum}";
259 };
260 };
261EOF
262
263 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "${bootscr_sign_keyname}" ] ; then
264 sed -i '$ d' ${1}
265 cat << EOF >> ${1}
266 signature@1 {
267 algo = "${bootscr_csum},${bootscr_sign_algo}";
268 key-name-hint = "${bootscr_sign_keyname}";
269 };
270 };
271EOF
272 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500273}
274
275#
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600276# Emit the fitImage ITS setup section
277#
278# $1 ... .its filename
279# $2 ... Image counter
280# $3 ... Path to setup image
281fitimage_emit_section_setup() {
282
Brad Bishopf3fd2882019-06-21 08:06:37 -0400283 setup_csum="${FIT_HASH_ALG}"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600284
285 cat << EOF >> ${1}
286 setup@${2} {
287 description = "Linux setup.bin";
288 data = /incbin/("${3}");
289 type = "x86_setup";
290 arch = "${UBOOT_ARCH}";
291 os = "linux";
292 compression = "none";
293 load = <0x00090000>;
294 entry = <0x00090000>;
295 hash@1 {
296 algo = "${setup_csum}";
297 };
298 };
299EOF
300}
301
302#
George McCollister185c8ae2016-05-26 08:55:16 -0500303# Emit the fitImage ITS ramdisk section
304#
305# $1 ... .its filename
306# $2 ... Image counter
307# $3 ... Path to ramdisk image
308fitimage_emit_section_ramdisk() {
309
Brad Bishopf3fd2882019-06-21 08:06:37 -0400310 ramdisk_csum="${FIT_HASH_ALG}"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600311 ramdisk_sign_algo="${FIT_SIGN_ALG}"
312 ramdisk_sign_keyname="${UBOOT_SIGN_KEYNAME}"
Nathan Rossib4a4dc02016-10-21 22:07:27 +1000313 ramdisk_loadline=""
314 ramdisk_entryline=""
315
316 if [ -n "${UBOOT_RD_LOADADDRESS}" ]; then
317 ramdisk_loadline="load = <${UBOOT_RD_LOADADDRESS}>;"
318 fi
319 if [ -n "${UBOOT_RD_ENTRYPOINT}" ]; then
320 ramdisk_entryline="entry = <${UBOOT_RD_ENTRYPOINT}>;"
321 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500322
323 cat << EOF >> ${1}
324 ramdisk@${2} {
Rick Altherrbc1b8802017-01-20 11:28:53 -0800325 description = "${INITRAMFS_IMAGE}";
George McCollister185c8ae2016-05-26 08:55:16 -0500326 data = /incbin/("${3}");
327 type = "ramdisk";
328 arch = "${UBOOT_ARCH}";
329 os = "linux";
Brad Bishop00e122a2019-10-05 11:10:57 -0400330 compression = "none";
Nathan Rossib4a4dc02016-10-21 22:07:27 +1000331 ${ramdisk_loadline}
332 ${ramdisk_entryline}
George McCollister185c8ae2016-05-26 08:55:16 -0500333 hash@1 {
334 algo = "${ramdisk_csum}";
335 };
336 };
337EOF
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600338
339 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "${ramdisk_sign_keyname}" ] ; then
340 sed -i '$ d' ${1}
341 cat << EOF >> ${1}
342 signature@1 {
343 algo = "${ramdisk_csum},${ramdisk_sign_algo}";
344 key-name-hint = "${ramdisk_sign_keyname}";
345 };
346 };
347EOF
348 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500349}
350
351#
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500352# Emit the fitImage ITS configuration section
353#
George McCollister185c8ae2016-05-26 08:55:16 -0500354# $1 ... .its filename
355# $2 ... Linux kernel ID
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500356# $3 ... DTB image name
George McCollister185c8ae2016-05-26 08:55:16 -0500357# $4 ... ramdisk ID
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600358# $5 ... u-boot script ID
359# $6 ... config ID
360# $7 ... default flag
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500361fitimage_emit_section_config() {
362
Brad Bishopf3fd2882019-06-21 08:06:37 -0400363 conf_csum="${FIT_HASH_ALG}"
Brad Bishop64c979e2019-11-04 13:55:29 -0500364 conf_sign_algo="${FIT_SIGN_ALG}"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600365 if [ -n "${UBOOT_SIGN_ENABLE}" ] ; then
366 conf_sign_keyname="${UBOOT_SIGN_KEYNAME}"
367 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500368
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600369 its_file="${1}"
370 kernel_id="${2}"
371 dtb_image="${3}"
372 ramdisk_id="${4}"
373 bootscr_id="${5}"
374 config_id="${6}"
375 default_flag="${7}"
376
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500377 # Test if we have any DTBs at all
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800378 sep=""
379 conf_desc=""
Andrew Geissler635e0e42020-08-21 15:58:33 -0500380 conf_node="conf@"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800381 kernel_line=""
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600382 fdt_line=""
383 ramdisk_line=""
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600384 bootscr_line=""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500385 setup_line=""
386 default_line=""
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600387
Andrew Geissler635e0e42020-08-21 15:58:33 -0500388 # conf node name is selected based on dtb ID if it is present,
389 # otherwise its selected based on kernel ID
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600390 if [ -n "${dtb_image}" ]; then
391 conf_node=$conf_node${dtb_image}
Andrew Geissler635e0e42020-08-21 15:58:33 -0500392 else
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600393 conf_node=$conf_node${kernel_id}
Andrew Geissler635e0e42020-08-21 15:58:33 -0500394 fi
395
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600396 if [ -n "${kernel_id}" ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800397 conf_desc="Linux kernel"
398 sep=", "
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600399 kernel_line="kernel = \"kernel@${kernel_id}\";"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800400 fi
401
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600402 if [ -n "${dtb_image}" ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800403 conf_desc="${conf_desc}${sep}FDT blob"
404 sep=", "
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600405 fdt_line="fdt = \"fdt@${dtb_image}\";"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600406 fi
407
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600408 if [ -n "${ramdisk_id}" ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800409 conf_desc="${conf_desc}${sep}ramdisk"
410 sep=", "
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600411 ramdisk_line="ramdisk = \"ramdisk@${ramdisk_id}\";"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500412 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600413
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600414 if [ -n "${bootscr_id}" ]; then
415 conf_desc="${conf_desc}${sep}u-boot script"
416 sep=", "
417 bootscr_line="bootscr = \"bootscr@${bootscr_id}\";"
418 fi
419
420 if [ -n "${config_id}" ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800421 conf_desc="${conf_desc}${sep}setup"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600422 setup_line="setup = \"setup@${config_id}\";"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600423 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500424
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600425 if [ "${default_flag}" = "1" ]; then
Andrew Geissler635e0e42020-08-21 15:58:33 -0500426 # default node is selected based on dtb ID if it is present,
427 # otherwise its selected based on kernel ID
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600428 if [ -n "${dtb_image}" ]; then
429 default_line="default = \"conf@${dtb_image}\";"
Andrew Geissler635e0e42020-08-21 15:58:33 -0500430 else
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600431 default_line="default = \"conf@${kernel_id}\";"
Andrew Geissler635e0e42020-08-21 15:58:33 -0500432 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500433 fi
434
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600435 cat << EOF >> ${its_file}
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500436 ${default_line}
Andrew Geissler635e0e42020-08-21 15:58:33 -0500437 $conf_node {
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600438 description = "${default_flag} ${conf_desc}";
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500439 ${kernel_line}
440 ${fdt_line}
George McCollister185c8ae2016-05-26 08:55:16 -0500441 ${ramdisk_line}
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600442 ${bootscr_line}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600443 ${setup_line}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500444 hash@1 {
445 algo = "${conf_csum}";
446 };
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600447EOF
448
449 if [ ! -z "${conf_sign_keyname}" ] ; then
450
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800451 sign_line="sign-images = "
452 sep=""
453
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600454 if [ -n "${kernel_id}" ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800455 sign_line="${sign_line}${sep}\"kernel\""
456 sep=", "
457 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600458
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600459 if [ -n "${dtb_image}" ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800460 sign_line="${sign_line}${sep}\"fdt\""
461 sep=", "
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600462 fi
463
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600464 if [ -n "${ramdisk_id}" ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800465 sign_line="${sign_line}${sep}\"ramdisk\""
466 sep=", "
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600467 fi
468
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600469 if [ -n "${bootscr_id}" ]; then
470 sign_line="${sign_line}${sep}\"bootscr\""
471 sep=", "
472 fi
473
474 if [ -n "${config_id}" ]; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800475 sign_line="${sign_line}${sep}\"setup\""
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600476 fi
477
478 sign_line="${sign_line};"
479
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600480 cat << EOF >> ${its_file}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600481 signature@1 {
Brad Bishop64c979e2019-11-04 13:55:29 -0500482 algo = "${conf_csum},${conf_sign_algo}";
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600483 key-name-hint = "${conf_sign_keyname}";
484 ${sign_line}
485 };
486EOF
487 fi
488
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600489 cat << EOF >> ${its_file}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500490 };
491EOF
492}
493
George McCollister185c8ae2016-05-26 08:55:16 -0500494#
495# Assemble fitImage
496#
497# $1 ... .its filename
498# $2 ... fitImage name
499# $3 ... include ramdisk
500fitimage_assemble() {
501 kernelcount=1
502 dtbcount=""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500503 DTBS=""
George McCollister185c8ae2016-05-26 08:55:16 -0500504 ramdiskcount=${3}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600505 setupcount=""
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600506 bootscr_id=""
George McCollister185c8ae2016-05-26 08:55:16 -0500507 rm -f ${1} arch/${ARCH}/boot/${2}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500508
George McCollister185c8ae2016-05-26 08:55:16 -0500509 fitimage_emit_fit_header ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500510
George McCollister185c8ae2016-05-26 08:55:16 -0500511 #
512 # Step 1: Prepare a kernel image section.
513 #
514 fitimage_emit_section_maint ${1} imagestart
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500515
George McCollister185c8ae2016-05-26 08:55:16 -0500516 uboot_prep_kimage
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600517
518 if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
519 initramfs_bundle_path="arch/"${UBOOT_ARCH}"/boot/"${KERNEL_IMAGETYPE_REPLACEMENT}".initramfs"
520 if [ -e "${initramfs_bundle_path}" ]; then
521
522 #
523 # Include the kernel/rootfs bundle.
524 #
525
526 fitimage_emit_section_kernel ${1} "${kernelcount}" "${initramfs_bundle_path}" "${linux_comp}"
527 else
528 bbwarn "${initramfs_bundle_path} not found."
529 fi
530 else
531 fitimage_emit_section_kernel ${1} "${kernelcount}" linux.bin "${linux_comp}"
532 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500533
George McCollister185c8ae2016-05-26 08:55:16 -0500534 #
535 # Step 2: Prepare a DTB image section
536 #
Brad Bishop19323692019-04-05 15:28:33 -0400537
538 if [ -z "${EXTERNAL_KERNEL_DEVICETREE}" ] && [ -n "${KERNEL_DEVICETREE}" ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500539 dtbcount=1
George McCollister185c8ae2016-05-26 08:55:16 -0500540 for DTB in ${KERNEL_DEVICETREE}; do
541 if echo ${DTB} | grep -q '/dts/'; then
542 bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
543 DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
544 fi
545 DTB_PATH="arch/${ARCH}/boot/dts/${DTB}"
546 if [ ! -e "${DTB_PATH}" ]; then
547 DTB_PATH="arch/${ARCH}/boot/${DTB}"
548 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500549
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500550 DTB=$(echo "${DTB}" | tr '/' '_')
551 DTBS="${DTBS} ${DTB}"
552 fitimage_emit_section_dtb ${1} ${DTB} ${DTB_PATH}
George McCollister185c8ae2016-05-26 08:55:16 -0500553 done
554 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500555
Brad Bishop19323692019-04-05 15:28:33 -0400556 if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ]; then
557 dtbcount=1
Andrew Geissler82c905d2020-04-13 13:39:40 -0500558 for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" \( -name '*.dtb' -o -name '*.dtbo' \) -printf '%P\n' | sort); do
Brad Bishop19323692019-04-05 15:28:33 -0400559 DTB=$(echo "${DTB}" | tr '/' '_')
560 DTBS="${DTBS} ${DTB}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500561 fitimage_emit_section_dtb ${1} ${DTB} "${EXTERNAL_KERNEL_DEVICETREE}/${DTB}"
Brad Bishop19323692019-04-05 15:28:33 -0400562 done
563 fi
564
George McCollister185c8ae2016-05-26 08:55:16 -0500565 #
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600566 # Step 3: Prepare a u-boot script section
567 #
568
569 if [ -n "${UBOOT_ENV}" ] && [ -d "${STAGING_DIR_HOST}/boot" ]; then
570 if [ -e "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY}" ]; then
571 cp ${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} ${B}
572 bootscr_id="${UBOOT_ENV_BINARY}"
573 fitimage_emit_section_boot_script ${1} "${bootscr_id}" ${UBOOT_ENV_BINARY}
574 else
575 bbwarn "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} not found."
576 fi
577 fi
578
579 #
580 # Step 4: Prepare a setup section. (For x86)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600581 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500582 if [ -e arch/${ARCH}/boot/setup.bin ]; then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600583 setupcount=1
584 fitimage_emit_section_setup ${1} "${setupcount}" arch/${ARCH}/boot/setup.bin
585 fi
586
587 #
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600588 # Step 5: Prepare a ramdisk section.
George McCollister185c8ae2016-05-26 08:55:16 -0500589 #
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600590 if [ "x${ramdiskcount}" = "x1" ] && [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
Rick Altherrbc1b8802017-01-20 11:28:53 -0800591 # Find and use the first initramfs image archive type we find
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800592 for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.gz ext2.gz cpio; do
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500593 initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.${img}"
Rick Altherrbc1b8802017-01-20 11:28:53 -0800594 echo "Using $initramfs_path"
595 if [ -e "${initramfs_path}" ]; then
596 fitimage_emit_section_ramdisk ${1} "${ramdiskcount}" "${initramfs_path}"
597 break
598 fi
599 done
George McCollister185c8ae2016-05-26 08:55:16 -0500600 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500601
George McCollister185c8ae2016-05-26 08:55:16 -0500602 fitimage_emit_section_maint ${1} sectend
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500603
George McCollister185c8ae2016-05-26 08:55:16 -0500604 # Force the first Kernel and DTB in the default config
605 kernelcount=1
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500606 if [ -n "${dtbcount}" ]; then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600607 dtbcount=1
608 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500609
George McCollister185c8ae2016-05-26 08:55:16 -0500610 #
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600611 # Step 6: Prepare a configurations section
George McCollister185c8ae2016-05-26 08:55:16 -0500612 #
613 fitimage_emit_section_maint ${1} confstart
614
Andrew Geissler635e0e42020-08-21 15:58:33 -0500615 # kernel-fitimage.bbclass currently only supports a single kernel (no less or
616 # more) to be added to the FIT image along with 0 or more device trees and
617 # 0 or 1 ramdisk.
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600618 # It is also possible to include an initramfs bundle (kernel and rootfs in one binary)
619 # When the initramfs bundle is used ramdisk is disabled.
Andrew Geissler635e0e42020-08-21 15:58:33 -0500620 # If a device tree is to be part of the FIT image, then select
621 # the default configuration to be used is based on the dtbcount. If there is
622 # no dtb present than select the default configuation to be based on
623 # the kernelcount.
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500624 if [ -n "${DTBS}" ]; then
625 i=1
626 for DTB in ${DTBS}; do
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800627 dtb_ext=${DTB##*.}
628 if [ "${dtb_ext}" = "dtbo" ]; then
Andrew Geissler9b4d8b02021-02-19 12:26:16 -0600629 fitimage_emit_section_config ${1} "" "${DTB}" "" "${bootscr_id}" "" "`expr ${i} = ${dtbcount}`"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800630 else
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600631 fitimage_emit_section_config ${1} "${kernelcount}" "${DTB}" "${ramdiskcount}" "${bootscr_id}" "${setupcount}" "`expr ${i} = ${dtbcount}`"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800632 fi
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500633 i=`expr ${i} + 1`
634 done
Andrew Geissler635e0e42020-08-21 15:58:33 -0500635 else
636 defaultconfigcount=1
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600637 fitimage_emit_section_config ${1} "${kernelcount}" "" "${ramdiskcount}" "${bootscr_id}" "${setupcount}" "${defaultconfigcount}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500638 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500639
640 fitimage_emit_section_maint ${1} sectend
641
642 fitimage_emit_section_maint ${1} fitend
643
644 #
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600645 # Step 7: Assemble the image
George McCollister185c8ae2016-05-26 08:55:16 -0500646 #
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600647 ${UBOOT_MKIMAGE} \
George McCollister185c8ae2016-05-26 08:55:16 -0500648 ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
649 -f ${1} \
650 arch/${ARCH}/boot/${2}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600651
652 #
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600653 # Step 8: Sign the image and add public key to U-Boot dtb
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600654 #
655 if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
Brad Bishop19323692019-04-05 15:28:33 -0400656 add_key_to_u_boot=""
657 if [ -n "${UBOOT_DTB_BINARY}" ]; then
658 # The u-boot.dtb is a symlink to UBOOT_DTB_IMAGE, so we need copy
659 # both of them, and don't dereference the symlink.
660 cp -P ${STAGING_DATADIR}/u-boot*.dtb ${B}
661 add_key_to_u_boot="-K ${B}/${UBOOT_DTB_BINARY}"
662 fi
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600663 ${UBOOT_MKIMAGE_SIGN} \
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600664 ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
665 -F -k "${UBOOT_SIGN_KEYDIR}" \
Brad Bishop19323692019-04-05 15:28:33 -0400666 $add_key_to_u_boot \
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600667 -r arch/${ARCH}/boot/${2} \
668 ${UBOOT_MKIMAGE_SIGN_ARGS}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600669 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500670}
671
672do_assemble_fitimage() {
673 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
674 cd ${B}
675 fitimage_assemble fit-image.its fitImage
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500676 fi
677}
678
679addtask assemble_fitimage before do_install after do_compile
680
George McCollister185c8ae2016-05-26 08:55:16 -0500681do_assemble_fitimage_initramfs() {
682 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
683 test -n "${INITRAMFS_IMAGE}" ; then
684 cd ${B}
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600685 if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
686 fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage ""
687 else
688 fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-${INITRAMFS_IMAGE} 1
689 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500690 fi
691}
692
Brad Bishop19323692019-04-05 15:28:33 -0400693addtask assemble_fitimage_initramfs before do_deploy after do_bundle_initramfs
George McCollister185c8ae2016-05-26 08:55:16 -0500694
Andrew Geisslerf0343792020-11-18 10:42:21 -0600695do_generate_rsa_keys() {
696 if [ "${UBOOT_SIGN_ENABLE}" = "0" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then
697 bbwarn "FIT_GENERATE_KEYS is set to 1 eventhough UBOOT_SIGN_ENABLE is set to 0. The keys will not be generated as they won't be used."
698 fi
699
700 if [ "${UBOOT_SIGN_ENABLE}" = "1" ] && [ "${FIT_GENERATE_KEYS}" = "1" ]; then
701
702 # Generate keys only if they don't already exist
703 if [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key ] || \
704 [ ! -f "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt]; then
705
706 # make directory if it does not already exist
707 mkdir -p "${UBOOT_SIGN_KEYDIR}"
708
709 echo "Generating RSA private key for signing fitImage"
710 openssl genrsa ${FIT_KEY_GENRSA_ARGS} -out \
711 "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \
712 "${FIT_SIGN_NUMBITS}"
713
714 echo "Generating certificate for signing fitImage"
715 openssl req ${FIT_KEY_REQ_ARGS} "${FIT_KEY_SIGN_PKCS}" \
716 -key "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".key \
717 -out "${UBOOT_SIGN_KEYDIR}/${UBOOT_SIGN_KEYNAME}".crt
718 fi
719 fi
720}
721
722addtask generate_rsa_keys before do_assemble_fitimage after do_compile
George McCollister185c8ae2016-05-26 08:55:16 -0500723
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500724kernel_do_deploy[vardepsexclude] = "DATETIME"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500725kernel_do_deploy_append() {
726 # Update deploy directory
He Zhefe76b1e2016-05-25 04:47:16 -0400727 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800728
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600729 if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
730 echo "Copying fit-image.its source file..."
731 install -m 0644 ${B}/fit-image.its "$deployDir/fitImage-its-${KERNEL_FIT_NAME}.its"
732 ln -snf fitImage-its-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${KERNEL_FIT_LINK_NAME}"
733
734 echo "Copying linux.bin file..."
735 install -m 0644 ${B}/linux.bin $deployDir/fitImage-linux.bin-${KERNEL_FIT_NAME}.bin
736 ln -snf fitImage-linux.bin-${KERNEL_FIT_NAME}.bin "$deployDir/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}"
737 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500738
George McCollister185c8ae2016-05-26 08:55:16 -0500739 if [ -n "${INITRAMFS_IMAGE}" ]; then
740 echo "Copying fit-image-${INITRAMFS_IMAGE}.its source file..."
Brad Bishop64c979e2019-11-04 13:55:29 -0500741 install -m 0644 ${B}/fit-image-${INITRAMFS_IMAGE}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its"
742 ln -snf fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
George McCollister185c8ae2016-05-26 08:55:16 -0500743
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600744 if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
745 echo "Copying fitImage-${INITRAMFS_IMAGE} file..."
746 install -m 0644 ${B}/arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin"
747 ln -snf fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
748 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500749 fi
Brad Bishop19323692019-04-05 15:28:33 -0400750 if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ] ; then
751 # UBOOT_DTB_IMAGE is a realfile, but we can't use
752 # ${UBOOT_DTB_IMAGE} since it contains ${PV} which is aimed
753 # for u-boot, but we are in kernel env now.
Brad Bishop64c979e2019-11-04 13:55:29 -0500754 install -m 0644 ${B}/u-boot-${MACHINE}*.dtb "$deployDir/"
Brad Bishop19323692019-04-05 15:28:33 -0400755 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500756 fi
757}
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600758
759# The function below performs the following in case of initramfs bundles:
760# - Removes do_assemble_fitimage. FIT generation is done through
761# do_assemble_fitimage_initramfs. do_assemble_fitimage is not needed
762# and should not be part of the tasks to be executed.
763# - Since do_generate_rsa_keys is inserted by default
764# between do_compile and do_assemble_fitimage, this is
765# not suitable in case of initramfs bundles. do_generate_rsa_keys
766# should be between do_bundle_initramfs and do_assemble_fitimage_initramfs.
767python () {
768 if d.getVar('INITRAMFS_IMAGE_BUNDLE') == "1":
769 bb.build.deltask('do_assemble_fitimage', d)
770 bb.build.deltask('generate_rsa_keys', d)
771 bb.build.addtask('generate_rsa_keys', 'do_assemble_fitimage_initramfs', 'do_bundle_initramfs', d)
772}