Title: Implementation of hive registry + binfs on the s3c2440a platform -- reprinted

Source: Internet
Author: User
Title: Implementation of hive registry + binfs on the s3c2440a Platform

Similar posts can also refer to http://bbs.driverdevelop.com/htm_data/48/0709/106094.html
Today we will summarize some implementation processes and principles.

My example is based on Samsung s3c2440a + Samsung onenand + wince5.0, and the Development Platform is platfo.
Rm Builder 5.0. First, the image based on Ram register can run normally.
The file system is provided for users to store space other than the image. This part of the driver uses Samsung's pocetst
Oreii15.

Let's take a look at the underlying stuff. Our image mainly consists of two parts: xipkernel. Bin and NK. Bin, X
The items in ipkernel. Bin are those programs and DLL files that are core and need to be loaded frequently in wince.
File, these files will be copied to ram by the boot loader at startup, so that xip can be copied in Ram
(Excute in place. Some programs and
DLL, for example, most of the drivers under buildin, such as Microsoft's IE, mediaplayer and other applications.
Even the Device Manager device.exe can be stored here. These files are copied only when necessary.
Memory to save the memory and speed up the startup time. Hey, here we will probably know how binfs works.
And importance.

Binfs is built using Ut (an underlying tool set of the OEM ).
The xipkernel and NK are automatically saved to the specific logical sector of flash. Boot Loader
The xipkernel is copied to ram, and then the xipkernel entry point in Ram is executed.
It will run some initialization processes such as CPU, memory, and medium-short such as oeminit, and then the OS will find Bi from the Registry
Some NFS settings, and then load the binfs driver to make the binfs partition available for the OS, if device. Ex
If e is in NK. Bin, you can use/binfs/device.exe (/binfs is a hypothetical installation.
When the binfs is not successfully completed, device.exe cannot be executed.
, Then the system will definitely fail.

Now let's talk about hive. In fact, hive is a very simple thing. It's all strange that it has brought together binfs to solve many problems.
Wrong direction. We could have done the result for four or five days in one day, nnd. Let's talk about it. There are two types of registration in wince.
Table, one is Ram-based, and the other is hive-based. The former is used by default.
When translating the contents of common. Reg and platform. Reg into a file named reginit. ini and then compress it
Default. *** (if you forget the extension, there is an old sign), put the file in the xipkernel.
Will decompress this file into RAM to form the ram-based registry. Since it is Ram-based, all
Changes will evaporate after power failure, haha. What should we do? In fact, you can think of it again, just save it to a disk.
Are you finished !? It's too clever for you, but if you want to put the entire registry on a disk (sdmmc, HDD, or flash)
On wince, how can I read the Registry without loading your disk driver? In general
Dynamic programs also require registry support! Hey, by the way, this is what hive thought of. It depends on how it is done, and it registers
The table is divided into two parts (in fact, three parts, at that time, the two steps are roughly divided into user. HV and system. HV as part
), The first part is the Registry named Boot. HV, which contains some things that are not stored on the disk.
Some settings are required for booting before the registry. The Registry and ram-based are the same.
The power is gone, so the registry items in this part do not need to be changed. All the items that need to be changed are placed in the second part.
Yes. The second part is system. HV and user. HV, that is, the registration to be put on the disk.
During table compilation, Pb determines which table items are placed in Boot. h according to the labels in platform. Reg and common. Reg.
In V, this label is; hive boot section; end boot section, the table items between the labels
During compilation, Pb inserts them into boot. HV (boot. HV is a binary file, depending on whether the file has been put.
Which of the following table items can be found on Google?
The contents will be inserted into default. HV and user. HV respectively, and finally all these three HV files will be inserted into xipkern
El. In this way, WinCE will throw all the HV into RAM in the first phase of the boot, and then enable boot. HV to get
To the necessary information, which includes how to attach the drive to the disk where system. HV is placed, so those and attach this
All disk-related drivers should be placed in Boot. HV, such as the FAT file system driver and mspart partition driver,
Here, we recommend that you use binfsand device.exe in NK. Bin, so it must be in the first stage.
Make sure binfs is available. Otherwise, it is impossible to create conditions for system. HV. Magnetic
There is no Dongdong on the disk. At this time, WinCE will copy default. HV and user. HV in the memory to the Registry bootva.
When the RS is specified, default. HV is often renamed to system. HV. The second startup will first check
Is HV consistent with that in the memory? If it is inconsistent, the table items on the disk will be loaded.
The whole process is like this, but note that the hive Registry is also running in the memory. The difference is that
The modified table items will be read from the disk, because this ensures the speed, so the Registry changes you made
This is also done in the memory. If you do not need to use flushregister to save the values in the memory to the disk
These changes will be lost. Two methods to avoid loss, one is to call flushregiste
R. Set a flag to enable wince to automatically flush after each registry change.

Finally, let's summarize what I have done:
1) Pull hivebased registers to the workspaces of the project in Pb.
2) Add the following list items in platform. reg to boot. HV.
3) build image

Attach my registry settings for reference:
;---------------------------------------------------------------------------
--------------
; All these entries below will be add to boot. HV when hive register is enable
D!
; Hive boot section
[HKEY_LOCAL_MACHINE/init/bootvars]
"Systemhive" = "events and settings // system. HV"; system. HV is saved to/HDD/
Documents and Settings/system. HV
"Profiledir" = "Documents and Settings"; user. HV is saved to/HDD/documents and S.
Ettings/default/user. HV
"Flags" = DWORD: 3; this should be the table item in which device.exe is started under wince 5.0.
"Defaultuser" = "default"; we only have one user default, which basically decides user. h.
V path
"Registryflags" = DWORD: 1; this is to set the Registry to automatically flush to system. HV after each change
; ######################################## ###################################

This part is the binfs registry key. If you are not using binfs, you do not need to drag them to boot. HV.
[HKEY_LOCAL_MACHINE/system/storagemanager/autoload/smflash]
"Driverpath" = "drivers // blockdevice // smflash"
"Loadflags" = DWORD: 1
"Mountflags" = DWORD: 11
"Bootphase" = DWORD: 0
"Flags" = DWORD: 1000
[HKEY_LOCAL_MACHINE/Drivers/blockdevice/smflash]
"Prefix" = "DSK"
"DLL" = "bibdrv. dll"; the binfs driver dll must be inside the xipkernel.
"Order" = DWORD: 0
"IOCTL" = DWORD: 4
"Profile" = "smflash"
"Friendlyname" = "Samsung Flash Driver"
"Mountflags" = DWORD: 11
"Bootphase" = DWORD: 0
"Flags" = DWORD: 1000
; Bind binfs to the block driver
[HKEY_LOCAL_MACHINE/system/storagemanager/profiles/smflash]
"Defaultfilesystem" = "binfs"; binfs path:/binfs
"Partitiondriver" = "mspart. dll"; the driver DLL of this partition must be inside the xipkernel.
"Automount" = DWORD: 1
"Autopart" = DWORD: 1
"Mountflags" = DWORD: 11
"Folder" = "residentflash"
"Name" = "Samsung flash disk"
"Bootphase" = DWORD: 0; binfs must be loaded in the first phase.
"Flags" = DWORD: 1000
"Mounthidden" = DWORD: 0; with this, you can see all the NKS of NK. bin in the/binfs directory.
Now
; ######################################## ###################################

; ######################################## ###################################

; This part is the driver for setting the disk to save system. HV. Everyone is different, but it is similar.
Here I am using the Flash Driver poketstroeii15, and system. HV is stored in the first flash partition.
If bsp_pocketstore
[HKEY_LOCAL_MACHINE/Drivers/builtin/pocketstore]
"Prefix" = "DSK"
"DLL" = "ondisk. dll"; this is loaded after binfs, so it can be placed in NK. Bin.
"Order" = DWORD: 1
"Profile" = "pocketstore"
"Iclass" = multi_sz: "{A4E7EDDA-E575-4252-9D6B-4195D48BB865 }"
"Bmlvolumeid" = DWORD: 0; BML volume id = 0
"Bmlpartitionid" = DWORD: 8; BML parition id = partition_id_filesystem
"Index" = DWORD: 2
"Flags" = DWORD: 1000; this flag specifies that the driver is loaded only once in Boot. HV.
[HKEY_LOCAL_MACHINE/system/storagemanager/profiles/pocketstore]
"Defaultfilesystem" = "fatfs"
"Partitiondriver" = "mspart. dll"
"Automount" = DWORD: 1
"Autopart" = DWORD: 1
"AutoFormat" = DWORD: 1
"Mountasbootable" = DWORD: 1; this is the function of saving system. HV in the specified partition in wince 5.0.
Key
"Folder" = "HDD"
"Name" = "NAND drive"
"IOCTL" = DWORD: 4
[HKEY_LOCAL_MACHINE/system/storagemanager/profiles/pocketstore/fatfs]
"Enablecachewarm" = DWORD: 0
Endif
; ######################################## ###################################

; End hive boot section

Supplement:
My flash is divided into four zones. The first zone is a 4 K bootloader that can only run in the nor mode.
Put ut in two zones, xipkernel and binfs in the third zone, and all the remaining slice formats in the fourth Zone
As a FAT partition as a file system, system. HV is placed in the last partition, and
You can see that there is a document and setting folder, and the HV files in it are hidden.

We use Samsung's onenand flash, which is actually a 4 K nor NAND Flash. Our bootlo
The Uploader is also divided into three parts. The first part of the bootloader is mainly the jump commands mapped to the 0x00000000 address.
, This part will be burned into the first 4 K flash, and then Samsung's onenand will automatically copy the data of the first 4 K
In a physical module similar to nor, this nor module supports direct addressing of the CPU; the second part is IPL, which functions
It can be an image or UT loaded in NAND Flash, and then jump to its Ram entry to execute after loading, because
The data line and address line of the CPU can only directly access nor flash at this time. If you want to access NAND flash
The NAND interface driver must be available, so the IPL part has the code of the NAND interface driver, which causes IPL
The code is usually dozens to hundreds of K. One Flash block is 128 K, and the first two parts occupy two parts.
Ut is a common tool, such as image burning, bootloader burning, and Flash formatting.
The maintenance and image upgrade tools are used. The data in this part includes a lot of drivers at most, and the volume is also very large,
It looks like kb.

In the end, the three bootloaders occupy the first 10 blocks (blocks) of flash, 128 K * 10,
These three parts are two BML partitions in Samsung's flash partition (in Samsung's flash drive pocetstoreii
Concept, you can think of it as a normal disk partition), wait for the following illustration to see.

The next block will place an MBR, and then we will place the image of Wince from 11 blocks. This area is the third
BML partitions, the size is usually around 40-, because the image of Wince is around 4-20 m, these
Partitioning is done by the UT mentioned above. I did not carefully read the source code, but only saw bmlf
The parameters of a function such as ormat are shown in the following figure. If binfs is used, two modulus will be placed in this zone.
Blocks: xipkernel, NK, and NK are identified by binfs drivers and loaded into fat partitions.
What we can see in the resource manager of Wince is that we have not understood how it is identified.

In the end of the big budget estimate, all the space above will be occupied by more than 20 mb. You can use the remaining space at will.
The partitioning method still calls bmlformat and stlformat in Samsung's flash drive. The partition parameters are set.
They will automatically create partitions, which we have done in BT. Then, in wince, you only need
Read some partitions and display them as disks. This is similar to the SD and HDD drivers. Refer to the above"
If bsp_pocketstore "can be written in the registry.

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.