Simon Glass | 9b95f3f | 2021-02-04 21:17:12 -0700 | [diff] [blame] | 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_STRING (string #define) |
| 64 | U_BOOT_VERSION followed by build-time information |
| 65 | and CONFIG_IDENT_STRING. |
| 66 | |
| 67 | Examples:: |
| 68 | |
| 69 | U-Boot 2020.10 (Jan 06 2021 - 08:50:36 -0700) |
| 70 | U-Boot 2021.01-rc5-00248-g60dd854f3ba-dirty (Jan 06 2021 - 08:50:36 -0700) for spring |
| 71 | |
Simon Glass | 68f6a90 | 2021-02-04 21:17:13 -0700 | [diff] [blame] | 72 | U_BOOT_VERSION_NUM (integer #define) |
| 73 | Release year, e.g. 2021 for release 2021.01. Note |
| 74 | this is an integer, not a string. |
| 75 | |
| 76 | U_BOOT_VERSION_NUM_PATCH (integer #define) |
| 77 | Patch number, e.g. 1 for release 2020.01. Note |
| 78 | this is an integer, not a string. |
| 79 | |
Simon Glass | 9b95f3f | 2021-02-04 21:17:12 -0700 | [diff] [blame] | 80 | Build date/time is also included. See the generated file |
| 81 | include/generated/timestamp_autogenerated.h for the available |
| 82 | fields. For example:: |
| 83 | |
| 84 | #define U_BOOT_DATE "Jan 06 2021" (US format only) |
| 85 | #define U_BOOT_TIME "08:50:36" (24-hour clock) |
| 86 | #define U_BOOT_TZ "-0700" (Time zone in hours) |
Simon Glass | 9b95f3f | 2021-02-04 21:17:12 -0700 | [diff] [blame] | 87 | #define U_BOOT_BUILD_DATE 0x20210106 (hex yyyymmdd format) |
| 88 | #define U_BOOT_EPOCH 1609948236 |
| 89 | |
| 90 | The Epoch is the number of seconds since midnight on 1/1/70. You can convert |
| 91 | this to a time with:: |
| 92 | |
| 93 | $ date -u -d @1609948236 |
| 94 | Wed 06 Jan 2021 03:50:36 PM UTC |
| 95 | $ date -d 'Wed 06 Jan 2021 03:50:36 PM UTC' +%s |
| 96 | 1609948236 |
| 97 | |
| 98 | Every time you build U-Boot this will update based on the time |
| 99 | on your build machine. See 'Reproducible builds' if you want to |
| 100 | avoid that. |