TRX header

From Embedded Xinu
Revision as of 18:33, 29 July 2009 by Michael (talk | contribs) (Created TRX header page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

TRX is the format used to store kernel images in Flash memory for CFE based (and possibly others) routers. Unfortunately, not much is known about the format or what limitations and rules exist. Currently, Embedded Xinu uses a simple utility from the OpenWRT repository to build TRX images. However, the quality of our TRX images seems to vary between revisions of the operating system. We do not yet know why. Possible reasons include:

  • alignment problems,
  • compression/extraction problems,
  • incorrectly configuration at startup (differences between TFTP booting and booting from Flash), or a
  • combination of above and some unknown problem.

What we do know is the format of the 28 byte TRX header, it is as follows:

 0                   1                   2                   3   
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+---------------------------------------------------------------+
|                     magic number ('HDR0')                     |
+---------------------------------------------------------------+
|                  length (header size + data)                  |
+---------------+---------------+-------------------------------+
|                       32-bit CRC value                        |
+---------------+---------------+-------------------------------+
|           TRX flags           |          TRX version          |
+-------------------------------+-------------------------------+
|                      Partition offset[0]                      |
+---------------------------------------------------------------+
|                      Partition offset[1]                      |
+---------------------------------------------------------------+
|                      Partition offset[2]                      |
+---------------------------------------------------------------+

After the TRX header, the data section begins.