-
Notifications
You must be signed in to change notification settings - Fork 606
boot/nxboot: Enhancements to add progress messages and copy-to-RAM #3068
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ | |
* Pre-processor Definitions | ||
****************************************************************************/ | ||
|
||
#define ERROR -1 | ||
|
||
#define NXBOOT_PRIMARY_SLOT_NUM (0) | ||
#define NXBOOT_SECONDARY_SLOT_NUM (1) | ||
#define NXBOOT_TERTIARY_SLOT_NUM (2) | ||
|
@@ -117,6 +119,7 @@ struct nxboot_img_header | |
|
||
struct nxboot_img_version img_version; /* Image version */ | ||
}; | ||
|
||
static_assert(CONFIG_NXBOOT_HEADER_SIZE > sizeof(struct nxboot_img_header), | ||
"CONFIG_NXBOOT_HEADER_SIZE has to be larger than" | ||
"sizeof(struct nxboot_img_header)"); | ||
|
@@ -131,10 +134,42 @@ struct nxboot_state | |
enum nxboot_update_type next_boot; /* nxboot_update_type with next operation */ | ||
}; | ||
|
||
enum progress_type_e | ||
{ | ||
nxboot_info = 0, /* Prefixes arg. string with "INFO:" */ | ||
nxboot_error, /* Prefixes arg. string with "ERR:" */ | ||
nxboot_progress_start, /* Prints arg. string with no newline to allow ..... sequence to follow */ | ||
nxboot_progress_dot, /* Prints of a "." to the ..... progress sequence */ | ||
nxboot_progress_percent, /* Displays progress as % remaining */ | ||
nxboot_progress_end, /* Flags end of a "..." progrees sequence and prints newline */ | ||
}; | ||
|
||
enum progress_msg_e | ||
{ | ||
startup_msg = 0, | ||
power_reset, | ||
soft_reset, | ||
found_bootable_image, | ||
no_bootable_image, | ||
boardioc_image_boot_fail, | ||
ramcopy_started, | ||
recovery_revert, | ||
recovery_create, | ||
update_from_update, | ||
validate_primary, | ||
validate_recovery, | ||
validate_update, | ||
recovery_created, | ||
recovery_invalid, | ||
update_failed, | ||
}; | ||
|
||
/**************************************************************************** | ||
* Public Function Prototypes | ||
****************************************************************************/ | ||
|
||
void nxboot_progress(enum progress_type_e type, ...); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please document this function and its arguments. Primarily, what is expected to be passed in variadic. And I am not sure if variadic is worth it here. As far as I can see, it is used only to allow progress to be passed or not in case of progress end, and a dot. I would instead define integer and define it for that, for example, where end and dot would have some invalid value such as |
||
|
||
/**************************************************************************** | ||
* Name: nxboot_get_state | ||
* | ||
|
@@ -148,7 +183,7 @@ struct nxboot_state | |
* state: The pointer to nxboot_state structure. The state is stored here. | ||
* | ||
* Returned Value: | ||
* 0 on success, -1 and sets errno on failure. | ||
* OK (0) on success, ERROR (-1) and sets errno on failure. | ||
* | ||
****************************************************************************/ | ||
|
||
|
@@ -164,7 +199,7 @@ int nxboot_get_state(struct nxboot_state *state); | |
* if afterwards. | ||
* | ||
* Returned Value: | ||
* Valid file descriptor on success, -1 and sets errno on failure. | ||
* Valid file descriptor on success, ERROR (-1) and sets errno on failure. | ||
* | ||
****************************************************************************/ | ||
|
||
|
@@ -180,7 +215,7 @@ int nxboot_open_update_partition(void); | |
* state of the bootloader. | ||
* | ||
* Returned Value: | ||
* 1 means confirmed, 0 not confirmed, -1 and sets errno on failure. | ||
* 1 if confirmed, OK (0) on success, ERROR (-1) and sets errno on failure. | ||
* | ||
****************************************************************************/ | ||
|
||
|
@@ -194,14 +229,14 @@ int nxboot_get_confirm(void); | |
* its copy in update partition as a recovery. | ||
* | ||
* Returned Value: | ||
* 0 on success, -1 and sets errno on failure. | ||
* OK (0) on success, ERROR (-1) and sets errno on failure. | ||
* | ||
****************************************************************************/ | ||
|
||
int nxboot_confirm(void); | ||
|
||
/**************************************************************************** | ||
* Name: nxboot_perform_swap | ||
* Name: nxboot_perform_update | ||
* | ||
* Description: | ||
* Checks for the possible firmware update and performs it by copying | ||
|
@@ -216,10 +251,29 @@ int nxboot_confirm(void); | |
* check_only: Only repairs corrupted update, but do not start another one | ||
* | ||
* Returned Value: | ||
* 0 on success, -1 and sets errno on failure. | ||
* OK (0) on success, ERROR (-1) and sets errno on failure. | ||
* | ||
****************************************************************************/ | ||
|
||
int nxboot_perform_update(bool check_only); | ||
|
||
/**************************************************************************** | ||
* Name: nxboot_ramcopy | ||
* | ||
* Description: | ||
* Copies the (already) validate bootable image to RAM memory | ||
* | ||
* NOTE - no checking that the RAM location is correct, nor that the | ||
* image size is appropriate for that RAM address! | ||
* | ||
* Input parameters: | ||
* none | ||
* | ||
* Returned Value: | ||
* OK (0) on success, ERROR (-1) on fail | ||
* | ||
****************************************************************************/ | ||
|
||
int nxboot_ramcopy(void); | ||
|
||
#endif /* __BOOT_NXBOOT_INCLUDE_NXBOOT_H */ |
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.
Please include a ---help--- explaining when and why to use it, etc
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.
Sure!
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.
Added