summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/fitimage.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/fitimage.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/fitimage.py365
1 files changed, 300 insertions, 65 deletions
diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py
index b39f2622df..be291e4b0f 100644
--- a/meta/lib/oeqa/selftest/cases/fitimage.py
+++ b/meta/lib/oeqa/selftest/cases/fitimage.py
@@ -4,13 +4,36 @@
4# SPDX-License-Identifier: MIT 4# SPDX-License-Identifier: MIT
5# 5#
6 6
7from oeqa.selftest.case import OESelftestTestCase
8from oeqa.utils.commands import runCmd, bitbake, get_bb_vars
9import os 7import os
10import re 8import re
11import shlex 9import shlex
12import logging 10import logging
13import pprint 11import pprint
12import tempfile
13
14import oe.fitimage
15
16from oeqa.selftest.case import OESelftestTestCase
17from oeqa.utils.commands import runCmd, bitbake, get_bb_vars, get_bb_var
18
19
20class BbVarsMockGenKeys:
21 def __init__(self, keydir, gen_keys="0", sign_enabled="0", keyname="", sign_ind="0", img_keyname=""):
22 self.bb_vars = {
23 'FIT_GENERATE_KEYS': gen_keys,
24 'FIT_KEY_GENRSA_ARGS': "-F4",
25 'FIT_KEY_REQ_ARGS': "-batch -new",
26 'FIT_KEY_SIGN_PKCS': "-x509",
27 'FIT_SIGN_INDIVIDUAL': sign_ind,
28 'FIT_SIGN_NUMBITS': "2048",
29 'UBOOT_SIGN_ENABLE': sign_enabled,
30 'UBOOT_SIGN_IMG_KEYNAME': img_keyname,
31 'UBOOT_SIGN_KEYDIR': keydir,
32 'UBOOT_SIGN_KEYNAME': keyname,
33 }
34
35 def getVar(self, var):
36 return self.bb_vars[var]
14 37
15class FitImageTestCase(OESelftestTestCase): 38class FitImageTestCase(OESelftestTestCase):
16 """Test functions usable for testing kernel-fitimage.bbclass and uboot-sign.bbclass 39 """Test functions usable for testing kernel-fitimage.bbclass and uboot-sign.bbclass
@@ -161,10 +184,23 @@ class FitImageTestCase(OESelftestTestCase):
161 184
162 @staticmethod 185 @staticmethod
163 def _get_dtb_files(bb_vars): 186 def _get_dtb_files(bb_vars):
187 """Return a list of devicetree names
188
189 The list should be used to check the dtb and conf nodes in the FIT image or its file.
190 In addition to the entries from KERNEL_DEVICETREE, the external devicetree and the
191 external devicetree overlay added by the test recipe bbb-dtbs-as-ext are handled as well.
192 """
164 kernel_devicetree = bb_vars.get('KERNEL_DEVICETREE') 193 kernel_devicetree = bb_vars.get('KERNEL_DEVICETREE')
194 all_dtbs = []
195 dtb_symlinks = []
165 if kernel_devicetree: 196 if kernel_devicetree:
166 return [os.path.basename(dtb) for dtb in kernel_devicetree.split()] 197 all_dtbs += [os.path.basename(dtb) for dtb in kernel_devicetree.split()]
167 return [] 198 # Support only the test recipe which provides 1 devicetree and 1 devicetree overlay
199 pref_prov_dtb = bb_vars.get('PREFERRED_PROVIDER_virtual/dtb')
200 if pref_prov_dtb == "bbb-dtbs-as-ext":
201 all_dtbs += ["am335x-bonegreen-ext.dtb", "BBORG_RELAY-00A2.dtbo"]
202 dtb_symlinks.append("am335x-bonegreen-ext-alias.dtb")
203 return (all_dtbs, dtb_symlinks)
168 204
169 def _is_req_dict_in_dict(self, found_dict, req_dict): 205 def _is_req_dict_in_dict(self, found_dict, req_dict):
170 """ 206 """
@@ -243,7 +279,7 @@ class FitImageTestCase(OESelftestTestCase):
243 self.logger.debug("sigs:\n%s\n" % pprint.pformat(sigs, indent=4)) 279 self.logger.debug("sigs:\n%s\n" % pprint.pformat(sigs, indent=4))
244 if req_sigvalues_config or req_sigvalues_image: 280 if req_sigvalues_config or req_sigvalues_image:
245 for its_path, values in sigs.items(): 281 for its_path, values in sigs.items():
246 if 'conf-' in its_path: 282 if bb_vars.get('FIT_CONF_PREFIX', "conf-") in its_path:
247 reqsigvalues = req_sigvalues_config 283 reqsigvalues = req_sigvalues_config
248 else: 284 else:
249 reqsigvalues = req_sigvalues_image 285 reqsigvalues = req_sigvalues_image
@@ -356,9 +392,8 @@ class FitImageTestCase(OESelftestTestCase):
356 # Verify the FIT image 392 # Verify the FIT image
357 self._check_fitimage(bb_vars, fitimage_path, uboot_tools_bindir) 393 self._check_fitimage(bb_vars, fitimage_path, uboot_tools_bindir)
358 394
359 395class KernelFitImageBase(FitImageTestCase):
360class KernelFitImageTests(FitImageTestCase): 396 """Test cases for the linux-yocto-fitimage recipe"""
361 """Test cases for the kernel-fitimage bbclass"""
362 397
363 def _fit_get_bb_vars(self, additional_vars=[]): 398 def _fit_get_bb_vars(self, additional_vars=[]):
364 """Retrieve BitBake variables specific to the test case. 399 """Retrieve BitBake variables specific to the test case.
@@ -367,6 +402,8 @@ class KernelFitImageTests(FitImageTestCase):
367 """ 402 """
368 internal_used = { 403 internal_used = {
369 'DEPLOY_DIR_IMAGE', 404 'DEPLOY_DIR_IMAGE',
405 'FIT_CONF_DEFAULT_DTB',
406 'FIT_CONF_PREFIX',
370 'FIT_DESC', 407 'FIT_DESC',
371 'FIT_HASH_ALG', 408 'FIT_HASH_ALG',
372 'FIT_KERNEL_COMP_ALG', 409 'FIT_KERNEL_COMP_ALG',
@@ -376,9 +413,11 @@ class KernelFitImageTests(FitImageTestCase):
376 'INITRAMFS_IMAGE_BUNDLE', 413 'INITRAMFS_IMAGE_BUNDLE',
377 'INITRAMFS_IMAGE_NAME', 414 'INITRAMFS_IMAGE_NAME',
378 'INITRAMFS_IMAGE', 415 'INITRAMFS_IMAGE',
416 'KERNEL_DEPLOYSUBDIR',
379 'KERNEL_DEVICETREE', 417 'KERNEL_DEVICETREE',
380 'KERNEL_FIT_LINK_NAME', 418 'KERNEL_FIT_LINK_NAME',
381 'MACHINE', 419 'MACHINE',
420 'PREFERRED_PROVIDER_virtual/dtb',
382 'UBOOT_ARCH', 421 'UBOOT_ARCH',
383 'UBOOT_ENTRYPOINT', 422 'UBOOT_ENTRYPOINT',
384 'UBOOT_LOADADDRESS', 423 'UBOOT_LOADADDRESS',
@@ -391,10 +430,19 @@ class KernelFitImageTests(FitImageTestCase):
391 'UBOOT_SIGN_KEYDIR', 430 'UBOOT_SIGN_KEYDIR',
392 'UBOOT_SIGN_KEYNAME', 431 'UBOOT_SIGN_KEYNAME',
393 } 432 }
394 bb_vars = get_bb_vars(list(internal_used | set(additional_vars)), "virtual/kernel") 433 bb_vars = get_bb_vars(list(internal_used | set(additional_vars)), self.kernel_recipe)
395 self.logger.debug("bb_vars: %s" % pprint.pformat(bb_vars, indent=4)) 434 self.logger.debug("bb_vars: %s" % pprint.pformat(bb_vars, indent=4))
396 return bb_vars 435 return bb_vars
397 436
437 def _config_add_kernel_classes(self, config):
438 config += '# Use kernel-fit-extra-artifacts.bbclass for the creation of the vmlinux artifact' + os.linesep
439 config += 'KERNEL_CLASSES = "kernel-fit-extra-artifacts"' + os.linesep
440 return config
441
442 @property
443 def kernel_recipe(self):
444 return "linux-yocto-fitimage"
445
398 def _config_add_uboot_env(self, config): 446 def _config_add_uboot_env(self, config):
399 """Generate an u-boot environment 447 """Generate an u-boot environment
400 448
@@ -408,7 +456,7 @@ class KernelFitImageTests(FitImageTestCase):
408 config += '# Add an u-boot script to the fitImage' + os.linesep 456 config += '# Add an u-boot script to the fitImage' + os.linesep
409 config += 'FIT_UBOOT_ENV = "%s"' % fit_uenv_file + os.linesep 457 config += 'FIT_UBOOT_ENV = "%s"' % fit_uenv_file + os.linesep
410 config += 'FILESEXTRAPATHS:prepend := "${TOPDIR}/%s:"' % test_files_dir + os.linesep 458 config += 'FILESEXTRAPATHS:prepend := "${TOPDIR}/%s:"' % test_files_dir + os.linesep
411 config += 'SRC_URI:append:pn-linux-yocto = " file://${FIT_UBOOT_ENV}"' + os.linesep 459 config += 'SRC_URI:append:pn-%s = " file://${FIT_UBOOT_ENV}"' % self.kernel_recipe + os.linesep
412 460
413 if not os.path.isdir(test_files_dir): 461 if not os.path.isdir(test_files_dir):
414 os.makedirs(test_files_dir) 462 os.makedirs(test_files_dir)
@@ -420,7 +468,7 @@ class KernelFitImageTests(FitImageTestCase):
420 468
421 def _bitbake_fit_image(self, bb_vars): 469 def _bitbake_fit_image(self, bb_vars):
422 """Bitbake the kernel and return the paths to the its file and the FIT image""" 470 """Bitbake the kernel and return the paths to the its file and the FIT image"""
423 bitbake("virtual/kernel") 471 bitbake(self.kernel_recipe)
424 472
425 # Find the right its file and the final fitImage and check if both files are available 473 # Find the right its file and the final fitImage and check if both files are available
426 deploy_dir_image = bb_vars['DEPLOY_DIR_IMAGE'] 474 deploy_dir_image = bb_vars['DEPLOY_DIR_IMAGE']
@@ -439,8 +487,13 @@ class KernelFitImageTests(FitImageTestCase):
439 fitimage_name = "fitImage" # or fitImage-${KERNEL_IMAGE_LINK_NAME}${KERNEL_IMAGE_BIN_EXT} 487 fitimage_name = "fitImage" # or fitImage-${KERNEL_IMAGE_LINK_NAME}${KERNEL_IMAGE_BIN_EXT}
440 else: 488 else:
441 self.fail('Invalid configuration: INITRAMFS_IMAGE_BUNDLE = "1" and not INITRAMFS_IMAGE') 489 self.fail('Invalid configuration: INITRAMFS_IMAGE_BUNDLE = "1" and not INITRAMFS_IMAGE')
442 fitimage_its_path = os.path.realpath(os.path.join(deploy_dir_image, fitimage_its_name)) 490 kernel_deploysubdir = bb_vars['KERNEL_DEPLOYSUBDIR']
443 fitimage_path = os.path.realpath(os.path.join(deploy_dir_image, fitimage_name)) 491 if kernel_deploysubdir:
492 fitimage_its_path = os.path.realpath(os.path.join(deploy_dir_image, kernel_deploysubdir, fitimage_its_name))
493 fitimage_path = os.path.realpath(os.path.join(deploy_dir_image, kernel_deploysubdir, fitimage_name))
494 else:
495 fitimage_its_path = os.path.realpath(os.path.join(deploy_dir_image, fitimage_its_name))
496 fitimage_path = os.path.realpath(os.path.join(deploy_dir_image, fitimage_name))
444 return (fitimage_its_path, fitimage_path) 497 return (fitimage_its_path, fitimage_path)
445 498
446 def _get_req_its_paths(self, bb_vars): 499 def _get_req_its_paths(self, bb_vars):
@@ -452,7 +505,7 @@ class KernelFitImageTests(FitImageTestCase):
452 ['/', 'images', 'kernel-1', 'signature-1'], 505 ['/', 'images', 'kernel-1', 'signature-1'],
453 ] 506 ]
454 """ 507 """
455 dtb_files = FitImageTestCase._get_dtb_files(bb_vars) 508 dtb_files, dtb_symlinks = FitImageTestCase._get_dtb_files(bb_vars)
456 fit_sign_individual = bb_vars['FIT_SIGN_INDIVIDUAL'] 509 fit_sign_individual = bb_vars['FIT_SIGN_INDIVIDUAL']
457 fit_uboot_env = bb_vars['FIT_UBOOT_ENV'] 510 fit_uboot_env = bb_vars['FIT_UBOOT_ENV']
458 initramfs_image = bb_vars['INITRAMFS_IMAGE'] 511 initramfs_image = bb_vars['INITRAMFS_IMAGE']
@@ -470,11 +523,11 @@ class KernelFitImageTests(FitImageTestCase):
470 if initramfs_image and initramfs_image_bundle != "1": 523 if initramfs_image and initramfs_image_bundle != "1":
471 images.append('ramdisk-1') 524 images.append('ramdisk-1')
472 525
473 # configuration nodes 526 # configuration nodes (one per DTB and also one per symlink)
474 if dtb_files: 527 if dtb_files:
475 configurations = [ 'conf-' + conf for conf in dtb_files ] 528 configurations = [bb_vars['FIT_CONF_PREFIX'] + conf for conf in dtb_files + dtb_symlinks]
476 else: 529 else:
477 configurations = [ 'conf-1' ] 530 configurations = [bb_vars['FIT_CONF_PREFIX'] + '1']
478 531
479 # Create a list of paths for all image and configuration nodes 532 # Create a list of paths for all image and configuration nodes
480 req_its_paths = [] 533 req_its_paths = []
@@ -497,11 +550,11 @@ class KernelFitImageTests(FitImageTestCase):
497 its_field_check = [ 550 its_field_check = [
498 'description = "%s";' % bb_vars['FIT_DESC'], 551 'description = "%s";' % bb_vars['FIT_DESC'],
499 'description = "Linux kernel";', 552 'description = "Linux kernel";',
500 'data = /incbin/("linux.bin");',
501 'type = "' + str(bb_vars['UBOOT_MKIMAGE_KERNEL_TYPE']) + '";', 553 'type = "' + str(bb_vars['UBOOT_MKIMAGE_KERNEL_TYPE']) + '";',
554 # 'compression = "' + str(bb_vars['FIT_KERNEL_COMP_ALG']) + '";', defined based on files in TMPDIR, not ideal...
555 'data = /incbin/("linux.bin");',
502 'arch = "' + str(bb_vars['UBOOT_ARCH']) + '";', 556 'arch = "' + str(bb_vars['UBOOT_ARCH']) + '";',
503 'os = "linux";', 557 'os = "linux";',
504 # 'compression = "' + str(bb_vars['FIT_KERNEL_COMP_ALG']) + '";', defined based on files in TMPDIR, not ideal...
505 'load = <' + str(bb_vars['UBOOT_LOADADDRESS']) + '>;', 558 'load = <' + str(bb_vars['UBOOT_LOADADDRESS']) + '>;',
506 'entry = <' + str(bb_vars['UBOOT_ENTRYPOINT']) + '>;', 559 'entry = <' + str(bb_vars['UBOOT_ENTRYPOINT']) + '>;',
507 ] 560 ]
@@ -511,10 +564,14 @@ class KernelFitImageTests(FitImageTestCase):
511 its_field_check.append("load = <%s>;" % uboot_rd_loadaddress) 564 its_field_check.append("load = <%s>;" % uboot_rd_loadaddress)
512 if uboot_rd_entrypoint: 565 if uboot_rd_entrypoint:
513 its_field_check.append("entry = <%s>;" % uboot_rd_entrypoint) 566 its_field_check.append("entry = <%s>;" % uboot_rd_entrypoint)
514 its_field_check += [ 567
515 # 'default = "conf-1";', needs more work 568 fit_conf_default_dtb = bb_vars.get('FIT_CONF_DEFAULT_DTB')
516 'kernel = "kernel-1";', 569 if fit_conf_default_dtb:
517 ] 570 fit_conf_prefix = bb_vars.get('FIT_CONF_PREFIX', "conf-")
571 its_field_check.append('default = "' + fit_conf_prefix + fit_conf_default_dtb + '";')
572
573 its_field_check.append('kernel = "kernel-1";')
574
518 if initramfs_image and initramfs_image_bundle != "1": 575 if initramfs_image and initramfs_image_bundle != "1":
519 its_field_check.append('ramdisk = "ramdisk-1";') 576 its_field_check.append('ramdisk = "ramdisk-1";')
520 577
@@ -548,7 +605,7 @@ class KernelFitImageTests(FitImageTestCase):
548 605
549 def _get_req_sections(self, bb_vars): 606 def _get_req_sections(self, bb_vars):
550 """Generate a dictionary of expected sections in the output of dumpimage""" 607 """Generate a dictionary of expected sections in the output of dumpimage"""
551 dtb_files = FitImageTestCase._get_dtb_files(bb_vars) 608 dtb_files, dtb_symlinks = FitImageTestCase._get_dtb_files(bb_vars)
552 fit_hash_alg = bb_vars['FIT_HASH_ALG'] 609 fit_hash_alg = bb_vars['FIT_HASH_ALG']
553 fit_sign_alg = bb_vars['FIT_SIGN_ALG'] 610 fit_sign_alg = bb_vars['FIT_SIGN_ALG']
554 fit_sign_individual = bb_vars['FIT_SIGN_INDIVIDUAL'] 611 fit_sign_individual = bb_vars['FIT_SIGN_INDIVIDUAL']
@@ -584,25 +641,36 @@ class KernelFitImageTests(FitImageTestCase):
584 } 641 }
585 # Create a configuration section for each DTB 642 # Create a configuration section for each DTB
586 if dtb_files: 643 if dtb_files:
587 for dtb in dtb_files: 644 for dtb in dtb_files + dtb_symlinks:
588 req_sections['conf-' + dtb] = { 645 conf_name = bb_vars['FIT_CONF_PREFIX'] + dtb
589 "Kernel": "kernel-1", 646 # Assume that DTBs with an "-alias" in its name are symlink DTBs created e.g. by the
590 "FDT": 'fdt-' + dtb, 647 # bbb-dtbs-as-ext test recipe. Make the configuration node pointing to the real DTB.
591 } 648 real_dtb = dtb.replace("-alias", "")
649 # dtb overlays do not refer to a kernel (yet?)
650 if dtb.endswith('.dtbo'):
651 req_sections[conf_name] = {
652 "FDT": 'fdt-' + real_dtb,
653 }
654 else:
655 req_sections[conf_name] = {
656 "Kernel": "kernel-1",
657 "FDT": 'fdt-' + real_dtb,
658 }
592 if initramfs_image and initramfs_image_bundle != "1": 659 if initramfs_image and initramfs_image_bundle != "1":
593 req_sections['conf-' + dtb]['Init Ramdisk'] = "ramdisk-1" 660 req_sections[conf_name]['Init Ramdisk'] = "ramdisk-1"
594 else: 661 else:
595 req_sections['conf-1'] = { 662 conf_name = bb_vars['FIT_CONF_PREFIX'] + '1'
663 req_sections[conf_name] = {
596 "Kernel": "kernel-1" 664 "Kernel": "kernel-1"
597 } 665 }
598 if initramfs_image and initramfs_image_bundle != "1": 666 if initramfs_image and initramfs_image_bundle != "1":
599 req_sections['conf-1']['Init Ramdisk'] = "ramdisk-1" 667 req_sections[conf_name]['Init Ramdisk'] = "ramdisk-1"
600 668
601 # Add signing related properties if needed 669 # Add signing related properties if needed
602 if uboot_sign_enable == "1": 670 if uboot_sign_enable == "1":
603 for section in req_sections: 671 for section in req_sections:
604 req_sections[section]['Hash algo'] = fit_hash_alg 672 req_sections[section]['Hash algo'] = fit_hash_alg
605 if section.startswith('conf-'): 673 if section.startswith(bb_vars['FIT_CONF_PREFIX']):
606 req_sections[section]['Hash value'] = "unavailable" 674 req_sections[section]['Hash value'] = "unavailable"
607 req_sections[section]['Sign algo'] = "%s,%s:%s" % (fit_hash_alg, fit_sign_alg, uboot_sign_keyname) 675 req_sections[section]['Sign algo'] = "%s,%s:%s" % (fit_hash_alg, fit_sign_alg, uboot_sign_keyname)
608 num_signatures += 1 676 num_signatures += 1
@@ -624,18 +692,26 @@ class KernelFitImageTests(FitImageTestCase):
624 uboot_sign_keyname = bb_vars['UBOOT_SIGN_KEYNAME'] 692 uboot_sign_keyname = bb_vars['UBOOT_SIGN_KEYNAME']
625 uboot_sign_img_keyname = bb_vars['UBOOT_SIGN_IMG_KEYNAME'] 693 uboot_sign_img_keyname = bb_vars['UBOOT_SIGN_IMG_KEYNAME']
626 deploy_dir_image = bb_vars['DEPLOY_DIR_IMAGE'] 694 deploy_dir_image = bb_vars['DEPLOY_DIR_IMAGE']
695 kernel_deploysubdir = bb_vars['KERNEL_DEPLOYSUBDIR']
627 fit_sign_individual = bb_vars['FIT_SIGN_INDIVIDUAL'] 696 fit_sign_individual = bb_vars['FIT_SIGN_INDIVIDUAL']
628 fit_hash_alg_len = FitImageTestCase.MKIMAGE_HASH_LENGTHS[fit_hash_alg] 697 fit_hash_alg_len = FitImageTestCase.MKIMAGE_HASH_LENGTHS[fit_hash_alg]
629 fit_sign_alg_len = FitImageTestCase.MKIMAGE_SIGNATURE_LENGTHS[fit_sign_alg] 698 fit_sign_alg_len = FitImageTestCase.MKIMAGE_SIGNATURE_LENGTHS[fit_sign_alg]
630 for section, values in sections.items(): 699 for section, values in sections.items():
631 # Configuration nodes are always signed with UBOOT_SIGN_KEYNAME (if UBOOT_SIGN_ENABLE = "1") 700 # Configuration nodes are always signed with UBOOT_SIGN_KEYNAME (if UBOOT_SIGN_ENABLE = "1")
632 if section.startswith("conf"): 701 if section.startswith(bb_vars['FIT_CONF_PREFIX']):
633 sign_algo = values.get('Sign algo', None) 702 sign_algo = values.get('Sign algo', None)
634 req_sign_algo = "%s,%s:%s" % (fit_hash_alg, fit_sign_alg, uboot_sign_keyname) 703 req_sign_algo = "%s,%s:%s" % (fit_hash_alg, fit_sign_alg, uboot_sign_keyname)
635 self.assertEqual(sign_algo, req_sign_algo, 'Signature algorithm for %s not expected value' % section) 704 self.assertEqual(sign_algo, req_sign_algo, 'Signature algorithm for %s not expected value' % section)
636 sign_value = values.get('Sign value', None) 705 sign_value = values.get('Sign value', None)
637 self.assertEqual(len(sign_value), fit_sign_alg_len, 'Signature value for section %s not expected length' % section) 706 self.assertEqual(len(sign_value), fit_sign_alg_len, 'Signature value for section %s not expected length' % section)
638 dtb_path = os.path.join(deploy_dir_image, section.replace('conf-', '')) 707 dtb_file_name = section.replace(bb_vars['FIT_CONF_PREFIX'], '')
708 dtb_path = os.path.join(deploy_dir_image, dtb_file_name)
709 if kernel_deploysubdir:
710 dtb_path = os.path.join(deploy_dir_image, kernel_deploysubdir, dtb_file_name)
711 # External devicetrees created by devicetree.bbclass are in a subfolder and have priority
712 dtb_path_ext = os.path.join(deploy_dir_image, "devicetree", dtb_file_name)
713 if os.path.exists(dtb_path_ext):
714 dtb_path = dtb_path_ext
639 self._verify_fit_image_signature(uboot_tools_bindir, fitimage_path, dtb_path, section) 715 self._verify_fit_image_signature(uboot_tools_bindir, fitimage_path, dtb_path, section)
640 else: 716 else:
641 # Image nodes always need a hash which gets indirectly signed by the config signature 717 # Image nodes always need a hash which gets indirectly signed by the config signature
@@ -660,6 +736,8 @@ class KernelFitImageTests(FitImageTestCase):
660 self.assertEqual(found_comments, num_signatures, "Expected %d signed and commented (%s) sections in the fitImage." % 736 self.assertEqual(found_comments, num_signatures, "Expected %d signed and commented (%s) sections in the fitImage." %
661 (num_signatures, a_comment)) 737 (num_signatures, a_comment))
662 738
739class KernelFitImageRecipeTests(KernelFitImageBase):
740 """Test cases for the kernel-fitimage bbclass"""
663 741
664 def test_fit_image(self): 742 def test_fit_image(self):
665 """ 743 """
@@ -675,10 +753,7 @@ class KernelFitImageTests(FitImageTestCase):
675 Author: Usama Arif <usama.arif@arm.com> 753 Author: Usama Arif <usama.arif@arm.com>
676 """ 754 """
677 config = """ 755 config = """
678# Enable creation of fitImage
679KERNEL_IMAGETYPE = "Image" 756KERNEL_IMAGETYPE = "Image"
680KERNEL_IMAGETYPES += " fitImage "
681KERNEL_CLASSES = " kernel-fitimage "
682 757
683# RAM disk variables including load address and entrypoint for kernel and RAM disk 758# RAM disk variables including load address and entrypoint for kernel and RAM disk
684IMAGE_FSTYPES += "cpio.gz" 759IMAGE_FSTYPES += "cpio.gz"
@@ -690,8 +765,76 @@ UBOOT_RD_ENTRYPOINT = "0x88000000"
690UBOOT_LOADADDRESS = "0x80080000" 765UBOOT_LOADADDRESS = "0x80080000"
691UBOOT_ENTRYPOINT = "0x80080000" 766UBOOT_ENTRYPOINT = "0x80080000"
692FIT_DESC = "A model description" 767FIT_DESC = "A model description"
768FIT_CONF_PREFIX = "foo-"
769"""
770 config = self._config_add_kernel_classes(config)
771 self.write_config(config)
772 bb_vars = self._fit_get_bb_vars()
773 self._test_fitimage(bb_vars)
774
775 def test_get_compatible_from_dtb(self):
776 """Test the oe.fitimage.get_compatible_from_dtb function
777
778 1. bitbake bbb-dtbs-as-ext
779 2. Check if symlink_points_below returns the path to the DTB
780 3. Check if the expected compatible string is found by get_compatible_from_dtb()
781 """
782 DTB_RECIPE = "bbb-dtbs-as-ext"
783 DTB_FILE = "am335x-bonegreen-ext.dtb"
784 DTB_SYMLINK = "am335x-bonegreen-ext-alias.dtb"
785 DTBO_FILE = "BBORG_RELAY-00A2.dtbo"
786 EXPECTED_COMP = ["ti,am335x-bone-green", "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"]
787
788 config = """
789DISTRO="poky"
790MACHINE = "beaglebone-yocto"
693""" 791"""
694 self.write_config(config) 792 self.write_config(config)
793
794 # Provide the fdtget command called by get_compatible_from_dtb
795 dtc_bindir = FitImageTestCase._setup_native('dtc-native')
796 fdtget_path = os.path.join(dtc_bindir, "fdtget")
797 self.assertExists(fdtget_path)
798
799 # bitbake an external DTB with a symlink to it and a DTB overlay
800 bitbake(DTB_RECIPE)
801 deploy_dir_image = get_bb_var("DEPLOY_DIR_IMAGE", DTB_RECIPE)
802 devicetree_dir = os.path.join(deploy_dir_image, "devicetree")
803 dtb_path = os.path.join(devicetree_dir, DTB_FILE)
804 dtb_alias_path = os.path.join(devicetree_dir, DTB_SYMLINK)
805 dtbo_file = os.path.join(devicetree_dir, DTBO_FILE)
806 self.assertExists(dtb_path)
807 self.assertExists(dtb_alias_path)
808 self.assertExists(dtbo_file)
809
810 # Test symlink_points_below
811 linked_dtb = oe.fitimage.symlink_points_below(dtb_alias_path, devicetree_dir)
812 self.assertEqual(linked_dtb, DTB_FILE)
813
814 # Check if get_compatible_from_dtb finds the expected compatible string in the DTBs
815 comp = oe.fitimage.get_compatible_from_dtb(dtb_path, fdtget_path)
816 self.assertEqual(comp, EXPECTED_COMP)
817 comp_alias = oe.fitimage.get_compatible_from_dtb(dtb_alias_path, fdtget_path)
818 self.assertEqual(comp_alias, EXPECTED_COMP)
819 # The alias is a symlink, therefore the compatible string is equal
820 self.assertEqual(comp_alias, comp)
821
822 def test_fit_image_ext_dtb_dtbo(self):
823 """
824 Summary: Check if FIT image and Image Tree Source (its) are created correctly.
825 Expected: 1) its and FIT image are built successfully
826 2) The its file contains also the external devicetree overlay
827 3) Dumping the FIT image indicates the devicetree overlay
828 """
829 config = """
830# Enable creation of fitImage
831MACHINE = "beaglebone-yocto"
832# Add a devicetree overlay which does not need kernel sources
833PREFERRED_PROVIDER_virtual/dtb = "bbb-dtbs-as-ext"
834"""
835 config = self._config_add_kernel_classes(config)
836 config = self._config_add_uboot_env(config)
837 self.write_config(config)
695 bb_vars = self._fit_get_bb_vars() 838 bb_vars = self._fit_get_bb_vars()
696 self._test_fitimage(bb_vars) 839 self._test_fitimage(bb_vars)
697 840
@@ -702,8 +845,7 @@ FIT_DESC = "A model description"
702 and the configuration nodes are signed correctly. 845 and the configuration nodes are signed correctly.
703 Expected: 1) its and FIT image are built successfully 846 Expected: 1) its and FIT image are built successfully
704 2) Scanning the its file indicates signing is enabled 847 2) Scanning the its file indicates signing is enabled
705 as requested by UBOOT_SIGN_ENABLE (using 1 key 848 as requested by UBOOT_SIGN_ENABLE
706 generated by the test not via FIT_GENERATE_KEYS)
707 3) Dumping the FIT image indicates signature values 849 3) Dumping the FIT image indicates signature values
708 are present (only for the configuration nodes as 850 are present (only for the configuration nodes as
709 FIT_SIGN_INDIVIDUAL is disabled) 851 FIT_SIGN_INDIVIDUAL is disabled)
@@ -714,13 +856,13 @@ FIT_DESC = "A model description"
714 config = """ 856 config = """
715# Enable creation of fitImage 857# Enable creation of fitImage
716MACHINE = "beaglebone-yocto" 858MACHINE = "beaglebone-yocto"
717KERNEL_IMAGETYPES += " fitImage "
718KERNEL_CLASSES = " kernel-fitimage "
719UBOOT_SIGN_ENABLE = "1" 859UBOOT_SIGN_ENABLE = "1"
720UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys" 860UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys"
721UBOOT_SIGN_KEYNAME = "dev" 861UBOOT_SIGN_KEYNAME = "dev"
722UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart comment'" 862UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart comment'"
863FIT_CONF_DEFAULT_DTB = "am335x-bonegreen.dtb"
723""" 864"""
865 config = self._config_add_kernel_classes(config)
724 config = self._config_add_uboot_env(config) 866 config = self._config_add_uboot_env(config)
725 self.write_config(config) 867 self.write_config(config)
726 868
@@ -733,10 +875,7 @@ UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart comment'"
733 'UBOOT_SIGN_KEYDIR', 875 'UBOOT_SIGN_KEYDIR',
734 ]) 876 ])
735 877
736 # Do not use the random keys generated by FIT_GENERATE_KEYS.
737 # Using a static key is probably a more realistic scenario.
738 self._gen_signing_key(bb_vars) 878 self._gen_signing_key(bb_vars)
739
740 self._test_fitimage(bb_vars) 879 self._test_fitimage(bb_vars)
741 880
742 def test_sign_fit_image_individual(self): 881 def test_sign_fit_image_individual(self):
@@ -745,11 +884,11 @@ UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart comment'"
745 and all nodes are signed correctly. 884 and all nodes are signed correctly.
746 Expected: 1) its and FIT image are built successfully 885 Expected: 1) its and FIT image are built successfully
747 2) Scanning the its file indicates signing is enabled 886 2) Scanning the its file indicates signing is enabled
748 as requested by UBOOT_SIGN_ENABLE (using 2 keys 887 as requested by UBOOT_SIGN_ENABLE
749 generated via FIT_GENERATE_KEYS)
750 3) Dumping the FIT image indicates signature values 888 3) Dumping the FIT image indicates signature values
751 are present (including for images as enabled via 889 are present (including for images as enabled via
752 FIT_SIGN_INDIVIDUAL) 890 FIT_SIGN_INDIVIDUAL)
891 This also implies that FIT_GENERATE_KEYS = "1" works.
753 4) Verify the FIT image contains the comments passed via 892 4) Verify the FIT image contains the comments passed via
754 UBOOT_MKIMAGE_SIGN_ARGS once per image and per 893 UBOOT_MKIMAGE_SIGN_ARGS once per image and per
755 configuration node. 894 configuration node.
@@ -765,8 +904,6 @@ UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart comment'"
765 config = """ 904 config = """
766# Enable creation of fitImage 905# Enable creation of fitImage
767MACHINE = "beaglebone-yocto" 906MACHINE = "beaglebone-yocto"
768KERNEL_IMAGETYPES += " fitImage "
769KERNEL_CLASSES = " kernel-fitimage "
770UBOOT_SIGN_ENABLE = "1" 907UBOOT_SIGN_ENABLE = "1"
771FIT_GENERATE_KEYS = "1" 908FIT_GENERATE_KEYS = "1"
772UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys" 909UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys"
@@ -775,9 +912,14 @@ UBOOT_SIGN_KEYNAME = "cfg-oe-selftest"
775FIT_SIGN_INDIVIDUAL = "1" 912FIT_SIGN_INDIVIDUAL = "1"
776UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart comment'" 913UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart comment'"
777""" 914"""
915 config = self._config_add_kernel_classes(config)
778 config = self._config_add_uboot_env(config) 916 config = self._config_add_uboot_env(config)
779 self.write_config(config) 917 self.write_config(config)
780 bb_vars = self._fit_get_bb_vars() 918 bb_vars = self._fit_get_bb_vars()
919
920 # Ensure new keys are generated and FIT_GENERATE_KEYS = "1" is tested
921 bitbake("kernel-signing-keys-native -c cleansstate")
922
781 self._test_fitimage(bb_vars) 923 self._test_fitimage(bb_vars)
782 924
783 def test_fit_image_sign_initramfs(self): 925 def test_fit_image_sign_initramfs(self):
@@ -801,8 +943,6 @@ MACHINE = "beaglebone-yocto"
801INITRAMFS_IMAGE = "core-image-minimal-initramfs" 943INITRAMFS_IMAGE = "core-image-minimal-initramfs"
802INITRAMFS_SCRIPTS = "" 944INITRAMFS_SCRIPTS = ""
803UBOOT_MACHINE = "am335x_evm_defconfig" 945UBOOT_MACHINE = "am335x_evm_defconfig"
804KERNEL_CLASSES = " kernel-fitimage "
805KERNEL_IMAGETYPES = "fitImage"
806UBOOT_SIGN_ENABLE = "1" 946UBOOT_SIGN_ENABLE = "1"
807UBOOT_SIGN_KEYNAME = "beaglebonekey" 947UBOOT_SIGN_KEYNAME = "beaglebonekey"
808UBOOT_SIGN_KEYDIR ?= "${DEPLOY_DIR_IMAGE}" 948UBOOT_SIGN_KEYDIR ?= "${DEPLOY_DIR_IMAGE}"
@@ -816,11 +956,11 @@ UBOOT_ARCH = "arm"
816UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000" 956UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
817UBOOT_MKIMAGE_KERNEL_TYPE = "kernel" 957UBOOT_MKIMAGE_KERNEL_TYPE = "kernel"
818UBOOT_EXTLINUX = "0" 958UBOOT_EXTLINUX = "0"
819FIT_GENERATE_KEYS = "1"
820KERNEL_IMAGETYPE_REPLACEMENT = "zImage" 959KERNEL_IMAGETYPE_REPLACEMENT = "zImage"
821FIT_KERNEL_COMP_ALG = "none" 960FIT_KERNEL_COMP_ALG = "none"
822FIT_HASH_ALG = "sha256" 961FIT_HASH_ALG = "sha256"
823""" 962"""
963 config = self._config_add_kernel_classes(config)
824 config = self._config_add_uboot_env(config) 964 config = self._config_add_uboot_env(config)
825 self.write_config(config) 965 self.write_config(config)
826 966
@@ -833,10 +973,7 @@ FIT_HASH_ALG = "sha256"
833 'UBOOT_SIGN_KEYDIR', 973 'UBOOT_SIGN_KEYDIR',
834 ]) 974 ])
835 975
836 # Do not use the random keys generated by FIT_GENERATE_KEYS.
837 # Using a static key is probably a more realistic scenario.
838 self._gen_signing_key(bb_vars) 976 self._gen_signing_key(bb_vars)
839
840 self._test_fitimage(bb_vars) 977 self._test_fitimage(bb_vars)
841 978
842 def test_fit_image_sign_initramfs_bundle(self): 979 def test_fit_image_sign_initramfs_bundle(self):
@@ -861,8 +998,6 @@ INITRAMFS_IMAGE_BUNDLE = "1"
861INITRAMFS_IMAGE = "core-image-minimal-initramfs" 998INITRAMFS_IMAGE = "core-image-minimal-initramfs"
862INITRAMFS_SCRIPTS = "" 999INITRAMFS_SCRIPTS = ""
863UBOOT_MACHINE = "am335x_evm_defconfig" 1000UBOOT_MACHINE = "am335x_evm_defconfig"
864KERNEL_CLASSES = " kernel-fitimage "
865KERNEL_IMAGETYPES = "fitImage"
866UBOOT_SIGN_ENABLE = "1" 1001UBOOT_SIGN_ENABLE = "1"
867UBOOT_SIGN_KEYNAME = "beaglebonekey" 1002UBOOT_SIGN_KEYNAME = "beaglebonekey"
868UBOOT_SIGN_KEYDIR ?= "${DEPLOY_DIR_IMAGE}" 1003UBOOT_SIGN_KEYDIR ?= "${DEPLOY_DIR_IMAGE}"
@@ -874,20 +1009,124 @@ UBOOT_ARCH = "arm"
874UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000" 1009UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb -p 2000"
875UBOOT_MKIMAGE_KERNEL_TYPE = "kernel" 1010UBOOT_MKIMAGE_KERNEL_TYPE = "kernel"
876UBOOT_EXTLINUX = "0" 1011UBOOT_EXTLINUX = "0"
877FIT_GENERATE_KEYS = "1"
878KERNEL_IMAGETYPE_REPLACEMENT = "zImage" 1012KERNEL_IMAGETYPE_REPLACEMENT = "zImage"
879FIT_KERNEL_COMP_ALG = "none" 1013FIT_KERNEL_COMP_ALG = "none"
880FIT_HASH_ALG = "sha256" 1014FIT_HASH_ALG = "sha256"
881""" 1015"""
1016 config = self._config_add_kernel_classes(config)
882 config = self._config_add_uboot_env(config) 1017 config = self._config_add_uboot_env(config)
883 self.write_config(config) 1018 self.write_config(config)
884 bb_vars = self._fit_get_bb_vars() 1019 bb_vars = self._fit_get_bb_vars()
1020 self._gen_signing_key(bb_vars)
885 self._test_fitimage(bb_vars) 1021 self._test_fitimage(bb_vars)
886 1022
1023class FitImagePyTests(KernelFitImageBase):
1024 """Test cases for the fitimage.py module without calling bitbake"""
1025
1026 def _test_fitimage_py(self, bb_vars_overrides=None):
1027 topdir = os.path.join(os.environ['BUILDDIR'])
1028 fitimage_its_path = os.path.join(topdir, self._testMethodName + '.its')
1029
1030 # Provide variables without calling bitbake
1031 bb_vars = {
1032 # image-fitimage.conf
1033 'FIT_DESC': "Kernel fitImage for a dummy distro",
1034 'FIT_HASH_ALG': "sha256",
1035 'FIT_SIGN_ALG': "rsa2048",
1036 'FIT_PAD_ALG': "pkcs-1.5",
1037 'FIT_GENERATE_KEYS': "0",
1038 'FIT_SIGN_NUMBITS': "2048",
1039 'FIT_KEY_GENRSA_ARGS': "-F4",
1040 'FIT_KEY_REQ_ARGS': "-batch -new",
1041 'FIT_KEY_SIGN_PKCS': "-x509",
1042 'FIT_SIGN_INDIVIDUAL': "0",
1043 'FIT_CONF_PREFIX': "conf-",
1044 'FIT_SUPPORTED_INITRAMFS_FSTYPES': "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio",
1045 'FIT_CONF_DEFAULT_DTB': "",
1046 'FIT_ADDRESS_CELLS': "1",
1047 'FIT_UBOOT_ENV': "",
1048 # kernel.bbclass
1049 'UBOOT_ENTRYPOINT': "0x20008000",
1050 'UBOOT_LOADADDRESS': "0x20008000",
1051 'INITRAMFS_IMAGE': "",
1052 'INITRAMFS_IMAGE_BUNDLE': "",
1053 # kernel-uboot.bbclass
1054 'FIT_KERNEL_COMP_ALG': "gzip",
1055 'FIT_KERNEL_COMP_ALG_EXTENSION': ".gz",
1056 'UBOOT_MKIMAGE_KERNEL_TYPE': "kernel",
1057 # uboot-config.bbclass
1058 'UBOOT_MKIMAGE_DTCOPTS': "",
1059 'UBOOT_MKIMAGE': "uboot-mkimage",
1060 'UBOOT_MKIMAGE_SIGN': "uboot-mkimage",
1061 'UBOOT_MKIMAGE_SIGN_ARGS': "",
1062 'UBOOT_SIGN_ENABLE': "0",
1063 'UBOOT_SIGN_KEYDIR': None,
1064 'UBOOT_SIGN_KEYNAME': None,
1065 'UBOOT_SIGN_IMG_KEYNAME': None,
1066 # others
1067 'MACHINE': "qemux86-64",
1068 'UBOOT_ARCH': "x86",
1069 'HOST_PREFIX': "x86_64-poky-linux-"
1070 }
1071 if bb_vars_overrides:
1072 bb_vars.update(bb_vars_overrides)
1073
1074 root_node = oe.fitimage.ItsNodeRootKernel(
1075 bb_vars["FIT_DESC"], bb_vars["FIT_ADDRESS_CELLS"],
1076 bb_vars['HOST_PREFIX'], bb_vars['UBOOT_ARCH'], bb_vars["FIT_CONF_PREFIX"],
1077 oe.types.boolean(bb_vars['UBOOT_SIGN_ENABLE']), bb_vars["UBOOT_SIGN_KEYDIR"],
1078 bb_vars["UBOOT_MKIMAGE"], bb_vars["UBOOT_MKIMAGE_DTCOPTS"],
1079 bb_vars["UBOOT_MKIMAGE_SIGN"], bb_vars["UBOOT_MKIMAGE_SIGN_ARGS"],
1080 bb_vars['FIT_HASH_ALG'], bb_vars['FIT_SIGN_ALG'], bb_vars['FIT_PAD_ALG'],
1081 bb_vars['UBOOT_SIGN_KEYNAME'],
1082 oe.types.boolean(bb_vars['FIT_SIGN_INDIVIDUAL']), bb_vars['UBOOT_SIGN_IMG_KEYNAME']
1083 )
1084
1085 root_node.fitimage_emit_section_kernel("kernel-1", "linux.bin", "none",
1086 bb_vars.get('UBOOT_LOADADDRESS'), bb_vars.get('UBOOT_ENTRYPOINT'),
1087 bb_vars.get('UBOOT_MKIMAGE_KERNEL_TYPE'), bb_vars.get("UBOOT_ENTRYSYMBOL")
1088 )
1089
1090 dtb_files, _ = FitImageTestCase._get_dtb_files(bb_vars)
1091 for dtb in dtb_files:
1092 root_node.fitimage_emit_section_dtb(dtb, os.path.join("a-dir", dtb),
1093 bb_vars.get("UBOOT_DTB_LOADADDRESS"), bb_vars.get("UBOOT_DTBO_LOADADDRESS"))
1094
1095 if bb_vars.get('FIT_UBOOT_ENV'):
1096 root_node.fitimage_emit_section_boot_script(
1097 "bootscr-" + bb_vars['FIT_UBOOT_ENV'], bb_vars['FIT_UBOOT_ENV'])
1098
1099 if bb_vars['MACHINE'] == "qemux86-64": # Not really the right if
1100 root_node.fitimage_emit_section_setup("setup-1", "setup1.bin")
1101
1102 if bb_vars.get('INITRAMFS_IMAGE') and bb_vars.get("INITRAMFS_IMAGE_BUNDLE") != "1":
1103 root_node.fitimage_emit_section_ramdisk("ramdisk-1", "a-dir/a-initramfs-1",
1104 "core-image-minimal-initramfs",
1105 bb_vars.get("UBOOT_RD_LOADADDRESS"), bb_vars.get("UBOOT_RD_ENTRYPOINT"))
1106
1107 root_node.fitimage_emit_section_config(bb_vars['FIT_CONF_DEFAULT_DTB'])
1108 root_node.write_its_file(fitimage_its_path)
1109
1110 self.assertExists(fitimage_its_path, "%s image tree source doesn't exist" % (fitimage_its_path))
1111 self.logger.debug("Checking its: %s" % fitimage_its_path)
1112 self._check_its_file(bb_vars, fitimage_its_path)
1113
1114 def test_fitimage_py_default(self):
1115 self._test_fitimage_py()
1116
1117 def test_fitimage_py_default_dtb(self):
1118 bb_vars_overrides = {
1119 'KERNEL_DEVICETREE': "one.dtb two.dtb three.dtb",
1120 'FIT_CONF_DEFAULT_DTB': "two.dtb"
1121 }
1122 self._test_fitimage_py(bb_vars_overrides)
1123
887 1124
888class UBootFitImageTests(FitImageTestCase): 1125class UBootFitImageTests(FitImageTestCase):
889 """Test cases for the uboot-sign bbclass""" 1126 """Test cases for the uboot-sign bbclass"""
890 1127
1128 BOOTLOADER_RECIPE = "virtual/bootloader"
1129
891 def _fit_get_bb_vars(self, additional_vars=[]): 1130 def _fit_get_bb_vars(self, additional_vars=[]):
892 """Get bb_vars as needed by _test_sign_fit_image 1131 """Get bb_vars as needed by _test_sign_fit_image
893 1132
@@ -929,13 +1168,13 @@ class UBootFitImageTests(FitImageTestCase):
929 'UBOOT_SIGN_KEYDIR', 1168 'UBOOT_SIGN_KEYDIR',
930 'UBOOT_SIGN_KEYNAME', 1169 'UBOOT_SIGN_KEYNAME',
931 } 1170 }
932 bb_vars = get_bb_vars(list(internal_used | set(additional_vars)), "virtual/bootloader") 1171 bb_vars = get_bb_vars(list(internal_used | set(additional_vars)), UBootFitImageTests.BOOTLOADER_RECIPE)
933 self.logger.debug("bb_vars: %s" % pprint.pformat(bb_vars, indent=4)) 1172 self.logger.debug("bb_vars: %s" % pprint.pformat(bb_vars, indent=4))
934 return bb_vars 1173 return bb_vars
935 1174
936 def _bitbake_fit_image(self, bb_vars): 1175 def _bitbake_fit_image(self, bb_vars):
937 """Bitbake the bootloader and return the paths to the its file and the FIT image""" 1176 """Bitbake the bootloader and return the paths to the its file and the FIT image"""
938 bitbake("virtual/bootloader") 1177 bitbake(UBootFitImageTests.BOOTLOADER_RECIPE)
939 1178
940 deploy_dir_image = bb_vars['DEPLOY_DIR_IMAGE'] 1179 deploy_dir_image = bb_vars['DEPLOY_DIR_IMAGE']
941 machine = bb_vars['MACHINE'] 1180 machine = bb_vars['MACHINE']
@@ -1286,9 +1525,7 @@ UBOOT_SIGN_KEYNAME = "cfg-oe-selftest"
1286 self.write_config(config) 1525 self.write_config(config)
1287 bb_vars = self._fit_get_bb_vars() 1526 bb_vars = self._fit_get_bb_vars()
1288 1527
1289 # Using a static key. FIT_GENERATE_KEYS = "1" does not work without kernel-fitimage.bbclass
1290 self._gen_signing_key(bb_vars) 1528 self._gen_signing_key(bb_vars)
1291
1292 self._test_fitimage(bb_vars) 1529 self._test_fitimage(bb_vars)
1293 self._check_kernel_dtb(bb_vars) 1530 self._check_kernel_dtb(bb_vars)
1294 1531
@@ -1449,11 +1686,9 @@ FIT_SIGN_INDIVIDUAL = "1"
1449""" 1686"""
1450 self.write_config(config) 1687 self.write_config(config)
1451 bb_vars = self._fit_get_bb_vars() 1688 bb_vars = self._fit_get_bb_vars()
1452
1453 # Using a static key. FIT_GENERATE_KEYS = "1" does not work without kernel-fitimage.bbclass
1454 self._gen_signing_key(bb_vars) 1689 self._gen_signing_key(bb_vars)
1455 1690
1456 bitbake("virtual/bootloader") 1691 bitbake(UBootFitImageTests.BOOTLOADER_RECIPE)
1457 1692
1458 # Just check the DTB of u-boot since there is no u-boot FIT image 1693 # Just check the DTB of u-boot since there is no u-boot FIT image
1459 self._check_kernel_dtb(bb_vars) 1694 self._check_kernel_dtb(bb_vars)