packrat: Read caboose metadata into ereports #2344
Merged
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.
Follow-up from #2343
PR #2343 removes the
hubris_archive_idfield from ereport metadata, as we have determined that this ought not be used to identify Hubris except in the case of firmware updates. If this is being removed, though, we really ought to have other metadata fields identifying the Hubris image. Therefore, this commit adds fields from the caboose (in particular, theBORD,VERS, andGITCtags) to the ereport metadata message. These fields are read from the caboose every time metadata is refreshed, in order to avoid buffering them in packrat, which would duplicate data already in flash and didn't seem necessary as metadata refreshes occur infrequently (on SP reset/MGS restart).All of these fields are optional, and if any of them are not present or could not be read successfully, we send a CBOR
null. Additionally, I've nested all of them under ahubris_caboosefield, which isnullif the image has no caboose whatsoever. This way, we can differentiate between images with no caboose and images where none of the tags we read into the metadata message could be found. I'm open to being convinced this is unnecessary, but it seemed worthwhile, and since the metadata message doesn't compete for space in the ereport ringbuffer, we can be a bit more verbose here, provided it fits in a UDP datagram.Naturally, every app.toml where Packrat produces ereports needed to be updated to allow packrat to read from the caboose. Packrat also uses a bit more stack in order to do this.
For example, here's output from a Gimletlet with caboose fields (including a fake version tag) in its ereport metadata: