diff options
| author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2025-03-10 10:35:46 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-03-11 11:20:34 +0000 |
| commit | c93f487dc4ff2e39ae6daca190d78ac1c3fa4b29 (patch) | |
| tree | 5086b5a15de9f3c9e7ec026f6fa97a9dfd30a425 | |
| parent | 66ba0ddcc4a0676cf1913113bc84f7aea9b16b12 (diff) | |
| download | poky-c93f487dc4ff2e39ae6daca190d78ac1c3fa4b29.tar.gz | |
oe-selftest: adapt u-boot tests to latest changes
For u-boot test cases (bitbake virtual/bootloader) inheriting the
kernel-fitimage.bbclass is no longer needed. Also setting any variable
which is evaluated by the kernel-fitimage.bbclass but not by
uboot-sign.bbclass is pointless since:
* Commit OE-Core rev: 5e12dc911d0c541f43aa6d0c046fb87e8b7c1f7e
changed the test case from
bitbake virtual/kernel
to
bitbake virtual/bootloader
* Commit OE-Core rev: 259bfa86f384206f0d0a96a5b84887186c5f689e has
finally removed the dependency of uboot-sign.bbclass on the
kernel-fitimage.bbclass completely.
Remove the related lines of code which are now without any effect.
The two test cases test_uboot_fit_image and test_uboot_sign_fit_image
do the exact same test. Both generate a binary equal its file:
/dts-v1/;
/ {
description = "A model description";
#address-cells = <1>;
images {
uboot {
description = "U-Boot image";
data = /incbin/("u-boot-nodtb.bin");
type = "standalone";
os = "u-boot";
arch = "arm";
compression = "none";
load = <0x80080000>;
entry = <0x80080000>;
};
fdt {
description = "U-Boot FDT";
data = /incbin/("u-boot.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
};
};
configurations {
default = "conf";
conf {
description = "Boot with signed U-Boot FIT";
loadables = "uboot";
fdt = "fdt";
};
};
};
The code diff between the two equal test cases looks like:
@@ -1,8 +1,9 @@
- def test_uboot_fit_image(self):
+ def test_uboot_sign_fit_image(self):
"""
Summary: Check if Uboot FIT image and Image Tree Source
(its) are built and the Image Tree Source has the
- correct fields.
+ correct fields, in the scenario where the Kernel
+ is also creating/signing it's fitImage.
Expected: 1. u-boot-fitImage and u-boot-its can be built
2. The type, load address, entrypoint address and
default values of U-boot image are correct in the
@@ -26,16 +27,15 @@
UBOOT_LOADADDRESS = "0x80080000"
UBOOT_ENTRYPOINT = "0x80080000"
UBOOT_FIT_DESC = "A model description"
-
-# Enable creation of Kernel fitImage
KERNEL_IMAGETYPES += " fitImage "
-KERNEL_CLASSES = " kernel-fitimage"
+KERNEL_CLASSES = " kernel-fitimage "
UBOOT_SIGN_ENABLE = "1"
FIT_GENERATE_KEYS = "1"
UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys"
UBOOT_SIGN_IMG_KEYNAME = "img-oe-selftest"
UBOOT_SIGN_KEYNAME = "cfg-oe-selftest"
FIT_SIGN_INDIVIDUAL = "1"
+UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart U-Boot comment'"
"""
self.write_config(config)
Conclusion: The test case test_uboot_sign_fit_image looks redundant.
Contrary to its name, it does not insert any signature nodes into the
its-file and therefore does not test any type of signature.
Code history:
- Commit OE-Core rev: e71e4c617568496ae3bd6bb678f97b4f73cb43d8
introduces both test cases.
- Commit OE-Core rev: 5e12dc911d0c541f43aa6d0c046fb87e8b7c1f7e
changes both test cases like this:
- bitbake("virtual/kernel")
+ bitbake("virtual/bootloader")
It looks like the original implementation of test_uboot_sign_fit_image
was supposed to test the interaction between the kernel-fitimage.bbclass
and uboot-sign.bbclass which does not longer work like that.
When compiling u-boot, the variable that is relevant for creating an its
file with signature nodes is: SPL_SIGN_ENABLE. This is what the test
case test_sign_standalone_uboot_fit_image verifies. Lets just delete the
now obsolete test_uboot_sign_fit_image test case.
(From OE-Core rev: de8bfdff0f997f59a2bd27842a2ffcd365f725f3)
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.py | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py index 5af9ea8afc..dd177e0b04 100644 --- a/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/meta/lib/oeqa/selftest/cases/fitimage.py | |||
| @@ -342,16 +342,6 @@ UBOOT_FITIMAGE_ENABLE = "1" | |||
| 342 | UBOOT_LOADADDRESS = "0x80080000" | 342 | UBOOT_LOADADDRESS = "0x80080000" |
| 343 | UBOOT_ENTRYPOINT = "0x80080000" | 343 | UBOOT_ENTRYPOINT = "0x80080000" |
| 344 | UBOOT_FIT_DESC = "A model description" | 344 | UBOOT_FIT_DESC = "A model description" |
| 345 | |||
| 346 | # Enable creation of Kernel fitImage | ||
| 347 | KERNEL_IMAGETYPES += " fitImage " | ||
| 348 | KERNEL_CLASSES = " kernel-fitimage" | ||
| 349 | UBOOT_SIGN_ENABLE = "1" | ||
| 350 | FIT_GENERATE_KEYS = "1" | ||
| 351 | UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys" | ||
| 352 | UBOOT_SIGN_IMG_KEYNAME = "img-oe-selftest" | ||
| 353 | UBOOT_SIGN_KEYNAME = "cfg-oe-selftest" | ||
| 354 | FIT_SIGN_INDIVIDUAL = "1" | ||
| 355 | """ | 345 | """ |
| 356 | self.write_config(config) | 346 | self.write_config(config) |
| 357 | 347 | ||
| @@ -396,89 +386,6 @@ FIT_SIGN_INDIVIDUAL = "1" | |||
| 396 | "Fields in Image Tree Source File %s did not match, error in finding %s" | 386 | "Fields in Image Tree Source File %s did not match, error in finding %s" |
| 397 | % (fitimage_its_path, its_field_check[field_index])) | 387 | % (fitimage_its_path, its_field_check[field_index])) |
| 398 | 388 | ||
| 399 | def test_uboot_sign_fit_image(self): | ||
| 400 | """ | ||
| 401 | Summary: Check if Uboot FIT image and Image Tree Source | ||
| 402 | (its) are built and the Image Tree Source has the | ||
| 403 | correct fields, in the scenario where the Kernel | ||
| 404 | is also creating/signing it's fitImage. | ||
| 405 | Expected: 1. u-boot-fitImage and u-boot-its can be built | ||
| 406 | 2. The type, load address, entrypoint address and | ||
| 407 | default values of U-boot image are correct in the | ||
| 408 | Image Tree Source. Not all the fields are tested, | ||
| 409 | only the key fields that wont vary between | ||
| 410 | different architectures. | ||
| 411 | Product: oe-core | ||
| 412 | Author: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com> | ||
| 413 | based on work by Usama Arif <usama.arif@arm.com> | ||
| 414 | """ | ||
| 415 | config = """ | ||
| 416 | # We need at least CONFIG_SPL_LOAD_FIT and CONFIG_SPL_OF_CONTROL set | ||
| 417 | MACHINE = "qemuarm" | ||
| 418 | UBOOT_MACHINE = "am57xx_evm_defconfig" | ||
| 419 | SPL_BINARY = "MLO" | ||
| 420 | |||
| 421 | # Enable creation of the U-Boot fitImage | ||
| 422 | UBOOT_FITIMAGE_ENABLE = "1" | ||
| 423 | |||
| 424 | # (U-boot) fitImage properties | ||
| 425 | UBOOT_LOADADDRESS = "0x80080000" | ||
| 426 | UBOOT_ENTRYPOINT = "0x80080000" | ||
| 427 | UBOOT_FIT_DESC = "A model description" | ||
| 428 | KERNEL_IMAGETYPES += " fitImage " | ||
| 429 | KERNEL_CLASSES = " kernel-fitimage " | ||
| 430 | UBOOT_SIGN_ENABLE = "1" | ||
| 431 | FIT_GENERATE_KEYS = "1" | ||
| 432 | UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys" | ||
| 433 | UBOOT_SIGN_IMG_KEYNAME = "img-oe-selftest" | ||
| 434 | UBOOT_SIGN_KEYNAME = "cfg-oe-selftest" | ||
| 435 | FIT_SIGN_INDIVIDUAL = "1" | ||
| 436 | UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart U-Boot comment'" | ||
| 437 | """ | ||
| 438 | self.write_config(config) | ||
| 439 | |||
| 440 | # The U-Boot fitImage is created as part of the U-Boot recipe | ||
| 441 | bitbake("virtual/bootloader") | ||
| 442 | |||
| 443 | deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') | ||
| 444 | machine = get_bb_var('MACHINE') | ||
| 445 | fitimage_its_path = os.path.join(deploy_dir_image, | ||
| 446 | "u-boot-its-%s" % (machine,)) | ||
| 447 | fitimage_path = os.path.join(deploy_dir_image, | ||
| 448 | "u-boot-fitImage-%s" % (machine,)) | ||
| 449 | |||
| 450 | self.assertExists(fitimage_its_path, "%s image tree source doesn't exist" % (fitimage_its_path)) | ||
| 451 | self.assertExists(fitimage_path, "%s FIT image doesn't exist" % (fitimage_path)) | ||
| 452 | |||
| 453 | # Check that the type, load address, entrypoint address and default | ||
| 454 | # values for kernel and ramdisk in Image Tree Source are as expected. | ||
| 455 | # The order of fields in the below array is important. Not all the | ||
| 456 | # fields are tested, only the key fields that wont vary between | ||
| 457 | # different architectures. | ||
| 458 | its_field_check = [ | ||
| 459 | 'description = "A model description";', | ||
| 460 | 'type = "standalone";', | ||
| 461 | 'load = <0x80080000>;', | ||
| 462 | 'entry = <0x80080000>;', | ||
| 463 | 'default = "conf";', | ||
| 464 | 'loadables = "uboot";', | ||
| 465 | 'fdt = "fdt";' | ||
| 466 | ] | ||
| 467 | |||
| 468 | with open(fitimage_its_path) as its_file: | ||
| 469 | field_index = 0 | ||
| 470 | for line in its_file: | ||
| 471 | if field_index == len(its_field_check): | ||
| 472 | break | ||
| 473 | if its_field_check[field_index] in line: | ||
| 474 | field_index +=1 | ||
| 475 | |||
| 476 | if field_index != len(its_field_check): # if its equal, the test passed | ||
| 477 | self.assertTrue(field_index == len(its_field_check), | ||
| 478 | "Fields in Image Tree Source File %s did not match, error in finding %s" | ||
| 479 | % (fitimage_its_path, its_field_check[field_index])) | ||
| 480 | |||
| 481 | |||
| 482 | def test_sign_standalone_uboot_fit_image(self): | 389 | def test_sign_standalone_uboot_fit_image(self): |
| 483 | """ | 390 | """ |
| 484 | Summary: Check if U-Boot FIT image and Image Tree Source (its) are | 391 | Summary: Check if U-Boot FIT image and Image Tree Source (its) are |
| @@ -505,9 +412,6 @@ UBOOT_MKIMAGE_SIGN_ARGS = "-c 'a smart U-Boot comment'" | |||
| 505 | MACHINE = "qemuarm" | 412 | MACHINE = "qemuarm" |
| 506 | UBOOT_MACHINE = "am57xx_evm_defconfig" | 413 | UBOOT_MACHINE = "am57xx_evm_defconfig" |
| 507 | SPL_BINARY = "MLO" | 414 | SPL_BINARY = "MLO" |
| 508 | # The kernel-fitimage class is a dependency even if we're only | ||
| 509 | # creating/signing the U-Boot fitImage | ||
| 510 | KERNEL_CLASSES = " kernel-fitimage" | ||
| 511 | # Enable creation and signing of the U-Boot fitImage | 415 | # Enable creation and signing of the U-Boot fitImage |
| 512 | UBOOT_FITIMAGE_ENABLE = "1" | 416 | UBOOT_FITIMAGE_ENABLE = "1" |
| 513 | SPL_SIGN_ENABLE = "1" | 417 | SPL_SIGN_ENABLE = "1" |
| @@ -663,8 +567,6 @@ SPL_MKIMAGE_SIGN_ARGS = "-c 'a smart cascaded U-Boot comment'" | |||
| 663 | UBOOT_EXTLINUX = "0" | 567 | UBOOT_EXTLINUX = "0" |
| 664 | UBOOT_FIT_GENERATE_KEYS = "1" | 568 | UBOOT_FIT_GENERATE_KEYS = "1" |
| 665 | UBOOT_FIT_HASH_ALG = "sha256" | 569 | UBOOT_FIT_HASH_ALG = "sha256" |
| 666 | KERNEL_IMAGETYPES += " fitImage " | ||
| 667 | KERNEL_CLASSES = " kernel-fitimage " | ||
| 668 | UBOOT_SIGN_ENABLE = "1" | 570 | UBOOT_SIGN_ENABLE = "1" |
| 669 | FIT_GENERATE_KEYS = "1" | 571 | FIT_GENERATE_KEYS = "1" |
| 670 | UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys" | 572 | UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys" |
| @@ -1030,9 +932,6 @@ UBOOT_FIT_ARM_TRUSTED_FIRMWARE_ENTRYPOINT = "0x80280000" | |||
| 1030 | MACHINE = "qemuarm" | 932 | MACHINE = "qemuarm" |
| 1031 | UBOOT_MACHINE = "am57xx_evm_defconfig" | 933 | UBOOT_MACHINE = "am57xx_evm_defconfig" |
| 1032 | SPL_BINARY = "MLO" | 934 | SPL_BINARY = "MLO" |
| 1033 | # The kernel-fitimage class is a dependency even if we're only | ||
| 1034 | # creating/signing the U-Boot fitImage | ||
| 1035 | KERNEL_CLASSES = " kernel-fitimage" | ||
| 1036 | # Enable creation and signing of the U-Boot fitImage | 935 | # Enable creation and signing of the U-Boot fitImage |
| 1037 | UBOOT_FITIMAGE_ENABLE = "1" | 936 | UBOOT_FITIMAGE_ENABLE = "1" |
| 1038 | SPL_SIGN_ENABLE = "1" | 937 | SPL_SIGN_ENABLE = "1" |
