In Eboot, from the STARTUP.S jump to the C program entrance, the program can be written in C language, so feel much better. The General C language entrance is a main function, may also be called other names. The Bootloadermain function is dropped in this main function, which is defined in the Blcommon module. The general main function is written as follows:
void (void)
{
// Common boot loader (blcommon) main routine.
BootloaderMain();
// Should never get here.
SpinForever();
}
As can be seen from the program, eboot after entering the C program, only called the Bootloadermain function, as for the Spinforever function is actually a while dead loop. So it can be seen that eboot all the work in the Bootloadermain, the source code can be found in the "\wince600\public\common\oak\drivers\ethdbg\blcommon". Detailed process as shown:
Here are some specific steps:
The 1.BootloaderMain function first calls the Kernelrelocate function to copy the global variables used in bootloader to RAM.
2. Then call the Oemdebuginit function to initialize debug debugging functions, generally initializing the serial port, so you can use the serial port to print debugging information.
3. Then call the Oemplatforminit function to initialize the board, and many platform-related initialization work can be done in this function.
4. Call the Oempredownload function, from the process should be to download the kernel to do some preparatory work, the function is executed, depending on the return is worth different can choose to download the kernel, or jump execution. In fact, the function will first read the boot configuration information, and then initialize the download device, typically the network card device.
5. If the Oempredownload function returns Bl_download, wince image will be downloaded from the host.
6. If the Oempredownload function returns Bl_jump, jump directly to the location where wince image is located.
The OEM functions involved are required to be implemented by the user and then invoked by the Blcommon module. These functions will be introduced later.