Michel Lind de7e84
From ffdf133fc75b7b2491e004b9dae643e32efe9087 Mon Sep 17 00:00:00 2001
ec3a16
From: Yonghong Song <yonghong.song@linux.dev>
ec3a16
Date: Fri, 20 Oct 2023 14:21:30 -0700
Michel Lind de7e84
Subject: [PATCH 115/118] kpatch-build: handle init/version-timestamp.o
ec3a16
ec3a16
init/version-timestamp.c is introduced after 5.19.
ec3a16
   2df8220cc511  kbuild: build init/built-in.a just once
ec3a16
The init/version-timestamp.o is built after some compilation/build has
ec3a16
been done, so it can have accurate version information. The
ec3a16
init/version-timestamp.o is used in final linking. Different build
ec3a16
environment, including machine or build time can make
ec3a16
init/version-timestamp.o different from each other.
ec3a16
ec3a16
Make two changes in kpatch-build to avoid init/version-timestamp.o
ec3a16
introduced build failures.
ec3a16
ec3a16
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
ec3a16
Signed-off-by: Song Liu <song@kernel.org>
Michel Lind de7e84
(cherry picked from commit 1b77c087cbaf667d9ce140a7a5885bba7cca59d1)
ec3a16
---
ec3a16
 kpatch-build/kpatch-build | 3 ++-
ec3a16
 1 file changed, 2 insertions(+), 1 deletion(-)
ec3a16
ec3a16
diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
Michel Lind de7e84
index 4dd72ef..7f60ca0 100755
ec3a16
--- a/kpatch-build/kpatch-build
ec3a16
+++ b/kpatch-build/kpatch-build
Michel Lind de7e84
@@ -676,6 +676,7 @@ find_kobj() {
ec3a16
 			arch/x86/kernel/head*.o|\
ec3a16
 			arch/x86/kernel/platform-quirks.o|\
ec3a16
 			arch/x86/lib/lib.a|\
ec3a16
+			init/version-timestamp.o|\
ec3a16
 			lib/lib.a)
ec3a16
 				KOBJFILE=vmlinux
ec3a16
 				return
Michel Lind de7e84
@@ -1442,7 +1443,7 @@ for i in $FILES; do
ec3a16
 	[[ "$DISTRO" = rhel ]] || [[ "$DISTRO" = centos ]] || [[ "$DISTRO" = ol ]] && \
ec3a16
 		[[ "$i" = arch/x86/lib/copy_user_64.o ]] && continue
ec3a16
 
ec3a16
-	[[ "$i" = usr/initramfs_data.o ]] && continue
ec3a16
+	[[ "$i" = usr/initramfs_data.o || $i = init/version-timestamp.o ]] && continue
ec3a16
 
ec3a16
 	mkdir -p "output/$(dirname "$i")"
ec3a16
 	cd "$BUILDDIR" || die
ec3a16
-- 
Michel Lind de7e84
2.48.1
ec3a16