Bootpart is a partition module provided by Microsoft and can be used in eboot. But to be honest, I seldom use it. I know some vendors support this function in BSP, and it is also part of eboot, so I 'd like to introduce it. First look at the architecture,
In eboot, blcommon is at the top layer. As mentioned earlier, the bootpart module will be called by OEM functions, while the bootpart module needs flash to operate the storage device.
Driver support. The Flash Driver is the Flash Driver Under wince, that is, the driver of the fmd_xxx interface. Therefore, to use the bootpart module, you must first support the Flash Driver. The bootpart module can find the source code under "/wince600/public/common/oak/Drivers/ethdbg/bootpart". The main implementations are in bootpart. cpp. The bootpart module provides the flash device partitioning function and binfs support. The following describes the functions used:
1. bool bp_init (lpbyte pmemory, DWORD dwsize, lpctstr lpactivereg, ppci_reg_info pregin, ppci_reg_info pregout)
This function can be said to be the initialization function of the bootpart module. You can see the code that it will call fmd_init to initialize the flash device and initialize a piece of memory. This function is generally called in the oemplatforminit function. Pmemory points to a piece of memory to store MBR information. dwsize is the memory size. lpactivereg, pregin, and pregout are used by fmd_init. Generally, they can be set to null.
2. bool bp_lowlevelformat (DWORD dwstartblock, DWORD dwnumblocks, DWORD dwflags)
This function is used for low-level formatting. It will format the block in the flash device, recreate the MBR, and store the MBR in the first sector of blockd. Dwstartblock is the starting block, dwnumblocks is the number of blocks, and dwflags is the formatting flag, indicating the formatting method. This function is called Based on the function in eboot.
3. ppartentry bp_getpartitioninfo (handle hpartition)
This function is used to obtain information about a partition. Hpartition is the handle of a partition, and the corresponding partition information is returned.
4. Handle bp_openpartition (DWORD dwstartsector, DWORD dwnumsectors, DWORD dwparttype, bool factive, DWORD dwcreationflags)
This function is used to open or create a partition. You can use this function to create a partition on a flash device. Dwstartsector is the starting logical sector, dwnumsectors is the number of sectors contained in the partition, dwparttype indicates the partition type, factive indicates whether to activate the partition, dwcreationflags indicates whether to create or open the partition, return the partition handle after successful execution.
5. bool bp_writedata (handle hpartition, lpbyte pbbuffer, DWORD dwlength)
This function is used to write data to a partition. Generally, eboot can use this function to write wince image to the partition. Hpartition is the handle of the created partition, pbbuffer is the buffer to write data, and dwlength is the length of the data to be written.
6. bool bp_readdata (handle hpartition, lpbyte pbbuffer, DWORD dwlength)
This function reads data from a partition. eboot can use this function to read wince image to ram. Hpartition is the handle of the created partition, pbbuffer is the buffer for Data Reading, and dwlength is the length of data to be read.
7. bool bp_setdatapointer (handle hpartition, DWORD dwaddress)
This function is used to set the Data Pointer of a partition. In fact, the Data Pointer refers to the next read or write position in the partition. It is generally used with the bp_readdata (...) and bp_writedata (...) functions. Hpartition is the handle of the created partition, and dwaddress is the new position of the Data Pointer.
These functions are commonly used. In the end, this module provided by Microsoft is mainly used to partition flash devices, or to help us layout flash devices. To use eboot, you must first implement the Flash Driver. In fact, when you look at the code, you will find that these functions, whether creating MBR or creating partitions, essentially write some tag information in flash and encapsulate some functions for users. I seldom use the bootpart module. I am more accustomed to managing the entire flash by myself. I feel more clear.