Logic error in FwPackageGetImageIndex
While working on this pull request:
https://github.com/OE4T/meta-tegra/pull/1285
I discovered what appears to be a bug in the logic that is attempting to find a match to either the compatibility or full TnSpec. I think the simple fix is to add a break here:
https://github.com/NVIDIA/edk2-nvidia/blob/main/Silicon/NVIDIA/Library/FwPackageLib/FwPackageLib.c#L267
The bug was exposed due to meta-tegra having additional bup specs that differed from the L4T 35.3.1 release (which was resolved in the PR). I was able to recreate it using the L4T release by simply adding this spec:
'boardid=3668;fab=200;boardsku=0001;boardrev=;fuselevel_s=1;chiprev=2;board=jetson-xavier-nx-devkit-emmc;rootdev=mmcblk0p1'
to the jetson-xavier-nx-devkit-emmc board of the t19x_spec in jetson_board_spec.cfg and then rebuilding the capsule per here. With the additional spec present the code will fail to break out of the loop and will match on the next entry, but since Found is now TRUE it will fall into the else clause that returns EFI_UNSUPPORTED.
Thanks for opening this issue! We're checking on it and will get back to you soon.
@Lexmark-chad the linked PR changes the loop you mention to give debug warnings if multiple matching images are in the capsule instead of rejecting the capsule with EFI_UNSUPPORTED. Thanks again for opening the issue.