Skip to content

s390x build failures #594

@ddiss

Description

@ddiss

I'm running into big-endian related build failures on the s390x architecture.
I'm currently playing around with the following attempted fix, but the CONFIG_CPU_BIG_ENDIAN=y setting doesn't appear to make it through to my KCONFIG provided kernel config. Debugging this is very slow going, as qemu-system-s390x runs at a snails pace on my x86-64 build host.

From 9e5b33d105bc7de590486680d2133ca68c33c85f Mon Sep 17 00:00:00 2001
From: David Disseldorp <[email protected]>
Date: Wed, 23 Apr 2025 08:07:43 +0200
Subject: [PATCH] tools/lkl: fix s390x and big endian detection

Fixes: 0d680a3d5886e ("lkl: remove CONFIG_ leaks in uapi headers")
Signed-off-by: David Disseldorp <[email protected]>
---
 tools/lkl/Makefile.autoconf | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/lkl/Makefile.autoconf b/tools/lkl/Makefile.autoconf
index 36f24cfd05c81..7289df264108c 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_BIG_ENDIAN,1)
   $(call set_kernel_config,BIG_ENDIAN,y)
+  $(call set_kernel_config,CPU_BIG_ENDIAN,y)
 endef
 
 define 64bit_host
@@ -296,7 +297,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)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions