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