Updated: October 28, 2024 |
Most of the startup code is stored in the main() function, which follows the _start() and _main() functions in the startup code sequence.
The _start() function is the entry point to the startup program (e.g., hardware/startup/lib/arm/cstart.S). This function sets up an environment for executing C code. Specifically, the _start() function:
When it completes its work, _start() calls _main(), which prepares the environment for the subsequent main() (without the underscore) function. Specifically, the earlier _main() function:
The pseudo-code below shows the structure of the main() function, with links to the entries for each called function in the Startup Library chapter:
Global variables main() { // Initialize hardware Call add_callout_array() // Parse commandline arguments Call handle_common_option() // Remove ram used by modules in the image Call init_raminfo() // Initialize the MMU if (virtual) Call init_mmu() Call init_intrinfo() Call init_qtime() Call init_cacheattr() Call init_cpuinfo() // Set hardware machine name Call init_system_private() // Print debugging output Call print_syspage() }