20160803_jeffrey - silenceuncrio/diary GitHub Wiki

Index

  • 0815 - review
  • 0825 - 再確認 - 修改 <IMX_KOBS_SRC> - 燒錄 U-Boot image - 是否能開機
  • 0840 - 可以開機 - 放心 trace imx-kobs source code
  • 0845 - 如何透過網路將電腦上的檔案上傳到 M300
  • 0950 - 利用 tftpbootserverip 上將 test.bin 複製到 address 0x80000000
  • 1020 - 從 RAM address 0x80000000test.bin 複製到 NAND Flash address 0x01000000
  • 1100 - cmp command
  • 1120 - 怎麼把 M300 RAM 裡某一段的內容再傳到 PC 上 - tftpput
  • 1305 - 將 RAM address 0x80000000 裡 64 bytes 的 test.bin 利用 tftpput put 到 tftp server 上
  • 1325 - 理論 - 0x300000 大的 u-boot-all.bin 寫入 NAND Flash - 開機
  • 1340 - NAND read from offset 0 failed - nand read.raw... OK
  • 1450 - 13 號板 - 玩第一個 page 觀察 OOB 的變化
  • 1545 - FCBx 用 read.raw/write.raw - DBBTxtmp_kobs_ng 用 read/write
  • 1800 - 13 號板 - 開機成功 - 外包廠看到 SOP 可能 很不爽

0815

review 先

0825

再確認一次修改了 <IMX_KOBS_SRC> 之後

取代 MfgTool 的 Profiles\Linux\OS Firmware\firmware\fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot

所燒錄的 U-Boot image 是否能開機

0840

可以開機

這樣就比較能放心 trace imx-kobs 的 source code 了

0845

熟悉一下 U-Boot 的工具

  • 如何透過網路將電腦上的檔案上傳到 M300
  • 如何將 M300 上的檔案寫到 NAND Flash 去

先思考 如何透過網路將電腦上的檔案上傳到 M300

我們有現成的 tftpboot 可以用 - tftpboot- boot image via network using TFTP protocol

利用 help tftpboot 看一下如何使用

=> help tftpboot
tftpboot - boot image via network using TFTP protocol

Usage:
tftpboot [loadAddress] [[hostIPaddr:]bootfilename]
=>

不過使用前需要確定我們 M300 與 tftp server 是否能連線

假設我們 tftp server 的 ip 為 192.168.1.113

利用 bdinfo 來確認 ethaddripaddr 設定了沒

=> bdinfo
arch_number = 0x00000000
boot_params = 0x80000100
DRAM bank   = 0x00000000
-> start    = 0x80000000
-> size     = 0x20000000
eth0name    = FEC1
ethaddr     = 00:01:02:03:04:05
current eth = FEC1
ip_addr     = 192.168.1.1
baudrate    = 115200 bps
TLB addr    = 0x9FFF0000
relocaddr   = 0x9FF45000
reloc off   = 0x18745000
irq_sp      = 0x9EF24EA0
sp start    = 0x9EF24E90
FB base     = 0x00000000
=>

使用 ping 確認連線

=> ping 192.168.1.113
Using FEC1 device
host 192.168.1.113 is alive
=>

記得還要設定 serverip

=> setenv serverip 192.168.1.113
=> printenv serverip
serverip=192.168.1.113
=>

先準備個測試用的 file 準備上傳

例如我們需要大小為 64 bytes, 內容為隨機的 test.bin

jeffrey@jeffbuntu:~/tmp$ dd if=/dev/urandom of=test.bin bs=64 count=1
1+0 records in
1+0 records out
64 bytes copied, 0.0195592 s, 3.3 kB/s
jeffrey@jeffbuntu:~/tmp$ xxd test.bin 
00000000: a68a 10a3 5910 d6c1 ebf6 85f8 0880 ab8e  ....Y...........
00000010: aa7b 433e 5f95 8f48 2920 f50e 0acc d182  .{C>_..H) ......
00000020: 8253 6791 d557 ebc5 7d10 de5a 8a07 7ed4  .Sg..W..}..Z..~.
00000030: a252 90d6 4748 18e4 e947 c017 66b6 4845  .R..GH...G..f.HE
jeffrey@jeffbuntu:~/tmp$ 

使用 xxd 確認每個 byte 的內容方便待會上傳到 M300 後確認

0950

=> help tftpboot
tftpboot - boot image via network using TFTP protocol

Usage:
tftpboot [loadAddress] [[hostIPaddr:]bootfilename]
=>

注意到 loadAddress - 這是代表 RAM 的位址

=> help md
md - memory display

Usage:
md [.b, .w, .l] address [# of objects]
=>

md 可以看一下 memory 的內容

不過要注意不要修改到以下的 memory address 的內容

=> printenv
...
fdt_addr=0x83000000
initrd_addr=0x83800000
loadaddr=0x80800000
...

試著利用 tftpbootserverip 上將 test.bin 複製到 address 0x80000000

=> tftpboot 80000000 test.bin
Using FEC1 device
TFTP from server 192.168.1.113; our IP address is 192.168.1.1
Filename 'test.bin'.
Load address: 0x80000000
Loading: #
         1000 Bytes/s
done
Bytes transferred = 64 (40 hex)

確認一下內容

=> md.b 80000000 40
80000000: a6 8a 10 a3 59 10 d6 c1 eb f6 85 f8 08 80 ab 8e    ....Y...........
80000010: aa 7b 43 3e 5f 95 8f 48 29 20 f5 0e 0a cc d1 82    .{C>_..H) ......
80000020: 82 53 67 91 d5 57 eb c5 7d 10 de 5a 8a 07 7e d4    .Sg..W..}..Z..~.
80000030: a2 52 90 d6 47 48 18 e4 e9 47 c0 17 66 b6 48 45    .R..GH...G..f.HE

確認無誤

1020

那怎麼把 test.bin 寫到 NAND Flash 去呢?

nd biterr off - make a bit error at offset (UNSAFE)
=>
nand - NAND sub-system

Usage:
nand info - show available NAND devices
nand device [dev] - show or set current device
nand read - addr off|partition size
nand write - addr off|partition size
    read/write 'size' bytes starting at offset 'off'
    to/from memory address 'addr', skipping bad blocks.
nand read.raw - addr off|partition [count]
nand write.raw - addr off|partition [count]
    Use read.raw/write.raw to avoid ECC and access the flash as-is.
...

先使用 nand write 就好了

不過先 nand read 看看

參考 Nand flash uboot 命令详解 - dancy_xu

nand read 的使用方式很讓人誤會 - nand read addr off size

addr 指的是 RAM 的 address, off 指的是 NAND Flash 的 address

待會就把 NAND Flash 的內容讀個 64 bytes 到 RAM address 0x81000000

先觀察一下讀之前 RAM address .0x81000000 的內容

=> md.b 81000000 40
81000000: b6 8a 80 d9 b2 1d 10 f0 19 00 97 19 13 85 b0 6b    ...............k
81000010: 58 18 01 c1 80 f2 01 4c 28 02 00 00 2a 27 10 42    X......L(...*'.B
81000020: 9a 11 0c 05 a2 30 22 01 20 d7 88 34 08 cb 88 1c    .....0". ..4....
81000030: 29 12 20 88 41 88 15 40 14 a8 01 84 34 00 03 00    ). [email protected]...

從 NAND Flash address 0x01000000(16,777,216) 的地方開始讀好了 - 大約是 16MB 的地方

nand read 81000000 1000000 40

=> nand read 81000000 1000000 40

NAND read: device 0 offset 0x1000000, size 0x40
 64 bytes read: OK

再觀察 RAM address .0x81000000 的內容

=> md.b 81000000 40
81000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
81000010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
81000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
81000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

試著從剛剛 RAM address 0x80000000test.bin 所在之處將 test.bin 複製到 NAND Flash address 0x01000000

=> nand write 80000000 1000000 40

NAND write: device 0 offset 0x1000000, size 0x40
 64 bytes written: OK

從 NAND Flash address 0x01000000 讀 64 bytes 到 RAM address 0x81000000

=> nand read 81000000 1000000 40

NAND read: device 0 offset 0x1000000, size 0x40
 64 bytes read: OK

確認 RAM address 0x81000000 的內容

=> md.b 81000000 40
81000000: a6 8a 10 a3 59 10 d6 c1 eb f6 85 f8 08 80 ab 8e    ....Y...........
81000010: aa 7b 43 3e 5f 95 8f 48 29 20 f5 0e 0a cc d1 82    .{C>_..H) ......
81000020: 82 53 67 91 d5 57 eb c5 7d 10 de 5a 8a 07 7e d4    .Sg..W..}..Z..~.
81000030: a2 52 90 d6 47 48 18 e4 e9 47 c0 17 66 b6 48 45    .R..GH...G..f.HE

這樣便可確認 test.bin 成功的寫入到 NAND Flash address 0x01000000 去了

1100

64 bytes 的內容用肉眼比對還可行

不過內容量一大了就太勉強了

=> help cmp
cmp - memory compare

Usage:
cmp [.b, .w, .l] addr1 addr2 count

試一下 cmp command

我們知道目前 RAM address 0x800000000x81000000 都有一個 64 bytes 的 test.bin

=> cmp.b 80000000 81000000 40
Total of 64 byte(s) were the same

看來效果很讚

1120

那怎麼把 M300 RAM 裡某一段的內容再傳到 PC 上呢?

tftp put ?

沒有這 command

不過在 <UBOOT_SRC> 的 cmd_net.c 看到

#ifdef CONFIG_CMD_TFTPPUT
int do_tftpput(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	int ret;

	ret = netboot_common(TFTPPUT, cmdtp, argc, argv);
	return ret;
}

U_BOOT_CMD(
	tftpput,	4,	1,	do_tftpput,
	"TFTP put command, for uploading files to a server",
	"Address Size [[hostIPaddr:]filename]"
);
#endif

目前 CONFIG_CMD_TFTPPUT 沒有被定義

在 <UBOOT_SRC_NAND> 的 mx6ul_14x14_evk.h 去定義 CONFIG_CMD_TFTPPUT

make 產生 u-boot.i.xdd 到 SD Card 去

=> help tftpput
tftpput - TFTP put command, for uploading files to a server

Usage:
tftpput Address Size [[hostIPaddr:]filename]

有囉... 下午再來試

1305

試著將 RAM address 0x80000000 裡 64 bytes 的 test.bin 利用 tftpput put 到 tftp server 上

=> tftpput 80000000 40 test_ram.bin
Using FEC1 device
TFTP to server 192.168.1.113; our IP address is 192.168.1.1
Filename 'test_ram.bin'.
Save address: 0x80000000
Save size:    0x40
Saving: *
         20.5 KiB/s
done
Bytes transferred = 64 (40 hex)

用肉眼看一下

jeffrey@jeffbuntu:~/tmp$ xxd test_ram.bin 
00000000: a68a 10a3 5910 d6c1 ebf6 85f8 0880 ab8e  ....Y...........
00000010: aa7b 433e 5f95 8f48 2920 f50e 0acc d182  .{C>_..H) ......
00000020: 8253 6791 d557 ebc5 7d10 de5a 8a07 7ed4  .Sg..W..}..Z..~.
00000030: a252 90d6 4748 18e4 e947 c017 66b6 4845  .R..GH...G..f.HE
jeffrey@jeffbuntu:~/tmp$ xxd test.bin 
00000000: a68a 10a3 5910 d6c1 ebf6 85f8 0880 ab8e  ....Y...........
00000010: aa7b 433e 5f95 8f48 2920 f50e 0acc d182  .{C>_..H) ......
00000020: 8253 6791 d557 ebc5 7d10 de5a 8a07 7ed4  .Sg..W..}..Z..~.
00000030: a252 90d6 4748 18e4 e947 c017 66b6 4845  .R..GH...G..f.HE

或是用 diff

jeffrey@jeffbuntu:~/tmp$ diff test.bin test_ram.bin 
jeffrey@jeffbuntu:~/tmp$ 

沒任何 output 就是 test.bintest_ram.bin 完全相同的意思

1325

手上的 CPU 板是 6 號

從 NAND Flash 可以開機

mx6ul_14x14_evk.hmtdparts 定義為 mtdparts=gpmi-nand:3m(boot),16m(kernel),16m(dtb),-(rootfs)

MfgTool 燒錄過程的 console 有這樣的 log

...
Creating 4 MTD partitions on "gpmi-nand":
0x000000000000-0x000000300000 : "boot"
0x000000300000-0x000001300000 : "kernel"
0x000001300000-0x000002300000 : "dtb"
0x000002300000-0x000008000000 : "rootfs"
gpmi-nand 1806000.gpmi-nand: driver registered.
...
UTP: executing "kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 $FILE"
...
v6_rom_mtd_commit_structures()
-------------- Start to write the [ FCB ] -----
mtd: erasing @0:0x0-0x20000
mtd: Writing FCB0 [ @0:0x0 ] (840) *
mtd: erasing @0:0x20000-0x40000
mtd: Writing FCB1 [ @0:0x20000 ] (840) *
mtd: erasing @0:0x40000-0x60000
mtd: Writing FCB2 [ @0:0x40000 ] (840) *
mtd: erasing @0:0x60000-0x80000
mtd: Writing FCB3 [ @0:0x60000 ] (840) *
mtd_commit_bcb(FCB): status 0

-------------- Start to write the [ DBBT ] -----
mtd: erasing @0:0x80000-0xa0000
mtd: Writing DBBT0 [ @0:0x80000 ] (800) *
mtd: erasing @0:0xa0000-0xc0000
mtd: Writing DBBT1 [ @0:0xa0000 ] (800) *
mtd: erasing @0:0xc0000-0xe0000
mtd: Writing DBBT2 [ @0:0xc0000 ] (800) *
mtd: erasing @0:0xe0000-0x100000
mtd: Writing DBBT3 [ @0:0xe0000 ] (800) *
mtd_commit_bcb(DBBT): status 0

---------- Start to write the [ .tmp_kobs_ng ]----
mtd: Writting .tmp_kobs_ng: #0 @0: 0x00100000 - 0x00165000
mtd: erasing @0:0x100000-0x120000
mtd: erasing @0:0x120000-0x140000
mtd: erasing @0:0x140000-0x160000
mtd: erasing @0:0x160000-0x180000
mtd: We write one page for save guard. *
mtd: Writting .tmp_kobs_ng: #1 @0: 0x00200000 - 0x00265000
mtd: erasing @0:0x200000-0x220000
mtd: erasing @0:0x220000-0x240000
mtd: erasing @0:0x240000-0x260000
mtd: erasing @0:0x260000-0x280000
mtd: We write one page for save guard. *
UTP: sending Success to kernel for command $ kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 $FILE.
utp_poll: pass returned.
...

簡單來說

不管 kobs-ng 做的事有多複雜

最終都逃不出 NAND Flash assress 0x000000000x00300000 這個範圍

計有 0x300000(3,145,728) 這麼大

理論上我們可以把這一大坨 0x300000 大的東西從 NAND Flash read 到 RAM address 0x80000000

再從 RAM 把這一坨 put 到 tftp server 來

就叫它 u-boot-all.bin 好了

再利用 tftpboot download 到 M300 RAM address 0x81000000

寫入 NAND Flash 前先比較一下

寫入

從 NAND Flash 開機

一拍兩瞪眼

1340

實際針對 6 號板來做吧

從 NAND Flash address 0x00000000 讀 0x300000 這麼多 bytes 到 RAM address 0x81000000

=> nand read 81000000 00000000 300000

NAND read: device 0 offset 0x0, size 0x300000
NAND read from offset 0 failed -74
 0 bytes read: ERROR

shit! 一次讀太多嗎?

=> nand info

Device 0: nand0, sector size 128 KiB
  Page size      2048 b
  OOB size         64 b
  Erase size   131072 b

一個 page 有 2048 bytes

=> nand read 81000000 800 800

NAND read: device 0 offset 0x800, size 0x800
 2048 bytes read: OK

讀第 2 個 page 可以

=> nand read 81000000 0 800

NAND read: device 0 offset 0x0, size 0x800
NAND read from offset 0 failed -74
 0 bytes read: ERROR

讀第一個不行

=> nand read.raw 81000000 0 800

NAND read:  4325376 bytes read: OK
=>

這樣就可以了 - nand read.raw?

=> help nand
nand - NAND sub-system

Usage:
...
nand read.raw - addr off|partition [count]
nand write.raw - addr off|partition [count]
    Use read.raw/write.raw to avoid ECC and access the flash as-is.
...

我看就先針對這第一個 page 來下手 - 0x800 bytes - 2,048 bytes

理論上我用 nand write.raw 再從 RAM address 0x81000000 把這 0x800 大的東西寫回 NAND Flash 還是要可以開機才對

=> nand write.raw 81000000 0 800

NAND write:  4325376 bytes written: OK

為什麼寫了 4325376 bytes

hex 為 0x420000 ?

我看我還是把這第一個 page 用 tftpput 丟到 tftp server 上再說

=> tftpput 81000000 800 page_1.bin
Using FEC1 device
TFTP to server 192.168.1.113; our IP address is 192.168.1.1
Filename 'page_1.bin'.
Save address: 0x81000000
Save size:    0x800
Saving: Payload (1514) too large
#T Payload (1514) too large
T Payload (1514) too large
T Payload (1514) too large
...
Abort
=>

shit! tftp 的 payload 不夠放一個 page

分兩次

=> tftpput 81000000 400 page_1_1.bin
Using FEC1 device
TFTP to server 192.168.1.113; our IP address is 192.168.1.1
Filename 'page_1_1.bin'.
Save address: 0x81000000
Save size:    0x400
Saving: *
         333 KiB/s
done
Bytes transferred = 1024 (400 hex)
=> tftpput 81000400 400 page_1_2.bin
Using FEC1 device
TFTP to server 192.168.1.113; our IP address is 192.168.1.1
Filename 'page_1_2.bin'.
Save address: 0x81000400
Save size:    0x400
Saving: *
         333 KiB/s
done
Bytes transferred = 1024 (400 hex)
=>

到時候再想辦法合併成 2048 bytes 的 page 1

不過使用 nand dump 時 - nand dump[.oob] off - dump page

=> nand dump 0 1
Page 00000000 dump:
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 01 50 3c 00 02
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 c2 00  00 00 51 58 9a 40 60 20
        83 20 70 00 e1 09 83 41  20 20 24 02 40 03 21 8a
        26 00 2c 20 68 83 0c 02  31 0a 64 00 04 41 61 a1
        a8 02 71 28 75 40 05 09  20 ac a0 10 22 a8 61 02
        25 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 84 a0 00 00 42
        08 81 31 03 10 04 32 04  e0 47 4a 14 01 07 00 04
        40 08 10 60 0a 16 00 16  00 2e 41 08 00 80 1a 12
        00 14 80 14 01 08 48 00  1a 00 40 8d 08 00 85 08
        00 44 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        ...
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
OOB:
        ff 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00
=>

還有 OOB 這個 field - 8 * 8 = 64 bytes

1450

拿一塊 13 號板從 nand scrub.chip 後開始玩第一個 page 觀察 OOB 的變化

=> nand dump 0 1
Page 00000000 dump:
        ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
        ...
        ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
OOB:
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
        ff ff ff ff ff ff ff ff
=>

直接來個 2048 bytes 的 test_2048.bin 試試

=> tftpboot 80000000 test_2048.bin
Using FEC1 device
TFTP from server 192.168.1.113; our IP address is 192.168.1.13
Filename 'test_2048.bin'.
Load address: 0x80000000
Loading: #
         666 KiB/s
done
Bytes transferred = 2048 (800 hex)

寫到 NAND Flash 的第一個 page 去

=> nand write 80000000 0 800

NAND write: device 0 offset 0x0, size 0x800
 2048 bytes written: OK

可以耶...

dump 看看

=> nand dump 0 1
Page 00000000 dump:
        c3 ff ff ff ff ff ff ff  ff ff 2e f9 a8 af e8 b3
        12 79 94 d1 bf 00 71 78  7f 12 04 27 bc a7 cf 58
        ...
        96 98 4c de a4 e4 f8 57  4a 0e ff 1b 66 46 f4 8c
OOB:
        ff 62 01 32 60 67 2d e1
        70 34 4f b3 a2 d7 be 29
        2b 1b 6b 31 3a bd aa 75
        48 ee ee de e7 9e c1 3e
        ef d2 32 0e 00 00 00 00
        00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00
=>

不過可以用 nand read 第一個 page 耶...

=> nand read 81000000 0 800

NAND read: device 0 offset 0x0, size 0x800
 2048 bytes read: OK
=>

奇怪

1545

我們可以用 nand read.raw 一次 read 一整個 page 包含 OOB - 共 2048+64 = 2112 bytes

不過寫回去的時候也要使用 nand write.raw

-------------- Start to write the [ FCB ] -----
mtd: erasing @0:0x0-0x20000
mtd: Writing FCB0 [ @0:0x0 ] (840) *
mtd: erasing @0:0x20000-0x40000
mtd: Writing FCB1 [ @0:0x20000 ] (840) *
mtd: erasing @0:0x40000-0x60000
mtd: Writing FCB2 [ @0:0x40000 ] (840) *
mtd: erasing @0:0x60000-0x80000
mtd: Writing FCB3 [ @0:0x60000 ] (840) *
mtd_commit_bcb(FCB): status 0

-------------- Start to write the [ DBBT ] -----
mtd: erasing @0:0x80000-0xa0000
mtd: Writing DBBT0 [ @0:0x80000 ] (800) *
mtd: erasing @0:0xa0000-0xc0000
mtd: Writing DBBT1 [ @0:0xa0000 ] (800) *
mtd: erasing @0:0xc0000-0xe0000
mtd: Writing DBBT2 [ @0:0xc0000 ] (800) *
mtd: erasing @0:0xe0000-0x100000
mtd: Writing DBBT3 [ @0:0xe0000 ] (800) *
mtd_commit_bcb(DBBT): status 0

---------- Start to write the [ .tmp_kobs_ng ]----
mtd: Writting .tmp_kobs_ng: #0 @0: 0x00100000 - 0x00165000
mtd: erasing @0:0x100000-0x120000
mtd: erasing @0:0x120000-0x140000
mtd: erasing @0:0x140000-0x160000
mtd: erasing @0:0x160000-0x180000
mtd: We write one page for save guard. *
mtd: Writting .tmp_kobs_ng: #1 @0: 0x00200000 - 0x00265000
mtd: erasing @0:0x200000-0x220000
mtd: erasing @0:0x220000-0x240000
mtd: erasing @0:0x240000-0x260000
mtd: erasing @0:0x260000-0x280000
mtd: We write one page for save guard. *

FCB0, FCB1, FCB2FCB3 應該可以使用 nand read.raw 和 nand write.raw 解決

DBBT0, DBBT1, DBBT2 和, DBBT3 使用 nand read 和 nand write 解決

tmp_kobs_ng 也是使用 nand read 和 nand write 解決

先把每個 fcb 從 nand flash read.raw 到 ram

  • nand read.raw 81000000 0 1
  • nand read.raw 81020000 20000 1
  • nand read.raw 81040000 40000 1
  • nand read.raw 81060000 60000 1

再把每個 fcb 從 ram 用 tftp put 到 tftp server - 需切割

  • tftpput 81000000 400 fcb0_1
  • tftpput 81000400 440 fcb0_2
  • tftpput 81020000 400 fcb1_1
  • tftpput 81020400 440 fcb1_2
  • tftpput 81040000 400 fcb2_1
  • tftpput 81040400 440 fcb2_2
  • tftpput 81060000 400 fcb3_1
  • tftpput 81060400 440 fcb3_2

把每個 dbbt 從 nand flash read.raw 到 ram

  • nand read 81080000 80000 800
  • nand read 810a0000 a0000 800
  • nand read 810c0000 c0000 800
  • nand read 810e0000 e0000 800

再把每個 dbbt 從 ram 用 tftp put 到 tftp server - 需切割

  • tftpput 81080000 400 dbbt0_1
  • tftpput 81080400 400 dbbt0_2
  • tftpput 810a0000 400 dbbt1_1
  • tftpput 810a0400 400 dbbt1_2
  • tftpput 810c0000 400 dbbt2_1
  • tftpput 810c0400 400 dbbt2_2
  • tftpput 810e0000 400 dbbt3_1
  • tftpput 810e0400 400 dbbt3_2

把 tmp_kobs_ng_0 從 nand flash read 到 ram

  • nand read 81100000 100000 65800 - 65000 + 800(one page for save guard) = 65800

再把 tmp_kobs_ng_0 從 ram 用 tftp put 到 tftp server - 需切割

  • tftpput 81100000 400 tmp_kobs_ng_0_01
  • tftpput 81100400 400 tmp_kobs_ng_0_02
  • tftpput 81100800 400 tmp_kobs_ng_0_03
  • tftpput 81100b00 400 tmp_kobs_ng_0_04
  • ...
  • tftpput 81164b00 400 tmp_kobs_ng_0_x4
  • tftpput 81165000 400 tmp_kobs_ng_0_x3
  • tftpput 81165400 400 tmp_kobs_ng_0_x2
  • tftpput 81165800 400 tmp_kobs_ng_0_x1

超麻煩... 直接修改原本的 image 算了

反正前面補 1024 bytes, 後面捕兩個 1024 bytes

1800

最後我得到下述清單

  • fcb0
  • fcb1
  • fcb2
  • fcb3
  • dbbt0
  • dbbt1
  • dbbt2
  • dbbt3
  • tmp_kobs_ng

拿 13 號板來開刀

  • fcb0
    • tftpboot 81000000 fcb0
    • nand write.raw 81000000 0 1
  • fcb1
    • tftpboot 81020000 fcb1
    • nand write.raw 81020000 20000 1
  • fcb2
    • tftpboot 81040000 fcb2
    • nand write.raw 81040000 40000 1
  • fcb3
    • tftpboot 81060000 fcb3
    • nand write.raw 81060000 60000 1
  • dbbt0
    • tftpboot 81080000 dbbt0
    • nand write 81080000 80000 800
  • dbbt1
    • tftpboot 810a0000 dbbt1
    • nand write 810a0000 a0000 800
  • dbbt2
    • tftpboot 810c0000 dbbt2
    • nand write 810c0000 c0000 800
  • dbbt3
    • tftpboot 810e0000 dbbt3
    • nand write 810e0000 e0000 800
  • tmp_kobs_ng
    • tftpboot 81100000 tmp_kobs_ng
    • nand write 81100000 100000 65800
  • tmp_kobs_ng
    • nand write 81100000 200000 65800

關機

切換成 NAND Flash boot

開機... 成功囉... 爽

不過外包廠看到 SOP 可能會很不爽

⚠️ **GitHub.com Fallback** ⚠️