acpi: Use U-Boot version for OEM_REVISION
[platform/kernel/u-boot.git] / doc / develop / version.rst
1 .. SPDX-License-Identifier: GPL-2.0+
2 .. Copyright (c) 2013 The Chromium OS Authors.
3
4 Version information
5 ===================
6
7 U-Boot releases are named by year and patch level, for example 2020.10 means the
8 release that came out in October 2020. Release candidates are tagged every few
9 weeks as the project heads to the next release. So 2020.10-rc1 was the first
10 release candidate (RC), tagged soon after 2020.07 was released.
11
12 See https://www.denx.de/wiki/view/U-Boot/ReleaseCycle for full details.
13
14 Within the build system, various Makefile variables are created, making use of
15 VERSION, PATCHLEVEL and EXTRAVERSION defined at the top of 'Makefile'. There is
16 also SUBLEVEL available for downstream use. See also CONFIG_IDENT_STRING.
17
18 Some variables end up in a generated header file at
19 include/generated/version_autogenerated.h and can be accessed from C source by
20 including <version.h>
21
22 The following are available:
23
24    UBOOTRELEASE (Makefile)
25       Full release version as a string. If this is not a tagged release, it also
26       includes the number of commits since the last tag as well as the the git
27       hash.  If there are uncommitted changes a '-dirty' suffix is added too.
28
29       This is written by scripts/setlocalversion (maintained by Linux) to
30       include/config/uboot.release and ends up in the UBOOTRELEASE Makefile
31       variable.
32
33       Examples::
34
35          2020.10-rc3
36          2021.01-rc5-00248-g60dd854f3ba-dirty
37
38    PLAIN_VERSION (string #define)
39       This is UBOOTRELEASE but available in C source.
40
41       Examples::
42
43          2020.10
44          2021.01-rc5-00248-g60dd854f3ba-dirty
45
46    UBOOTVERSION (Makefile)
47       This holds just the first three components of UBOOTRELEASE (i.e. not the
48       git hash, etc.)
49
50       Examples::
51
52          2020.10
53          2021.01-rc5
54
55    U_BOOT_VERSION (string #define)
56       "U-Boot " followed by UBOOTRELEASE, for example::
57
58          U-Boot 2020.10
59          U-Boot 2021.01-rc5
60
61       This is used as part of the banner string when U-Boot starts.
62
63    U_BOOT_VERSION_NUM (integer #define)
64       Release year, e.g. 2021 for release 2021.01. Note
65       this is an integer, not a string.
66
67    U_BOOT_VERSION_NUM_PATCH (integer #define)
68       Patch number, e.g. 1 for release 2020.01. Note
69       this is an integer, not a string.
70
71 Human readable U-Boot version string is available in header file
72 include/version_string.h in following variable:
73
74    version_string (const char[])
75       U_BOOT_VERSION followed by build-time information
76       and CONFIG_IDENT_STRING.
77
78       Examples::
79
80          U-Boot 2020.10 (Jan 06 2021 - 08:50:36 -0700)
81          U-Boot 2021.01-rc5-00248-g60dd854f3ba-dirty (Jan 06 2021 - 08:50:36 -0700) for spring
82
83 Build date/time is also included. See the generated file
84 include/generated/timestamp_autogenerated.h for the available
85 fields. For example::
86
87    #define U_BOOT_DATE "Jan 06 2021"     (US format only)
88    #define U_BOOT_TIME "08:50:36"        (24-hour clock)
89    #define U_BOOT_TZ "-0700"             (Time zone in hours)
90    #define U_BOOT_EPOCH 1609948236
91
92 The Epoch is the number of seconds since midnight on 1/1/70. You can convert
93 this to a time with::
94
95    $ date -u -d @1609948236
96    Wed 06 Jan 2021 03:50:36 PM UTC
97    $ date -d 'Wed 06 Jan 2021 03:50:36 PM UTC' +%s
98    1609948236
99
100 Every time you build U-Boot this will update based on the time
101 on your build machine. See 'Reproducible builds' if you want to
102 avoid that.