mirror of
https://git.yoctoproject.org/poky
synced 2026-04-04 23:02:22 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
66ba0ddcc4
commit
c93f487dc4
@@ -342,16 +342,6 @@ UBOOT_FITIMAGE_ENABLE = "1"
|
||||
UBOOT_LOADADDRESS = "0x80080000"
|
||||
UBOOT_ENTRYPOINT = "0x80080000"
|
||||
UBOOT_FIT_DESC = "A model description"
|
||||
|
||||
# Enable creation of Kernel fitImage
|
||||
KERNEL_IMAGETYPES += " 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"
|
||||
"""
|
||||
self.write_config(config)
|
||||
|
||||
@@ -396,89 +386,6 @@ FIT_SIGN_INDIVIDUAL = "1"
|
||||
"Fields in Image Tree Source File %s did not match, error in finding %s"
|
||||
% (fitimage_its_path, its_field_check[field_index]))
|
||||
|
||||
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, 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
|
||||
Image Tree Source. Not all the fields are tested,
|
||||
only the key fields that wont vary between
|
||||
different architectures.
|
||||
Product: oe-core
|
||||
Author: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
|
||||
based on work by Usama Arif <usama.arif@arm.com>
|
||||
"""
|
||||
config = """
|
||||
# We need at least CONFIG_SPL_LOAD_FIT and CONFIG_SPL_OF_CONTROL set
|
||||
MACHINE = "qemuarm"
|
||||
UBOOT_MACHINE = "am57xx_evm_defconfig"
|
||||
SPL_BINARY = "MLO"
|
||||
|
||||
# Enable creation of the U-Boot fitImage
|
||||
UBOOT_FITIMAGE_ENABLE = "1"
|
||||
|
||||
# (U-boot) fitImage properties
|
||||
UBOOT_LOADADDRESS = "0x80080000"
|
||||
UBOOT_ENTRYPOINT = "0x80080000"
|
||||
UBOOT_FIT_DESC = "A model description"
|
||||
KERNEL_IMAGETYPES += " 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)
|
||||
|
||||
# The U-Boot fitImage is created as part of the U-Boot recipe
|
||||
bitbake("virtual/bootloader")
|
||||
|
||||
deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE')
|
||||
machine = get_bb_var('MACHINE')
|
||||
fitimage_its_path = os.path.join(deploy_dir_image,
|
||||
"u-boot-its-%s" % (machine,))
|
||||
fitimage_path = os.path.join(deploy_dir_image,
|
||||
"u-boot-fitImage-%s" % (machine,))
|
||||
|
||||
self.assertExists(fitimage_its_path, "%s image tree source doesn't exist" % (fitimage_its_path))
|
||||
self.assertExists(fitimage_path, "%s FIT image doesn't exist" % (fitimage_path))
|
||||
|
||||
# Check that the type, load address, entrypoint address and default
|
||||
# values for kernel and ramdisk in Image Tree Source are as expected.
|
||||
# The order of fields in the below array is important. Not all the
|
||||
# fields are tested, only the key fields that wont vary between
|
||||
# different architectures.
|
||||
its_field_check = [
|
||||
'description = "A model description";',
|
||||
'type = "standalone";',
|
||||
'load = <0x80080000>;',
|
||||
'entry = <0x80080000>;',
|
||||
'default = "conf";',
|
||||
'loadables = "uboot";',
|
||||
'fdt = "fdt";'
|
||||
]
|
||||
|
||||
with open(fitimage_its_path) as its_file:
|
||||
field_index = 0
|
||||
for line in its_file:
|
||||
if field_index == len(its_field_check):
|
||||
break
|
||||
if its_field_check[field_index] in line:
|
||||
field_index +=1
|
||||
|
||||
if field_index != len(its_field_check): # if its equal, the test passed
|
||||
self.assertTrue(field_index == len(its_field_check),
|
||||
"Fields in Image Tree Source File %s did not match, error in finding %s"
|
||||
% (fitimage_its_path, its_field_check[field_index]))
|
||||
|
||||
|
||||
def test_sign_standalone_uboot_fit_image(self):
|
||||
"""
|
||||
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'"
|
||||
MACHINE = "qemuarm"
|
||||
UBOOT_MACHINE = "am57xx_evm_defconfig"
|
||||
SPL_BINARY = "MLO"
|
||||
# The kernel-fitimage class is a dependency even if we're only
|
||||
# creating/signing the U-Boot fitImage
|
||||
KERNEL_CLASSES = " kernel-fitimage"
|
||||
# Enable creation and signing of the U-Boot fitImage
|
||||
UBOOT_FITIMAGE_ENABLE = "1"
|
||||
SPL_SIGN_ENABLE = "1"
|
||||
@@ -663,8 +567,6 @@ SPL_MKIMAGE_SIGN_ARGS = "-c 'a smart cascaded U-Boot comment'"
|
||||
UBOOT_EXTLINUX = "0"
|
||||
UBOOT_FIT_GENERATE_KEYS = "1"
|
||||
UBOOT_FIT_HASH_ALG = "sha256"
|
||||
KERNEL_IMAGETYPES += " fitImage "
|
||||
KERNEL_CLASSES = " kernel-fitimage "
|
||||
UBOOT_SIGN_ENABLE = "1"
|
||||
FIT_GENERATE_KEYS = "1"
|
||||
UBOOT_SIGN_KEYDIR = "${TOPDIR}/signing-keys"
|
||||
@@ -1030,9 +932,6 @@ UBOOT_FIT_ARM_TRUSTED_FIRMWARE_ENTRYPOINT = "0x80280000"
|
||||
MACHINE = "qemuarm"
|
||||
UBOOT_MACHINE = "am57xx_evm_defconfig"
|
||||
SPL_BINARY = "MLO"
|
||||
# The kernel-fitimage class is a dependency even if we're only
|
||||
# creating/signing the U-Boot fitImage
|
||||
KERNEL_CLASSES = " kernel-fitimage"
|
||||
# Enable creation and signing of the U-Boot fitImage
|
||||
UBOOT_FITIMAGE_ENABLE = "1"
|
||||
SPL_SIGN_ENABLE = "1"
|
||||
|
||||
Reference in New Issue
Block a user