blob: 50a91e199069acbfca98b18146b305a0b9c1522e [file] [log] [blame]
Patrick Williamsc0f7c042017-02-23 20:41:17 -06001inherit kernel-uboot uboot-sign
Patrick Williamsc124f4f2015-09-15 14:41:29 -05002
3python __anonymous () {
Brad Bishop6e60e8b2018-02-01 10:27:11 -05004 kerneltypes = d.getVar('KERNEL_IMAGETYPES') or ""
He Zhefe76b1e2016-05-25 04:47:16 -04005 if 'fitImage' in kerneltypes.split():
Brad Bishop6e60e8b2018-02-01 10:27:11 -05006 depends = d.getVar("DEPENDS")
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007 depends = "%s u-boot-mkimage-native dtc-native" % depends
8 d.setVar("DEPENDS", depends)
9
Brad Bishopd7bf8c12018-02-25 22:55:05 -050010 uarch = d.getVar("UBOOT_ARCH")
11 if uarch == "arm64":
12 replacementtype = "Image"
13 elif uarch == "mips":
Brad Bishop6e60e8b2018-02-01 10:27:11 -050014 replacementtype = "vmlinuz.bin"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050015 elif uarch == "x86":
Patrick Williamsc0f7c042017-02-23 20:41:17 -060016 replacementtype = "bzImage"
Brad Bishop316dfdd2018-06-25 12:45:53 -040017 elif uarch == "microblaze":
18 replacementtype = "linux.bin"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060019 else:
20 replacementtype = "zImage"
21
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022 # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
23 # to kernel.bbclass . We have to override it, since we pack zImage
24 # (at least for now) into the fitImage .
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025 typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
He Zhefe76b1e2016-05-25 04:47:16 -040026 if 'fitImage' in typeformake.split():
Patrick Williamsc0f7c042017-02-23 20:41:17 -060027 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', replacementtype))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028
Brad Bishop6e60e8b2018-02-01 10:27:11 -050029 image = d.getVar('INITRAMFS_IMAGE')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030 if image:
George McCollister185c8ae2016-05-26 08:55:16 -050031 d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
32
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033 # Verified boot will sign the fitImage and append the public key to
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034 # U-Boot dtb. We ensure the U-Boot dtb is deployed before assembling
Patrick Williamsc0f7c042017-02-23 20:41:17 -060035 # the fitImage:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036 if d.getVar('UBOOT_SIGN_ENABLE') == "1":
37 uboot_pn = d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'
Patrick Williamsc0f7c042017-02-23 20:41:17 -060038 d.appendVarFlag('do_assemble_fitimage', 'depends', ' %s:do_deploy' % uboot_pn)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039}
40
Yannick Gicqueld5813b42016-04-27 16:20:55 +020041# Options for the device tree compiler passed to mkimage '-D' feature:
42UBOOT_MKIMAGE_DTCOPTS ??= ""
43
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044#
45# Emit the fitImage ITS header
46#
George McCollister185c8ae2016-05-26 08:55:16 -050047# $1 ... .its filename
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048fitimage_emit_fit_header() {
George McCollister185c8ae2016-05-26 08:55:16 -050049 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050/dts-v1/;
51
52/ {
53 description = "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}";
54 #address-cells = <1>;
55EOF
56}
57
58#
59# Emit the fitImage section bits
60#
George McCollister185c8ae2016-05-26 08:55:16 -050061# $1 ... .its filename
62# $2 ... Section bit type: imagestart - image section start
Patrick Williamsc124f4f2015-09-15 14:41:29 -050063# confstart - configuration section start
64# sectend - section end
65# fitend - fitimage end
66#
67fitimage_emit_section_maint() {
George McCollister185c8ae2016-05-26 08:55:16 -050068 case $2 in
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069 imagestart)
George McCollister185c8ae2016-05-26 08:55:16 -050070 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071
72 images {
73EOF
74 ;;
75 confstart)
George McCollister185c8ae2016-05-26 08:55:16 -050076 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077
78 configurations {
79EOF
80 ;;
81 sectend)
George McCollister185c8ae2016-05-26 08:55:16 -050082 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050083 };
84EOF
85 ;;
86 fitend)
George McCollister185c8ae2016-05-26 08:55:16 -050087 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050088};
89EOF
90 ;;
91 esac
92}
93
94#
95# Emit the fitImage ITS kernel section
96#
George McCollister185c8ae2016-05-26 08:55:16 -050097# $1 ... .its filename
98# $2 ... Image counter
99# $3 ... Path to kernel image
100# $4 ... Compression type
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500101fitimage_emit_section_kernel() {
102
103 kernel_csum="sha1"
104
Brad Bishop316dfdd2018-06-25 12:45:53 -0400105 ENTRYPOINT="${UBOOT_ENTRYPOINT}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500106 if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
107 ENTRYPOINT=`${HOST_PREFIX}nm vmlinux | \
108 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500109 fi
110
George McCollister185c8ae2016-05-26 08:55:16 -0500111 cat << EOF >> ${1}
112 kernel@${2} {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113 description = "Linux kernel";
George McCollister185c8ae2016-05-26 08:55:16 -0500114 data = /incbin/("${3}");
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115 type = "kernel";
116 arch = "${UBOOT_ARCH}";
117 os = "linux";
George McCollister185c8ae2016-05-26 08:55:16 -0500118 compression = "${4}";
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500119 load = <${UBOOT_LOADADDRESS}>;
120 entry = <${ENTRYPOINT}>;
121 hash@1 {
122 algo = "${kernel_csum}";
123 };
124 };
125EOF
126}
127
128#
129# Emit the fitImage ITS DTB section
130#
George McCollister185c8ae2016-05-26 08:55:16 -0500131# $1 ... .its filename
132# $2 ... Image counter
133# $3 ... Path to DTB image
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500134fitimage_emit_section_dtb() {
135
136 dtb_csum="sha1"
137
George McCollister185c8ae2016-05-26 08:55:16 -0500138 cat << EOF >> ${1}
139 fdt@${2} {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500140 description = "Flattened Device Tree blob";
George McCollister185c8ae2016-05-26 08:55:16 -0500141 data = /incbin/("${3}");
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500142 type = "flat_dt";
143 arch = "${UBOOT_ARCH}";
144 compression = "none";
145 hash@1 {
146 algo = "${dtb_csum}";
147 };
148 };
149EOF
150}
151
152#
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600153# Emit the fitImage ITS setup section
154#
155# $1 ... .its filename
156# $2 ... Image counter
157# $3 ... Path to setup image
158fitimage_emit_section_setup() {
159
160 setup_csum="sha1"
161
162 cat << EOF >> ${1}
163 setup@${2} {
164 description = "Linux setup.bin";
165 data = /incbin/("${3}");
166 type = "x86_setup";
167 arch = "${UBOOT_ARCH}";
168 os = "linux";
169 compression = "none";
170 load = <0x00090000>;
171 entry = <0x00090000>;
172 hash@1 {
173 algo = "${setup_csum}";
174 };
175 };
176EOF
177}
178
179#
George McCollister185c8ae2016-05-26 08:55:16 -0500180# Emit the fitImage ITS ramdisk section
181#
182# $1 ... .its filename
183# $2 ... Image counter
184# $3 ... Path to ramdisk image
185fitimage_emit_section_ramdisk() {
186
187 ramdisk_csum="sha1"
Rick Altherrbc1b8802017-01-20 11:28:53 -0800188 ramdisk_ctype="none"
Nathan Rossib4a4dc02016-10-21 22:07:27 +1000189 ramdisk_loadline=""
190 ramdisk_entryline=""
191
192 if [ -n "${UBOOT_RD_LOADADDRESS}" ]; then
193 ramdisk_loadline="load = <${UBOOT_RD_LOADADDRESS}>;"
194 fi
195 if [ -n "${UBOOT_RD_ENTRYPOINT}" ]; then
196 ramdisk_entryline="entry = <${UBOOT_RD_ENTRYPOINT}>;"
197 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500198
Rick Altherrbc1b8802017-01-20 11:28:53 -0800199 case $3 in
200 *.gz)
201 ramdisk_ctype="gzip"
202 ;;
203 *.bz2)
204 ramdisk_ctype="bzip2"
205 ;;
206 *.lzma)
207 ramdisk_ctype="lzma"
208 ;;
209 *.lzo)
210 ramdisk_ctype="lzo"
211 ;;
212 *.lz4)
213 ramdisk_ctype="lz4"
214 ;;
215 esac
216
George McCollister185c8ae2016-05-26 08:55:16 -0500217 cat << EOF >> ${1}
218 ramdisk@${2} {
Rick Altherrbc1b8802017-01-20 11:28:53 -0800219 description = "${INITRAMFS_IMAGE}";
George McCollister185c8ae2016-05-26 08:55:16 -0500220 data = /incbin/("${3}");
221 type = "ramdisk";
222 arch = "${UBOOT_ARCH}";
223 os = "linux";
Rick Altherrbc1b8802017-01-20 11:28:53 -0800224 compression = "${ramdisk_ctype}";
Nathan Rossib4a4dc02016-10-21 22:07:27 +1000225 ${ramdisk_loadline}
226 ${ramdisk_entryline}
George McCollister185c8ae2016-05-26 08:55:16 -0500227 hash@1 {
228 algo = "${ramdisk_csum}";
229 };
230 };
231EOF
232}
233
234#
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500235# Emit the fitImage ITS configuration section
236#
George McCollister185c8ae2016-05-26 08:55:16 -0500237# $1 ... .its filename
238# $2 ... Linux kernel ID
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500239# $3 ... DTB image name
George McCollister185c8ae2016-05-26 08:55:16 -0500240# $4 ... ramdisk ID
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600241# $5 ... config ID
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500242# $6 ... default flag
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500243fitimage_emit_section_config() {
244
245 conf_csum="sha1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600246 if [ -n "${UBOOT_SIGN_ENABLE}" ] ; then
247 conf_sign_keyname="${UBOOT_SIGN_KEYNAME}"
248 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500249
250 # Test if we have any DTBs at all
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600251 conf_desc="Linux kernel"
252 kernel_line="kernel = \"kernel@${2}\";"
253 fdt_line=""
254 ramdisk_line=""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500255 setup_line=""
256 default_line=""
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600257
258 if [ -n "${3}" ]; then
259 conf_desc="${conf_desc}, FDT blob"
George McCollister185c8ae2016-05-26 08:55:16 -0500260 fdt_line="fdt = \"fdt@${3}\";"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600261 fi
262
263 if [ -n "${4}" ]; then
264 conf_desc="${conf_desc}, ramdisk"
George McCollister185c8ae2016-05-26 08:55:16 -0500265 ramdisk_line="ramdisk = \"ramdisk@${4}\";"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500266 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600267
268 if [ -n "${5}" ]; then
269 conf_desc="${conf_desc}, setup"
270 setup_line="setup = \"setup@${5}\";"
271 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500272
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500273 if [ "${6}" = "1" ]; then
274 default_line="default = \"conf@${3}\";"
275 fi
276
George McCollister185c8ae2016-05-26 08:55:16 -0500277 cat << EOF >> ${1}
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500278 ${default_line}
279 conf@${3} {
280 description = "${6} ${conf_desc}";
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500281 ${kernel_line}
282 ${fdt_line}
George McCollister185c8ae2016-05-26 08:55:16 -0500283 ${ramdisk_line}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600284 ${setup_line}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500285 hash@1 {
286 algo = "${conf_csum}";
287 };
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600288EOF
289
290 if [ ! -z "${conf_sign_keyname}" ] ; then
291
292 sign_line="sign-images = \"kernel\""
293
294 if [ -n "${3}" ]; then
295 sign_line="${sign_line}, \"fdt\""
296 fi
297
298 if [ -n "${4}" ]; then
299 sign_line="${sign_line}, \"ramdisk\""
300 fi
301
302 if [ -n "${5}" ]; then
303 sign_line="${sign_line}, \"setup\""
304 fi
305
306 sign_line="${sign_line};"
307
308 cat << EOF >> ${1}
309 signature@1 {
310 algo = "${conf_csum},rsa2048";
311 key-name-hint = "${conf_sign_keyname}";
312 ${sign_line}
313 };
314EOF
315 fi
316
317 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500318 };
319EOF
320}
321
George McCollister185c8ae2016-05-26 08:55:16 -0500322#
323# Assemble fitImage
324#
325# $1 ... .its filename
326# $2 ... fitImage name
327# $3 ... include ramdisk
328fitimage_assemble() {
329 kernelcount=1
330 dtbcount=""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500331 DTBS=""
George McCollister185c8ae2016-05-26 08:55:16 -0500332 ramdiskcount=${3}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600333 setupcount=""
George McCollister185c8ae2016-05-26 08:55:16 -0500334 rm -f ${1} arch/${ARCH}/boot/${2}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500335
George McCollister185c8ae2016-05-26 08:55:16 -0500336 fitimage_emit_fit_header ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500337
George McCollister185c8ae2016-05-26 08:55:16 -0500338 #
339 # Step 1: Prepare a kernel image section.
340 #
341 fitimage_emit_section_maint ${1} imagestart
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500342
George McCollister185c8ae2016-05-26 08:55:16 -0500343 uboot_prep_kimage
344 fitimage_emit_section_kernel ${1} "${kernelcount}" linux.bin "${linux_comp}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500345
George McCollister185c8ae2016-05-26 08:55:16 -0500346 #
347 # Step 2: Prepare a DTB image section
348 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500349 if [ -n "${KERNEL_DEVICETREE}" ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500350 dtbcount=1
George McCollister185c8ae2016-05-26 08:55:16 -0500351 for DTB in ${KERNEL_DEVICETREE}; do
352 if echo ${DTB} | grep -q '/dts/'; then
353 bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
354 DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
355 fi
356 DTB_PATH="arch/${ARCH}/boot/dts/${DTB}"
357 if [ ! -e "${DTB_PATH}" ]; then
358 DTB_PATH="arch/${ARCH}/boot/${DTB}"
359 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500360
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500361 DTB=$(echo "${DTB}" | tr '/' '_')
362 DTBS="${DTBS} ${DTB}"
363 fitimage_emit_section_dtb ${1} ${DTB} ${DTB_PATH}
George McCollister185c8ae2016-05-26 08:55:16 -0500364 done
365 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500366
George McCollister185c8ae2016-05-26 08:55:16 -0500367 #
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600368 # Step 3: Prepare a setup section. (For x86)
369 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500370 if [ -e arch/${ARCH}/boot/setup.bin ]; then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600371 setupcount=1
372 fitimage_emit_section_setup ${1} "${setupcount}" arch/${ARCH}/boot/setup.bin
373 fi
374
375 #
376 # Step 4: Prepare a ramdisk section.
George McCollister185c8ae2016-05-26 08:55:16 -0500377 #
378 if [ "x${ramdiskcount}" = "x1" ] ; then
Rick Altherrbc1b8802017-01-20 11:28:53 -0800379 # Find and use the first initramfs image archive type we find
380 for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.gz cpio; do
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500381 initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.${img}"
Rick Altherrbc1b8802017-01-20 11:28:53 -0800382 echo "Using $initramfs_path"
383 if [ -e "${initramfs_path}" ]; then
384 fitimage_emit_section_ramdisk ${1} "${ramdiskcount}" "${initramfs_path}"
385 break
386 fi
387 done
George McCollister185c8ae2016-05-26 08:55:16 -0500388 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500389
George McCollister185c8ae2016-05-26 08:55:16 -0500390 fitimage_emit_section_maint ${1} sectend
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500391
George McCollister185c8ae2016-05-26 08:55:16 -0500392 # Force the first Kernel and DTB in the default config
393 kernelcount=1
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500394 if [ -n "${dtbcount}" ]; then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600395 dtbcount=1
396 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500397
George McCollister185c8ae2016-05-26 08:55:16 -0500398 #
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600399 # Step 5: Prepare a configurations section
George McCollister185c8ae2016-05-26 08:55:16 -0500400 #
401 fitimage_emit_section_maint ${1} confstart
402
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500403 if [ -n "${DTBS}" ]; then
404 i=1
405 for DTB in ${DTBS}; do
406 fitimage_emit_section_config ${1} "${kernelcount}" "${DTB}" "${ramdiskcount}" "${setupcount}" "`expr ${i} = ${dtbcount}`"
407 i=`expr ${i} + 1`
408 done
409 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500410
411 fitimage_emit_section_maint ${1} sectend
412
413 fitimage_emit_section_maint ${1} fitend
414
415 #
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600416 # Step 6: Assemble the image
George McCollister185c8ae2016-05-26 08:55:16 -0500417 #
418 uboot-mkimage \
419 ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
420 -f ${1} \
421 arch/${ARCH}/boot/${2}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600422
423 #
424 # Step 7: Sign the image and add public key to U-Boot dtb
425 #
426 if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
427 uboot-mkimage \
428 ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
429 -F -k "${UBOOT_SIGN_KEYDIR}" \
430 -K "${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_BINARY}" \
431 -r arch/${ARCH}/boot/${2}
432 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500433}
434
435do_assemble_fitimage() {
436 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
437 cd ${B}
438 fitimage_assemble fit-image.its fitImage
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500439 fi
440}
441
442addtask assemble_fitimage before do_install after do_compile
443
George McCollister185c8ae2016-05-26 08:55:16 -0500444do_assemble_fitimage_initramfs() {
445 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
446 test -n "${INITRAMFS_IMAGE}" ; then
447 cd ${B}
448 fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-${INITRAMFS_IMAGE} 1
449 fi
450}
451
452addtask assemble_fitimage_initramfs before do_deploy after do_install
453
454
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500455kernel_do_deploy[vardepsexclude] = "DATETIME"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500456kernel_do_deploy_append() {
457 # Update deploy directory
He Zhefe76b1e2016-05-25 04:47:16 -0400458 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500459 cd ${B}
460 echo "Copying fit-image.its source file..."
He Zhefe76b1e2016-05-25 04:47:16 -0400461 its_base_name="fitImage-its-${PV}-${PR}-${MACHINE}-${DATETIME}"
462 its_symlink_name=fitImage-its-${MACHINE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500463 install -m 0644 fit-image.its ${DEPLOYDIR}/${its_base_name}.its
He Zhefe76b1e2016-05-25 04:47:16 -0400464 linux_bin_base_name="fitImage-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}"
465 linux_bin_symlink_name=fitImage-linux.bin-${MACHINE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500466 install -m 0644 linux.bin ${DEPLOYDIR}/${linux_bin_base_name}.bin
467
George McCollister185c8ae2016-05-26 08:55:16 -0500468 if [ -n "${INITRAMFS_IMAGE}" ]; then
469 echo "Copying fit-image-${INITRAMFS_IMAGE}.its source file..."
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500470 its_initramfs_base_name="fitImage-its-${INITRAMFS_IMAGE_NAME}-${PV}-${PR}-${DATETIME}"
471 its_initramfs_symlink_name=fitImage-its-${INITRAMFS_IMAGE_NAME}
George McCollister185c8ae2016-05-26 08:55:16 -0500472 install -m 0644 fit-image-${INITRAMFS_IMAGE}.its ${DEPLOYDIR}/${its_initramfs_base_name}.its
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500473 fit_initramfs_base_name="fitImage-${INITRAMFS_IMAGE_NAME}-${PV}-${PR}-${DATETIME}"
474 fit_initramfs_symlink_name=fitImage-${INITRAMFS_IMAGE_NAME}
George McCollister185c8ae2016-05-26 08:55:16 -0500475 install -m 0644 arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} ${DEPLOYDIR}/${fit_initramfs_base_name}.bin
476 fi
477
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500478 cd ${DEPLOYDIR}
479 ln -sf ${its_base_name}.its ${its_symlink_name}.its
480 ln -sf ${linux_bin_base_name}.bin ${linux_bin_symlink_name}.bin
George McCollister185c8ae2016-05-26 08:55:16 -0500481
482 if [ -n "${INITRAMFS_IMAGE}" ]; then
483 ln -sf ${its_initramfs_base_name}.its ${its_initramfs_symlink_name}.its
484 ln -sf ${fit_initramfs_base_name}.bin ${fit_initramfs_symlink_name}.bin
485 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500486 fi
487}