Editing SELF File Format
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
ORBIS SELFs from PS4 have a somewhat different structure from the ones we see on vita and ps3. | |||
The structure is documented as follows: | |||
= SELF Header Structure = | = SELF Header Structure = | ||
Line 10: | Line 11: | ||
| 0x4 || 4 || Unknown || Always 00 01 01 12 | | 0x4 || 4 || Unknown || Always 00 01 01 12 | ||
|- | |- | ||
| 0x8 || 1 || | | 0x8 || 1 || Unknown || Always 1 | ||
|- | |- | ||
| 0x9 || 1 || | | 0x9 || 1 || Key Type || 0xC SK, 0xF SL, 0xE SM, 0x8 EBOOT and ELF and SELF, 0x9 SPRX and SDLL and SEXE | ||
|- | |- | ||
| 0xA || 2 || Padding || | | 0xA || 2 || Padding || | ||
|- | |- | ||
| 0xC || 2 || | | 0xC || 2 || MetaData Offset || | ||
|- | |- | ||
| 0xE || 2 || | | 0xE || 2 || MetaData Size || | ||
|- | |- | ||
| 0x10 || 4 || | | 0x10 || 4 || Size of SELF || | ||
|- | |- | ||
| 0x14 || 4 || Padding || | | 0x14 || 4 || Padding || | ||
|- | |- | ||
| 0x18 || 2 || Number of Segments || 1 | | 0x18 || 2 || Number of Segments || 1 SK, 2 SL and Modules, 4 SK Elfs, 6 .selfs, 2 .sdll, 6 .sprx, 6 ShellCore, 6 eboot.bin, 2 sexe | ||
|- | |- | ||
| 0x1A || 2 || Unknown || Always 0x22 | | 0x1A || 2 || Unknown || Always 0x22 | ||
|- | |- | ||
| 0x1C || 4 || Padding || | | 0x1C || 4 || Padding || | ||
|- | |||
|} | |} | ||
== | == Self Segment Structure == | ||
Depending on the number of segments, at 0x20 the following structure follows and presents a size multiple of 0x20. | |||
Depending on the number of segments, at | |||
<pre> | <pre> | ||
typedef struct { | typedef struct | ||
unsigned | { | ||
unsigned short unknown_1; | |||
unsigned short unknown_2; | |||
unsigned int padding; | |||
unsigned long long offset; | unsigned long long offset; | ||
unsigned long long encrypted_compressed_size | unsigned long long encrypted_compressed_size | ||
unsigned long long decrypted_decompressed_size; | unsigned long long decrypted_decompressed_size ; | ||
} SEGMENT_TABLE; | } SEGMENT_TABLE; | ||
</pre> | </pre> | ||
Line 89: | Line 53: | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ ELF header | |+ ELF header<ref>{{cite web|url=http://www.sco.com/developers/gabi/2000-07-17/ch4.eheader.html |title=ELF Header |publisher=Sco.com |date=July 2000 |access-date=2014-02-07}}</ref> | ||
|- | |- | ||
! colspan="2" | Offset!! colspan="2" | Size (bytes) !! rowspan="2" | Field !! rowspan="2" | Purpose | ! colspan="2" | Offset!! colspan="2" | Size (bytes) !! rowspan="2" | Field !! rowspan="2" | Purpose | ||
Line 147: | Line 111: | ||
|0x11||[[CloudABI]] | |0x11||[[CloudABI]] | ||
|} | |} | ||
It is often set to <code>0</code> regardless of the target platform. | |||
|- | |- | ||
| colspan="2" | 0x08 || colspan="2" | 1 || <tt>e_ident[EI_ABIVERSION]</tt> | | colspan="2" | 0x08 || colspan="2" | 1 || <tt>e_ident[EI_ABIVERSION]</tt> | ||
|Further specifies the ABI version. Its interpretation depends on the target ABI. Linux kernel (after at least 2.6) has no definition of it. In that case, offset and size of EI_PAD are <code>8</code>. | |Further specifies the ABI version. Its interpretation depends on the target ABI. Linux kernel (after at least 2.6) has no definition of it.<ref>{{cite web|url=http://lxr.linux.no/linux+v2.6.11/include/linux/elf.h#L380|title=LXR linux/include/linux/elf.h|work=linux.no|access-date=27 April 2015}}</ref> In that case, offset and size of EI_PAD are <code>8</code>. | ||
|- | |- | ||
| colspan="2" | 0x09 || colspan="2" | 7 || <tt>e_ident[EI_PAD]</tt> | | colspan="2" | 0x09 || colspan="2" | 7 || <tt>e_ident[EI_PAD]</tt> | ||
| | |currently unused | ||
|- | |- | ||
| colspan="2" | 0x10 || colspan="2" | 2 || <tt>e_type</tt> | | colspan="2" | 0x10 || colspan="2" | 2 || <tt>e_type</tt> | ||
Line 160: | Line 123: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
!Value!!Type | !Value!!Type | ||
|- | |- | ||
| | |0x00||ET_NONE | ||
|- | |- | ||
| | |0x01||ET_REL | ||
|- | |- | ||
| | |0x02||ET_EXEC | ||
|- | |- | ||
| | |0x03||ET_DYN | ||
|- | |- | ||
| | |0x04||ET_CORE | ||
|- | |- | ||
| | |0xfe00||ET_LOOS | ||
|- | |- | ||
| | |0xfeff||ET_HIOS | ||
|- | |- | ||
| | |0xff00||ET_LOPROC | ||
|- | |- | ||
|0xffff||ET_HIPROC | |||
|0xffff||ET_HIPROC | |||
|} | |} | ||
|- | |- | ||
Line 256: | Line 213: | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ Program header | |+ Program header<ref>{{cite web|url=http://www.sco.com/developers/gabi/2000-07-17/ch5.pheader.html |title=Program Header |publisher=Sco.com |date=July 2000 |access-date=2017-04-05}}</ref> | ||
|- | |- | ||
! colspan="2" | Offset!! colspan="2" | Size (bytes) !! rowspan="2" | Field !! rowspan="2" | Purpose | ! colspan="2" | Offset!! colspan="2" | Size (bytes) !! rowspan="2" | Field !! rowspan="2" | Purpose | ||
Line 321: | Line 278: | ||
|} | |} | ||
= | = SCE Special = | ||
Just before the start of the metadata a special section exists which contains the following: | |||
{| class="wikitable" | {| class="wikitable" | ||
! Offset !! Size !! Description !! Notes | ! Offset !! Size !! Description !! Notes | ||
|- | |- | ||
| 0 || | | 0 || 0x8 || AuthID || | ||
|- | |- | ||
| | | 0x8 || 0x8 || KeyType || | ||
|- | |- | ||
| | | 0x10 || 0x8 || Version_1 || | ||
|- | |- | ||
| | | 0x18 || 0x8 || Version_2 || | ||
|- | |- | ||
| | | N.A/0x20 || 0x20 || Content ID || Only exists if the self is NPDRM | ||
|- | |- | ||
| | | 0x20/0x40 || 0x20 || SHA256SUM || | ||
|- | |- | ||
|} | |} | ||
= Footer Signature | = Footer Signature (Extra) = | ||
Additionally, at the bottom, there is likely a footer signature as well as some extra data (size 0x4D bytes) | |||