Skip to content

Conversation

@ddiss
Copy link

@ddiss ddiss commented Jun 1, 2025

As tracked in #594 , there are currently a few bugs which break s390x builds:

  • s390x architecture isn't properly detected when building core LKL
  • CONFIG_CPU_BIG_ENDIAN isn't propagated through from tools/lkl/Makefile.autoconf to the main kernel .config file
  • asm/byteorder.h checks for LKL_CONFIG_BIG_ENDIAN which is never set

These changes attempt to fix the above issues. The last commit as a cleanup.
https://build.opensuse.org/public/build/home:ddiss:lkl_s390x/openSUSE_Factory_zSystems/s390x/lkl/_log is a successful s390x build log with these patches applied (atop a 6.4 based LKL kernel).

The following changes since commit 06837c8cdedb302577ef3832cf300175771d320f:

  Merge pull request #599 from lrh2000/no-gettid (2025-05-13 10:45:39 +0900)

are available in the Git repository at:

  https://github.com/ddiss/linux lkl_fix_s390x

for you to fetch changes up to fa6d8ea16b0c7def67885dcfa0078722a9ddba15:

  arch/lkl: use archprepare rule to generate config.h (2025-06-01 20:45:07 +1000)

----------------------------------------------------------------
David Disseldorp (4):
      tools/lkl: fix s390x and big endian detection
      arch/lkl: drop BIG_ENDIAN from kconfig
      arch/lkl: fix "make olddefconfig" with CONFIG_CPU_BIG_ENDIAN=y
      arch/lkl: use archprepare rule to generate config.h

 arch/lkl/Kconfig                      |  6 ++----
 arch/lkl/Makefile                     | 14 ++++++++++++++
 arch/lkl/include/asm/Kbuild           |  2 ++
 arch/lkl/include/uapi/asm/byteorder.h |  2 +-
 tools/lkl/.gitignore                  |  1 -
 tools/lkl/Makefile                    | 12 ++----------
 tools/lkl/Makefile.autoconf           | 12 ++----------
 7 files changed, 23 insertions(+), 26 deletions(-)

ddiss added 4 commits June 1, 2025 20:18
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: 0d680a3 ("lkl: remove CONFIG_ leaks in uapi headers")
Signed-off-by: David Disseldorp <[email protected]>
In contrast to CONFIG_CPU_BIG_ENDIAN, CONFIG_BIG_ENDIAN isn't used
outside of arch/lkl. Remove it.

Signed-off-by: David Disseldorp <[email protected]>
LKL's final kernel config is created by appending the
tools/lkl/Makefile.autoconf generated kernel.config to .config and
then calling "make ARCH=lkl olddefconfig".
With the existing config CPU_BIG_ENDIAN setting of "def_bool n", a
.config with CONFIG_CPU_BIG_ENDIAN=y appended will drop the
CONFIG_CPU_BIG_ENDIAN=y setting when "make ARCH=lkl olddefconfig" is
called.
This issue is resolved by changing config CPU_BIG_ENDIAN to:
	bool "Big-endian kernel"
	default n

Signed-off-by: David Disseldorp <[email protected]>
arch/lkl/include/generated/uapi/asm/config.h is generated at build time
with any of:
  #define LKL_CONFIG_64BIT 1
  #define LKL_CONFIG_CPU_BIG_ENDIAN 1
based on the build environment.
Generation is handled by Makefiles under tools/lkl, where it is then
copied to arch/lkl/include/generated/uapi/asm/config.h prior to kernel
compilation.
This change simplifies header generation by doing it directly in the
arch/lkl parent Makefile. It also improves rebuild times by only
rewriting config.h if its contents would change.

Signed-off-by: David Disseldorp <[email protected]>
@ddiss
Copy link
Author

ddiss commented Jun 1, 2025

./arch/lkl/include/generated/uapi/asm/config.h:1:1: error: expected external declaration
-en /* this header is autogenerated */

Hmm, my config.h generator changes rely on echo -en, which doesn't appear to be available here.

I've pushed a v2 which uses printf instead.

@ddiss
Copy link
Author

ddiss commented Jun 2, 2025

The checkpatch warning can IMO be ignored:

 WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: 0d680a3d5886 ("lkl: remove CONFIG_ leaks in uapi headers")'
#13: 
Fixes: 0d680a3d5886e ("lkl: remove CONFIG_ leaks in uapi headers")

I.e. 13 sha1 chars are used instead of 12 chars.

Copy link
Member

@tavip tavip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @ddiss !

@tavip tavip merged commit 74ef248 into lkl:master Jun 7, 2025
12 of 13 checks passed
@ddiss ddiss deleted the lkl_fix_s390x branch June 9, 2025 23:59
@ddiss ddiss mentioned this pull request Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants