-
-
Notifications
You must be signed in to change notification settings - Fork 779
[rfc] Comptibility header (v1) #2669
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
Conversation
0d1dd29 to
db012d2
Compare
kernel/src/lib.rs
Outdated
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.
We need some way to remember to update this.
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.
Could we auto generate/update this from git tags?
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.
Generate doesn't work if someone downloads the zip file and there is no git repo. But something that at least checked somehow would be nice.
doc/TockBinaryFormat.md
Outdated
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.
I am wary of this kind of specification. For example, it means that we can't change a system call API for a particular device number without a major number increment. Defining "compatible" seems difficult.
Instead, I'd suggest that we add this to the end of the main header. It should either be present in every app, or not. It should include only a major version number, which relates to the ABI with the kernel. Anything further than that (compatibility) can be determined by the app itself, e.g., by probing if devices are installed.
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.
The intent is for this (i.e. TLV id 7) to only specify kernel ABI. We wanted major and minor, because Tock 2.1 might include a new allow call that Tock 2.0 does not. We do need to make this clear in the docs.
We also thought that a TLV was an appropriate option for two reasons:
- We're not entirely sure this is the long term best way to handle this sort of compatibility checking. Using a TLV makes it easy to deprecate this in the future and possibly replace it with something else.
- Some boards/deployments might not want to include any compatibility information (and save the bytes in the header). They can easily omit the TLV.
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.
I detailed this in the documentation.
kernel/src/process_standard.rs
Outdated
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.
I think this should error if enforce_kernel_version is true.
d5d3bc9 to
5463a21
Compare
592f867 to
8998c40
Compare
| app_flash.as_ptr() as usize, | ||
| app_flash.as_ptr() as usize + app_flash.len() - 1, | ||
| process_name | ||
| process_name.unwrap_or("(no name)") |
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.
I don't understand this change. Is this related?
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.
Its not related, but this would display the process name instead of Some(process_name). I suggest the same change at line 1452.
Co-authored-by: Brad Campbell <[email protected]>
Co-authored-by: Brad Campbell <[email protected]>
Co-authored-by: Brad Campbell <[email protected]>
Co-authored-by: Brad Campbell <[email protected]>
Co-authored-by: Brad Campbell <[email protected]>
Co-authored-by: Brad Campbell <[email protected]>
Co-authored-by: Brad Campbell <[email protected]>
Co-authored-by: Brad Campbell <[email protected]>
Co-authored-by: Hudson Ayers <[email protected]>
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.
We need to merge at least the elf2tab changes and release elf2tab before we merge this.
|
Or we could set required to |
As long is we change it back before we release 2.0 this should be fine. |
|
Let's do this right -- @alexandruradovici can you rebase tock/elf2tab#30 so we can review and merge? It seems like everyone is on-board and it all looks good, let's just do it. |
|
I rebased tock/elf2tab#30, I would be great if @alistair23 can take a look at it the merge was with the permissions header. |
221: Added kernel version and automatic update for elf2tab r=bradjc a=alexandruradovici This PR adds - the command line for elf2tab to add the `KernelVersion` header - the automatic updatce of elf2tab. This is needed to add the `KernelVersion` header (tock/tock#2669) Co-authored-by: Alexandru Radovici <[email protected]>
|
bors r+ |
221: Added kernel version and automatic update for elf2tab r=bradjc a=alexandruradovici This PR adds - the command line for elf2tab to add the `KernelVersion` header - the automatic updatce of elf2tab. This is needed to add the `KernelVersion` header (tock/tock#2669) Co-authored-by: Alexandru Radovici <[email protected]>
Pull Request Overview
This pull request adds a compatibility header to the TBF. This is the first version of such a header.
The idea is to add the ability to the kernel to ignore and not load the processes that do not meet the kernel compatibility constraints defined in this header.
This defines a fixed header that contains:
Processes that provide a
KernelVersionheader state that the exact required kernel version and theminimum required kernel minor version. For instance, if a process specifies kernel version 2.12, this means it requires a kernel
version that is >= 2.12 and < 3.0.
Testing Strategy
This was tested using a Microbit v2 and libtock-c with the new elf2tab (tock/elf2tab#30).
EDIT: Tockloader seems to send over to the board unknown TLV headers as this works with the unmodified tockloader.
TODO or Help Wanted
kernel/src/lib.rs. Another idea was to define them within theConfigstructure. The printed kernel version is taken from the git release, which, at least for the development tree, is difficult to parseDocumentation Updated
/docs, or no updates are required.Formatting
make prepush.