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 FILE_SECBOOT ( PERMITTED );
26 
27 /** @file
28  *
29  * Version number
30  *
31  */
32 
33 #include <wchar.h>
34 #include <ipxe/features.h>
35 #include <ipxe/version.h>
36 #include <ipxe/sbat.h>
37 #include <config/general.h>
38 #include <config/branding.h>
39 
40 /**
41  * Create wide-character version of string
42  *
43  * @v string String
44  * @ret wstring Wide-character version of string
45  */
46 #define WSTRING( string ) _WSTRING ( string )
47 #define _WSTRING( string ) L ## string
48 
49 /** Version number feature */
50 FEATURE_VERSION ( VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH );
51 
52 /** Build timestamp (generated by linker) */
53 extern unsigned long ABS_SYMBOL ( _build_timestamp );
54 
55 /** Build ID (generated by linker) */
56 extern unsigned long ABS_SYMBOL ( _build_id );
57 
58 /** Build timestamp */
59 unsigned long build_timestamp = ABS_VALUE_INIT ( _build_timestamp );
60 
61 /** Build ID */
62 unsigned long build_id = ABS_VALUE_INIT ( _build_id );
63 
64 /** Product major version */
65 const int product_major_version = VERSION_MAJOR;
66 
67 /** Product minor version */
68 const int product_minor_version = VERSION_MINOR;
69 
70 /** Product version string */
71 const char product_version[] = VERSION;
72 
73 /** Product name string */
74 const char product_name[] = PRODUCT_NAME;
75 
76 /** Product short name string */
78 
79 /** Build name string */
80 const char build_name[] = BUILD_NAME;
81 
82 /** Wide-character product version string */
83 const wchar_t product_wversion[] = WSTRING ( VERSION );
84 
85 /** Wide-character product name string */
86 const wchar_t product_wname[] = WSTRING ( PRODUCT_NAME );
87 
88 /** Wide-character product short name string */
90 
91 /** Wide-character build name string */
92 const wchar_t build_wname[] = WSTRING ( BUILD_NAME );
93 
94 /** Copy of build name string within ".prefix" */
95 const char build_name_prefix[] __attribute__ (( section ( ".prefix.name" ) ))
96  = BUILD_NAME;
97 
98 /** SBAT upstream iPXE line
99  *
100  * This line represents the security generation of the upstream
101  * codebase from which this build is derived.
102  */
103 #define SBAT_IPXE \
104  SBAT_LINE ( "ipxe", IPXE_SBAT_GENERATION, \
105  "iPXE", BUILD_NAME, VERSION, "https://ipxe.org" )
106 
107 /** SBAT local build line
108  *
109  * This line states the security generation of the local build, which
110  * may include non-default features or non-upstreamed modifications.
111  */
112 #if PRODUCT_SBAT_GENERATION
113 #define SBAT_PRODUCT \
114  SBAT_LINE ( "ipxe." PRODUCT_SBAT_NAME, PRODUCT_SBAT_GENERATION, \
115  PRODUCT_SHORT_NAME, BUILD_NAME, VERSION, \
116  PRODUCT_URI )
117 #else
118 #define SBAT_PRODUCT ""
119 #endif
120 
121 /** SBAT data */
122 #define SBAT_DATA SBAT_HEADER "" SBAT_IPXE "" SBAT_PRODUCT
123 
124 /** SBAT data (without any NUL terminator) */
125 const char sbat[ sizeof ( SBAT_DATA ) - 1 ] __sbat = SBAT_DATA;
const char product_short_name[]
Product short name string.
Definition: version.c:77
#define __attribute__(x)
Definition: compiler.h:10
#define PRODUCT_SHORT_NAME
Definition: branding.h:29
FILE_SECBOOT(PERMITTED)
const char build_name[]
Build name string.
Definition: version.c:80
#define SBAT_DATA
SBAT data.
Definition: version.c:122
const wchar_t product_short_wname[]
Wide-character product short name string.
Definition: version.c:89
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:46
const char sbat [sizeof(SBAT_DATA) - 1] __sbat
SBAT data (without any NUL terminator)
Definition: version.c:125
const wchar_t product_wname[]
Wide-character product name string.
Definition: version.c:86
unsigned long build_id
Build ID.
Definition: version.c:62
unsigned long ABS_SYMBOL(_build_timestamp)
Build timestamp (generated by linker)
Feature list.
unsigned long build_timestamp
Build timestamp.
Definition: version.c:59
FEATURE_VERSION(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
Version number feature.
const char product_version[]
Product version string.
Definition: version.c:71
Version number.
const wchar_t build_wname[]
Wide-character build name string.
Definition: version.c:92
const int product_major_version
Product major version.
Definition: version.c:65
#define PRODUCT_NAME
Definition: branding.h:28
General configuration.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
const wchar_t product_wversion[]
Wide-character product version string.
Definition: version.c:83
const char build_name_prefix[]
Copy of build name string within ".prefix".
Definition: version.c:96
const char product_name[]
Product name string.
Definition: version.c:74
#define ABS_VALUE_INIT(name)
Get value of an absolute symbol for use in a static initializer.
Definition: compiler.h:668
Secure Boot Advanced Targeting (SBAT)
const int product_minor_version
Product minor version.
Definition: version.c:68