Blob Blame History Raw
From 1b77c087cbaf667d9ce140a7a5885bba7cca59d1 Mon Sep 17 00:00:00 2001
From: Yonghong Song <yonghong.song@linux.dev>
Date: Fri, 20 Oct 2023 14:21:30 -0700
Subject: [PATCH 110/112] kpatch-build: handle init/version-timestamp.o

init/version-timestamp.c is introduced after 5.19.
   2df8220cc511  kbuild: build init/built-in.a just once
The init/version-timestamp.o is built after some compilation/build has
been done, so it can have accurate version information. The
init/version-timestamp.o is used in final linking. Different build
environment, including machine or build time can make
init/version-timestamp.o different from each other.

Make two changes in kpatch-build to avoid init/version-timestamp.o
introduced build failures.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Signed-off-by: Song Liu <song@kernel.org>
---
 kpatch-build/kpatch-build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
index 429f214..3af1918 100755
--- a/kpatch-build/kpatch-build
+++ b/kpatch-build/kpatch-build
@@ -634,6 +634,7 @@ find_kobj() {
 			arch/x86/kernel/head*.o|\
 			arch/x86/kernel/platform-quirks.o|\
 			arch/x86/lib/lib.a|\
+			init/version-timestamp.o|\
 			lib/lib.a)
 				KOBJFILE=vmlinux
 				return
@@ -1287,7 +1288,7 @@ for i in $FILES; do
 	[[ "$DISTRO" = rhel ]] || [[ "$DISTRO" = centos ]] || [[ "$DISTRO" = ol ]] && \
 		[[ "$i" = arch/x86/lib/copy_user_64.o ]] && continue
 
-	[[ "$i" = usr/initramfs_data.o ]] && continue
+	[[ "$i" = usr/initramfs_data.o || $i = init/version-timestamp.o ]] && continue
 
 	mkdir -p "output/$(dirname "$i")"
 	cd "$BUILDDIR" || die
-- 
2.45.1