返回资讯中心
外部精选
软件工程
#开发者实时流

开发者将Switch的Horizon OS裸机移植到骁龙865手机

来源标题:Booting Nintendo Switch's Horizon OS Bare-Metal on Snapdragon 865

一个独立研究项目成功在三星Galaxy S20 FE 5G(骁龙865)上裸机启动任天堂Switch的Horizon OS 20.0.1(Atmosphère 1.8.0 + Mesosphere EL1微内核),可渲染qlaunch主菜单和系统设置并支持触摸输入。项目不包含任何任天堂版权文件,用户需自备从自有Switch提取的固件。目前状态为实验性主动适配中,构建版本为#104。

Hacker News 最新Hugozz262026/11/30 · 今天20 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Legal Disclaimer & Bring Your Own Files (BYOF): This repository is an independent, non-commercial ARM64 operating systems and hardware interoperability research project. It contains no copyrighted Nintendo binaries, firmware dumps, system titles, fonts, or cryptographic keys (prod.keys, title.keys, .nso, .nca, .nsp, .romfs). To build and run this project, you must provide your own firmware files legally extracted from a Nintendo Switch console you own.

Status: Experimental / Active Bring-Up (Build #104) — Nintendo Switch Horizon OS 20.0.1 (Atmosphère 1.8.0 + Mesosphere EL1 microkernel) booting bare-metal directly on Qualcomm Snapdragon 865 (SM8250), rendering the interactive qlaunch Home Menu and System Settings (including live Light/Dark theme switching) with real nn::font text and physical I2C touchscreen input.

Build #104 Screenshot (System Settings + Live Kernel Log + Virtual A/B Bar):

This project ports Horizon OS 20.0.1 bare-metal (no Android, no Linux, no hypervisor) onto a Samsung Galaxy S20 FE 5G (Qualcomm Snapdragon 865 / SM8250). A custom Mesosphere EL1 microkernel replaces the stock Linux kernel inside boot.img, boots directly from the Qualcomm bootloader (ABL), brings up display, timers, GICv3 interrupts, and embedded Stratosphere sysmodules, and launches retail qlaunch (0100000000001000).

Component Specification

Device Samsung Galaxy S20 FE 5G (SM8250, Qualcomm Snapdragon 865)

Display AMOLED 1080x2400 32bpp BGRA framebuffer @ 0x9C000000

Switch Viewport Top 16:9 region 1080x608 (Y = 56..663), live kernel/service log console below, and virtual A/B touch bar at the bottom

Touchscreen Samsung Zinitix ZT7650 (0x20) driven via SM8250 North TLMM bit-bang I2C (GPIO 12/13, IRQ GPIO 15, AVDD GPIO 92)

Boot Partition /dev/block/by-name/boot (/dev/block/sda23) — flashed via TWRP (recovery on /dev/block/sda24 is never touched)

Architecture

flowchart TD ABL["Qualcomm ABL Bootloader"] --> WRAP["ARM64 Image Header + Mesosphere EL1 Kernel"] WRAP --> KIP["Embedded KIPs: loader, sm, pm, boot, spl, fs"] KIP --> CORE["User-Built stratosphere_core.romfs (Sysmodules + nvservices + qlaunch)"] CORE --> NV["nvservices (0100000000000019)"] NV --> HAL["Tegra X1 Maxwell 3D / MME / DMA / 2D -> SM8250 Software HAL"] NV --> HID["Native SM8250 HID / HID:SYS / HID:DBG + ZT7650 Touch (Core 1)"] NV --> PLU["pl:u Shared Font Server (512 KB SharedMemory, Open-Source TTF)"] HAL --> FB["SM8250 AMOLED Framebuffer (0x9C000000, 1080x608 Viewport)"] CORE --> QL["Retail qlaunch (0100000000001000) — Home Menu & System Settings"] QL <--> NV

Loading

What Works Today (Build #104)

Bare-Metal Boot & Microkernel: Mesosphere EL1 boots directly on SM8250 from boot.img, initializes the MMU, GICv3, and Kryo 585 cores, brings up loader, sm, pm, boot, spl, fs, and launches boot2 + qlaunch.

Interactive Home Menu & System Settings: OOBE/starter lock bypassed in qlaunch (0x9e6e44 -> b 0x9e6e80 and 0x9ef618 -> mov x8, x9), booting straight into StSa (Home Menu) with full touch navigation into System Settings and submenus (including live Basic Light / Basic Dark theme switching).

Live Touchscreen Input: Native Zinitix ZT7650 I2C driver running on a dedicated 60 Hz thread on Core 1 (nvservices_main.cpp + nvservices_hid.cpp), feeding HidSharedMemory (touchscreen.lifo + Handheld npad + virtual A/B buttons) with tap retention so quick taps are never dropped.

Tegra X1 Maxwell GPU Translation Layer (nvservices_hal.cpp):

Executes NVN pushbuffers, GPFIFO submissions, Maxwell MME macros, syncpoints, semaphores, DMA copies, 2D blits, and 3D draws.

Decodes Tegra Block-Linear GOB surfaces (bit-shift fast path) and compressed/uncompressed textures (RGBA8, RG8, R8/R8_UNORM, BC1, BC3, BC4, BC5).

Renders nn::ui2d panes and icons (1x1 sharp for small icons/text, 2x2 fast path for large background textures) at ~145 ms/frame (non-blit).

Real Shared Font (pl:u) & nn::font Instanced Text Rendering:

nvservices_hid.cpp serves pl:u (including HOS 20.0.1 cmd 6 GetSharedFontInOrderOfPriority) backed by a 512 KB SharedMemory font buffer.

qlaunch runs FreeType2 + nn::font::TextureCache + LibMessageStudio (1024x6144 R8_UNORM glyph atlas).

Reverse-engineered qlaunch's embedded BNSH #0 (font_BuildinShader_Nvn_Binary) Maxwell shader: implemented full SSBO instanced text rendering (PerCharacterParamBlock at VS_CB0[0x110..0x114], 64 bytes/glyph, 0x0586 INSTANCE_NEXT bit 26, linear/pitch R8_UNORM atlas sampling) taking ~5 ms for 75 characters.

Known Limitations (v0.1)

Software Framebuffer Scanout: BlitSurfaceToViewport currently runs on CPU over Device-mapped AMOLED memory (~152 ms). Hardware acceleration on the Adreno 650 is planned.

Extended System Icon Glyphs: Standard Latin text renders cleanly; proprietary FontNintendoExtended Private Use Area (0xE000+) glyphs are not redistributed in this repository and require user-supplied firmware files.

Unimplemented Subsystems: Wi-Fi, Bluetooth, audio, and commercial 3D game rendering are not supported in this bring-up release.

Key Project Layout

Path Purpose

Atmosphere/mesosphere/ Custom SM8250 Mesosphere EL1 kernel and kernel_ldr

Atmosphere/stratosphere/nvservices/ Custom nvservices sysmodule (nvservices_hal.cpp, nvservices_hid.cpp, nvservices_main.cpp, nvservices_ipc.cpp, nvservices.json)

scripts/patch_qlaunch.py Local qlaunch binary patcher (OOBE bypass, pl:u 512 KB map, etc. — requires user-supplied firmware)

scripts/repack_and_zip.py Wraps mesosphere.bin into an ARM64 Image and repacks user-supplied boot_stock.img into out/horizon-mesosphere-boot.img

docs/ Technical deep-dives (SM8250 memory map, IPC/CMIF reverse engineering, Maxwell HAL, Mesosphere bring-up)

Build & Safe Flash Workflow

  1. Prerequisites (User-Supplied)

Stock boot_stock.img from your Samsung Galaxy S20 FE 5G (SM-G781B).

Firmware 20.0.1 files extracted from your own Nintendo Switch console (placed in the gitignored firmware_input/ directory).

WSL2 + devkitPro (devkitA64) toolchain for building Mesosphere and nvservices.

  1. Surgical Builds (-j2)

Only the modified component is rebuilt to keep iteration fast (~15s–90s):

python ./scripts/repack_and_zip.py --boot-only

  1. Safe Flashing via TWRP (ADB)

Caution

NEVER flash /dev/block/sda24 (recovery / TWRP) and NEVER run adb reboot. Always verify /dev/block/by-name/boot resolves to /dev/block/sda23, compute the exact 4096-byte block count dynamically, verify byte-for-byte SHA-256 readback, clean up /tmp/boot.img, and reboot manually in TWRP (Reboot -> System).

$serial = "<YOUR_DEVICE_SERIAL>" $img = "./out/horizon-mesosphere-boot.img" $fi = Get-Item $img $blocks = [int]($fi.Length / 4096) $localSha = (Get-FileHash $img -Algorithm SHA256).Hash.ToLower() $target = (adb -s $serial shell "readlink -f /dev/block/by-name/boot").Trim() if ($target -ne "/dev/block/sda23") { throw "ABORT: unexpected boot target $target" }

adb -s $serial push $img /tmp/boot.img adb -s $serial shell "dd if=/tmp/boot.img of=/dev/block/by-name/boot bs=4096 conv=fsync && sync" $devSha = ((adb -s $serial shell "dd if=/dev/block/by-name/boot bs=4096 count=$blocks 2>/dev/null | sha256sum").Trim() -split '\s+')[0].ToLower() adb -s $serial shell "rm -f /tmp/boot.img" if ($devSha -ne $localSha) { throw "SHA256 MISMATCH!" }

Roadmap

UI Scanout Optimization: Optimize BlitSurfaceToViewport via Write-Combining / dirty-rectangle updates for smoother 30–60 FPS UI rendering.

Adreno 650 Hardware Acceleration: Bring up KGSL / bare-metal PM4 command submission to offload NVN/Maxwell 3D rendering from CPU to GPU.

Additional Peripherals: Audio, Wi-Fi/Bluetooth, and USB/gamepad input.

Homebrew Support: Run open-source .nro homebrew applications (hbmenu) and technical demos natively.

Author & Contact

Developed by Hugo de Souza Crispim (@hugozz26), a 16-year-old systems & reverse-engineering student from Brasília, Brazil.

Built on top of the open-source Atmosphère (Mesosphere / Stratosphere) project by SciresM and contributors, licensed under GPLv2.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →