summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown2014-06-19 01:35:04 +0200
committerMichael Brown2014-06-24 16:32:35 +0200
commit8290a955130e0a6d6112ad8f269d8f617103e070 (patch)
tree9a3b124dacb036cbf6359fb4ef27fbce3f898fd6 /src/core
parent[debug] Allow debug message colours to be customised via DBGCOL=... (diff)
downloadipxe-8290a955130e0a6d6112ad8f269d8f617103e070.tar.gz
ipxe-8290a955130e0a6d6112ad8f269d8f617103e070.tar.xz
ipxe-8290a955130e0a6d6112ad8f269d8f617103e070.zip
[build] Expose build timestamp, build name, and product names
Expose the build timestamp (measured in seconds since the Epoch) and the build name (e.g. "rtl8139.rom" or "ipxe.efi"), and provide the product name and product short name in a single centralised location. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/main.c4
-rw-r--r--src/core/version.c50
2 files changed, 51 insertions, 3 deletions
diff --git a/src/core/main.c b/src/core/main.c
index c55ca26cb..db09e4c39 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -17,8 +17,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <stddef.h>
#include <stdio.h>
#include <ipxe/init.h>
+#include <ipxe/version.h>
#include <usr/autoboot.h>
-#include <config/general.h>
/**
* Main entry point
@@ -31,7 +31,7 @@ __asmcall int main ( void ) {
initialise();
/* Some devices take an unreasonably long time to initialise */
- printf ( PRODUCT_SHORT_NAME " initialising devices..." );
+ printf ( "%s initialising devices...", product_short_name );
startup();
printf ( "ok\n" );
diff --git a/src/core/version.c b/src/core/version.c
index 1aa22d8ec..1e1e9daca 100644
--- a/src/core/version.c
+++ b/src/core/version.c
@@ -25,12 +25,35 @@ FILE_LICENCE ( GPL2_OR_LATER );
*
*/
+#include <wchar.h>
#include <ipxe/features.h>
#include <ipxe/version.h>
+#include <config/general.h>
+
+/**
+ * Create wide-character version of string
+ *
+ * @v string String
+ * @ret wstring Wide-character version of string
+ */
+#define WSTRING( string ) _WSTRING ( string )
+#define _WSTRING( string ) L ## string
/** Version number feature */
FEATURE_VERSION ( VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH );
+/** Build timestamp (generated by linker) */
+extern char _build_timestamp[];
+
+/** Build ID (generated by linker) */
+extern char _build_id[];
+
+/** Build timestamp */
+unsigned long build_timestamp = ( ( unsigned long ) _build_timestamp );
+
+/** Build ID */
+unsigned long build_id = ( ( unsigned long ) _build_id );
+
/** Product major version */
const int product_major_version = VERSION_MAJOR;
@@ -38,4 +61,29 @@ const int product_major_version = VERSION_MAJOR;
const int product_minor_version = VERSION_MINOR;
/** Product version string */
-const char *product_version = VERSION;
+const char product_version[] = VERSION;
+
+/** Product name string */
+const char product_name[] = PRODUCT_NAME;
+
+/** Product short name string */
+const char product_short_name[] = PRODUCT_SHORT_NAME;
+
+/** Build name string */
+const char build_name[] = BUILD_NAME;
+
+/** Wide-character product version string */
+const wchar_t product_wversion[] = WSTRING ( VERSION );
+
+/** Wide-character product name string */
+const wchar_t product_wname[] = WSTRING ( PRODUCT_NAME );
+
+/** Wide-character product short name string */
+const wchar_t product_short_wname[] = WSTRING ( PRODUCT_SHORT_NAME );
+
+/** Wide-character build name string */
+const wchar_t build_wname[] = WSTRING ( BUILD_NAME );
+
+/** Copy of build name string within ".prefix" */
+const char build_name_prefix[] __attribute__ (( section ( ".prefix.name" ) ))
+ = BUILD_NAME;