TOC(Table of Content)数据结构

来源:互联网 发布:保险从业人员数据 编辑:程序博客网 时间:2024/06/07 01:10

       TOC(Table Of Content)是整个Nand Flash中存储内容的一个列表,这里面储存了有关启动和系统内核的一些相关存储信息,需要写在Nand Flash的block1中由Nboot里的函数读取。之后Nboot会按照读取的内容进行配置和跳转到不同的地址。

       TOC是一个只有512字节的结构,具体定义如下:

typedef struct _TOC {       DWORD    dwSignature;              // How to boot the images in this TOC.       // This could be moved into the image descriptor if desired,       // but I prefer to conserve space.        BOOT_CFG             BootCfg;         // Array of Image Descriptors.        IMAGE_DESCRIPTOR     id[MAX_TOC_DESCRIPTORS];          CHAININFO            chainInfo;         //注意,网上很多人给的程序,udid都在dwSignature的下面,这是错误的!       BYTE     udid[8];   } TOC, *PTOC;           // 512 bytes  

       其中还包含了三个结构体:BOOT_CFG、IMAGE_DESCRIPTOR和CHAINFO。

       BOOT_CFG包含了用以太网下载内核镜像所需的网络配置信息,具体定义如下:

typedef struct _BOOTCFG {         ULONG        ImageIndex;    //镜像索引号         ULONG        ConfigFlags;   //配置标号       ULONG        BootDelay;     //进入启动模式的等待时间          EDBG_ADDR    EdbgAddr;      //目标机的IP地址       ULONG        SubnetMask;    //所在局域网的子网掩码     } BOOT_CFG, *PBOOT_CFG;  typedef struct _EDBG_ADDR {       DWORD   dwIP;         // @field IP address (net byte order)       USHORT wMAC[3];      // @field Ethernet address (net byte order)       USHORT wPort;        // @field UDP port # (net byte order) - only used if appropriate   } EDBG_ADDR;  

         IMAGE_DESCRIPTOR包含了镜像的描述信息,这里所讲的镜像,不只是内核镜像,还包括Eboot等。具体定义如下:

typedef struct _IMAGE_DESCRIPTOR {         // File version info        DWORD dwVersion;                    // e.g: build number        DWORD dwSignature;                  // e.g: "EBOT", "CFSH", etc        UCHAR ucString[IMAGE_STRING_LEN];   // e.g: "PocketPC_2002"          DWORD dwImageType;      // IMAGE_TYPE_ flags(镜像类型)        DWORD dwTtlSectors;     // TTL image size in sectors.(存储镜像所需的sector总数)                               // We store size in sectors instead of bytes                               // to simplify sector reads in Nboot.          DWORD dwLoadAddress;    // Virtual address to load image (ImageStart)(把镜像载入内存RAM的虚拟地址)        DWORD dwJumpAddress;    // Virtual address to jump (StartAddress/LaunchAddr)(执行镜像或调用系统内核的虚拟起始地址)         // This array equates to a sector-based MXIP MultiBINInfo in blcommon.       // Unused entries are zeroed.       // You could chain image descriptors if needed.        SG_SECTOR sgList[MAX_SG_SECTORS];     } IMAGE_DESCRIPTOR, *PIMAGE_DESCRIPTOR;  typedef struct _SG_SECTOR {         DWORD dwSector;     // Starting sector of the image segment       DWORD dwLength;     // Image length of this segment, in contigious sectors.     } SG_SECTOR, *PSG_SECTOR;  

       CHAININFO描述了镜像的一些连接信息,当启动系统时需要将这些信息载入内存才可正常启动。具体定义如下:

typedef struct _CHAININFO {        DWORD    dwLoadAddress;          // Load address in SDRAM(载入到内存的起始地址)        DWORD    dwFlashAddress;         // Start location on the NAND(位于Nand Flash的起始地址)        DWORD    dwLength;               // The length of the image(镜像长度)   } CHAININFO, *PCHAININFO;  

    2009-10-19                   

    注:源自原百度博客“至美心"

0 0
原创粉丝点击