Boot Sequence

The Vita main application processor is a Cortex A9 MPcore. It implements ARM TrustZone for execution in both a non-secure world and a sandboxed Secure World.

Boot ROM
It is likely that the F00D processor (MeP Core) is the actual secure boot device rather than the ARM CPU. The F00D processor is Toshiba MEP based and is the first secure device ("first loader") to start on the Vita. Once it starts it likely maps the eMMC and directly reads in the second_loader.enp or second_loader.enp_ from the eMMC slb2 partition. This is in the native load format of the F00D bootrom. There are likely 2 layers of encryption. First it decrypts the per-console layer that was added during the install. After that it will decrypt the factory-encrypted layer then begin execution.

The second_loader is primarily responsible for preparing the ARM processor. It initializes DRAM and decrypts slb2 kernel_boot_loader.self into DRAM. It also writes the ARM exception vector and some boot context information to the 32KB scratch buffer (mirror mapped to 0x00000000 on ARM). kernel_boot_loader.self contains both the secure world kernel bootloader and secure kernel, as well as the non-secure kernel boot loader. At this point the slb2 kprx_auth_sm.self and prog_rvk.srvk are both loaded into DRAM.

Finally, the second_loader resets itself with a pointer to the secure_kernel.enp or enp_. F00D processor then restarts and loads the secure_kernel.enp in and again decrypts the per-console layer that was added by the install, and the factory layer. At this point the F00D processor secure kernel is prepared and it resets the ARM CPU at 0x00000000 (F00D scratch buffer). This triggers the ARM secure boot process to begin.

Secure Kernel
The bootloader decompresses the ARZL secure kernel, loads it and sets up the VBAR and MVBAR. It then decompresses the ARZL non-secure kernel bootloader and sets NS in SCR and jumps into non-secure kernel bootloader. See Secure Bootloader for more information.

SceKblForKernel
The non-secure kernel bootloader contains an embedded and likely stripped version of SceSysmem, SceKernelModulemgr, SceSblSmschedProxy, and some other core drivers. The NS KBL sets up the eMMC device (again) and starts.

ScePsp2BootConfig
This kernel module does not export any library. It only has a module init function that has a hard coded list of core kernel modules (ex: sysmem.skprx) which are loaded with calls back into NSKBL through SceKblForKernel imports. Once the core initialization is done, the next module to run is SceSysStateMgr.

SceSysStateMgr
This kernel module also does not export any library. Its init function first maps all the SceKernelBootimage embedded modules and redirects them to os0:kd/. Then it decrypts  or   or   and parses the System Configuration Script to load the remaining modules and finally either SceSafemode or SceShell or ScePsp2Swu or ScePsp2Diag.

Boot Partition
The boot partition is SLB2 formatted. It contains entries these files:

System Configuration Script
once decrypted is a UTF-8 text file that is parsed by SceSysStateMgr. It is a very simple script format.

If "manufacturing mode" is enabled, then it is possible to load  from   (not present in any production device or devkits) or. However, the files must still be signed and encrypted SELFs. In "manufacturing mode" with the default boot config, if  or   exists (and is a valid signed & encrypted SELF), then it will be launched. If "development mode" is enabled (note that this does not necessarily mean PDEL or devkit), then  can be a plaintext file instead.

Comments
Comments start out with, as an example, here's the header of 1.69 psp2config.skprx
 * 1) PSP2 System Configuration for Release
 * 2) [NOTICE]
 * 3) This configuration is only for kernel_boot_loader_release.self.
 * 1) [NOTICE]
 * 2) This configuration is only for kernel_boot_loader_release.self.
 * 1) This configuration is only for kernel_boot_loader_release.self.

Conditionals
Conditionals start with  and end with. There are certain conditional constants defined in SceSysStateMgr. A table of known conditionals is below.

Example: if SAFE_MODE spawn	os0:ue/safemode.self end endif

Load
will load the kernel module at.

possibly stands for "test load." Possibly used in development units to load to module to dedicated devkit RAM.

Example: load	os0:kd/ngs.skprx

Spawn
will spawn an app and continue processing the script in the background.

will spawn an app and wait for it to exit before continuing processing the script.

is used to spawn. Specify a paramater to pass.

Known param constants:

Example: if UPDATE_MODE if UD0_EXIST spawn ud0:PSP2UPDATE/psp2swu.self else spawn ur0:PSP2UPDATE/psp2swu.self endif end endif

Include
will include and process a config script located at.

Example: include	ur0:temp/bcfg2.txt

End
will end script processing

Ignore Error
Any line that starts with  will not fail the boot sequence if the line fails. For example, you can specify an optional module to load such that boot continues if the module does not exist or errors on load.

All codes (from 0.990)
load, unload, loadonly, start, stop, unloadonly, spawn, spawnwait, wait, kill, loadconfig, ifmodel, ifnmodel, setenv, setmodfile, repeat, endrepeat, appspawn, tload

Boot Debug Checkpoint Codes
During the boot sequence, the various bootloaders will update a GPIO register specifying the progress into boot. This can be used to debug where in the boot process something fails.

GPIO
The GPIO registers are registered at  (turn off bits) and   (turn on bits). On PDEL units, this maps to the LED lights.

Suspend and Resume
Upon suspension, context is written to memory and a syscon command is issued to save the context pointer as well as other information (for example, if it should restart into update mode). When resuming, the boot process is the same as cold boot up until the secure kernel bootloader. After secure kernel loads, instead of decompressing and jumping to the non-secure kernel bootloader, it restores the saved context and returns to the kernel resume code.

See Suspend.