Skip to content

arch/x86_64: kernel build with Cmake - #19694

Open
raiden00pl wants to merge 5 commits into
apache:masterfrom
raiden00pl:fix-x86_64-cmake-kernel-build
Open

arch/x86_64: kernel build with Cmake#19694
raiden00pl wants to merge 5 commits into
apache:masterfrom
raiden00pl:fix-x86_64-cmake-kernel-build

Conversation

@raiden00pl

Copy link
Copy Markdown
Member

Summary

  1. arch: fix arch_interface guard for kernel builds
  2. arch/x86_64: define CMAKE_LD and CMAKE_STRIP for ELF applications
  3. cmake: fix installed application binaries to match Application.mk
  4. boards/x86_64/qemu-intel64: generate ROMFS image in CMake kernel builds
  5. Documentation: describe CMake build for qemu-intel64 knsh_romfs

Impact

kernel build works now with cmake

Testing

kernel build automate tests with ntfc

arch_interface exists only for CONFIG_BUILD_PROTECTED, but x86_64 and
arm64 referenced it for any non-flat build, breaking CMake
configuration of kernel builds. Use the CONFIG_BUILD_PROTECTED guard
as arm and risc-v do.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
CMAKE_LD was never set, so application link commands were invalid, and
CMAKE_STRIP defaulted to plain 'strip', which removes the symbol and
relocation tables required to load CONFIG_BINFMT_ELF_RELOCATABLE
binaries. Use the host linker and 'strip --strip-unneeded' as on the
other architectures.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
@raiden00pl
raiden00pl force-pushed the fix-x86_64-cmake-kernel-build branch from 1a8b3c9 to e6eb175 Compare August 5, 2026 08:38
@github-actions github-actions Bot added Area: Build system Arch: arm64 Issues related to ARM64 (64-bit) architecture Arch: x86_64 Issues related to the x86_64 architecture Size: S The size of the change in this PR is small Board: x86_64 labels Aug 5, 2026
Match the Application.mk install rule: keep the application attribute
symbols (nx_stacksize etc.) through strip as NX_KEEP does, and mark
the installed binaries executable, since ld -r output is not and
filesystem images built from bin/ refuse to exec.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
The CMake build compiled no ROMFS source, so kernel-mode
configurations (knsh_romfs) failed to link with undefined references
to romfs_img. Generate the ROMFS image from the applications in
<build>/bin with genromfs/xxd and compile it into the board library;
other configurations keep the empty stub.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
The CMake build does not need the manual export/import/mkromfsimg
steps: applications and the ROMFS image are generated by the normal
build. Document the CMake invocation and how to run the image.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
@raiden00pl
raiden00pl force-pushed the fix-x86_64-cmake-kernel-build branch from e6eb175 to 71de790 Compare August 5, 2026 09:55
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm64 Issues related to ARM64 (64-bit) architecture Arch: x86_64 Issues related to the x86_64 architecture Area: Build system Board: x86_64 Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants