Skip to content

Commit ffae115

Browse files
committed
Extract PKG_ABI from mutated string
1 parent fabcf48 commit ffae115

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

debian/rules.d/0-common-vars.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ kmake = make ARCH=$(build_arch) \
201201
KERNELRELEASE=$(abi_release)-$(target_flavour) \
202202
CONFIG_DEBUG_SECTION_MISMATCH=y \
203203
KBUILD_BUILD_VERSION="$(uploadnum)" \
204-
CFLAGS_MODULE="-DPKG_ABI=$(abinum)" \
204+
CFLAGS_MODULE='-DPKG_ABI=\"$(abinum)\"' \
205205
PYTHON=$(PYTHON)
206206
ifneq ($(LOCAL_ENV_CC),)
207207
kmake += CC="$(LOCAL_ENV_CC)" DISTCC_HOSTS="$(LOCAL_ENV_DISTCC_HOSTS)"

include/asm-generic/mshyperv.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, u16 varhead_size,
120120
* Preserve the ability to 'make deb-pkg' since PKG_ABI is provided
121121
* by the Ubuntu build rules.
122122
*/
123-
#define PKG_ABI 0
123+
#define PKG_ABI "0"
124124
#endif
125125

126126
/* Generate the guest OS identifier as described in the Hyper-V TLFS */
@@ -130,7 +130,14 @@ static inline u64 hv_generate_guest_id(u64 kernel_version)
130130

131131
guest_id = (((u64)HV_LINUX_VENDOR_ID) << 48);
132132
guest_id |= (kernel_version << 16);
133-
guest_id |= PKG_ABI;
133+
/*
134+
* Delphix mutates the ABI number by appending a date and the commit hash. Strip it.
135+
*/
136+
char *token;
137+
char *pkg_abi_str = PKG_ABI;
138+
token = strsep(&pkg_abi_str, "-");
139+
unsigned long abi_number = simple_strtoul(token, NULL, 10);
140+
guest_id |= (abi_number << 8);
134141

135142
return guest_id;
136143
}

0 commit comments

Comments
 (0)