Add image string information to the display output of the fw-info subcommand#339
Add image string information to the display output of the fw-info subcommand#339hsinliang wants to merge 1 commit intoMicrosemi:masterfrom
Conversation
| { | ||
| int i; | ||
|
|
||
| for (i = 0; i < len; i++) |
There was a problem hiding this comment.
Please follow the coding style: should use tab characters (set to 8 spaces) as indents and the { for for and if statements should be on the same line.
This project follows Linux coding style so see here for more information:
https://www.kernel.org/doc/html/latest/process/coding-style.html
|
|
||
| if(inf->valid){ | ||
| printf("Image String:"); | ||
| char_arr_print(inf->img_str, sizeof(inf->img_str)); |
There was a problem hiding this comment.
This doesn't actually need the new helper, it should be equivalent to:
printf("%.*s", sizeof(inf->img_str), inf->img_str);| inf->valid ? "" : " (Invalid)"); | ||
|
|
||
| if(inf->valid){ | ||
| printf("Image String:"); |
There was a problem hiding this comment.
The lines here are going to be too long for a standard screen. Can we maybe add this to a new line and match the indent of the Version string?
if (inf->valid) {
printf(" %-4s\tImage String: %.*s\n", "", sizeof(inf->img_str),
inf->img_str);| size_t part_body_offset; //!< Partition image body offset | ||
| size_t image_len; //!< Length of the image | ||
| unsigned long image_crc; //!< CRC checksum of the image | ||
| char img_str[16]; |
There was a problem hiding this comment.
NIT: I'd very much prefer changes to the library be put in separate patches from changes to the CLI.
| inf->metadata = metadata; | ||
|
|
||
| for(i = 0; i< 16; i++) | ||
| inf->img_str[i] = metadata->img_str[i]; |
There was a problem hiding this comment.
This can be a memcpy() and shouldn't need the constant 16:
memcpy(inf->img_str, metadata->img_str, sizeof(inf->img_str));
Add image string information to the display output of the fw-info subcommand. The user can modify the image string in the firmware header using the ChipLink Firmware Image Header Editor tool. After updating the firmware, use Switchtec-User fw-info to verify the image string information.