arch/lkl: set OUTPUT_FORMAT, 64BIT, CPU_BIG_ENDIAN defaults

Kconfig makes it relatively easy to set kernel config parameters based
on compiler settings, etc. So move some of the logic from
tools/lkl/Makefile.autoconf into arch/lkl/Kconfig .
Moving non-tools specific parameters out of Makefile.autoconf should
make it easier to build LKL as a standalone library.

Signed-off-by: David Disseldorp <ddiss@suse.de>
This commit is contained in:
David Disseldorp
2025-06-02 13:54:29 +10:00
parent b0c5c1e6e8
commit 83549bf8e6
2 changed files with 6 additions and 14 deletions

View File

@@ -38,7 +38,8 @@ config LKL_LINE_COV
config OUTPUT_FORMAT
string "Output format"
default ""
default $(shell,$(LD) -r -print-output-format) if LD_IS_BFD
default $(shell,test "$(CROSS_COMPILE)" = "x86_64-linux-gnu" && echo "elf64-x86-64" || echo "unsupported-llvm") if LD_IS_LLD
config ARCH_DMA_ADDR_T_64BIT
def_bool 64BIT
@@ -48,7 +49,8 @@ config PHYS_ADDR_T_64BIT
config 64BIT
bool "64bit kernel"
default n
default y if OUTPUT_FORMAT = "pe-x86-64" || OUTPUT_FORMAT = "elf64-x86-64"
default $(success,$(LD) -r -print-output-format|grep -q '^elf64-') if LD_IS_BFD && OUTPUT_FORMAT != "pe-x86-64" && OUTPUT_FORMAT != "elf64-x86-64"
config MMU
bool "LKL MMU implementation"
@@ -91,7 +93,8 @@ config COREDUMP
config CPU_BIG_ENDIAN
bool "Big-endian kernel"
default n
default y if OUTPUT_FORMAT = "elf64-s390"
default n if OUTPUT_FORMAT != "elf64-s390"
config GENERIC_CSUM
def_bool y

View File

@@ -113,14 +113,6 @@ define nt_host
$(if $(filter $(1),pe-x86-64),$(call nt64_host))
endef
define s390_host
$(call set_kernel_config,CPU_BIG_ENDIAN,y)
endef
define 64bit_host
$(call set_kernel_config,64BIT,y)
endef
define kasan_x86_64
$(call set_autoconf_var,KASAN_SHADOW_OFFSET,0x0000200000000000)
$(call set_kernel_config,KASAN_SHADOW_OFFSET,0x0000200000000000)
@@ -284,9 +276,6 @@ define do_autoconf
$(if $(LKL_FUZZING),$(call do_autoconf_fuzzing))
$(if $(LLVM),$(call do_autoconf_llvm),$(call do_autoconf_gnu))
$(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 $(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)))