mirror of https://github.com/ipxe/ipxe.git
[build] Include version number within only a single object file
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/598/head
parent
0932bc5156
commit
4867085c0c
|
@ -169,11 +169,6 @@ GITVERSION := $(shell git describe --always --abbrev=1 --match "" 2>/dev/null)
|
|||
ifneq ($(GITVERSION),)
|
||||
VERSION += ($(GITVERSION))
|
||||
endif
|
||||
CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) \
|
||||
-DVERSION_MINOR=$(VERSION_MINOR) \
|
||||
-DVERSION_PATCH=$(VERSION_PATCH) \
|
||||
-DVERSION="\"$(VERSION)\""
|
||||
IDENT = '$(@F) $(VERSION) (GPL) ipxe.org'
|
||||
version :
|
||||
@$(ECHO) "$(VERSION)"
|
||||
|
||||
|
|
|
@ -653,6 +653,13 @@ $(BIN)/embedded.o : override CC := env CCACHE_DISABLE=1 $(CC)
|
|||
|
||||
$(BIN)/clientcert.o : 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)\""
|
||||
|
||||
# We automatically generate rules for any file mentioned in AUTO_SRCS
|
||||
# using the following set of templates. It would be cleaner to use
|
||||
# $(eval ...), but this function exists only in GNU make >= 3.80.
|
||||
|
|
|
@ -39,6 +39,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
|||
#include <ipxe/init.h>
|
||||
#include <ipxe/features.h>
|
||||
#include <ipxe/uri.h>
|
||||
#include <ipxe/version.h>
|
||||
|
||||
FEATURE ( FEATURE_IMAGE, "MBOOT", DHCP_EB_FEATURE_MULTIBOOT, 1 );
|
||||
|
||||
|
@ -247,7 +248,7 @@ static struct multiboot_info __bss16 ( mbinfo );
|
|||
#define mbinfo __use_data16 ( mbinfo )
|
||||
|
||||
/** The multiboot bootloader name */
|
||||
static char __data16_array ( mb_bootloader_name, [] ) = "iPXE " VERSION;
|
||||
static char __bss16_array ( mb_bootloader_name, [32] );
|
||||
#define mb_bootloader_name __use_data16 ( mb_bootloader_name )
|
||||
|
||||
/** The multiboot memory map */
|
||||
|
@ -420,6 +421,8 @@ static int multiboot_exec ( struct image *image ) {
|
|||
mbinfo.cmdline = multiboot_add_cmdline ( image );
|
||||
mbinfo.mods_addr = virt_to_phys ( mbmodules );
|
||||
mbinfo.mmap_addr = virt_to_phys ( mbmemmap );
|
||||
snprintf ( mb_bootloader_name, sizeof ( mb_bootloader_name ),
|
||||
"iPXE %s", product_version );
|
||||
mbinfo.boot_loader_name = virt_to_phys ( mb_bootloader_name );
|
||||
if ( ( rc = multiboot_add_modules ( image, max, &mbinfo, mbmodules,
|
||||
( sizeof ( mbmodules ) /
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <ipxe/fakedhcp.h>
|
||||
#include <ipxe/image.h>
|
||||
#include <ipxe/features.h>
|
||||
#include <ipxe/version.h>
|
||||
|
||||
/** @file
|
||||
*
|
||||
|
@ -94,12 +95,6 @@ struct ebinfo {
|
|||
uint16_t flags; /* Bit flags */
|
||||
};
|
||||
|
||||
/** Info passed to NBI image */
|
||||
static struct ebinfo loaderinfo = {
|
||||
VERSION_MAJOR, VERSION_MINOR,
|
||||
0
|
||||
};
|
||||
|
||||
/**
|
||||
* Prepare a segment for an NBI image
|
||||
*
|
||||
|
@ -281,6 +276,10 @@ static int nbi_boot16 ( struct image *image, struct imgheader *imgheader ) {
|
|||
* @ret rc Return status code, if image returns
|
||||
*/
|
||||
static int nbi_boot32 ( struct image *image, struct imgheader *imgheader ) {
|
||||
struct ebinfo loaderinfo = {
|
||||
product_major_version, product_minor_version,
|
||||
0
|
||||
};
|
||||
int discard_D, discard_S, discard_b;
|
||||
int rc;
|
||||
|
||||
|
|
|
@ -39,12 +39,13 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
|||
#include <ipxe/serial.h>
|
||||
#include <ipxe/init.h>
|
||||
#include <ipxe/image.h>
|
||||
#include <ipxe/version.h>
|
||||
#include <usr/imgmgmt.h>
|
||||
#include "config/console.h"
|
||||
#include "config/serial.h"
|
||||
|
||||
/** The "SYSLINUX" version string */
|
||||
static char __data16_array ( syslinux_version, [] ) = "\r\niPXE " VERSION;
|
||||
static char __bss16_array ( syslinux_version, [32] );
|
||||
#define syslinux_version __use_data16 ( syslinux_version )
|
||||
|
||||
/** The "SYSLINUX" copyright string */
|
||||
|
@ -326,6 +327,10 @@ static __asmcall void int22 ( struct i386_all_regs *ix86 ) {
|
|||
/* SYSLINUX derivative ID */
|
||||
ix86->regs.dl = BZI_LOADER_TYPE_IPXE;
|
||||
|
||||
/* SYSLINUX version */
|
||||
snprintf ( syslinux_version, sizeof ( syslinux_version ),
|
||||
"\r\niPXE %s", product_version );
|
||||
|
||||
/* SYSLINUX version and copyright strings */
|
||||
ix86->segs.es = rm_ds;
|
||||
ix86->regs.si = ( ( unsigned ) __from_data16 ( syslinux_version ) );
|
||||
|
|
|
@ -21,6 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
|||
#include <ipxe/shell.h>
|
||||
#include <ipxe/image.h>
|
||||
#include <ipxe/keys.h>
|
||||
#include <ipxe/version.h>
|
||||
#include <usr/prompt.h>
|
||||
#include <usr/autoboot.h>
|
||||
#include <config/general.h>
|
||||
|
@ -82,10 +83,10 @@ __asmcall int main ( void ) {
|
|||
* do so.
|
||||
*
|
||||
*/
|
||||
printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "iPXE " VERSION
|
||||
printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "iPXE %s"
|
||||
NORMAL " -- Open Source Network Boot Firmware -- "
|
||||
CYAN "http://ipxe.org" NORMAL "\n"
|
||||
"Features:" );
|
||||
"Features:", product_version );
|
||||
for_each_table_entry ( feature, FEATURES )
|
||||
printf ( " %s", feature->name );
|
||||
printf ( "\n" );
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Version number
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ipxe/features.h>
|
||||
#include <ipxe/version.h>
|
||||
|
||||
/** Version number feature */
|
||||
FEATURE_VERSION ( VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH );
|
||||
|
||||
/** Product major version */
|
||||
const int product_major_version = VERSION_MAJOR;
|
||||
|
||||
/** Product minor version */
|
||||
const int product_minor_version = VERSION_MINOR;
|
||||
|
||||
/** Product version string */
|
||||
const char *product_version = VERSION;
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef _IPXE_VERSION_H
|
||||
#define _IPXE_VERSION_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Version number
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER );
|
||||
|
||||
extern const int product_major_version;
|
||||
extern const int product_minor_version;
|
||||
extern const char *product_version;
|
||||
|
||||
#endif /* _IPXE_VERSION_H */
|
|
@ -54,6 +54,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
|||
#include <ipxe/nvo.h>
|
||||
#include <ipxe/device.h>
|
||||
#include <ipxe/netdevice.h>
|
||||
#include <ipxe/version.h>
|
||||
#include <ipxe/efi/efi.h>
|
||||
#include <ipxe/efi/efi_hii.h>
|
||||
#include <ipxe/efi/efi_snp.h>
|
||||
|
@ -196,7 +197,7 @@ efi_snp_hii_package_list ( struct efi_snp_device *snpdev ) {
|
|||
efi_ifr_text_op ( &ifr,
|
||||
efi_ifr_string ( &ifr, "Version" ),
|
||||
efi_ifr_string ( &ifr, "Firmware version" ),
|
||||
efi_ifr_string ( &ifr, VERSION ) );
|
||||
efi_ifr_string ( &ifr, "%s", product_version ) );
|
||||
efi_ifr_text_op ( &ifr,
|
||||
efi_ifr_string ( &ifr, "Driver" ),
|
||||
efi_ifr_string ( &ifr, "Firmware driver" ),
|
||||
|
|
|
@ -48,6 +48,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
|||
#include <ipxe/md5.h>
|
||||
#include <ipxe/blockdev.h>
|
||||
#include <ipxe/acpi.h>
|
||||
#include <ipxe/version.h>
|
||||
#include <ipxe/http.h>
|
||||
|
||||
/* Disambiguate the various error causes */
|
||||
|
@ -1141,11 +1142,11 @@ static void http_step ( struct http_request *http ) {
|
|||
/* Send request */
|
||||
if ( ( rc = xfer_printf ( &http->socket,
|
||||
"%s %s HTTP/1.1\r\n"
|
||||
"User-Agent: iPXE/" VERSION "\r\n"
|
||||
"User-Agent: iPXE/%s\r\n"
|
||||
"Host: %s%s%s\r\n"
|
||||
"%s%s%s"
|
||||
"\r\n",
|
||||
method, uri, http->uri->host,
|
||||
method, uri, product_version, http->uri->host,
|
||||
( http->uri->port ?
|
||||
":" : "" ),
|
||||
( http->uri->port ?
|
||||
|
|
|
@ -91,9 +91,6 @@ static uint8_t dhcp_request_options_data[] = {
|
|||
DHCP_END
|
||||
};
|
||||
|
||||
/** Version number feature */
|
||||
FEATURE_VERSION ( VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH );
|
||||
|
||||
/** DHCP server address setting */
|
||||
struct setting dhcp_server_setting __setting ( SETTING_MISC ) = {
|
||||
.name = "dhcp-server",
|
||||
|
|
Loading…
Reference in New Issue