Extract SN, P2P and MAC from SPI Flash - ihipop/winsun_mininas_v1 GitHub Wiki
MFH list (SPI Flash Layout)
From Inventec mail:
MFH Entry List
Type ID Active Offset Size Label
cefdk_s1 00 YES 0x00000000 0x00010000
cefdk_s2 00 YES 0x00010000 0x0006F000
cefdk_s1h 00 YES 0x0007f000 0x00000800
cefdk_s2h 00 YES 0x0007f800 0x00000800
uc8051_fw 00 YES 0x00080800 0x00010000
splash 00 YES 0x00090800 0x000FD236
script 00 YES 0x0018da40 0x00000800
cefdk_params 00 YES 0x0018e240 0x000005F0
plat_params 00 YES 0x0018e830 0x00010000
kernel 00 YES 0x0019e830 0x0030E2FC
user flash 00 NO 0x00300000 0x00000000
I downloaded spi_nor.bin, kbl kernel and reconfigured some parameters. Now on my board it looks like:
shell> mfh list
MFH Entry List
Type ID Active Offset Size Label
cefdk_s1 00 YES 0x00000000 0x00010000
cefdk_s2 00 YES 0x00010000 0x0006F000
cefdk_s1h 00 YES 0x0007f000 0x00000800
cefdk_s2h 00 YES 0x0007f800 0x00000800
uc8051_fw 00 YES 0x00080800 0x00010000
splash 00 YES 0x00090800 0x000FD236
script 00 YES 0x0018da40 0x00000800
cefdk_params 00 YES 0x0018e240 0x000005F0
plat_params 00 YES 0x0018e830 0x00010000
kernel 00 YES 0x0019e830 0x0021F180
user flash 00 NO 0x00300000 0x00000000
Everything is the same with that of inventec mail, except for kernel size.
MTD device
From inventec email (pptx)
~ # dd if=/dev/mtdblock0 of=/serial.txt bs=1 count=11 skip=1697760
11+0 records in
11+0 records out
~ # cat /serial.txt
801DNN00006
~ #
I downloaded the whole spi flash by dd
dd if=/dev/mtdblock0 of=spi_flash.bin
Examine this file with VI
on pc
vim -b spi_flash.bin
# in VI
:%!xxd
We can find out
BASE: 0x0018e830 (plat_params)
mac: 6 bytes, hex
00195830: 001e 3310 4005 3005 0000 0000 0000 0000 [email protected].........
offset: 00195830 - 0018e830 = 0x7000
p2p: 20 bytes, ascii
0019e780: 3132 3334 3536 3738 3930 3132 3334 3536 1234567890123456
0019e790: 3738 3930 0000 0000 0000 0000 0000 0000 7890............
offset: 0019e780 - 0018e830 = 0xFF50
S/N: 11 bytes, ascii
0019e7e0: 3830 3144 4e4e 3030 3030 3600 0000 0000 801DNN00006.....
offset: 0019e7e0 - 0018e830 = 0xFFB0
The hex/decimal offset and length
mac : 0x195830 / 1660976 (6)
p2p : 0x19e780 / 1697664 (20)
s/n : 0x19e7e0 / 1697760 (11)
Command
For MAC (this is only the mac address for on-board giga eth, the machine may have other mac, wired or wireless)
root@winsuntech:~# dd if=/dev/mtdblock0 of=file bs=1 skip=1660976 count=6
6+0 records in
6+0 records out
6 bytes (6 B) copied, 0.00287158 s, 2.1 kB/s
root@winsuntech:~# cat file | xxd -p
001e33104005
root@winsuntech:~#
For P2P
root@winsuntech:~# dd if=/dev/mtdblock0 of=file bs=1 skip=1697664 count=20
20+0 records in
20+0 records out
20 bytes (20 B) copied, 0.00301802 s, 6.6 kB/s
root@winsuntech:~# cat file
12345678901234567890root@winsuntech:~#
For S/N
root@winsuntech:~# dd if=/dev/mtdblock0 of=file bs=1 skip=1697760 count=11
11+0 records in
11+0 records out
11 bytes (11 B) copied, 0.00287021 s, 3.8 kB/s
root@winsuntech:~# cat file
801DNN00006root@winsuntech:~#