Skip to content

Commit

Permalink
kbuild: add helper macro to determine pve release version
Browse files Browse the repository at this point in the history
  • Loading branch information
moetayuko committed Apr 14, 2024
1 parent 9e0fde6 commit e4e5a4a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Makefile.backport
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,17 @@ BASE_KERNEL_NAME := $(BASE_KERNEL_NAME).$(EXTENDED_VERSION_Z)
endif

else ifeq ($(OSV_NAME),)

ifeq ($(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep UTS_RELEASE | cut -d '"' -f2 | awk -F- '{print $$NF}'), pve)
OSV_NAME = PVE
EXTENDED_VERSION_X = $(shell cat $(KLIB_BUILD)/include/generated/utsrelease.h | grep UTS_RELEASE | cut -d '"' -f2 | cut -d '-' -f2)
BASE_KERNEL_NAME = $(KERN_VER)-$(EXTENDED_VERSION_X)-pve

#
# Extract Vanilla/Mainline Variables
#

ifeq ($(shell expr $(KERN_VER_XY) \== $(call get_kernel_version,5,4)), 1)
else ifeq ($(shell expr $(KERN_VER_XY) \== $(call get_kernel_version,5,4)), 1)
OSV_NAME = VANILLA_5.4LTS
OSV_KV_SUPPORTED = $(shell cat versions | grep "$(OSV_NAME)_KERNEL_VERSION" | cut -d '"' -f 2)
else ifeq ($(shell test $(KERN_VER_XY) = 5.10 && test "$(BUILD_CONFIG)" != CUSTOM_KERN_3 && echo 1), 1)
Expand Down Expand Up @@ -562,6 +568,10 @@ define filechk_osv_version_rhel.h
$(shell expr $(EXTENDED_VERSION_X) \* 65536 + 0$(EXTENDED_VERSION_Y) \* 256 + 0$(EXTENDED_VERSION_Z))'
endef

define filechk_osv_version_pve.h
echo '#define PVE_BACKPORT_RELEASE_CODE $(EXTENDED_VERSION_X)'
endef

define filechk_osv_version_generic.h
echo '#define GENERIC_BACKPORT_MAJOR $(EXTENDED_VERSION_X)'; \
echo '#define GENERIC_BACKPORT_MINOR $(EXTENDED_VERSION_Y)'; \
Expand Down Expand Up @@ -599,6 +609,8 @@ else ifeq ($(OSV_NAME), SUSE)
$(call filechk,osv_version_sles.h)
else ifeq ($(OSV_NAME), RHEL)
$(call filechk,osv_version_rhel.h)
else ifeq ($(OSV_NAME), PVE)
$(call filechk,osv_version_pve.h)
else ifeq ($(CUSTOM_KERN_1_VER), CUSTOM_KERN_1)
$(call filechk,osv_custom_kernel_1.h)
else ifeq ($(CUSTOM_KERN_3_VER), CUSTOM_KERN_3)
Expand Down
9 changes: 9 additions & 0 deletions backport-include/linux/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
#ifndef RHEL_RELEASE_VERSION
#define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b))
#endif

#ifndef PVE_BACKPORT_RELEASE_CODE
#define PVE_RELEASE_VERSION_IS_GEQ(X) 0
#define PVE_RELEASE_VERSION_IS_LESS(X) 0
#endif

#if defined(CONFIG_SUSE_KERNEL)
/*
* To differentiate between the different minor versions
Expand Down Expand Up @@ -134,6 +140,9 @@
#elif defined(CUSTOM_KERN_3_RELEASE_CODE)
#define CUSTOM_KERN_3_RELEASE_VERSION_IS_GEQ(X,Y,Z) CUSTOM_KERN_3_RELEASE_CODE >= CUSTOM_KERN_3_RELEASE_VERSION(X,Y,Z)
#define CUSTOM_KERN_3_RELEASE_VERSION_IS_LESS(X,Y,Z) CUSTOM_KERN_3_RELEASE_CODE < CUSTOM_KERN_3_RELEASE_VERSION(X,Y,Z)
#elif defined(PVE_BACKPORT_RELEASE_CODE)
#define PVE_RELEASE_VERSION_IS_GEQ(X) PVE_BACKPORT_RELEASE_CODE >= (X)
#define PVE_RELEASE_VERSION_IS_LESS(X) PVE_BACKPORT_RELEASE_CODE < (X)

#endif

Expand Down

0 comments on commit e4e5a4a

Please sign in to comment.