From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:TP-Link firmware header" |
|---|
| claim | "The classic TP-Link firmware header is 512 big-endian bytes: version 0x01000000 or 0x02000000, vendor 'TP-LINK Technologies', hardware id and revision, two MD5 fields, kernel load address and entry, and kernel/rootfs/boot offsets and lengths." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:TP-Link firmware header" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "fw_header" |
|---|
| size | "0x200" |
|---|
| endianness | "big" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "version" |
|---|
|
| offset | "0x4" |
|---|
| size | 24 |
|---|
| type | "char[24]" |
|---|
| name | "vendor_name" |
|---|
|
| offset | "0x1C" |
|---|
| size | 36 |
|---|
| type | "char[36]" |
|---|
| name | "fw_version" |
|---|
|
| offset | "0x40" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "hw_id" |
|---|
|
| offset | "0x44" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "hw_rev" |
|---|
|
| offset | "0x48" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "region_code" |
|---|
|
| offset | "0x4C" |
|---|
| size | 16 |
|---|
| type | "uint8_t[16]" |
|---|
| name | "md5sum1" |
|---|
|
| offset | "0x5C" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "unk2" |
|---|
|
| offset | "0x60" |
|---|
| size | 16 |
|---|
| type | "uint8_t[16]" |
|---|
| name | "md5sum2" |
|---|
|
| offset | "0x70" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "unk3" |
|---|
|
| offset | "0x74" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "kernel_la" |
|---|
|
| offset | "0x78" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "kernel_ep" |
|---|
|
| offset | "0x7C" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "fw_length" |
|---|
|
| offset | "0x80" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "kernel_ofs" |
|---|
|
| offset | "0x84" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "kernel_len" |
|---|
|
| offset | "0x88" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "rootfs_ofs" |
|---|
|
| offset | "0x8C" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "rootfs_len" |
|---|
|
| offset | "0x90" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "boot_ofs" |
|---|
|
| offset | "0x94" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "boot_len" |
|---|
|
| offset | "0x98" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "ver_hi" |
|---|
|
| offset | "0x9A" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "ver_mid" |
|---|
|
| offset | "0x9C" |
|---|
| size | 2 |
|---|
| type | "uint16_t" |
|---|
| name | "ver_lo" |
|---|
|
| offset | "0x9E" |
|---|
| size | 130 |
|---|
| type | "uint8_t[130]" |
|---|
| name | "pad" |
|---|
|
| offset | "0x120" |
|---|
| size | 32 |
|---|
| type | "char[32]" |
|---|
| name | "region_str1" |
|---|
|
| offset | "0x140" |
|---|
| size | 32 |
|---|
| type | "char[32]" |
|---|
| name | "region_str2" |
|---|
|
| offset | "0x160" |
|---|
| size | 160 |
|---|
| type | "uint8_t[160]" |
|---|
| name | "pad2" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "struct fw_header (packed); HEADER_VERSION_V1/V2; fill_header uses htonl/htons; kernel_ofs = sizeof(struct fw_header). Offsets computed from the field sizes" |
|---|
| repo | "https://github.com/openwrt/firmware-utils" |
|---|
| commit | "0179ab1e367f756ac108a485f26585661d4c528c" |
|---|
| path | "src/mktplinkfw.c" |
|---|
| lines | "30-60, 364-407" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "mktplinkfw header" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T06:50:47.627Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T07:38:51.678Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read struct fw_header (mktplinkfw.c 32-60, packed) and recomputed every offset: 0 version, 4 vendor[24], 0x1C fw_version[36], 0x40 hw_id, 0x44 hw_rev, 0x48 region, 0x4C md5sum1, 0x5C unk2, 0x60 md5sum2, 0x70 unk3, 0x74 kernel_la ... 0x94 boot_len, 0x98-0x9C ver words, 0x9E pad[130], 0x120 region_str1, 0x140 region_str2, 0x160 pad2[160] = 0x200; fill_header uses htonl/htons and kernel_ofs = sizeof(struct fw_header)." |
|---|
|
|
|---|