-
Notifications
You must be signed in to change notification settings - Fork 477
Building related enhancements, and try to match compatible on kernel dtbs
#570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
me-cafebabe
wants to merge
4
commits into
msm8916-mainline:main
Choose a base branch
from
me-cafebabe:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1a5c812
lk2nd: Fix ABOOT_STANDALONE code guards
SebaUbuntu 7db21a5
lk2nd: Make dtc command overrideable
me-cafebabe e012550
lk2nd: dev_tree: Mark as best dtb node if compatible matches with lk2…
me-cafebabe 8f33290
dts: msm8953-xiaomi-common: sakura: This device uses xiaomi-daisy dtb…
me-cafebabe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,6 +169,7 @@ struct dt_entry | |
| uint32_t offset; | ||
| uint32_t size; | ||
| uint32_t idx; | ||
| bool is_best; | ||
| }; | ||
|
|
||
| struct dt_table | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I see how it's tempting to just hack things together to make your single usecase work, I think this makes the code more confusing since it's hard to understand what is the meaning of which prop, and it would violate expectations one would have of DT matching.
I.e. you're currently creating two seemingly unrelated fields in the struct, but they now suddenly are an "array" of at most two fields, used for dtb mathing. Except contrary to the usual dtb logic, if the second (less specific, fallback) compatible is present, it would be preferred, even if a more specific compatible is available.
I'd strongly prefer this to align to common dt logic, i.e. I'd expect the
lk2nd_dev.compatiblebe changed to something likelk2nd_dev.compatibleswith a setup similar to.dtbfiles, and your selection logic to iterate over all of them to find the best pick.This will unfortunately require a slight refactoring where all uses of
lk2nd_dev.compatiblewill have to be changed tolk2nd_dev.compatibles[0], with a bit more care taken with assignments to create a correct pointer structure.What would I do to refactor for this implementation:
lk2nd_dev.compatible, I believe it's mainly used in lk2nd device module for picking the dtb in case of lk1st->lk2nd boot. Based on the usage, I'd change the variable to achar**likedtbfiles, uselkfdt_stringlist_get_allto assign it in the parser, and pointer to a string literal where it's assigned at compile time/from cmdline. Then refactor all read usages like suggested above. (I'd put it as a separate refactor commit)int lk2nd_is_compatible(char *compatible)that would compare a provided compatible against a list and return either -1 (no match) or an index of the provided compatible (i.e. sakura=0, daisy=1), which could be used to rank dtbs in a container by best match (i.e. loop over them and find the lowest index - that's the one to boot). This would allow you to add sakura.dtb later if you have to and keep the logic working. This funciton could also be reusable later if we ever want to implement other system containers like BLS#2 (UKI) for example.