ulib: Add a way to obtain the version

It is possible to simply read the 'version_string' variable, but it
seems better to add a proper API call to get this. It is already
defined in lib/ulib/ulib.c

Add a prototype to u-boot-lib.h

Make use of it from the demo program.

Fix the comment for ulib_uninit() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-09-10 13:26:38 -06:00
parent 3b1d056b30
commit 1db2a3f13b
2 changed files with 9 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
}
demo_show_banner();
printf("U-Boot version: %s\n", version_string);
printf("U-Boot version: %s\n", ulib_get_version());
printf("\n");
/* Use U-Boot's os_open to open a file */

View File

@@ -25,10 +25,17 @@ struct global_data;
int ulib_init(char *progname);
/**
* ulib_uninit() shut down the U-Boot librrary
* ulib_uninit() - shut down the U-Boot library
*
* Call this when your program has finished using the library, before it exits
*/
void ulib_uninit(void);
/**
* ulib_get_version() - Get the version string
*
* Return: Full U-Boot version string
*/
const char *ulib_get_version(void);
#endif