Analysis of NK. Bin and NK. nb0 file formats

Source: Internet
Author: User

Source: http://www.cnblogs.com/wogoyixikexie/archive/2009/01/19/1378341.html

Author: wogoyixikexie @ gliet

 

Borrow others' explanations:
The bin mentioned here is a binary image format that organizes data in units of segments. Each segment contains a header with the start address, length, and check value specified in the header. The Platform Builder tool combines all the files in the wince kernel into one file in Bin format. The default file name is NK. Bin. Bootloader splits NK. Bin into multiple files in the same format and puts them in Ram. You can type "viewbin NK. bin" in the command line to view the specific content in the binfile. Type the cvrtbin command to convert the. Bin format file to. SRE or. ABx format.
The nb0 format is the original binary image, which does not include the header. Generally, the system uses the nb0 format to download the kernel to the ram of the device. To generate a file in nbx format, you need to determine the following values in the relevant. bib file: romstart, romwidth, romsize

How is NK. Bin generated?

Romimage.exe is a locator application that creates Windows CE binary image (. Bin) files, usually limited to a single file called NK. Bin.
This means that romimage

  • Reads Ce. bib to determine which % _ flatreleasedir % binaries and files to include in the run-time image.
  • Assigns physical memory addresses to these binaries and files. (How does this work ?)
  • Creates the run-time image NK. Bin.

For more information about CE. bib, see make binary image tool.

 

Recently I tried to create multi bin and later found that my bootloader is youlong and does not support binfs partition formatting. I 'd like to port the code under eboot.

However, I am a little confused about the binfs. In principle, binfs is for nk. bin, But we downloaded NK. nb0, some download NK. bin, but decompress the package to NK. nb0.
How does binfs relate to NK. nb0?
================================== To see the binfile format ====== ================================

A bin file is stored in the following structure:

Composition: Mark (7) + image start address (1) + image length (1)
Record 0 address + record 0 Length + record 0 checksum + record 0 content (File Content)
Record 1 address + record 1 Length + record 1 checksum + record 1 content (File Content)
......
The last record indicates the end. Start = 0x00000000, length = 0x8c072c3c indicates the startup address, and chksum = 0x00000000

The bin File Header (excluding records) can be represented in the following structure
Struct binfile {
Byte signature [7]; // = {'B', '0', '0', '0', '0', 'F '', ''f'', ''\ ''}
DWORD imagestart
DWORD imagelength
};


Generally, xipkernel. bin, NK. all Bin files comply with the normal binfile format, including records starting from 0, 1, and 2 as special records, and 2 as the Cece mark. The last 4 bytes indicate the TOC address (pointing to the data in the romhdr structure ), 3. All records start with file records,
--- However, we actually use the NK. nb0 file, which is supported by the file system. I am waiting to find out his format. Go to lunch first.

Use others' explanations

First, the content in NK. Bin is compressed, and the content in NK. nb0 is not compressed. The difference between the two is that bin will automatically remove the null after you set during the generation process, and nb0 won't.

Now let's use Microsoft's built-in tools to see what the formats of these two files are.

The above explanation shows that the logo of this NK. binfile is boooff, and NK. nb0 does not. You need to know the specific information and check msdn.

 

At the end of the boot loader development process described in the topic how to develop a boot loader, you will have two different binary images for the Boot Loader: A. BIN file and an. nb0
File. the Microsoft Windows & reg; Ce Binary Image Data Format (. BIN) file is the most common format for Windows CE binary images. it is a binary file that consists of a number of individual
Records with associated per-record bookkeeping data. The format is convenient for minimizing the amount of data to be downloaded to the target device by removing the need to pad between records.
For more information about the. BIN file format, see Windows CE Binary Image Data Format (. Bin ).

The. nb0 file format is a raw binary image of the boot loader. The image is as it appears in the memory on the target device and does not contain the header information that the. Bin
File except des. the. nb0 file is typically larger than. BIN file. the. nb0 file is useful for placing the initial Boot Loader image on the target device. this is usually done with a built-in
Monitor Program provided by the board manufacturer. You can also place the initial Boot Loader image on the target device through a JTAG connection using a JTAG probe. Once the. nb0 image is
Stored on the device, it shocould be able to download and update itself using the. BIN file format from then on.

I am using the bootloader developed by analyticdb. There is no segment problem with this binfile. It should be different from Microsoft. Where is the problem of global variables? But why does it occasionally fail to start? Finally, it is found that the origin is returned. It seems that the binfile format in ads must be clear.

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.