scripts: add support for Sercomm kernel header
authorMikhail Zhilkin <csharper2005@gmail.com>
Fri, 18 Mar 2022 17:02:30 +0000 (17:02 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 3 Jul 2022 18:25:38 +0000 (20:25 +0200)
commit87092b3c065978fc0e673856c34b3db0829280db
tree034f7bea3748c10dfccb3403d7a7bc6dc18945d8
parent442708dfe2f599796b87eb113b03ab6cc42e0292
scripts: add support for Sercomm kernel header

This scripts creates custom kernel header that necessary for Sercomm
mt7621 devices:
- Sercomm S3
- Beeline SmartBox Giga
- Beeline SmartBox Pro
- Beeline Smartbox Turbo
- Beeline Smartbox Turbo+
- WiFire S1500.NBN

Header format
-------------
+--------+---------------+------------------------+
| Offset | Value         | Description            |
+========+===============+========================+
| 0x0    | 53 65 72 00   | Magic "Ser."           |
+--------+---------------+------------------------+
| 0x4    | 04 00 00 01   | End offset of RootFS   |
+--------+---------------+------------------------+
|        |               | This header checksum   |
| 0x8    | d6 14 9a c1   | htonl(~crc)            |
+--------+---------------+------------------------+
| 0xc    | 02 ff ff ff   | Constant               |
+--------+---------------+------------------------+
| 0x10   | 00 01 40 00   | Kernel start offset    |
+--------+---------------+------------------------+
| 0x14   | c6 94 24 00   | Kernel length          |
+--------+---------------+------------------------+
|        |               | Kernel checksum        |
| 0x18   | e7 78 89 f1   | htonl(~crc)            |
+--------+---------------+------------------------+
| 0x1c   | 00 00 00 00   | Constant               |
+--------+---------------+------------------------+
| 0x20   | ff ff ff ff   | Constant               |
+--------+---------------+------------------------+
| 0x24   | ff ff ff ff   | Constant               |
+--------+---------------+------------------------+
| 0x28   | 00 00 00 01   | RootFS offset          |
+--------+---------------+------------------------+
|        |               | RootFS length          |
| 0x2c   | 04 00 00 00   | Always 0x4, we check   |
|        |               | UBI magic only         |
+--------+---------------+------------------------+
|        |               | RootFS checksum        |
| 0x30   | 1c fc 55 2d   | htonl(~crc)            |
|        |               | Const for UBI magic    |
+--------+---------------+------------------------+
| 0x34   | 00 00 00 00   | Constant               |
+--------+---------------+------------------------+
| 0x38   | ff ff ff ff … | Pad to 0x100           |
+--------+---------------+------------------------+

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
scripts/sercomm-kernel-header.py [new file with mode: 0755]