diff mbox series

[v2,02/12] Makefile: Provide numeric versions

Message ID 20210120190636.v2.2.I9efe8832e785f28cb7c4bb98d6df6322fc756150@changeid
State Superseded
Delegated to: Bin Meng
Headers show
Series smbios: Enhancements for more flexibility | expand

Commit Message

Simon Glass Jan. 21, 2021, 2:06 a.m. UTC
For SMBIOS we want to store the numeric version numbers in the tables. It
does not make sense to parse the strings. Instead, add new #defines with
the version and patchlevel.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 Makefile | 4 ++++
 README   | 8 ++++++++
 2 files changed, 12 insertions(+)

Comments

Bin Meng Jan. 21, 2021, 5:54 a.m. UTC | #1
On Thu, Jan 21, 2021 at 10:06 AM Simon Glass <sjg@chromium.org> wrote:
>
> For SMBIOS we want to store the numeric version numbers in the tables. It
> does not make sense to parse the strings. Instead, add new #defines with
> the version and patchlevel.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> (no changes since v1)
>
>  Makefile | 4 ++++
>  README   | 8 ++++++++
>  2 files changed, 12 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index cef149dec97..67972dbdb9b 100644
--- a/Makefile
+++ b/Makefile
@@ -1849,9 +1849,13 @@  prepare: prepare0
 # Generate some files
 # ---------------------------------------------------------------------------
 
+# Use sed to remove leading zeros from PATCHLEVEL to avoid using octal numbers
 define filechk_version.h
 	(echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \
 	echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; \
+	echo \#define U_BOOT_VERSION_NUM $(VERSION); \
+	echo \#define U_BOOT_VERSION_NUM_PATCH $$(echo $(PATCHLEVEL) | \
+		sed -e "s/^0*//"); \
 	echo \#define CC_VERSION_STRING \"$$(LC_ALL=C $(CC) --version | head -n 1)\"; \
 	echo \#define LD_VERSION_STRING \"$$(LC_ALL=C $(LD) --version | head -n 1)\"; )
 endef
diff --git a/README b/README
index f32c69c8d77..37d21f18ca6 100644
--- a/README
+++ b/README
@@ -1898,6 +1898,14 @@  The following options need to be configured:
 			     U-Boot 2020.10 (Jan 06 2021 - 08:50:36 -0700)
                              U-Boot 2021.01-rc5-00248-g60dd854f3ba-dirty (Jan 06 2021 - 08:50:36 -0700) for spring
 
+		  U_BOOT_VERSION_NUM (integer #define)
+			  Release year, e.g. 2021 for release 2021.01. Note
+			  this is an integer, not a string.
+
+		  U_BOOT_VERSION_NUM_PATCH (integer #define)
+			  Patch number, e.g. 1 for release 2020.01. Note
+			  this is an integer, not a string.
+
 		Build date/time is also included. See the generated file
 		include/generated/timestamp_autogenerated.h for the available
 		fields. For example: