WinCE development of the boot loader bit by bit

Source: Internet
Author: User
Tags file system root directory

I am glad that in the company's product development process has not been caused by the boot loader resistance, because we use MSDOS+LOADCEPC to start the CE operating system. Obviously such luck is not forever, so to the boot loader should have enough research and understanding, do a rainy day.

The Boot loader is an important development step in customizing the Windows CE operating system. The role of the boot loader as the name of the two words: boot, both the boot system, if the CE-based products using the BIOS to implement hardware initialization and configuration, then boot loader just boot software system. If the BIOS is not used, then the role of the boot Loader also includes the implementation of the basic functions of the BIOS, Loader, both loading the operating system, boot Loader in a different way after the normal boot to load CE of the kernel file nk.bin. When the boot loader the nk.bin to RAM, the CPU control is given to the CE core. x86 platform of the most kinds of boot loader, the following on the x86 platform boot loader do a description:

x86 ROM Boot Loader

Also called ROM boot, remember that the previous written article mentioned ROM boot. ROM boot is designed to be stored in the Flash/eeprom, that is, the original BIOS location, so when the CPU to the fixed address execution code, that is, the implementation of the ROM boot contains code, it is the entire hardware system initialization and detection, It also supports downloading nk.bin from a remote machine via a NIC or looking for Nk.bin file loading from the active partition of the local ide/ata hard drive. Rom Boot is the advantage of booting and loading fast, and it has done all the operation, so no bios, MSDOS, not to LOADCEPC. The disadvantage is that the CE developers need to read its source code and modify. CE provides all the source code of ROM boot, the reader can look up the help document titled "x86 Source Organization", in this document lists all relevant contents and content, also listed four kinds of network card driver source directory.

x86 BIOS Boot Loader

BIOS boot loader and MSDOS+LOADCEPC are similar in two ways, BIOS boot loader just don't need msdos operating system, it still needs BIOS and FAT file system. Here's a guide to the boot sequence of the system using BIOS boot loader: After the system is on, after the BIOS finishes hardware initialization and configuration, the BIOS checks boot device boot sequence, if the boot device is hard disk, CF card, DOC (disk-on-chip) type of storage device, Then load the real-mode code in the primary boot sector (master boot sector) on these storage into memory and execute the code. The code mentioned here is called the Master Boot Record (MBR). The MBR first looks for the active partition in the partitioned table (also in the primary boot sector) and, if there is an active partition, loads the code in the first sector of the active partition into memory and executes the code. The first sector of the active partition mentioned here is called the boot sector (boot sector). The function of the code on the boot sector is to locate and load the BIOS boot Loader,bios boot Loader reload Nk.bin. The source of the boot sector is located in the%_winceroot%\public\common\oak\csp\i486\biosloader\bootsector directory. There is a ready-made boot sector mirror file with a path of%_winceroot%\public\common\oak\csp\i486\biosloader\diskimages\setupdisk\bsect.img. The BIOS Boot Loader,ce provides setupdisk.144 and bootdisk.144 two files for the file with the ". 144" extension. I've talked about it in the previous article. These two files are unpacked and contain mirrored files for the boot sector and boot loader. Execute the "Mkdisk C:" Batch command to write the two mirrored files to disk. Mkdisk sets the hidden properties of the boot loader so that the boot loader file is not displayed when you list all the files in the root directory.

Msdos+loadcepc

This way is very simple, after the Msdos boot to perform loadcepc.exe, let LOADCEPC load Nk.bin to memory and then the CPU control to the CE kernel program. Loadcepc has already talked about it in the previous article.

The following according to the General boot loader source to analyze the composition of the boot loader:

The boot loader is made up of two parts: the OEM startup code (OEM startup codes) and the main code. The OEM boot code is the first part of the function to initialize the memory registers, set the CPU frequency, initialize the cache, and so on. It then jumps to execution in the main code. General OEM startup code is written in assembler. The main code is generally written in C, which is responsible for all other tasks, and can also display relevant information about the execution on the screen while executing. General Add company logo or other launch logo are modified here.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.