# automatic build system.
#
NON_AUTO_SRCS :=
+NON_AUTO_SRCS += core/version.c
NON_AUTO_SRCS += drivers/net/prism2.c
# INCDIRS lists the include path
$(BIN)/certstore.% : override CC := env CCACHE_DISABLE=1 $(CC)
$(BIN)/privkey.% : override CC := env CCACHE_DISABLE=1 $(CC)
-# Version number
-#
-CFLAGS_version += -DVERSION_MAJOR=$(VERSION_MAJOR) \
- -DVERSION_MINOR=$(VERSION_MINOR) \
- -DVERSION_PATCH=$(VERSION_PATCH) \
- -DVERSION="\"$(VERSION)\""
-# Make sure the version number gets updated on every git checkout
-ifneq ($(GITVERSION),)
-ifneq ($(wildcard ../.git/index),)
-$(BIN)/version.o : ../.git/index
-endif
-endif
-
# Debug message autocolourisation range
#
DBGCOL_LIST := $(BIN)/.dbgcol.list
#
BUILD_ID_CMD := perl -e 'printf "0x%08x", int ( rand ( 0xffffffff ) );'
+# Build timestamp
+#
+BUILD_TIMESTAMP := $(shell date +%s)
+
+# Build version
+#
+GIT_INDEX := $(if $(GITVERSION),$(if $(wildcard ../.git/index),../.git/index))
+$(BIN)/%.version.o : core/version.c $(MAKEDEPS) $(GIT_INDEX)
+ $(QM)$(ECHO) " [VERSION] $@"
+ $(Q)$(COMPILE_c) -DBUILD_NAME="\"$*\"" \
+ -DVERSION_MAJOR=$(VERSION_MAJOR) \
+ -DVERSION_MINOR=$(VERSION_MINOR) \
+ -DVERSION_PATCH=$(VERSION_PATCH) \
+ -DVERSION="\"$(VERSION)\"" \
+ -c $< -o $@
+
# Build an intermediate object file from the objects required for the
# specified target.
#
-$(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
+$(BIN)/%.tmp : $(BIN)/%.version.o $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
$(QM)$(ECHO) " [LD] $@"
- $(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $(BLIB) -o $@ \
- --defsym _build_id=`$(BUILD_ID_CMD)` -Map $(BIN)/$*.tmp.map
+ $(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $< $(BLIB) -o $@ \
+ --defsym _build_id=`$(BUILD_ID_CMD)` \
+ --defsym _build_timestamp=$(BUILD_TIMESTAMP) \
+ -Map $(BIN)/$*.tmp.map
$(Q)$(OBJDUMP) -ht $@ | $(PERL) $(SORTOBJDUMP) >> $(BIN)/$*.tmp.map
# Keep intermediate object file (useful for debugging)
#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
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" );
*
*/
+#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;
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;
FILE_LICENCE ( GPL2_OR_LATER );
+#include <wchar.h>
+
+extern unsigned long build_timestamp;
+extern unsigned long build_id;
extern const int product_major_version;
extern const int product_minor_version;
-extern const char *product_version;
+extern const char product_version[];
+extern const char product_name[];
+extern const char product_short_name[];
+extern const char build_name[];
+extern const wchar_t product_wversion[];
+extern const wchar_t product_wname[];
+extern const wchar_t product_short_wname[];
+extern const wchar_t build_wname[];
#endif /* _IPXE_VERSION_H */
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <ipxe/version.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/DriverBinding.h>
#include <ipxe/efi/Protocol/ComponentName2.h>
#include <ipxe/efi/efi_strings.h>
#include <ipxe/efi/efi_driver.h>
-#include <config/general.h>
/** @file
*
efi_snprintf ( efidrv->wname,
( sizeof ( efidrv->wname ) /
sizeof ( efidrv->wname[0] ) ),
- PRODUCT_SHORT_NAME "%s%s",
+ "%s%s%s", product_short_name,
( efidrv->name ? " - " : "" ),
( efidrv->name ? efidrv->name : "" ) );
#include <ipxe/iobuf.h>
#include <ipxe/in.h>
#include <ipxe/pci.h>
+#include <ipxe/version.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_pci.h>
#include <ipxe/efi/efi_driver.h>
#include <ipxe/efi/efi_strings.h>
#include <ipxe/efi/efi_snp.h>
-#include <config/general.h>
#include <usr/autoboot.h>
/** EFI simple network protocol GUID */
efi_snprintf ( snpdev->driver_name,
( sizeof ( snpdev->driver_name ) /
sizeof ( snpdev->driver_name[0] ) ),
- PRODUCT_SHORT_NAME " %s", netdev->dev->driver_name );
+ "%s %s", product_short_name, netdev->dev->driver_name );
efi_snprintf ( snpdev->controller_name,
( sizeof ( snpdev->controller_name ) /
sizeof ( snpdev->controller_name[0] ) ),
- PRODUCT_SHORT_NAME " %s (%s)",
- netdev->name, netdev_addr ( netdev ) );
+ "%s %s (%s)", product_short_name, netdev->name,
+ netdev_addr ( netdev ) );
snpdev->name2.GetDriverName = efi_snp_get_driver_name;
snpdev->name2.GetControllerName = efi_snp_get_controller_name;
snpdev->name2.SupportedLanguages = "en";
#include <ipxe/efi/efi_hii.h>
#include <ipxe/efi/efi_snp.h>
#include <ipxe/efi/efi_strings.h>
-#include <config/general.h>
/** EFI configuration access protocol GUID */
static EFI_GUID efi_hii_config_access_protocol_guid
struct device *dev = netdev->dev;
struct efi_ifr_builder ifr;
EFI_HII_PACKAGE_LIST_HEADER *package;
- const char *product_name;
+ const char *name;
EFI_GUID package_guid;
EFI_GUID formset_guid;
EFI_GUID varstore_guid;
efi_ifr_init ( &ifr );
/* Determine product name */
- product_name = ( PRODUCT_NAME[0] ? PRODUCT_NAME : PRODUCT_SHORT_NAME );
+ name = ( product_name[0] ? product_name : product_short_name );
/* Generate GUIDs */
efi_snp_hii_random_guid ( &package_guid );
efi_snp_hii_random_guid ( &varstore_guid );
/* Generate title string (used more than once) */
- title_id = efi_ifr_string ( &ifr, "%s (%s)", product_name,
+ title_id = efi_ifr_string ( &ifr, "%s (%s)", name,
netdev_addr ( netdev ) );
/* Generate opcodes */
efi_ifr_form_set_op ( &ifr, &formset_guid, title_id,
- efi_ifr_string ( &ifr,
- "Configure " PRODUCT_SHORT_NAME),
+ efi_ifr_string ( &ifr, "Configure %s",
+ product_short_name ),
&efi_hii_platform_setup_formset_guid,
&efi_hii_ibm_ucm_compliant_formset_guid, NULL );
efi_ifr_guid_class_op ( &ifr, EFI_NETWORK_DEVICE_CLASS );
efi_ifr_text_op ( &ifr,
efi_ifr_string ( &ifr, "Name" ),
efi_ifr_string ( &ifr, "Firmware product name" ),
- efi_ifr_string ( &ifr, "%s", product_name ) );
+ efi_ifr_string ( &ifr, "%s", name ) );
efi_ifr_text_op ( &ifr,
efi_ifr_string ( &ifr, "Version" ),
efi_ifr_string ( &ifr, "Firmware version" ),
#include <ipxe/oncrpc_iob.h>
#include <ipxe/init.h>
#include <ipxe/settings.h>
-#include <config/general.h>
+#include <ipxe/version.h>
/** @file
*
fetch_string_setting_copy ( NULL, &hostname_setting,
&auth_sys->hostname );
if ( ! auth_sys->hostname )
- if ( ! ( auth_sys->hostname = strdup ( PRODUCT_SHORT_NAME ) ) )
+ if ( ! ( auth_sys->hostname = strdup ( product_short_name ) ) )
return -ENOMEM;
auth_sys->uid = fetch_uintz_setting ( NULL, &uid_setting );
* do so.
*
*/
- printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "iPXE %s"
+ printf ( NORMAL "\n\n%s\n" BOLD "iPXE %s"
NORMAL " -- Open Source Network Boot Firmware -- "
CYAN "http://ipxe.org" NORMAL "\n"
- "Features:", product_version );
+ "Features:", product_name, product_version );
for_each_table_entry ( feature, FEATURES )
printf ( " %s", feature->name );
printf ( "\n" );