Skip to content
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

Create trait for defining custom nodes that can be easily extracted from the Fdt #14

Open
jongwu opened this issue Oct 25, 2023 · 5 comments
Labels
enhancement New feature or request planned Planned feature request or change
Milestone

Comments

@jongwu
Copy link

jongwu commented Oct 25, 2023

Hello I'm new here and do some development based on this project.

I want to carry some self-defined info inside chosen, like store kernel info inside chosen node. But I get that, chosen node is private and can't be used outside. So, I wonder if it is likely to expose chosen as public or can I add self-defined chosen releated interface to this repo?

@jongwu
Copy link
Author

jongwu commented Nov 1, 2023

@repnop -, Any comments?

@repnop
Copy link
Owner

repnop commented Nov 1, 2023

Hi! I'm not 100% I understand what you mean, but this crate only supports a read-only view into the given flattened devicetree, as such its not possible to store that information anywhere, so even if it was possible to create your own Chosen, you would still need to store it separately. Having an API for creating a new devicetree based on an existing one is something that would make that possible and something I plan to create at some point, but would be probably be pretty heavy handed for simply inserting some information into a single node. My recommendation is to copy the contents that you want out of the Chosen node and use a custom struct to store the rest of the information you need. Hope that helps!

@jongwu
Copy link
Author

jongwu commented Nov 1, 2023

Hi! I'm not 100% I understand what you mean,

Sorry to have not made it clear.

but this crate only supports a read-only view into the given flattened devicetree, as such its not possible to store that information anywhere, so even if it was possible to create your own Chosen, you would still need to store it separately.

My case is for virtualization scenario. For example, store kernel image into memory and store its location address and size into FDT throught Chosen node in VMM, as the initramfs does. Then we can get those kernel information in guest firmware/kernel.

Having an API for creating a new devicetree based on an existing one is something that would make that possible and something I plan to create at some point,

I prefer this way,

but would be probably be pretty heavy handed for simply inserting some information into a single node. My recommendation is to copy the contents that you want out of the Chosen node and use a custom struct to store the rest of the information you need. Hope that helps!

You mean create a new node in "fdt" (I mean in this repo) to carry what I want?

@jongwu
Copy link
Author

jongwu commented Nov 22, 2023

Hello @repnop -, I raise a PR to demo what I want to do. We can discuss this issue there.

@repnop repnop changed the title expose chosen node to public use Create trait for defining custom nodes that can be easily extracted from the Fdt May 2, 2024
@repnop
Copy link
Owner

repnop commented May 2, 2024

Co-opting this issue and reusing it for tracking a trait to better define custom nodes so users can more easily access things

@repnop repnop added enhancement New feature or request planned Planned feature request or change labels May 2, 2024
@repnop repnop added this to the v0.2.0 milestone Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned Planned feature request or change
Projects
None yet
Development

No branches or pull requests

2 participants