Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:NRO

From ReverseEngineering.wiki
Format
Vendor libnx / switchbrew
Magic 4E 52 4F 30 ("NRO0") at offset 0x10
Extensions .nro
Endianness little
On this wiki Facts · Code · Notes · Topics

Nintendo Switch homebrew executable (.nro): a flat text/rodata/data image with a 0x10-byte start stub, a 0x70-byte header with magic NRO0 at offset 0x10, optionally followed by an ASET asset section holding the icon, NACP and RomFS.

Layout

See Fact:NRO/struct/NroHeader. Offset 0 holds a branch instruction, mod_offset (offset of the MOD0 header) and 8 padding bytes (NroStart). Three segments (text, rodata, data) are given as (file offset, size); the in-memory layout has them back to back, with bss after. build_id is 32 bytes.

elf2nro (switch-tools) sets the header word at 0x1C to a flags value (bit 0 is --alignedheader) and the word at 0x14 to 0; segment file offsets equal the ELF virtual addresses and the ASET asset offsets are relative to the ASET header (Fact:NRO/behavior/elf2nro output layout). The NRO0 header sits over bytes 0x10-0x7F of the first segment, where libnx's crt0 reserves space before its code at 0x80.

Asset section

Homebrew tools append an ASET section after the NRO (NROASSETHEADER_MAGIC 0x54455341, version 0) with (offset, size) u64 pairs for the icon (JPEG, 256x256), the Format:NACP and a RomFS. See Fact:NRO/struct/NroAssetHeader.

MOD0

The mod_offset points to a MOD0 header (see Format:MOD0 and Fact:NRO/struct/MOD0 header) that locates .dynamic, bss and .eh_frame_hdr; in libnx builds the crt0 stub contains the ASCII string HOMEBREW right after the offset (switch_crt0.s). The same MOD0 mechanism is used by Format:NSO.

Related

Platform:Nintendo Switch, Library:libnx.

Code & repositories

  • https://github.com/switchbrew/libnx @ 20cbcfd90567f7bf84df7725f27e345e2164fa6b · license: ISC
    libnx: nx/include/switch/nro.h (NRO), nacp.h (NACP), nx/source/runtime/dynamic.c (MOD0), switch_crt0.s (entry convention).
    Tested on: source read, not run: source read · checked 2026-10-18; last activity 2026-10-14