File 0001-tools-lkl-fix-s390x-and-big-endian-detection.patch of Package lkl
From 33f3e31defe5ae7bbc9d111ad5124eefd563949b Mon Sep 17 00:00:00 2001
From: David Disseldorp <ddiss@suse.de>
Date: Wed, 23 Apr 2025 08:07:43 +0200
Subject: [PATCH 1/4] tools/lkl: fix s390x and big endian detection
s390x detection is broken in that filters for "elf64-s390" using the '-'
trimmed EXEC_FMT variable.
Additionally, set_kernel_config_h is called with LKL_CONFIG_ENDIAN,
which doesn't match LKL_CONFIG_BIG_ENDIAN checked for in byteorder.h.
Change this to LKL_CONFIG_CPU_BIG_ENDIAN in preparation for removing
the redundant CONFIG_BIG_ENDIAN setting.
Fixes: 0d680a3d5886e ("lkl: remove CONFIG_ leaks in uapi headers")
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
arch/lkl/include/uapi/asm/byteorder.h | 2 +-
tools/lkl/Makefile.autoconf | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/lkl/include/uapi/asm/byteorder.h b/arch/lkl/include/uapi/asm/byteorder.h
index 93faf3350bd7..7d5e8fb458e1 100644
--- a/arch/lkl/include/uapi/asm/byteorder.h
+++ b/arch/lkl/include/uapi/asm/byteorder.h
@@ -3,7 +3,7 @@
#include <asm/config.h>
-#if defined(LKL_CONFIG_BIG_ENDIAN)
+#if defined(LKL_CONFIG_CPU_BIG_ENDIAN)
#include <linux/byteorder/big_endian.h>
#else
#include <linux/byteorder/little_endian.h>
diff --git a/tools/lkl/Makefile.autoconf b/tools/lkl/Makefile.autoconf
index 84b1715b7c6c..5b535ce12c79 100644
--- a/tools/lkl/Makefile.autoconf
+++ b/tools/lkl/Makefile.autoconf
@@ -119,8 +119,9 @@ define nt_host
endef
define s390_host
- $(call set_kernel_config_h,LKL_CONFIG_ENDIAN,1)
+ $(call set_kernel_config_h,LKL_CONFIG_CPU_BIG_ENDIAN,1)
$(call set_kernel_config,BIG_ENDIAN,y)
+ $(call set_kernel_config,CPU_BIG_ENDIAN,y)
endef
define 64bit_host
@@ -196,7 +197,7 @@ define do_autoconf
$(eval EXEC_FMT := $(shell echo $(LD_FMT) | cut -d "-" -f1))
$(call set_kernel_config,OUTPUT_FORMAT,\"$(LD_FMT)\")
$(if $(or $(filter $(EXEC_FMT),elf64),$(filter $(LD_FMT),pe-x86-64)),$(call 64bit_host))
- $(if $(filter $(EXEC_FMT),elf64-s390),$(call s390_host))
+ $(if $(filter $(LD_FMT),elf64-s390),$(call s390_host))
$(if $(filter $(EXEC_FMT),$(POSIX_HOSTS)),$(call posix_host,$(LD_FMT)))
$(if $(filter $(EXEC_FMT),$(NT_HOSTS)),$(call nt_host,$(LD_FMT)))
$(if $(and $(filter yes,$(kasan)),$(filter $(LD_FMT),$(KASAN_HOSTS))),$(call kasan_enable,$(LD_FMT)))
--
2.43.0