summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Freihofer <adrian.freihofer@siemens.com>2025-06-03 10:23:15 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-06-05 11:02:21 +0100
commit5ab2cd7747e7d27940ecbab33b2414be341b5da6 (patch)
tree22d34c1890a5896fe4c2e3653d29716e9045d9d3
parent62bd08a7833b41da92ee6ea55f37f6529808bd3b (diff)
downloadpoky-5ab2cd7747e7d27940ecbab33b2414be341b5da6.tar.gz
oe-selftest: fitimage: test FIT_CONF_PREFIX
Add a test which does not use the default FIT_CONF_PREFIX configuration. (From OE-Core rev: 12f20ddefe0393eea8d1c3534058596f3407b5f5) Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/fitimage.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py
index 31116979ef..812b34fab4 100644
--- a/meta/lib/oeqa/selftest/cases/fitimage.py
+++ b/meta/lib/oeqa/selftest/cases/fitimage.py
@@ -256,7 +256,7 @@ class FitImageTestCase(OESelftestTestCase):
256 self.logger.debug("sigs:\n%s\n" % pprint.pformat(sigs, indent=4)) 256 self.logger.debug("sigs:\n%s\n" % pprint.pformat(sigs, indent=4))
257 if req_sigvalues_config or req_sigvalues_image: 257 if req_sigvalues_config or req_sigvalues_image:
258 for its_path, values in sigs.items(): 258 for its_path, values in sigs.items():
259 if 'conf-' in its_path: 259 if bb_vars.get('FIT_CONF_PREFIX', "conf-") in its_path:
260 reqsigvalues = req_sigvalues_config 260 reqsigvalues = req_sigvalues_config
261 else: 261 else:
262 reqsigvalues = req_sigvalues_image 262 reqsigvalues = req_sigvalues_image
@@ -380,6 +380,7 @@ class KernelFitImageTests(FitImageTestCase):
380 """ 380 """
381 internal_used = { 381 internal_used = {
382 'DEPLOY_DIR_IMAGE', 382 'DEPLOY_DIR_IMAGE',
383 'FIT_CONF_PREFIX',
383 'FIT_DESC', 384 'FIT_DESC',
384 'FIT_HASH_ALG', 385 'FIT_HASH_ALG',
385 'FIT_KERNEL_COMP_ALG', 386 'FIT_KERNEL_COMP_ALG',
@@ -486,9 +487,9 @@ class KernelFitImageTests(FitImageTestCase):
486 487
487 # configuration nodes (one per DTB and also one per symlink) 488 # configuration nodes (one per DTB and also one per symlink)
488 if dtb_files: 489 if dtb_files:
489 configurations = [ 'conf-' + conf for conf in dtb_files + dtb_symlinks] 490 configurations = [bb_vars['FIT_CONF_PREFIX'] + conf for conf in dtb_files + dtb_symlinks]
490 else: 491 else:
491 configurations = [ 'conf-1' ] 492 configurations = [bb_vars['FIT_CONF_PREFIX'] + '1']
492 493
493 # Create a list of paths for all image and configuration nodes 494 # Create a list of paths for all image and configuration nodes
494 req_its_paths = [] 495 req_its_paths = []
@@ -526,7 +527,7 @@ class KernelFitImageTests(FitImageTestCase):
526 if uboot_rd_entrypoint: 527 if uboot_rd_entrypoint:
527 its_field_check.append("entry = <%s>;" % uboot_rd_entrypoint) 528 its_field_check.append("entry = <%s>;" % uboot_rd_entrypoint)
528 its_field_check += [ 529 its_field_check += [
529 # 'default = "conf-1";', needs more work 530 # 'default = bb_vars['FIT_CONF_PREFIX'] + "1";', needs more work
530 'kernel = "kernel-1";', 531 'kernel = "kernel-1";',
531 ] 532 ]
532 if initramfs_image and initramfs_image_bundle != "1": 533 if initramfs_image and initramfs_image_bundle != "1":
@@ -599,33 +600,35 @@ class KernelFitImageTests(FitImageTestCase):
599 # Create a configuration section for each DTB 600 # Create a configuration section for each DTB
600 if dtb_files: 601 if dtb_files:
601 for dtb in dtb_files + dtb_symlinks: 602 for dtb in dtb_files + dtb_symlinks:
603 conf_name = bb_vars['FIT_CONF_PREFIX'] + dtb
602 # Assume that DTBs with an "-alias" in its name are symlink DTBs created e.g. by the 604 # Assume that DTBs with an "-alias" in its name are symlink DTBs created e.g. by the
603 # bbb-dtbs-as-ext test recipe. Make the configuration node pointing to the real DTB. 605 # bbb-dtbs-as-ext test recipe. Make the configuration node pointing to the real DTB.
604 real_dtb = dtb.replace("-alias", "") 606 real_dtb = dtb.replace("-alias", "")
605 # dtb overlays do not refer to a kernel (yet?) 607 # dtb overlays do not refer to a kernel (yet?)
606 if dtb.endswith('.dtbo'): 608 if dtb.endswith('.dtbo'):
607 req_sections['conf-' + dtb] = { 609 req_sections[conf_name] = {
608 "FDT": 'fdt-' + real_dtb, 610 "FDT": 'fdt-' + real_dtb,
609 } 611 }
610 else: 612 else:
611 req_sections['conf-' + dtb] = { 613 req_sections[conf_name] = {
612 "Kernel": "kernel-1", 614 "Kernel": "kernel-1",
613 "FDT": 'fdt-' + real_dtb, 615 "FDT": 'fdt-' + real_dtb,
614 } 616 }
615 if initramfs_image and initramfs_image_bundle != "1": 617 if initramfs_image and initramfs_image_bundle != "1":
616 req_sections['conf-' + dtb]['Init Ramdisk'] = "ramdisk-1" 618 req_sections[conf_name]['Init Ramdisk'] = "ramdisk-1"
617 else: 619 else:
618 req_sections['conf-1'] = { 620 conf_name = bb_vars['FIT_CONF_PREFIX'] + '1'
621 req_sections[conf_name] = {
619 "Kernel": "kernel-1" 622 "Kernel": "kernel-1"
620 } 623 }
621 if initramfs_image and initramfs_image_bundle != "1": 624 if initramfs_image and initramfs_image_bundle != "1":
622 req_sections['conf-1']['Init Ramdisk'] = "ramdisk-1" 625 req_sections[conf_name]['Init Ramdisk'] = "ramdisk-1"
623 626
624 # Add signing related properties if needed 627 # Add signing related properties if needed
625 if uboot_sign_enable == "1": 628 if uboot_sign_enable == "1":
626 for section in req_sections: 629 for section in req_sections:
627 req_sections[section]['Hash algo'] = fit_hash_alg 630 req_sections[section]['Hash algo'] = fit_hash_alg
628 if section.startswith('conf-'): 631 if section.startswith(bb_vars['FIT_CONF_PREFIX']):
629 req_sections[section]['Hash value'] = "unavailable" 632 req_sections[section]['Hash value'] = "unavailable"
630 req_sections[section]['Sign algo'] = "%s,%s:%s" % (fit_hash_alg, fit_sign_alg, uboot_sign_keyname) 633 req_sections[section]['Sign algo'] = "%s,%s:%s" % (fit_hash_alg, fit_sign_alg, uboot_sign_keyname)
631 num_signatures += 1 634 num_signatures += 1
@@ -652,13 +655,13 @@ class KernelFitImageTests(FitImageTestCase):
652 fit_sign_alg_len = FitImageTestCase.MKIMAGE_SIGNATURE_LENGTHS[fit_sign_alg] 655 fit_sign_alg_len = FitImageTestCase.MKIMAGE_SIGNATURE_LENGTHS[fit_sign_alg]
653 for section, values in sections.items(): 656 for section, values in sections.items():
654 # Configuration nodes are always signed with UBOOT_SIGN_KEYNAME (if UBOOT_SIGN_ENABLE = "1") 657 # Configuration nodes are always signed with UBOOT_SIGN_KEYNAME (if UBOOT_SIGN_ENABLE = "1")
655 if section.startswith("conf"): 658 if section.startswith(bb_vars['FIT_CONF_PREFIX']):
656 sign_algo = values.get('Sign algo', None) 659 sign_algo = values.get('Sign algo', None)
657 req_sign_algo = "%s,%s:%s" % (fit_hash_alg, fit_sign_alg, uboot_sign_keyname) 660 req_sign_algo = "%s,%s:%s" % (fit_hash_alg, fit_sign_alg, uboot_sign_keyname)
658 self.assertEqual(sign_algo, req_sign_algo, 'Signature algorithm for %s not expected value' % section) 661 self.assertEqual(sign_algo, req_sign_algo, 'Signature algorithm for %s not expected value' % section)
659 sign_value = values.get('Sign value', None) 662 sign_value = values.get('Sign value', None)
660 self.assertEqual(len(sign_value), fit_sign_alg_len, 'Signature value for section %s not expected length' % section) 663 self.assertEqual(len(sign_value), fit_sign_alg_len, 'Signature value for section %s not expected length' % section)
661 dtb_file_name = section.replace('conf-', '') 664 dtb_file_name = section.replace(bb_vars['FIT_CONF_PREFIX'], '')
662 dtb_path = os.path.join(deploy_dir_image, dtb_file_name) 665 dtb_path = os.path.join(deploy_dir_image, dtb_file_name)
663 # External devicetrees created by devicetree.bbclass are in a subfolder and have priority 666 # External devicetrees created by devicetree.bbclass are in a subfolder and have priority
664 dtb_path_ext = os.path.join(deploy_dir_image, "devicetree", dtb_file_name) 667 dtb_path_ext = os.path.join(deploy_dir_image, "devicetree", dtb_file_name)
@@ -718,6 +721,7 @@ UBOOT_RD_ENTRYPOINT = "0x88000000"
718UBOOT_LOADADDRESS = "0x80080000" 721UBOOT_LOADADDRESS = "0x80080000"
719UBOOT_ENTRYPOINT = "0x80080000" 722UBOOT_ENTRYPOINT = "0x80080000"
720FIT_DESC = "A model description" 723FIT_DESC = "A model description"
724FIT_CONF_PREFIX = "foo-"
721""" 725"""
722 self.write_config(config) 726 self.write_config(config)
723 bb_vars = self._fit_get_bb_vars() 727 bb_vars = self._fit_get_bb_vars()