Line 2:
Line 2:
{{Stub}}
{{Stub}}
−
'''boot2''' is the [[Wii]]'s third-stage bootloader. It is responsible for loading the [[System Menu]] [[TMD]] and loading the appropriate [[IOS]] under normal circumstances, although it can also load [[MIOS]] if it detects the lowered clock speed set by [[BC]] (if [[IOS/Syscalls|syscall 55]] returns 162), and it can simply shut down if it detects a flag{{check}} set by MIOS. There is also a path that loads BC, although it appears unused.
+
'''boot2''' is the [[Wii]]'s third-stage bootloader. It is responsible for loading the [[System Menu]] [[TMD]] and loading the appropriate [[IOS]] under normal circumstances, although it can also load [[MIOS]] if it detects the lowered clock speed set by [[BC]] (if [[IOS/Syscalls|syscall 55]] returns 162).
+
+
boot2 is also launched by MIOS when the power button is pressed; the System Menu is initialized in this case, and [[Memory Map|0x80003164]] <!-- read as c0003164 by the system menu; written as 00003164 by boot2 --> is set to 1 if the SRSTB_CPU bit is set in [[Hardware/Hollywood_Registers#HW_RESETS|HW_RESETS]]; the System Menu checks 0x80003164 and shuts down if it is enabled and [[:/title/00000001/00000002/data/state.dat|state.dat]] is set appropriately, with the message "Shutdown system from GC!".
+
+
boot2 is built from the same code as a regular IOSes, but has a [[IOS/Syscalls|kernel flavor]] (syscall 47) of 0 instead of 3; boot2's ES module includes all of the [[:/dev/es|normal ES functionality]] but it goes unused due to this kernel flavor value. Regular IOSes also have the same check for a flavor less than 3, but the bootmii path goes unused.
There are two copies of boot2 housed in [[Hardware/NAND|NAND]] blocks 1-7 in case of failure, loaded by [[boot1]]. Additionally, a copy of boot2 may exist as title 1-1 in the NAND filesystem.
There are two copies of boot2 housed in [[Hardware/NAND|NAND]] blocks 1-7 in case of failure, loaded by [[boot1]]. Additionally, a copy of boot2 may exist as title 1-1 in the NAND filesystem.