http://www.psdevwiki.com/psp/api.php?action=feedcontributions&user=SocraticBliss&feedformat=atom PSP Developer wiki - User contributions [en] 2024-03-28T11:31:11Z User contributions MediaWiki 1.39.6 http://www.psdevwiki.com/psp/index.php?title=Initial_Program_Loader&diff=10580 Initial Program Loader 2020-06-22T19:03:07Z <p>SocraticBliss: </p> <hr /> <div>Initial Program Loader, abbreviated as IPL, is a PSP program that runs on boot and loads Kernel. IPL is loaded by [[PRE-IPL]]. IPL can be stored either on the NAND or on a [[Magic Memory Stick]], depending on the PRE-IPL code and if a [[JigKick Battery]] is inserted or not.<br /> <br /> = Tools =<br /> <br /> == Dumper ==<br /> <br /> [https://github.com/KanadeEngel/PSP/tree/master/NAND-IPL-DUMPER NAND-IPL-DUMPER by KanadeEngel]<br /> <br /> == Decrypter / Encrypter ==<br /> <br /> [https://github.com/zecoxao/ipltool ipltool by zecoxao and others]<br /> <br /> == IPL SDK ==<br /> <br /> * [https://github.com/mathieulh/PSP_IPL_SDK PSP_IPL_SDK by mathieulh]<br /> * [https://github.com/DaveeFTW/iplsdk iplsdk by davee]<br /> * [https://www.brewology.com/downloads/download.php?id=10768&amp;mcid=1 PSP-IPL-SDK Rev.0.5 (2007.10.9)]<br /> <br /> == Bruteforce forger ==<br /> <br /> [https://github.com/mathieulh/Kirk-Bruteforce Kirk-Bruteforce by Team C+D]<br /> <br /> = Location =<br /> <br /> = Structure =<br /> <br /> == Encrypted form ==<br /> <br /> IPL is divided into chunks of 0x1000 bytes, the size of the buffer used at address 0xBFD00000 where they are decrypted. The IPL blocks are standard KIRK cmd 1 blocks and passed directly to [[KIRK Crypto Engine]] for decryption.<br /> <br /> == Decrypted form ==<br /> <br /> === Retail ===<br /> <br /> The decrypted IPL is composed of 3 parts: Part1 - the 'loader', Part2 - 'main.bin', and Part3 - the 'payload'.<br /> <br /> Part1 is plaintext MIPS code, Part2 is gzip compressed, and Part3 is again encrypted (from 2.60 onwards, parts 2 &amp; 3 are further encrypted again).<br /> <br /> === Prototype 0.4.0-0.6.0 (23-07-2004 or older) ===<br /> <br /> The decrypted IPL only contains the 'payload'<br /> <br /> = IPL Boot Sequence =<br /> <br /> == Part1 IPL (the loader) ==<br /> <br /> One of the first things Part1 IPL does is reset the main CPU.<br /> <br /> After reset the PRE-IPL mask ROM device is no longer mapped to memory at all (the 0x1FC00000 address range is then remapped to the 4KB RAM mentioned above to be used for the ME reset vector). This is why the PRE-IPL is no longer accessible once the IPL has booted.<br /> <br /> Part1 IPL does some very basic hardware inits and decompresses the gzipped Part2 IPL (main.bin) to address 0x04000000 (still in EDRAM).<br /> <br /> Part1 IPL then jumps to the entry address of main.bin (0x04000000) to initialize the hardware.<br /> <br /> == Part2 IPL (main.bin) ==<br /> <br /> Part2 IPL (main.bin) is responsible for initializing the PSP hardware.<br /> <br /> It has copies of its own driver modules similar to the drivers found in the firmware (including: sceNAND_Driver, sceDDR_Driver, sceIdStorage_Service, sceSYSREG_Driver, sceSYSCON_Driver, sceGPIO_Driver, sceClockgen_Driver, &amp; sceI2C_Driver). Some of the initialisation of the hardware depends on data stored in IDStorage leaves (for example leaves 4, 5, 6). Note this is where TA-082 / TA-086 motherboards 'brick' on 1.50 firmware. The clockgen hardware was changed on TA-082 / TA-086 motherboards so the functions used to initialize it does not recognise the new hardware. And because part of the initialization depends on data stored in leaf 5, simply by invalidating leaf 5 (by corrupting the header), the initialization is skipped allowing the firmware to continue to boot. See [https://psp.brewology.com/downloads/download.php?id=6454 IdRepair by codes02].<br /> <br /> After initializing the hardware (including the DDR RAM), Part2 IPL decrypts Part3 IPL (the payload) and loads it to address 0x08400000 (which is located in normal DDR RAM now that it has been initialised).<br /> <br /> It then jumps to the entry address of the Part3 IPL (0x08400000) to boot the firmware.<br /> <br /> == Part3 IPL (the payload) ==<br /> <br /> TODO<br /> <br /> = Custom IPL =<br /> <br /> It is possible to load a custom IPL by either:<br /> * exploiting PRE-IPL to run unsigned IPL (never done)<br /> * crafting a fake IPL using bruteforce (since 2007 thanks to [[Prometheus Project]])<br /> * crafting a valid encrypted and signed IPL using recovered keys (since 2018 thanks to PS3 hacks and mathieulh)<br /> <br /> See [[PRE-IPL]] and [[Pandora]].<br /> <br /> = See also =<br /> <br /> * [https://web.archive.org/web/20090206152144/http://dark-alex.org/forum/viewtopic.php?f=44&amp;t=1194&amp;start=0 IPL security explanation by Dark_Alex]<br /> * [https://lolhax.org/2011/07/03/a-look-at-the-ta-88v3-ipl-hash/ Explanation by Davee]</div> SocraticBliss http://www.psdevwiki.com/psp/index.php?title=Initial_Program_Loader&diff=10579 Initial Program Loader 2020-06-22T19:00:22Z <p>SocraticBliss: /* Structure */</p> <hr /> <div>Initial Program Loader, abbreviated as IPL, is a PSP program that runs on boot and loads Kernel. IPL is loaded by [[PRE-IPL]]. IPL can be stored either on the NAND or on a [[Magic Memory Stick]], depending on the PRE-IPL code and if a [[JigKick Battery]] is inserted or not.<br /> <br /> = Tools =<br /> <br /> == Dumper ==<br /> <br /> [https://github.com/KanadeEngel/PSP/tree/master/NAND-IPL-DUMPER NAND-IPL-DUMPER by KanadeEngel]<br /> <br /> == Decrypter / Encrypter ==<br /> <br /> [https://github.com/zecoxao/ipltool ipltool by zecoxao and others]<br /> <br /> == IPL SDK ==<br /> <br /> * [https://github.com/mathieulh/PSP_IPL_SDK PSP_IPL_SDK by mathieulh]<br /> * [https://github.com/DaveeFTW/iplsdk iplsdk by davee]<br /> * [https://www.brewology.com/downloads/download.php?id=10768&amp;mcid=1 PSP-IPL-SDK Rev.0.5 (2007.10.9)]<br /> <br /> == Bruteforce forger ==<br /> <br /> [https://github.com/mathieulh/Kirk-Bruteforce Kirk-Bruteforce by Team C+D]<br /> <br /> = Location =<br /> <br /> = Structure =<br /> <br /> == Encrypted form ==<br /> <br /> IPL is divided into chunks of 0x1000 bytes, the size of the buffer used at address 0xBFD00000 where they are decrypted. The IPL blocks are standard KIRK cmd 1 blocks and passed directly to [[KIRK Crypto Engine]] for decryption.<br /> <br /> == Decrypted form ==<br /> <br /> The decrypted IPL is composed of 3 parts: Part1 - the 'loader', Part2 - 'main.bin', and Part3 - the 'payload'.<br /> <br /> Part1 is plaintext MIPS code, Part2 is gzip compressed, and Part3 is again encrypted (from 2.60 onwards, parts 2 &amp; 3 are further encrypted again).<br /> <br /> == Prototype 0.4.0-0.6.0 (23-07-2004 or older) ==<br /> <br /> The decrypted IPL only contains the 'payload'<br /> <br /> = IPL Boot Sequence =<br /> <br /> == Part1 IPL (the loader) ==<br /> <br /> One of the first things Part1 IPL does is reset the main CPU.<br /> <br /> After reset the PRE-IPL mask ROM device is no longer mapped to memory at all (the 0x1FC00000 address range is then remapped to the 4KB RAM mentioned above to be used for the ME reset vector). This is why the PRE-IPL is no longer accessible once the IPL has booted.<br /> <br /> Part1 IPL does some very basic hardware inits and decompresses the gzipped Part2 IPL (main.bin) to address 0x04000000 (still in EDRAM).<br /> <br /> Part1 IPL then jumps to the entry address of main.bin (0x04000000) to initialize the hardware.<br /> <br /> == Part2 IPL (main.bin) ==<br /> <br /> Part2 IPL (main.bin) is responsible for initializing the PSP hardware.<br /> <br /> It has copies of its own driver modules similar to the drivers found in the firmware (including: sceNAND_Driver, sceDDR_Driver, sceIdStorage_Service, sceSYSREG_Driver, sceSYSCON_Driver, sceGPIO_Driver, sceClockgen_Driver, &amp; sceI2C_Driver). Some of the initialisation of the hardware depends on data stored in IDStorage leaves (for example leaves 4, 5, 6). Note this is where TA-082 / TA-086 motherboards 'brick' on 1.50 firmware. The clockgen hardware was changed on TA-082 / TA-086 motherboards so the functions used to initialize it does not recognise the new hardware. And because part of the initialization depends on data stored in leaf 5, simply by invalidating leaf 5 (by corrupting the header), the initialization is skipped allowing the firmware to continue to boot. See [https://psp.brewology.com/downloads/download.php?id=6454 IdRepair by codes02].<br /> <br /> After initializing the hardware (including the DDR RAM), Part2 IPL decrypts Part3 IPL (the payload) and loads it to address 0x08400000 (which is located in normal DDR RAM now that it has been initialised).<br /> <br /> It then jumps to the entry address of the Part3 IPL (0x08400000) to boot the firmware.<br /> <br /> == Part3 IPL (the payload) ==<br /> <br /> TODO<br /> <br /> = Custom IPL =<br /> <br /> It is possible to load a custom IPL by either:<br /> * exploiting PRE-IPL to run unsigned IPL (never done)<br /> * crafting a fake IPL using bruteforce (since 2007 thanks to [[Prometheus Project]])<br /> * crafting a valid encrypted and signed IPL using recovered keys (since 2018 thanks to PS3 hacks and mathieulh)<br /> <br /> See [[PRE-IPL]] and [[Pandora]].<br /> <br /> = See also =<br /> <br /> * [https://web.archive.org/web/20090206152144/http://dark-alex.org/forum/viewtopic.php?f=44&amp;t=1194&amp;start=0 IPL security explanation by Dark_Alex]<br /> * [https://lolhax.org/2011/07/03/a-look-at-the-ta-88v3-ipl-hash/ Explanation by Davee]</div> SocraticBliss