Merge pull request #602 from ddiss/lkl_fix_s390x

fix s390x big endian builds
This commit is contained in:
Octavian Purdila
2025-06-06 17:27:21 -07:00
committed by GitHub
7 changed files with 23 additions and 26 deletions

View File

@@ -90,11 +90,9 @@ endif
config COREDUMP
def_bool n
config BIG_ENDIAN
def_bool n
config CPU_BIG_ENDIAN
def_bool BIG_ENDIAN
bool "Big-endian kernel"
default n
config GENERIC_CSUM
def_bool y

View File

@@ -65,6 +65,20 @@ core-y += arch/lkl/lib/
core-y += arch/lkl/mm/
core-y += arch/lkl/drivers/
configh-y = printf "/* this header is autogenerated */\n"
configh-$(CONFIG_64BIT) += && printf '\#define LKL_CONFIG_64BIT 1\n'
configh-$(CONFIG_CPU_BIG_ENDIAN) += && printf '\#define LKL_CONFIG_CPU_BIG_ENDIAN 1\n'
quiet_cmd_gen_configh = GEN $@
cmd_gen_configh = mkdir -p $(dir $@); ($(configh-y)) > $@
targets += arch/lkl/include/generated/uapi/asm/config.h
arch/lkl/include/generated/uapi/asm/config.h: FORCE
$(call if_changed,gen_configh)
archprepare: arch/lkl/include/generated/uapi/asm/config.h
all: lkl.o arch/lkl/include/generated/uapi/asm/syscall_defs.h
lkl.o: vmlinux

View File

@@ -33,3 +33,5 @@ generic-y += termios.h
generic-y += time.h
generic-y += user.h
generic-y += mman.h
generated-y += config.h

View File

@@ -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>

View File

@@ -13,7 +13,6 @@ tests/config
tests/test-dlmopen
Makefile.conf
include/lkl_autoconf.h
include/kernel_config.h
tests/autoconf.sh
*.pyc
bin/stat

View File

@@ -41,7 +41,7 @@ all:
conf: $(OUTPUT)Makefile.conf
$(OUTPUT)Makefile.conf $(OUTPUT)include/kernel_config.h $(OUTPUT)/kernel.config: Makefile.autoconf
$(OUTPUT)Makefile.conf $(OUTPUT)/kernel.config: Makefile.autoconf
$(call QUIET_AUTOCONF, headers)$(MAKE) -f Makefile.autoconf -s
include $(OUTPUT)Makefile.conf
@@ -72,8 +72,6 @@ else
$(Q)touch bin/stat
endif
ASM_UAPI_GENERATED:=$(OUTPUT)../../arch/lkl/include/generated/uapi/asm
ASM_CONFIG:=$(ASM_UAPI_GENERATED)/config.h
DOT_CONFIG:=$(OUTPUT)../../.config
$(DOT_CONFIG): $(OUTPUT)/kernel.config
@@ -82,13 +80,8 @@ $(DOT_CONFIG): $(OUTPUT)/kernel.config
$(Q)$(MAKE) -C ../.. ARCH=lkl $(KOPT) olddefconfig
$(Q)$(MAKE) -C ../.. ARCH=lkl $(KOPT) syncconfig
$(ASM_CONFIG): $(OUTPUT)include/kernel_config.h
$(Q)mkdir -p $$(dirname $@)
$(call QUIET_INSTALL, kernel_config.h)cp $< $@
# rule to build lkl.o
$(OUTPUT)lib/lkl.o: bin/stat $(ASM_CONFIG) $(DOT_CONFIG)
$(OUTPUT)lib/lkl.o: bin/stat $(DOT_CONFIG)
# this workaround is for arm32 linker (ld.gold)
$(Q)export PATH="$(srctree)/tools/lkl/bin/:${PATH}" ;\
$(MAKE) -C ../.. ARCH=lkl $(KOPT)
@@ -174,7 +167,6 @@ mrproper: clean
clean-conf: mrproper
$(call QUIET_CLEAN, Makefile.conf)$(RM) $(OUTPUT)/Makefile.conf
$(call QUIET_CLEAN, kernel_config.h)$(RM) $(OUTPUT)/include/kernel_config.h
$(call QUIET_CLEAN, kernel.config)$(RM) $(OUTPUT)/kernel.config
headers_install: $(TARGETS)

View File

@@ -9,11 +9,6 @@ define set_autoconf_var
export LKL_HOST_CONFIG_$(1)=$(2)
endef
define set_kernel_config_h
$(shell echo "#define $(1) $(2)" \
>> $(OUTPUT)/include/kernel_config.h)
endef
define set_kernel_config
$(shell echo "CONFIG_$(1)=$(2)" >> $(OUTPUT)/kernel.config)
endef
@@ -119,12 +114,10 @@ define nt_host
endef
define s390_host
$(call set_kernel_config_h,LKL_CONFIG_ENDIAN,1)
$(call set_kernel_config,BIG_ENDIAN,y)
$(call set_kernel_config,CPU_BIG_ENDIAN,y)
endef
define 64bit_host
$(call set_kernel_config_h,LKL_CONFIG_64BIT,1)
$(call set_kernel_config,64BIT,y)
endef
@@ -296,7 +289,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)))
@@ -310,7 +303,6 @@ $(OUTPUT)Makefile.conf: Makefile.autoconf
$(shell mkdir -p $(OUTPUT)/include)
$(shell mkdir -p $(OUTPUT)/tests)
$(shell echo -n "" > $(OUTPUT)/include/lkl_autoconf.h)
$(shell echo -n "" > $(OUTPUT)/include/kernel_config.h)
$(shell echo -n "" > $(OUTPUT)/kernel.config)
$(shell echo -n "" > $(OUTPUT)/tests/autoconf.sh)
@echo "$$do_autoconf" > $(OUTPUT)/Makefile.conf