Add CBnT 2.1 and replace code generation in intel/metadata#450
Open
micgor32 wants to merge 37 commits intolinuxboot:mainfrom
Open
Add CBnT 2.1 and replace code generation in intel/metadata#450micgor32 wants to merge 37 commits intolinuxboot:mainfrom
micgor32 wants to merge 37 commits intolinuxboot:mainfrom
Conversation
bg and cbnt packages will be merged in the follow-up commits. Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Add README describing new approach for metadata handling, and move old readme to separate place. Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
cbntbootpolicy and bgbootpolicy will be merged in the follow-up commits, thus bit of housekeeping here. Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
same reason as with cbntbootpolicy removal Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
types.go is basically for interfaces definition that do not belong to one type but is rather implemented by remaining types. Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Move bgheader.go to cbnt package since it is no longer reused by two separate packages (bg and cbnt as before). Recognize Header version > 0x21 is as CBnT 2.1 (Version21) after Table 5-16 in #575623-1.2.9. Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Add Common struct. Acts as an accessor for shared methods (ReadFrom, WriteTo, <type>TotalSize, <>Offset, TotalSize and PrettyString). Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Currently the calculation to find FIT pointer starts (as per spec) with substracting 0x40 from the image size. On some boards (Intel CRB's for e.g but I also experienced similar issues on production boards) this will end in null dereference, since the BIOS flash area is not span over the whole image (i.e. there is some padding at the end of the image). This can be solved by comparing BIOS flash area size exposed in IFD against the image size, and replacing image size with BIOS flash area size in the calculation if these two do not match. Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Merge Key Manifest for BG and CBnT. Given the differences, there are still two separate implementations of KM, these can, however, be accessed by the common constructor. While this commit adds a lots of code (sorry :D) there are no changes in the logic (as there was no changes in the 2.1 spec affecting KM). Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Similarly as with KM, merge BG and CBnT BPM. Constructor returns version specific implementation of BPM. No logical changes apart from usage of Common for shared methods in the Manifest implementation. Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Moved these out to the separate file for readabilty. Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
No logic changes. Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Will be replaced in the follow-up commit with the integration tests. Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
Signed-off-by: Michal Gorlas <michal.gorlas@9elements.com>
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #450 +/- ##
===========================================
+ Coverage 34.13% 44.76% +10.62%
===========================================
Files 209 170 -39
Lines 14120 12243 -1877
===========================================
+ Hits 4820 5480 +660
+ Misses 8411 5939 -2472
+ Partials 889 824 -65 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Author
|
ping @orangecms, @rminnich |
Collaborator
seen it! It's a bit of a change... :D I would also want to port the general logic and structs to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CBnT 2.1 (MTL and newer) brings breaking changes:
PDRSandCNBSare now mandatory element ofPCD(see d75ae02).0x00050004, given that the R/W methods for all SACM versions are same, the logic is moved out to the generic implementation (see 1800718, lines 357-377).0x21, thus0x22to0x25is recognized asBootGuardVersion.Version21.Replace codegen for manifest/structure methods. This is done by moving out the logic to a dedicated struct (
Common), that is then embed into the remaining structs. These have to provide their layout descriptor on each call toCommon. This reduces the amount of the code in general in theintel/metadata. Additionally,bgandcbntare now merged by letting the per-type constructor to return the correct type implementation. Both concepts are documented inpkg/intel/metadata/README.mdin 5903d58.Since the amount of (+- lines) changes is huge, I've tried to split commits into one per type + the unit test for it. There are few types that are just moved from either
bgorcbnt, and contribute to the modified lines, but do not contain any meaningful logic change. I've noted such cases in the commit description.Renamed
common/unittesttocommon/integrationto avoid confusion with the purpose of it and*_test.goincbnt. The integration test is now extended a bit, and its full scope is document inpkg/intel/metadata/common/integration/README.mdin c96a8bd.