Makerom
makerom is a tool which can be used to create NCCH, CCI, and CIA files.
makerom | |
General | |
---|---|
Author(s) | 3dsguy |
Type | PC utility |
Version | 0.13 |
Links | |
Download | |
Source |
Format Overviews
NCCH
The native format storing code binaries and data archives for the 3DS is NCCH. NCCH files are comprised of:
- code/exheader/plainregion (used for code execution) (plainregion just lists included SDK library add-ons)
- icon (app title text, icon, homemenu settings, see here
- banner (cbmd + cwav, i.e. the upper screen banner/sound shown on the homemenu)
- logo (the splash screen displayed after an application is launched from the homemenu)
- romfs (read-only filesystem used to store resources)
Typical uses for NCCH files include:
- Executable image (code+exheader+icon+banner+logo+romfs)
- e-Manual archive (accessed from homemenu) (romfs)
- DLP child CIA archive (accessed from application) (romfs)
- Update Data archive (romfs)
- Standalone data archive (romfs)
- DLC index archive (icon+romfs)
- DLC archive (romfs)
CCI
The native format for gamecard images is CCI and is a NCCH container format. CCI files are limited to containing 8 NCCH files, and can contain NCCH files for applications titles only.
NCCH configuration for CCI
NCCH | Required | Index |
---|---|---|
Executable image | YES | 0 |
e-Manual archive | NO | 1 |
DLP child CIA archive | NO | 2 |
Update Data archive | NO | 7 |
CIA
The native format for packaging NCCH files for install is CIA, which is also a NCCH container format. CIA files are limited to containing 65535 NCCH files and can be used to contain NCCH files for any title type. CIA files also contain data used by the 3DS for general title management and DRM. Installing custom CIA files on a 3DS which also uses eShop/SysUpdates is unwise as conflicts will likely occur.
NCCH configurations for CIA
Applications (Application/DlpChild/Demo/Patch/SystemApplication):
NCCH | Required | Index |
---|---|---|
Executable image | YES | 0 |
e-Manual archive | NO | 1 |
DLP child CIA archive | NO | 2 |
System Applet/Module:
NCCH | Required | Index |
---|---|---|
Executable image | YES | 0 |
System Data Archives:
NCCH | Required | Index |
---|---|---|
Data archive | YES | 0 |
DLC:
The number of DLC data archives in DLC varies for each DLC.
NCCH | Required | Index |
---|---|---|
DLC index archive | YES | 0 |
DLC data archive | YES | Varies |
Using Makerom
Command line
Since CCI and CIA are NCCH containers, makerom was built so CXIs could be built stand alone or straight into a container format. It is also possible rebuild CXIs from an ELF file. As a result there are many combinations which can be used; for simplicity, specific functions will be explained by breaking them up into argument groups:
Creating CXIs from scratch:
-elf <elf path> -rsf <rsf path> [-icon <icon path> -banner <banner path>]
Rebuilding CXIs:
-code <decompressed exefs .code> -exheader <exheader from original CXI> -rsf <rsf path> [-icon <icon path> -banner <banner path> -romfs <cleartext romfs binary>]
Creating CFAs:
-f cfa -rsf <rsf path> [-icon <icon path> -romfs <romfs binary>]
Creating CCIs:
-f cci [-content <path>:<index> ...]
Creating CIAs:
-f cia [-content <path>:<index>:<id> ...]
Using Desc presets:
-desc <app type>:<firm version>
- 'app type' can be SDApp / ECApp / Demo / DlpChild
- 'firm version' is the target kernel version minor for the intended 3DS system.
Examples: Create a CCI, using a manual CFA, and a desc preset:
makerom -f cci -elf homebrew.elf -rsf app.rsf -desc sdapp:33 -icon homebrew.icn -banner homebrew.bnr -content manual.cfa:1 -o homebrew.cci
Create a CIA using an already built application CXI and manual CFA:
makerom -f cia -content homebrew.cxi:0:0 -content manual.cfa:1:1 -o homebrew.cia
Rebuild a CXI:
makerom -code code.bin -exheader exheader.bin -icon icon.bin -banner banner.bin -romfs romfs.bin -rsf app.rsf -desc sdapp:33 -o rebuild.cxi
Creating RSF files
Inspired by Nintendo's format for their makerom, a yaml configuration file is required for creating NCCH files. CIA/CCI can be created without using a RSF file, but default settings will be used.
For CXI, RSF files can be used to specify permissions, and access control settings. Makerom can use default settings by use of the "-desc" option, which removes the requirement for specifying them in the RSF file.
Sample RSF to be used with "-desc": download
Sample RSF to be used without "-desc": download
Creating ELF files
DevKitARM used in conjunction with ctrulib can create ELF files compatible with makerom, provided they are linked with this linker script, and striped.
ELF files that are created using the official SDK are also supported by makerom.
Compiling Source
For Windows a MinGW/MSYS build setup is required.
For Linux, gcc/g++/make must be installed.
All additional libraries used by makerom (polarssl/libyaml) are included in the source, and are linked statically.
Issues
- RomFS hasn't been completely implemented (but valid pre-built RomFS can be used as substitute)