iPXE
version.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  *
19  * You can also choose to distribute this program under the terms of
20  * the Unmodified Binary Distribution Licence (as given in the file
21  * COPYING.UBDL), provided that you have satisfied its requirements.
22  */
23 
24 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25 
26 /** @file
27  *
28  * Version number
29  *
30  */
31 
32 #include <wchar.h>
33 #include <ipxe/features.h>
34 #include <ipxe/version.h>
35 #include <ipxe/sbat.h>
36 #include <config/general.h>
37 #include <config/branding.h>
38 
39 /**
40  * Create wide-character version of string
41  *
42  * @v string String
43  * @ret wstring Wide-character version of string
44  */
45 #define WSTRING( string ) _WSTRING ( string )
46 #define _WSTRING( string ) L ## string
47 
48 /** Version number feature */
49 FEATURE_VERSION ( VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH );
50 
51 /** Build timestamp (generated by linker) */
52 extern char _build_timestamp[];
53 
54 /** Build ID (generated by linker) */
55 extern char _build_id[];
56 
57 /** Build timestamp */
58 unsigned long build_timestamp = ( ( unsigned long ) _build_timestamp );
59 
60 /** Build ID */
61 unsigned long build_id = ( ( unsigned long ) _build_id );
62 
63 /** Product major version */
64 const int product_major_version = VERSION_MAJOR;
65 
66 /** Product minor version */
67 const int product_minor_version = VERSION_MINOR;
68 
69 /** Product version string */
70 const char product_version[] = VERSION;
71 
72 /** Product name string */
73 const char product_name[] = PRODUCT_NAME;
74 
75 /** Product short name string */
77 
78 /** Build name string */
79 const char build_name[] = BUILD_NAME;
80 
81 /** Wide-character product version string */
82 const wchar_t product_wversion[] = WSTRING ( VERSION );
83 
84 /** Wide-character product name string */
85 const wchar_t product_wname[] = WSTRING ( PRODUCT_NAME );
86 
87 /** Wide-character product short name string */
89 
90 /** Wide-character build name string */
91 const wchar_t build_wname[] = WSTRING ( BUILD_NAME );
92 
93 /** Copy of build name string within ".prefix" */
94 const char build_name_prefix[] __attribute__ (( section ( ".prefix.name" ) ))
95  = BUILD_NAME;
96 
97 /** SBAT upstream iPXE line
98  *
99  * This line represents the security generation of the upstream
100  * codebase from which this build is derived.
101  */
102 #define SBAT_IPXE \
103  SBAT_LINE ( "ipxe", IPXE_SBAT_GENERATION, \
104  "iPXE", BUILD_NAME, VERSION, "https://ipxe.org" )
105 
106 /** SBAT local build line
107  *
108  * This line states the security generation of the local build, which
109  * may include non-default features or non-upstreamed modifications.
110  */
111 #if PRODUCT_SBAT_GENERATION
112 #define SBAT_PRODUCT \
113  SBAT_LINE ( "ipxe." PRODUCT_SBAT_NAME, PRODUCT_SBAT_GENERATION, \
114  PRODUCT_SHORT_NAME, BUILD_NAME, VERSION, \
115  PRODUCT_URI )
116 #else
117 #define SBAT_PRODUCT ""
118 #endif
119 
120 /** SBAT data */
121 #define SBAT_DATA SBAT_HEADER "" SBAT_IPXE "" SBAT_PRODUCT
122 
123 /** SBAT data (without any NUL terminator) */
124 const char sbat[ sizeof ( SBAT_DATA ) - 1 ] __sbat = SBAT_DATA;
const char product_short_name[]
Product short name string.
Definition: version.c:76
#define __attribute__(x)
Definition: compiler.h:10
#define PRODUCT_SHORT_NAME
Definition: branding.h:28
const char build_name[]
Build name string.
Definition: version.c:79
#define SBAT_DATA
SBAT data.
Definition: version.c:121
const wchar_t product_short_wname[]
Wide-character product short name string.
Definition: version.c:88
char _build_timestamp[]
Build timestamp (generated by linker)
struct netvsc_rx_buffer_section section[1]
Section descriptors.
Definition: netvsc.h:18
Branding configuration.
#define WSTRING(string)
Create wide-character version of string.
Definition: version.c:45
const char sbat [sizeof(SBAT_DATA) - 1] __sbat
SBAT data (without any NUL terminator)
Definition: version.c:124
const wchar_t product_wname[]
Wide-character product name string.
Definition: version.c:85
unsigned long build_id
Build ID.
Definition: version.c:61
Feature list.
unsigned long build_timestamp
Build timestamp.
Definition: version.c:58
FEATURE_VERSION(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
Version number feature.
char _build_id[]
Build ID (generated by linker)
const char product_version[]
Product version string.
Definition: version.c:70
Version number.
const wchar_t build_wname[]
Wide-character build name string.
Definition: version.c:91
const int product_major_version
Product major version.
Definition: version.c:64
#define PRODUCT_NAME
Definition: branding.h:27
General configuration.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
const wchar_t product_wversion[]
Wide-character product version string.
Definition: version.c:82
const char build_name_prefix[]
Copy of build name string within ".prefix".
Definition: version.c:95
const char product_name[]
Product name string.
Definition: version.c:73
Secure Boot Advanced Targeting (SBAT)
const int product_minor_version
Product minor version.
Definition: version.c:67