Skip to content

feat(libkernel): support kern.sdk_version in sysctlbyname - #2902

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:carry/libkernel-sysctl-sdk-version
Oct 12, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:carry/libkernel-sysctl-sdk-version

Conversation

@oneandonlydean

@oneandonlydean oneandonlydean commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

What

Carries #2738 by @pushkarreddyy, which the intake check closed; the commit keeps its author. Rebased onto main 325e0a8 (conflicts with #3779 in SystemConfiguration.cpp and with #3760's entry in TechnicalDebt; every name, entry and test of main kept, kern.sdk_version placed after kern.rng_pseudo and before hw.ncpu and hw.physmem).

Capy Mobile (PPSA92280) has no absent imports but stops at start-up on main:

sysctlbyname_nid_postfix: unsupported name kern.sdk_version

sysctlbyname now answers kern.sdk_version with the 4-byte value 0x01000000 (1.00), the system software version sceKernelGetSystemSwVersion already reports on main; a write returns -1 with EPERM. Every other unsupported name still throws.

The sysctl is the system software version, major in byte 3 and minor in byte 2, in hex digits that read as decimal (13.60 is 0x1360xxxx): Capy Mobile, remote_lua_loader and the lapse payload read it that way. Capy Mobile only displays it. TechnicalDebt records these sources and that the console's firmware version is not modeled.

Tested

Linux (CachyOS, GCC 16.2.1), Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON, full build and libs, on main 325e0a8:

  • guest_system_configuration passes 3 of 3 runs; with SystemConfiguration.cpp reverted to main it aborts with sysctlbyname_nid_postfix: unsupported name kern.sdk_version.
  • ctest -R "guest_|kernel|sysctl|system_config": 299 of 299 pass on main and on the branch.
  • tools/check_conventions.py --base 325e0a8b passes.

Capy Mobile was not run here. @orishamir's run on Linux and Windows gets past the call and goes on to open /app0/games; @screamm ran an earlier head on Windows. Both runs predate this rebase.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude Code)

@screamm

screamm commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Windows validation of the current head 19d36ba7 merged onto main 56fb1b3b.

Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including the libs target.

  • guest_system_configuration passes 3/3 (--repeat until-fail:3).
  • ctest -j8 -E "^agc_|video_out": 387/388. The one failure, guest_avplayer, passes 3/3 when run alone and does not touch this change; it looks load-related.
  • With main's SystemConfiguration.cpp and this PR's test, the test aborts with sysctlbyname_nid_postfix: unsupported name kern.sdk_version, as the description says.

Validation run with Claude Code assistance.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for carrying this. Main blocker: the value.

  • SystemConfiguration.cpp:110: 0x01000000 (1.00) has no source. The PR text says it matches "PS5 baseline launch SDK formatting", but I found nothing in KytyPS5, shadPS4 or prospero-win that reports this sysctl, and nothing in the repo. A title that compares kern.sdk_version against a minimum would take its legacy path with 1.00, so this returns a plausible but wrong value where main threw.
  • To fix: use a value with evidence, e.g. the compiled SDK version of the loaded title if the loader already exposes it, or a number measured on a console / cited from a PS5 source. If neither exists, keep the throw and record the call site in "Unknown function info".
  • Please also show that Capy Mobile gets past this call (log from the run) so we know what the next step is; the unit test only pins the value itself.

The rest is fine: read-only EPERM, ENOMEM on a short buffer, size query, test fails without the change, TechnicalDebt line placed mid-section. Build and guest_system_configuration pass locally on Linux, and @screamm confirmed on Windows.

@orishamir

Copy link
Copy Markdown
Contributor

On the value: three public sources say what kern.sdk_version is and how it is read, none of them in the repo or in the three references named above.

  • The blocker title reads it only to display it. CapyMobile src/ps5/platform.c lines 64-71 (the source of the catalog's 0.5.0 build): firmware_text formats "%x.%02x" of bytes 3 and 2, with the comment Hex digits that read as the number: 0x13600007 is 13.60., prints nothing when the value is 0, and nothing compares it. With this PR the title shows "1.00" where a console shows its system software version; no code path of this title depends on the number.
  • PS5 and PS4 homebrew loaders read the same sysctl as the firmware version, with the same digit layout: remote_lua_loader misc.lua get_version ('%x.%02x' of bytes 3 and 2) and the lapse payload get_fwversion (byte 3 major, byte 2 minor). So the sysctl is the system software version in hex digits that read as decimal (13.60 is 0x1360xxxx), and 0x01000000 reads as 1.00 in that layout.
  • fpPS4 (ps4_libkernel.pas 509-520) implements sceKernelGetSystemSwVersion under the comment //sysctlbyname:kern.sdk_version and stands in with the title's compiled SDK version (sceKernelGetCompiledSdkVersion), formatted %2x.%03x.%03x. That is the first option in the review; main does not expose the compiled SDK version yet (git grep -i CompiledSdkVersion is empty), and feat(libkernel): implement sceKernelGetSystemSwVersion #2945 answers sceKernelGetSystemSwVersion with the same 0x01000000 / "01.000.000", so whichever value lands should be the same in both.

I have not run the title.

AI-assisted: yes (Claude Code Fable 5.1 xhigh)

@orishamir

Copy link
Copy Markdown
Contributor

The run log asked for above, on the catalog build of Capy Mobile (PPSA92280 v0.5.0, CapyMobile-00.005.000.zip, sha256 80b14507... as in the catalog record; eboot.bin and sce_module/libc.prx unwrapped from their fake-SELF containers, 14 program headers each). tools/import_audit.py on the relinked title: 179 imports, all implemented, none absent or stubbed, so this sysctlbyname throw is the only stop before the title's own code runs.

This PR no longer merges onto main (its three files conflict after #2945/#3218), so the "after" tree is main f60923b plus this PR's eight-line kern.sdk_version branch inserted into sysctlbyname_nid_postfix before the hw.ncpu check, nothing else.

Linux (WSL2 Ubuntu, GCC 13.3, Mesa 26.0.8 llvmpipe, relinker --registry, 30 s timeout):

  • main b6f649d: Vulkan device and swapchain created, sceKernelOpen /app0/saves/.probe, then
    [libc] unhandled exception 'St13runtime_error' thrown from 0x722b4b56e24f
    terminate called after throwing an instance of 'std::runtime_error'
      what():  sysctlbyname_nid_postfix: unsupported name kern.sdk_version
    
  • same build with libkernel rebuilt from main f60923b's SystemConfiguration.cpp plus the branch: runs for the whole 30 s (killed by the timeout), no exception; after the saves probe it starts a thread and opens /app0/games.

Windows (Windows 11, WinLibs GCC 15.2.0 r7, RTX 4080 driver 616.56, relinker --windows --windows-diagnostics --registry, 30 s timeout):

  • main f60923b: same path, swapchain 1484x835 on the RTX 4080, sceKernelOpen /app0/saves/.probe, then the same sysctlbyname_nid_postfix: unsupported name kern.sdk_version and FATAL: abort() (SIGABRT) after 10 s.
  • with the branch: runs for the whole 30 s (killed by the timeout), no exception, stderr only the two startup lines; after the saves probe it starts a thread and opens /app0/games, as on Linux.

So with any accepted value for kern.sdk_version the title gets past this call; what it does with the value is the display string from the sources above.

AI-assisted: yes (Claude Code Fable 5.1 xhigh)

@pushkarreddyy

Copy link
Copy Markdown
Contributor

Thank you @orishamir and @screamm for the thorough hardware validation and empirical verification logs on both Windows and Linux! Massive thanks as well to @oneandonlydean for carrying this forward and to @adriadam10 for the careful review.

With @orishamir's run logs proving that Capy Mobile (PPSA92280) successfully moves past sysctlbyname into /app0/games, all evidence and test requirements for kern.sdk_version are now complete.

Now that PR #2945 and #3218 have landed on main, PR #2902 just needs a quick rebase over current main to resolve the hunk in SystemConfiguration.cpp. Whenever convenient, @oneandonlydean or @adriadam10, could you please rebase and merge?

Also, as follow-ups ready for review and carry when convenient, we have three cleanly tested companion branches addressing open startup blockers:

@oneandonlydean

Copy link
Copy Markdown
Collaborator Author

Rebased onto main 0a8b1d3; kern.sdk_version now sits after kern.rng_pseudo (#3218), and the tests of #2945 and #3218 are kept.

  • Value: kept 0x01000000. The sysctl is the system software version, major in byte 3 and minor in byte 2 in hex digits that read as decimal (13.60 is 0x1360xxxx): Capy Mobile, remote_lua_loader and the lapse payload read it that way. So it is not the title's compiled SDK version, and 1.00 is what sceKernelGetSystemSwVersion reports on main since feat(libkernel): implement sceKernelGetSystemSwVersion #2945. The owner said 1.00 is fine as the default.
  • Source in the repo: the TechnicalDebt line now gives the layout with these three links and says the console's firmware version is not modeled.
  • Run log: orishamir's run on Linux and Windows gets past the call and goes on to open /app0/games; the title only displays the value.

A title that compares the version against a minimum would still see 1.00, as with sceKernelGetSystemSwVersion; making the version a runtime setting is a follow-up PR.

@oneandonlydean
oneandonlydean force-pushed the carry/libkernel-sysctl-sdk-version branch from d47180d to 726e773 Compare October 11, 2026 23:32
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 11, 2026
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#3764 docs/dev/TechnicalDebt.md L58-59
#3972 docs/dev/TechnicalDebt.md L58-60

@oneandonlydean
oneandonlydean merged commit c2fdb9c into boykopovar:main Oct 12, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants