Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Firmtool 3DS: Difference between revisions

From GameBrew
No edit summary
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Infobox-3DS-Homebrews
{{Infobox 3DS Homebrews
| title = firmtool
|title=firmtool
| image = https://dlhb.gamebrew.org/3dshomebrew/firmtool.jpg|250px
|image=Firmtool3ds3.png
| type = PC Utilities
|description=A tool to parse, extract, and builds 3DS firmware files.
| version=v1.4
|author=TuxSH
| lastupdated = 2020/12/27
|lastupdated=2020/12/27
| licence = Mixed
|type=File Operation
| author = TuxSH
|version=1.4
| website = https://github.com/TuxSH/firmtool
|license=Mixed
| download = https://dlhb.gamebrew.org/3dshomebrew/firmtool.rar
|download=https://dlhb.gamebrew.org/3dshomebrews/firmtool_1.4.zip
| source = https://github.com/TuxSH/firmtool
|website=https://github.com/TuxSH/firmtool
|source=https://github.com/TuxSH/firmtool
}}
}}
<youtube>hD3Tk_uGZKM&t=4s</youtube>
firmtool is a tool to parse, extract, and build 3DS firmware files.


== firmtool ==
Compatible with Python >= 3.2 and Python >= 2.7.


A tool to parse, extract, and build 3DS firmware files.
==Installation==
For Windows users:
* Install Python >= 3.4 using the installer from the official Python website.
* Make sure that <code>pip</code> is in <code>PATH</code>.


Compatible with Python &gt;= 3.2 and Python &gt;= 2.7.
For *ix users:
* Install the corresponding packages, they should be named <code>python</code>, <code>python-setuptools</code>, <code>python-pip</code> or similar.  
* You may need to upgrade <code>pip</code>.


== Installation ==
The preferred way to install/update firmtool:
 
* Run <code>pip install -U git+<nowiki>https://github.com/TuxSH/firmtool.git</nowiki></code> directly (with the appropriate permissions).
On Windows, install Python &gt;= 3.4 using the installer provided by the official Python website. Make sure that <code>pip</code> is in <code>PATH</code>.
* Although <code>python setup.py install</code> should work as well.
 
On *ix, install the corresponding packages, they should be named <code>python</code>, <code>python-setuptools</code>, <code>python-pip</code> or similar. You may need to upgrade <code>pip</code>.
 
The preferred way to install and update firmtool is to run <code>pip install -U git+https://github.com/TuxSH/firmtool.git</code> directly (with the appropriate permissions), although <code>python setup.py install</code> should work as well.


<code>firmtool</code> depends on <code>pycryptodome</code> (either as <code>Crypto</code> or <code>Cryptodome</code>), old <code>pycrypto</code> will not work.
<code>firmtool</code> depends on <code>pycryptodome</code> (either as <code>Crypto</code> or <code>Cryptodome</code>), old <code>pycrypto</code> will not work.


== Usage ==
==User guide==
 
Showing information about a firmware binary:
Showing information about a firmware binary:
<pre>firmtool parse the.firm </pre>


<pre>firmtool parse the.firm </pre>
Extracting a firmware binary, with decryption of the arm9bin and extraction of the k11 modules as well as Process9 (by default type <code>nand-retail</code> is assumed, if it's not the case use <code>-t</code>):
Extracting a firmware binary, with decryption of the arm9bin and extraction of the k11 modules as well as Process9 (by default type <code>nand-retail</code> is assumed, if it's not the case use <code>-t</code>):
<pre>firmtool extract -m native.firm </pre>


<pre>firmtool extract -m native.firm </pre>
Same as above plus using <code>ctrtool</code> and the shell to extract the code of each module
Same as above plus using <code>ctrtool</code> and the shell to extract the code of each module
<syntaxhighlight lang="bash">#!/bin/bash
<syntaxhighlight lang="bash">#!/bin/bash
firmtool extract -m native.firm
firmtool extract -m native.firm
cd modules
cd modules
Line 58: Line 57:
done
done
cd .. </syntaxhighlight>
cd .. </syntaxhighlight>
Building a firmware binary (for example with two sections, an Arm9 and and Arm11 one, with the entrypoints at the start of the respective sections):
Building a firmware binary (for example with two sections, an Arm9 and and Arm11 one, with the entrypoints at the start of the respective sections):
<syntaxhighlight lang="bash">firmtool build test.firm -n 0x08006800 -e 0x1FF80000 -D arm9.bin arm11.bin -A 0x08006800 0x1FF80000 -C NDMA XDMA </syntaxhighlight>


<syntaxhighlight lang="bash">firmtool build test.firm -n 0x08006800 -e 0x1FF80000 -D arm9.bin arm11.bin -A 0x08006800 0x1FF80000 -C NDMA XDMA </syntaxhighlight>
Building a firmware binary from an arm9loaderhax.bin payload which doesn't use the Arm11, with a loader supporting the Arm11 entrypoint being 0:
Building a firmware binary from an arm9loaderhax.bin payload which doesn't use the Arm11, with a loader supporting the Arm11 entrypoint being 0:
<syntaxhighlight lang="bash">firmtool build test.firm -n 0x23F00000 -e 0 -D arm9loaderhax.bin -A 0x23F00000 -C NDMA </syntaxhighlight>


<syntaxhighlight lang="bash">firmtool build test.firm -n 0x23F00000 -e 0 -D arm9loaderhax.bin -A 0x23F00000 -C NDMA </syntaxhighlight>
You may also use ELF files, in this case the entrypoint for the given processor is deduced automatically, when applicable (using the first NDMA FIRM section for arm9, and the first XDMA FIRM section for arm11), as well as the addresses of such FIRM sections (using the first loadable ELF sections, and assuming contiguity).
You may also use ELF files, in this case the entrypoint for the given processor is deduced automatically, when applicable (using the first NDMA FIRM section for arm9, and the first XDMA FIRM section for arm11), as well as the addresses of such FIRM sections (using the first loadable ELF sections, and assuming contiguity).
==External links==
* GitHub - https://github.com/TuxSH/firmtool

Latest revision as of 11:14, 22 Haziran 2024

firmtool
Firmtool3ds3.png
General
AuthorTuxSH
TypeFile Operation
Version1.4
LicenseMixed
Last Updated2020/12/27
Links
Download
Website
Source

firmtool is a tool to parse, extract, and build 3DS firmware files.

Compatible with Python >= 3.2 and Python >= 2.7.

Installation

For Windows users:

  • Install Python >= 3.4 using the installer from the official Python website.
  • Make sure that pip is in PATH.

For *ix users:

  • Install the corresponding packages, they should be named python, python-setuptools, python-pip or similar.
  • You may need to upgrade pip.

The preferred way to install/update firmtool:

  • Run pip install -U git+https://github.com/TuxSH/firmtool.git directly (with the appropriate permissions).
  • Although python setup.py install should work as well.

firmtool depends on pycryptodome (either as Crypto or Cryptodome), old pycrypto will not work.

User guide

Showing information about a firmware binary:

firmtool parse the.firm 

Extracting a firmware binary, with decryption of the arm9bin and extraction of the k11 modules as well as Process9 (by default type nand-retail is assumed, if it's not the case use -t):

firmtool extract -m native.firm 

Same as above plus using ctrtool and the shell to extract the code of each module

#!/bin/bash
firmtool extract -m native.firm
cd modules
for f in *.cxi
do
ctrtool -p --exefs=exefs.bin $f

if [ $f = "Process9.cxi" ]
then
ctrtool -t exefs --exefsdir=exefs exefs.bin > /dev/null
else
ctrtool -t exefs --exefsdir=exefs --decompresscode exefs.bin > /dev/null
fi

cp exefs/code.bin $(basename -s .cxi $f).bin
rm -rf exefs
done
cd ..

Building a firmware binary (for example with two sections, an Arm9 and and Arm11 one, with the entrypoints at the start of the respective sections):

firmtool build test.firm -n 0x08006800 -e 0x1FF80000 -D arm9.bin arm11.bin -A 0x08006800 0x1FF80000 -C NDMA XDMA

Building a firmware binary from an arm9loaderhax.bin payload which doesn't use the Arm11, with a loader supporting the Arm11 entrypoint being 0:

firmtool build test.firm -n 0x23F00000 -e 0 -D arm9loaderhax.bin -A 0x23F00000 -C NDMA

You may also use ELF files, in this case the entrypoint for the given processor is deduced automatically, when applicable (using the first NDMA FIRM section for arm9, and the first XDMA FIRM section for arm11), as well as the addresses of such FIRM sections (using the first loadable ELF sections, and assuming contiguity).

External links

Advertising: