blob: 9baf399f2ea03e1b8faf3e89897c4816a1b9e3e5 [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"
17 else:
18 replacementtype = "zImage"
19
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020 # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
21 # to kernel.bbclass . We have to override it, since we pack zImage
22 # (at least for now) into the fitImage .
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023 typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE") or ""
He Zhefe76b1e2016-05-25 04:47:16 -040024 if 'fitImage' in typeformake.split():
Patrick Williamsc0f7c042017-02-23 20:41:17 -060025 d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', replacementtype))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026
Brad Bishop6e60e8b2018-02-01 10:27:11 -050027 image = d.getVar('INITRAMFS_IMAGE')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 if image:
George McCollister185c8ae2016-05-26 08:55:16 -050029 d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
30
Patrick Williamsc0f7c042017-02-23 20:41:17 -060031 # Verified boot will sign the fitImage and append the public key to
Brad Bishop6e60e8b2018-02-01 10:27:11 -050032 # U-Boot dtb. We ensure the U-Boot dtb is deployed before assembling
Patrick Williamsc0f7c042017-02-23 20:41:17 -060033 # the fitImage:
Brad Bishop6e60e8b2018-02-01 10:27:11 -050034 if d.getVar('UBOOT_SIGN_ENABLE') == "1":
35 uboot_pn = d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'
Patrick Williamsc0f7c042017-02-23 20:41:17 -060036 d.appendVarFlag('do_assemble_fitimage', 'depends', ' %s:do_deploy' % uboot_pn)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050037}
38
Yannick Gicqueld5813b42016-04-27 16:20:55 +020039# Options for the device tree compiler passed to mkimage '-D' feature:
40UBOOT_MKIMAGE_DTCOPTS ??= ""
41
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042#
43# Emit the fitImage ITS header
44#
George McCollister185c8ae2016-05-26 08:55:16 -050045# $1 ... .its filename
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046fitimage_emit_fit_header() {
George McCollister185c8ae2016-05-26 08:55:16 -050047 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048/dts-v1/;
49
50/ {
51 description = "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}";
52 #address-cells = <1>;
53EOF
54}
55
56#
57# Emit the fitImage section bits
58#
George McCollister185c8ae2016-05-26 08:55:16 -050059# $1 ... .its filename
60# $2 ... Section bit type: imagestart - image section start
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061# confstart - configuration section start
62# sectend - section end
63# fitend - fitimage end
64#
65fitimage_emit_section_maint() {
George McCollister185c8ae2016-05-26 08:55:16 -050066 case $2 in
Patrick Williamsc124f4f2015-09-15 14:41:29 -050067 imagestart)
George McCollister185c8ae2016-05-26 08:55:16 -050068 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050069
70 images {
71EOF
72 ;;
73 confstart)
George McCollister185c8ae2016-05-26 08:55:16 -050074 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075
76 configurations {
77EOF
78 ;;
79 sectend)
George McCollister185c8ae2016-05-26 08:55:16 -050080 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081 };
82EOF
83 ;;
84 fitend)
George McCollister185c8ae2016-05-26 08:55:16 -050085 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050086};
87EOF
88 ;;
89 esac
90}
91
92#
93# Emit the fitImage ITS kernel section
94#
George McCollister185c8ae2016-05-26 08:55:16 -050095# $1 ... .its filename
96# $2 ... Image counter
97# $3 ... Path to kernel image
98# $4 ... Compression type
Patrick Williamsc124f4f2015-09-15 14:41:29 -050099fitimage_emit_section_kernel() {
100
101 kernel_csum="sha1"
102
103 ENTRYPOINT=${UBOOT_ENTRYPOINT}
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500104 if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
105 ENTRYPOINT=`${HOST_PREFIX}nm vmlinux | \
106 awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500107 fi
108
George McCollister185c8ae2016-05-26 08:55:16 -0500109 cat << EOF >> ${1}
110 kernel@${2} {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111 description = "Linux kernel";
George McCollister185c8ae2016-05-26 08:55:16 -0500112 data = /incbin/("${3}");
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113 type = "kernel";
114 arch = "${UBOOT_ARCH}";
115 os = "linux";
George McCollister185c8ae2016-05-26 08:55:16 -0500116 compression = "${4}";
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500117 load = <${UBOOT_LOADADDRESS}>;
118 entry = <${ENTRYPOINT}>;
119 hash@1 {
120 algo = "${kernel_csum}";
121 };
122 };
123EOF
124}
125
126#
127# Emit the fitImage ITS DTB section
128#
George McCollister185c8ae2016-05-26 08:55:16 -0500129# $1 ... .its filename
130# $2 ... Image counter
131# $3 ... Path to DTB image
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500132fitimage_emit_section_dtb() {
133
134 dtb_csum="sha1"
135
George McCollister185c8ae2016-05-26 08:55:16 -0500136 cat << EOF >> ${1}
137 fdt@${2} {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500138 description = "Flattened Device Tree blob";
George McCollister185c8ae2016-05-26 08:55:16 -0500139 data = /incbin/("${3}");
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500140 type = "flat_dt";
141 arch = "${UBOOT_ARCH}";
142 compression = "none";
143 hash@1 {
144 algo = "${dtb_csum}";
145 };
146 };
147EOF
148}
149
150#
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600151# Emit the fitImage ITS setup section
152#
153# $1 ... .its filename
154# $2 ... Image counter
155# $3 ... Path to setup image
156fitimage_emit_section_setup() {
157
158 setup_csum="sha1"
159
160 cat << EOF >> ${1}
161 setup@${2} {
162 description = "Linux setup.bin";
163 data = /incbin/("${3}");
164 type = "x86_setup";
165 arch = "${UBOOT_ARCH}";
166 os = "linux";
167 compression = "none";
168 load = <0x00090000>;
169 entry = <0x00090000>;
170 hash@1 {
171 algo = "${setup_csum}";
172 };
173 };
174EOF
175}
176
177#
George McCollister185c8ae2016-05-26 08:55:16 -0500178# Emit the fitImage ITS ramdisk section
179#
180# $1 ... .its filename
181# $2 ... Image counter
182# $3 ... Path to ramdisk image
183fitimage_emit_section_ramdisk() {
184
185 ramdisk_csum="sha1"
Rick Altherrbc1b8802017-01-20 11:28:53 -0800186 ramdisk_ctype="none"
Nathan Rossib4a4dc02016-10-21 22:07:27 +1000187 ramdisk_loadline=""
188 ramdisk_entryline=""
189
190 if [ -n "${UBOOT_RD_LOADADDRESS}" ]; then
191 ramdisk_loadline="load = <${UBOOT_RD_LOADADDRESS}>;"
192 fi
193 if [ -n "${UBOOT_RD_ENTRYPOINT}" ]; then
194 ramdisk_entryline="entry = <${UBOOT_RD_ENTRYPOINT}>;"
195 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500196
Rick Altherrbc1b8802017-01-20 11:28:53 -0800197 case $3 in
198 *.gz)
199 ramdisk_ctype="gzip"
200 ;;
201 *.bz2)
202 ramdisk_ctype="bzip2"
203 ;;
204 *.lzma)
205 ramdisk_ctype="lzma"
206 ;;
207 *.lzo)
208 ramdisk_ctype="lzo"
209 ;;
210 *.lz4)
211 ramdisk_ctype="lz4"
212 ;;
213 esac
214
George McCollister185c8ae2016-05-26 08:55:16 -0500215 cat << EOF >> ${1}
216 ramdisk@${2} {
Rick Altherrbc1b8802017-01-20 11:28:53 -0800217 description = "${INITRAMFS_IMAGE}";
George McCollister185c8ae2016-05-26 08:55:16 -0500218 data = /incbin/("${3}");
219 type = "ramdisk";
220 arch = "${UBOOT_ARCH}";
221 os = "linux";
Rick Altherrbc1b8802017-01-20 11:28:53 -0800222 compression = "${ramdisk_ctype}";
Nathan Rossib4a4dc02016-10-21 22:07:27 +1000223 ${ramdisk_loadline}
224 ${ramdisk_entryline}
George McCollister185c8ae2016-05-26 08:55:16 -0500225 hash@1 {
226 algo = "${ramdisk_csum}";
227 };
228 };
229EOF
230}
231
232#
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500233# Emit the fitImage ITS configuration section
234#
George McCollister185c8ae2016-05-26 08:55:16 -0500235# $1 ... .its filename
236# $2 ... Linux kernel ID
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500237# $3 ... DTB image name
George McCollister185c8ae2016-05-26 08:55:16 -0500238# $4 ... ramdisk ID
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600239# $5 ... config ID
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500240# $6 ... default flag
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500241fitimage_emit_section_config() {
242
243 conf_csum="sha1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600244 if [ -n "${UBOOT_SIGN_ENABLE}" ] ; then
245 conf_sign_keyname="${UBOOT_SIGN_KEYNAME}"
246 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500247
248 # Test if we have any DTBs at all
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600249 conf_desc="Linux kernel"
250 kernel_line="kernel = \"kernel@${2}\";"
251 fdt_line=""
252 ramdisk_line=""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500253 setup_line=""
254 default_line=""
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600255
256 if [ -n "${3}" ]; then
257 conf_desc="${conf_desc}, FDT blob"
George McCollister185c8ae2016-05-26 08:55:16 -0500258 fdt_line="fdt = \"fdt@${3}\";"
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600259 fi
260
261 if [ -n "${4}" ]; then
262 conf_desc="${conf_desc}, ramdisk"
George McCollister185c8ae2016-05-26 08:55:16 -0500263 ramdisk_line="ramdisk = \"ramdisk@${4}\";"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500264 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600265
266 if [ -n "${5}" ]; then
267 conf_desc="${conf_desc}, setup"
268 setup_line="setup = \"setup@${5}\";"
269 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500270
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500271 if [ "${6}" = "1" ]; then
272 default_line="default = \"conf@${3}\";"
273 fi
274
George McCollister185c8ae2016-05-26 08:55:16 -0500275 cat << EOF >> ${1}
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500276 ${default_line}
277 conf@${3} {
278 description = "${6} ${conf_desc}";
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500279 ${kernel_line}
280 ${fdt_line}
George McCollister185c8ae2016-05-26 08:55:16 -0500281 ${ramdisk_line}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600282 ${setup_line}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500283 hash@1 {
284 algo = "${conf_csum}";
285 };
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600286EOF
287
288 if [ ! -z "${conf_sign_keyname}" ] ; then
289
290 sign_line="sign-images = \"kernel\""
291
292 if [ -n "${3}" ]; then
293 sign_line="${sign_line}, \"fdt\""
294 fi
295
296 if [ -n "${4}" ]; then
297 sign_line="${sign_line}, \"ramdisk\""
298 fi
299
300 if [ -n "${5}" ]; then
301 sign_line="${sign_line}, \"setup\""
302 fi
303
304 sign_line="${sign_line};"
305
306 cat << EOF >> ${1}
307 signature@1 {
308 algo = "${conf_csum},rsa2048";
309 key-name-hint = "${conf_sign_keyname}";
310 ${sign_line}
311 };
312EOF
313 fi
314
315 cat << EOF >> ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500316 };
317EOF
318}
319
George McCollister185c8ae2016-05-26 08:55:16 -0500320#
321# Assemble fitImage
322#
323# $1 ... .its filename
324# $2 ... fitImage name
325# $3 ... include ramdisk
326fitimage_assemble() {
327 kernelcount=1
328 dtbcount=""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500329 DTBS=""
George McCollister185c8ae2016-05-26 08:55:16 -0500330 ramdiskcount=${3}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600331 setupcount=""
George McCollister185c8ae2016-05-26 08:55:16 -0500332 rm -f ${1} arch/${ARCH}/boot/${2}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500333
George McCollister185c8ae2016-05-26 08:55:16 -0500334 fitimage_emit_fit_header ${1}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500335
George McCollister185c8ae2016-05-26 08:55:16 -0500336 #
337 # Step 1: Prepare a kernel image section.
338 #
339 fitimage_emit_section_maint ${1} imagestart
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500340
George McCollister185c8ae2016-05-26 08:55:16 -0500341 uboot_prep_kimage
342 fitimage_emit_section_kernel ${1} "${kernelcount}" linux.bin "${linux_comp}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500343
George McCollister185c8ae2016-05-26 08:55:16 -0500344 #
345 # Step 2: Prepare a DTB image section
346 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500347 if [ -n "${KERNEL_DEVICETREE}" ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500348 dtbcount=1
George McCollister185c8ae2016-05-26 08:55:16 -0500349 for DTB in ${KERNEL_DEVICETREE}; do
350 if echo ${DTB} | grep -q '/dts/'; then
351 bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
352 DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
353 fi
354 DTB_PATH="arch/${ARCH}/boot/dts/${DTB}"
355 if [ ! -e "${DTB_PATH}" ]; then
356 DTB_PATH="arch/${ARCH}/boot/${DTB}"
357 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500358
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500359 DTB=$(echo "${DTB}" | tr '/' '_')
360 DTBS="${DTBS} ${DTB}"
361 fitimage_emit_section_dtb ${1} ${DTB} ${DTB_PATH}
George McCollister185c8ae2016-05-26 08:55:16 -0500362 done
363 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500364
George McCollister185c8ae2016-05-26 08:55:16 -0500365 #
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600366 # Step 3: Prepare a setup section. (For x86)
367 #
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500368 if [ -e arch/${ARCH}/boot/setup.bin ]; then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600369 setupcount=1
370 fitimage_emit_section_setup ${1} "${setupcount}" arch/${ARCH}/boot/setup.bin
371 fi
372
373 #
374 # Step 4: Prepare a ramdisk section.
George McCollister185c8ae2016-05-26 08:55:16 -0500375 #
376 if [ "x${ramdiskcount}" = "x1" ] ; then
Rick Altherrbc1b8802017-01-20 11:28:53 -0800377 # Find and use the first initramfs image archive type we find
378 for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.gz cpio; do
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500379 initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.${img}"
Rick Altherrbc1b8802017-01-20 11:28:53 -0800380 echo "Using $initramfs_path"
381 if [ -e "${initramfs_path}" ]; then
382 fitimage_emit_section_ramdisk ${1} "${ramdiskcount}" "${initramfs_path}"
383 break
384 fi
385 done
George McCollister185c8ae2016-05-26 08:55:16 -0500386 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500387
George McCollister185c8ae2016-05-26 08:55:16 -0500388 fitimage_emit_section_maint ${1} sectend
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500389
George McCollister185c8ae2016-05-26 08:55:16 -0500390 # Force the first Kernel and DTB in the default config
391 kernelcount=1
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500392 if [ -n "${dtbcount}" ]; then
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600393 dtbcount=1
394 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500395
George McCollister185c8ae2016-05-26 08:55:16 -0500396 #
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600397 # Step 5: Prepare a configurations section
George McCollister185c8ae2016-05-26 08:55:16 -0500398 #
399 fitimage_emit_section_maint ${1} confstart
400
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500401 if [ -n "${DTBS}" ]; then
402 i=1
403 for DTB in ${DTBS}; do
404 fitimage_emit_section_config ${1} "${kernelcount}" "${DTB}" "${ramdiskcount}" "${setupcount}" "`expr ${i} = ${dtbcount}`"
405 i=`expr ${i} + 1`
406 done
407 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500408
409 fitimage_emit_section_maint ${1} sectend
410
411 fitimage_emit_section_maint ${1} fitend
412
413 #
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600414 # Step 6: Assemble the image
George McCollister185c8ae2016-05-26 08:55:16 -0500415 #
416 uboot-mkimage \
417 ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
418 -f ${1} \
419 arch/${ARCH}/boot/${2}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600420
421 #
422 # Step 7: Sign the image and add public key to U-Boot dtb
423 #
424 if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
425 uboot-mkimage \
426 ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
427 -F -k "${UBOOT_SIGN_KEYDIR}" \
428 -K "${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_BINARY}" \
429 -r arch/${ARCH}/boot/${2}
430 fi
George McCollister185c8ae2016-05-26 08:55:16 -0500431}
432
433do_assemble_fitimage() {
434 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
435 cd ${B}
436 fitimage_assemble fit-image.its fitImage
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500437 fi
438}
439
440addtask assemble_fitimage before do_install after do_compile
441
George McCollister185c8ae2016-05-26 08:55:16 -0500442do_assemble_fitimage_initramfs() {
443 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
444 test -n "${INITRAMFS_IMAGE}" ; then
445 cd ${B}
446 fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-${INITRAMFS_IMAGE} 1
447 fi
448}
449
450addtask assemble_fitimage_initramfs before do_deploy after do_install
451
452
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500453kernel_do_deploy[vardepsexclude] = "DATETIME"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500454kernel_do_deploy_append() {
455 # Update deploy directory
He Zhefe76b1e2016-05-25 04:47:16 -0400456 if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500457 cd ${B}
458 echo "Copying fit-image.its source file..."
He Zhefe76b1e2016-05-25 04:47:16 -0400459 its_base_name="fitImage-its-${PV}-${PR}-${MACHINE}-${DATETIME}"
460 its_symlink_name=fitImage-its-${MACHINE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500461 install -m 0644 fit-image.its ${DEPLOYDIR}/${its_base_name}.its
He Zhefe76b1e2016-05-25 04:47:16 -0400462 linux_bin_base_name="fitImage-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}"
463 linux_bin_symlink_name=fitImage-linux.bin-${MACHINE}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500464 install -m 0644 linux.bin ${DEPLOYDIR}/${linux_bin_base_name}.bin
465
George McCollister185c8ae2016-05-26 08:55:16 -0500466 if [ -n "${INITRAMFS_IMAGE}" ]; then
467 echo "Copying fit-image-${INITRAMFS_IMAGE}.its source file..."
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500468 its_initramfs_base_name="fitImage-its-${INITRAMFS_IMAGE_NAME}-${PV}-${PR}-${DATETIME}"
469 its_initramfs_symlink_name=fitImage-its-${INITRAMFS_IMAGE_NAME}
George McCollister185c8ae2016-05-26 08:55:16 -0500470 install -m 0644 fit-image-${INITRAMFS_IMAGE}.its ${DEPLOYDIR}/${its_initramfs_base_name}.its
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500471 fit_initramfs_base_name="fitImage-${INITRAMFS_IMAGE_NAME}-${PV}-${PR}-${DATETIME}"
472 fit_initramfs_symlink_name=fitImage-${INITRAMFS_IMAGE_NAME}
George McCollister185c8ae2016-05-26 08:55:16 -0500473 install -m 0644 arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} ${DEPLOYDIR}/${fit_initramfs_base_name}.bin
474 fi
475
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500476 cd ${DEPLOYDIR}
477 ln -sf ${its_base_name}.its ${its_symlink_name}.its
478 ln -sf ${linux_bin_base_name}.bin ${linux_bin_symlink_name}.bin
George McCollister185c8ae2016-05-26 08:55:16 -0500479
480 if [ -n "${INITRAMFS_IMAGE}" ]; then
481 ln -sf ${its_initramfs_base_name}.its ${its_initramfs_symlink_name}.its
482 ln -sf ${fit_initramfs_base_name}.bin ${fit_initramfs_symlink_name}.bin
483 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500484 fi
485}