20190702_jeffrey - silenceuncrio/diary GitHub Wiki
mistrastar 還沒回信
繼續trace 之前先就現有的 trace 複習一下
mistastar 回信並給了我一支 patch 過的 mtk_nand.c
patch 後竟然成功了
先試著把自己放的 debug message 拿掉再 build
確定後再回個 mail 感謝 對方
以其中一台有 bad block 為例
相關的 console 如下
...
[ 2.116000] # MTK NAND # : Use HW ECC
[ 2.120000] NAND ID [C2 F1 80 95 02, 00809502]
[ 2.132000] Device not found, ID: c2f1
[ 2.140000] Not Support this Device!
[ 2.144000] chip_mode=00000001
[ 2.152000] Support this Device in MTK table! c2f1
[ 2.160000] NAND device: Manufacturer ID: 0xc2, Chip ID: 0xf1 (Macronix NAND 128MiB 3,3V 8-bit), 128MiB, page size: 2048, OOB size: 64
[ 2.184000] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[ 2.200000] Scanning device for bad blocks
[ 2.284000] Bad eraseblock 334 at 0x0000029c0000
[ 2.336000] Bad eraseblock 515 at 0x000004060000
[ 2.468000] Signature matched and data read!
[ 2.476000] load_fact_bbt success 1023
[ 2.484000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.500000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.520000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.540000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.560000] c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.580000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.600000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.620000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.640000] active dual image is b!
[ 2.648000] Creating 8 MTD partitions on "MT7621-NAND":
[ 2.660000] 0x000000000000-0x000007f80000 : "ALL"
[ 2.668000] 0x000000000000-0x000000080000 : "Bootloader"
[ 2.680000] 0x000000080000-0x000000100000 : "Config"
[ 2.692000] 0x000000100000-0x000000140000 : "Factory"
[ 2.704000] 0x000002140000-0x000004140000 : "firmware"
[ 2.716000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 2.740000] 0x0000022ef739-0x000004140000 : "rootfs"
[ 2.760000] mtd_pad_erasesize: bad_detected= 1
[ 2.772000] mtd: partition "rootfs_data" created automatically, ofs=0x2fa0000, len=0x11a0000
[ 2.792000] 0x000002fa0000-0x000004140000 : "rootfs_data"
[ 2.804000] 0x000000140000-0x000002140000 : "reserve"
[ 2.812000] 0x000005000000-0x000006000000 : "Proscend-config"
[ 2.828000] 0x000006000000-0x000007000000 : "Proscend-misc"
[ 2.836000] [mtk_nand] probe successfully!
[ 2.844000] rootfs = 22ef739 to 2fa0000
[ 2.852000] PPP generic driver version 2.4.2
...
[ 3.716000] 8021q: 802.1Q VLAN Support v1.8
[ 3.736000] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
...
可以發現雖然還是有 bad block
[ 2.284000] Bad eraseblock 334 at 0x0000029c0000
[ 2.336000] Bad eraseblock 515 at 0x000004060000
其中 Bad eraseblock 334 at 0x0000029c0000
還落在 rootfs
[ 2.844000] rootfs = 22ef739 to 2fa0000
但 suashfs 還是成功 mounted
[ 3.736000] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
打鐵趁熱
先上 patch 吧
先把需要的 files 備份出來
M360P/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14/drivers/mtd
- mtdpart.c
- mtdsplit.c
- nand/mtk_nand.c
參考 M360P wiki 來製作 kernel patch
step 1:Make a clean kernel code
利用 make target/linux/{clean,prepare} V=s QUILT=1
user@10972b0a698a:~$ make target/linux/{clean,prepare} V=s QUILT=1
Step 2:Go to kernel source code directory
利用 cd build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14/
user@10972b0a698a:~$ cd build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14/
user@10972b0a698a:~/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14$
Step 3:Create new patch file
參考 target/linux/ramips/patches
目錄來幫 patch 取個名字
以 M360P develop branch 為主
➜ M360P git:(develop) ✗ ls target/linux/ramips/patches -al
total 412
drwxrwxr-x 2 jeffrey jeffrey 4096 四 10 11:07 .
drwxrwxr-x 12 jeffrey jeffrey 4096 六 5 2018 ..
-rw-rw-r-- 1 jeffrey jeffrey 307 六 5 2018 0601-splice.patch
-rw-rw-r-- 1 jeffrey jeffrey 371 六 5 2018 0602-ufsd.patch
-rw-rw-r-- 1 jeffrey jeffrey 5187 六 5 2018 0621-sched_act_connmark.patch
-rw-rw-r-- 1 jeffrey jeffrey 418 六 5 2018 064-compile-error.patch
-rw-rw-r-- 1 jeffrey jeffrey 703 六 5 2018 065-hnat-interface.patch
-rw-rw-r-- 1 jeffrey jeffrey 622 六 5 2018 066-support-RA_HW_NAT_WIFI_NEW_ARCH.patch
-rw-rw-r-- 1 jeffrey jeffrey 2353 六 5 2018 067-lanwan-vlan.patch
-rw-rw-r-- 1 jeffrey jeffrey 516 六 5 2018 067-whnat.patch
-rw-rw-r-- 1 jeffrey jeffrey 584 六 5 2018 068-hwnat-error.patch
-rw-rw-r-- 1 jeffrey jeffrey 1814 六 5 2018 070-fix-br0.patch
-rw-rw-r-- 1 jeffrey jeffrey 2404 六 5 2018 071-[MTK]-fix-raeth-skb.patch
-rw-rw-r-- 1 jeffrey jeffrey 982 六 5 2018 071-nand-controller-busy.patch
-rw-rw-r-- 1 jeffrey jeffrey 638 六 5 2018 079-fix-mt7628-wan-mac-value-addr.patch
-rw-rw-r-- 1 jeffrey jeffrey 1599 六 5 2018 081-fix-boot-fail-when-bad-block-in-rootfs.patch
-rw-rw-r-- 1 jeffrey jeffrey 18793 六 5 2018 086-MSTC_IO_GROUP_TO_GPIOMODE.patch
-rw-rw-r-- 1 jeffrey jeffrey 1888 六 5 2018 0902-fix-hwnat-register-out-of-range.patch
-rw-rw-r-- 1 jeffrey jeffrey 688 六 5 2018 091-support-large-scan-list.patch
-rw-rw-r-- 1 jeffrey jeffrey 10697 六 5 2018 1010-support-ebtables-time-match.patch
-rw-rw-r-- 1 jeffrey jeffrey 944 六 5 2018 1012-add-ESMT-new-flash-id.patch
-rw-rw-r-- 1 jeffrey jeffrey 6729 六 5 2018 1101-usb-serial_option.patch
-rw-rw-r-- 1 jeffrey jeffrey 4137 六 5 2018 1102-M360P-usb-serial_option.patch
-rw-rw-r-- 1 jeffrey jeffrey 718 六 5 2018 1103-M360P-watchdog_max_timeout.patch
-rw-rw-r-- 1 jeffrey jeffrey 1132 六 5 2018 1104-M360P-increase_factory_part_size.patch
-rw-rw-r-- 1 jeffrey jeffrey 509 六 5 2018 1105-M360P-hide_nand_data_buffer_alignment_warning.patch
-rw-rw-r-- 1 jeffrey jeffrey 847 六 5 2018 1106-M360P-remove_LTE_USB_autosuspend.patch
-rw-rw-r-- 1 jeffrey jeffrey 2684 六 5 2018 1107-M360P-relayout_nand_mtd.patch
-rw-rw-r-- 1 jeffrey jeffrey 1803 六 5 2018 1108-M360P-dual_image.patch
-rw-rw-r-- 1 jeffrey jeffrey 579 十 9 2018 1109-M360P-IPS_set_max_remember_pkts_255.patch
-rw-rw-r-- 1 jeffrey jeffrey 47983 十 24 2018 1110-M360P-url_filter.patch
-rw-rw-r-- 1 jeffrey jeffrey 9077 十一 5 2018 1111-M360P-url_filter6.patch
-rw-rw-r-- 1 jeffrey jeffrey 12392 十二 11 2018 1112-quectel-1-3-5-driver.patch
-rw-rw-r-- 1 jeffrey jeffrey 666 四 10 11:07 1113-M360P-dont_add_trbs_for_ZLP_to_avoid_usb_hang.patch
-rwxrwxr-x 1 jeffrey jeffrey 160223 九 10 2018 2018090600_macnat_translate.patch
-rw-rw-r-- 1 jeffrey jeffrey 13511 一 3 11:05 2018091900_macnat_translate.patch
patch 名字就叫 1114-M360P-fix_bad_block.patch
user@10972b0a698a:~/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14$ quilt new platform/1114-M360P-fix_bad_block.patch
bash: quilt: command not found
user@10972b0a698a:~/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14$
尷尬了
docker 裡沒有 quilt
我應該可以直接在 ubuntu 下面做做看
也就是不要在 docker container 裡面
回到 Step 2:Go to kernel source code directory
利用 cd build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14/
➜ M360P git:(develop) ✗ cd build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14
➜ linux-3.10.14 git:(develop) ✗
patch 名叫 1114-M360P-fix_bad_block.patch
- quilt new platform/1114-M360P-fix_bad_block.patch
➜ linux-3.10.14 git:(develop) ✗ quilt new platform/1114-M360P-fix_bad_block.patch
Patch patches/platform/1114-M360P-fix_bad_block.patch is now on top
➜ linux-3.10.14 git:(develop) ✗
剩下的下午繼續
繼續
使用 quilt add
加入待會要的 files
- drivers/mtd/mtdpart.c
quilt add drivers/mtd/mtdpart.c
- drivers/mtd/mtdsplit.c
quilt add drivers/mtd/mtdsplit.c
- drivers/mtd/nand/mtk_nand.c
quilt add drivers/mtd/nand/mtk_nand.c
結果如下
➜ linux-3.10.14 git:(develop) ✗ quilt add drivers/mtd/mtdpart.c
File drivers/mtd/mtdpart.c added to patch patches/platform/1114-M360P-fix_bad_block.patch
➜ linux-3.10.14 git:(develop) ✗ quilt add drivers/mtd/mtdsplit.c
File drivers/mtd/mtdsplit.c added to patch patches/platform/1114-M360P-fix_bad_block.patch
➜ linux-3.10.14 git:(develop) ✗ quilt add drivers/mtd/nand/mtk_nand.c
File drivers/mtd/nand/mtk_nand.c added to patch patches/platform/1114-M360P-fix_bad_block.patch
➜ linux-3.10.14 git:(develop) ✗
繼續之前先切到準備再次 release 的 branch - hotfix/v1.03-patch
➜ linux-3.10.14 git:(develop) ✗ git checkout hotfix/v1.03-patch
Branch hotfix/v1.03-patch set up to track remote branch hotfix/v1.03-patch from origin.
Switched to a new branch 'hotfix/v1.03-patch'
➜ linux-3.10.14 git:(hotfix/v1.03-patch) ✗
把剛剛備份出來的 files 覆蓋掉原本的 files
➜ linux-3.10.14 git:(hotfix/v1.03-patch) ✗ pwd
/home/jeffrey/M360P/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14
➜ linux-3.10.14 git:(hotfix/v1.03-patch) ✗ cd drivers/mtd
➜ mtd git:(hotfix/v1.03-patch) ✗ cp ~/tmp/mtd.fix/mtdpart.c .
➜ mtd git:(hotfix/v1.03-patch) ✗ cp ~/tmp/mtd.fix/mtdsplit.c .
➜ mtd git:(hotfix/v1.03-patch) ✗ cd nand
➜ nand git:(hotfix/v1.03-patch) ✗ cp ~/tmp/mtd.fix/mtk_nand.c .
➜ nand git:(hotfix/v1.03-patch) ✗ pwd
/home/jeffrey/M360P/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14/drivers/mtd/nand
➜ nand git:(hotfix/v1.03-patch) ✗ cd ../../
➜ drivers git:(hotfix/v1.03-patch) ✗ pwd
/home/jeffrey/M360P/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14/drivers
➜ drivers git:(hotfix/v1.03-patch) ✗
利用 quilt refresh
得到我們要的 patch
➜ drivers git:(hotfix/v1.03-patch) ✗ quilt refresh
Warning: trailing whitespace in lines 873,1016 of drivers/mtd/mtdpart.c
Refreshed patch ../patches/platform/1114-M360P-fix_bad_block.patch
➜ drivers git:(hotfix/v1.03-patch) ✗
Step 4:Update the information back to kernel patch path
make target/linux/update V=s
這時候在 M360P source code 根目錄下敲 git status
➜ M360P git:(hotfix/v1.03-patch) ✗ git status
On branch hotfix/v1.03-patch
Your branch is up-to-date with 'origin/hotfix/v1.03-patch'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
proscend/mconfig/lxdialog/lxdialog
proscend/prosrc/icos/rawpacket/rawping
target/linux/ramips/patches/1114-M360P-fix_bad_block.patch
nothing added to commit but untracked files present (use "git add" to track)
➜ M360P git:(hotfix/v1.03-patch) ✗
便可以看到需要加上的 target/linux/ramips/patches/1114-M360P-fix_bad_block.patch
不過在 commit 之前先 build 個 image 試一下
直接在 proscend 外層敲 make
再進 proscend 目錄
make clean
後再 make
利用 uboot upgrade 後試試
...
[ 2.116000] # MTK NAND # : Use HW ECC
[ 2.120000] NAND ID [C2 F1 80 95 02, 00809502]
[ 2.132000] Device not found, ID: c2f1
[ 2.136000] Not Support this Device!
[ 2.144000] chip_mode=00000001
[ 2.152000] Support this Device in MTK table! c2f1
[ 2.160000] NAND device: Manufacturer ID: 0xc2, Chip ID: 0xf1 (Macronix NAND 128MiB 3,3V 8-bit), 128MiB, page size: 2048, OOB size: 64
[ 2.184000] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[ 2.200000] Scanning device for bad blocks
[ 2.284000] Bad eraseblock 334 at 0x0000029c0000
[ 2.336000] Bad eraseblock 515 at 0x000004060000
[ 2.468000] Signature matched and data read!
[ 2.476000] load_fact_bbt success 1023
[ 2.484000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.500000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.520000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.540000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.560000] c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.580000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.600000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.620000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.640000] active dual image is b!
[ 2.648000] Creating 8 MTD partitions on "MT7621-NAND":
[ 2.660000] 0x000000000000-0x000007f80000 : "ALL"
[ 2.668000] 0x000000000000-0x000000080000 : "Bootloader"
[ 2.680000] 0x000000080000-0x000000100000 : "Config"
[ 2.692000] 0x000000100000-0x000000140000 : "Factory"
[ 2.704000] 0x000002140000-0x000004140000 : "firmware"
[ 2.716000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 2.740000] 0x0000022ef6b1-0x000004140000 : "rootfs"
[ 2.760000] mtd_pad_erasesize: bad_detected= 1
[ 2.772000] mtd: partition "rootfs_data" created automatically, ofs=0x2fa0000, len=0x11a0000
[ 2.792000] 0x000002fa0000-0x000004140000 : "rootfs_data"
[ 2.804000] 0x000000140000-0x000002140000 : "reserve"
[ 2.812000] 0x000005000000-0x000006000000 : "Proscend-config"
[ 2.828000] 0x000006000000-0x000007000000 : "Proscend-misc"
[ 2.836000] [mtk_nand] probe successfully!
[ 2.844000] rootfs = 22ef6b1 to 2fa0000
[ 2.852000] PPP generic driver version 2.4.2
...
[ 3.816000] 8021q: 802.1Q VLAN Support v1.8
[ 3.832000] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
...
PASS
試著燒錄 image 到 dual image partition a 並開機試試
...
[ 2.116000] # MTK NAND # : Use HW ECC
[ 2.120000] NAND ID [C2 F1 80 95 02, 00809502]
[ 2.132000] Device not found, ID: c2f1
[ 2.140000] Not Support this Device!
[ 2.144000] chip_mode=00000001
[ 2.152000] Support this Device in MTK table! c2f1
[ 2.160000] NAND device: Manufacturer ID: 0xc2, Chip ID: 0xf1 (Macronix NAND 128MiB 3,3V 8-bit), 128MiB, page size: 2048, OOB size: 64
[ 2.184000] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[ 2.200000] Scanning device for bad blocks
[ 2.284000] Bad eraseblock 334 at 0x0000029c0000
[ 2.336000] Bad eraseblock 515 at 0x000004060000
[ 2.468000] Signature matched and data read!
[ 2.476000] load_fact_bbt success 1023
[ 2.484000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.504000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.524000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.544000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.560000] c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.580000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.600000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.620000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.640000] active dual image is a!
[ 2.648000] Creating 8 MTD partitions on "MT7621-NAND":
[ 2.660000] 0x000000000000-0x000007f80000 : "ALL"
[ 2.672000] 0x000000000000-0x000000080000 : "Bootloader"
[ 2.680000] 0x000000080000-0x000000100000 : "Config"
[ 2.692000] 0x000000100000-0x000000140000 : "Factory"
[ 2.704000] 0x000000140000-0x000002140000 : "firmware"
[ 2.716000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 2.744000] 0x0000002ef6b1-0x000002140000 : "rootfs"
[ 2.764000] mtd: partition "rootfs_data" created automatically, ofs=0xf80000, len=0x11c0000
[ 2.784000] 0x000000f80000-0x000002140000 : "rootfs_data"
[ 2.796000] 0x000002140000-0x000004140000 : "reserve"
[ 2.804000] 0x000005000000-0x000006000000 : "Proscend-config"
[ 2.820000] 0x000006000000-0x000007000000 : "Proscend-misc"
[ 2.828000] [mtk_nand] probe successfully!
[ 2.836000] rootfs = 2ef6b1 to f80000
[ 2.844000] PPP generic driver version 2.4.2
...
[ 3.708000] 8021q: 802.1Q VLAN Support v1.8
[ 3.728000] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
...
PASS
換另一片試試
...
[ 2.116000] # MTK NAND # : Use HW ECC
[ 2.120000] NAND ID [C2 F1 80 95 02, 00809502]
[ 2.132000] Device not found, ID: c2f1
[ 2.140000] Not Support this Device!
[ 2.144000] chip_mode=00000001
[ 2.152000] Support this Device in MTK table! c2f1
[ 2.160000] NAND device: Manufacturer ID: 0xc2, Chip ID: 0xf1 (Macronix NAND 128MiB 3,3V 8-bit), 128MiB, page size: 2048, OOB size: 64
[ 2.184000] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[ 2.200000] Scanning device for bad blocks
[ 2.220000] Bad eraseblock 55 at 0x0000006e0000
[ 2.304000] Bad eraseblock 373 at 0x000002ea0000
[ 2.312000] Bad eraseblock 376 at 0x000002f00000
[ 2.476000] Signature matched and data read!
[ 2.484000] load_fact_bbt success 1023
[ 2.492000] 00 00 00 00 00 00 00 00 00 00 00 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.512000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.532000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c 03 00
[ 2.552000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.568000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.588000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.608000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.628000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.648000] active dual image is b!
[ 2.656000] Creating 8 MTD partitions on "MT7621-NAND":
[ 2.668000] 0x000000000000-0x000007f80000 : "ALL"
[ 2.680000] 0x000000000000-0x000000080000 : "Bootloader"
[ 2.688000] 0x000000080000-0x000000100000 : "Config"
[ 2.700000] 0x000000100000-0x000000140000 : "Factory"
[ 2.712000] 0x000002140000-0x000004140000 : "firmware"
[ 2.724000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 2.752000] 0x0000022ef6b1-0x000004140000 : "rootfs"
[ 2.772000] mtd_pad_erasesize: bad_detected= 1
[ 2.780000] mtd_pad_erasesize: bad_detected= 2
[ 2.792000] mtd: partition "rootfs_data" created automatically, ofs=0x2fc0000, len=0x1180000
[ 2.808000] 0x000002fc0000-0x000004140000 : "rootfs_data"
[ 2.820000] 0x000000140000-0x000002140000 : "reserve"
[ 2.832000] 0x000005000000-0x000006000000 : "Proscend-config"
[ 2.844000] 0x000006000000-0x000007000000 : "Proscend-misc"
[ 2.856000] [mtk_nand] probe successfully!
[ 2.864000] rootfs = 22ef6b1 to 2fc0000
[ 2.872000] PPP generic driver version 2.4.2
...
[ 3.732000] 8021q: 802.1Q VLAN Support v1.8
[ 3.752000] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
...
PASS
換試一下 dual image partition a
...
[ 2.116000] # MTK NAND # : Use HW ECC
[ 2.120000] NAND ID [C2 F1 80 95 02, 00809502]
[ 2.132000] Device not found, ID: c2f1
[ 2.136000] Not Support this Device!
[ 2.144000] chip_mode=00000001
[ 2.152000] Support this Device in MTK table! c2f1
[ 2.160000] NAND device: Manufacturer ID: 0xc2, Chip ID: 0xf1 (Macronix NAND 128MiB 3,3V 8-bit), 128MiB, page size: 2048, OOB size: 64
[ 2.184000] [NAND]select ecc bit:4, sparesize :64 spare_per_sector=16
[ 2.200000] Scanning device for bad blocks
[ 2.220000] Bad eraseblock 55 at 0x0000006e0000
[ 2.304000] Bad eraseblock 373 at 0x000002ea0000
[ 2.312000] Bad eraseblock 376 at 0x000002f00000
[ 2.476000] Signature matched and data read!
[ 2.484000] load_fact_bbt success 1023
[ 2.492000] 00 00 00 00 00 00 00 00 00 00 00 00 00 c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.512000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.532000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c 03 00
[ 2.552000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.572000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.592000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.608000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.628000] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 2.648000] active dual image is a!
[ 2.656000] Creating 8 MTD partitions on "MT7621-NAND":
[ 2.668000] 0x000000000000-0x000007f80000 : "ALL"
[ 2.680000] 0x000000000000-0x000000080000 : "Bootloader"
[ 2.692000] 0x000000080000-0x000000100000 : "Config"
[ 2.700000] 0x000000100000-0x000000140000 : "Factory"
[ 2.712000] 0x000000140000-0x000002140000 : "firmware"
[ 2.724000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 2.752000] 0x0000002ef6b1-0x000002140000 : "rootfs"
[ 2.764000] mtd_pad_erasesize: bad_detected= 1
[ 2.784000] mtd: partition "rootfs_data" created automatically, ofs=0xfa0000, len=0x11a0000
[ 2.800000] 0x000000fa0000-0x000002140000 : "rootfs_data"
[ 2.812000] 0x000002140000-0x000004140000 : "reserve"
[ 2.824000] 0x000005000000-0x000006000000 : "Proscend-config"
[ 2.836000] 0x000006000000-0x000007000000 : "Proscend-misc"
[ 2.848000] [mtk_nand] probe successfully!
[ 2.856000] rootfs = 2ef6b1 to fa0000
[ 2.860000] PPP generic driver version 2.4.2
...
[ 3.824000] 8021q: 802.1Q VLAN Support v1.8
[ 3.840000] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
...
PASS
先上 code 吧
commit 7bdbe9d0991e33bfc6071463bb580fff8023b55b
Refs: [hotfix/v1.03-patch], {origin/hotfix/v1.03-patch}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 13:54:59 2019 +0800
fix bad block problem
- thanks the help from mistrastar
.../ramips/patches/1114-M360P-fix_bad_block.patch | 489 +++++++++++++++++++++
1 file changed, 489 insertions(+)
另外這個版本需要作個記號方便我們判斷這一版是不是已經修掉了 bad block 的問題
就放在 web ui 上的註解吧
以 chrome 瀏覽器為例
web ui 任何地方按右鍵 選擇 檢視網頁原始碼
我們會發現 html 註解 - <!-- fix bad block -->
這就表示目前的版本已經解決了 bad block 的問題
上 code
commit 9bf9f9ddfb6126564ae4a26c2bfb0e0212810aef
Refs: [hotfix/v1.03-patch], {origin/hotfix/v1.03-patch}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 14:16:44 2019 +0800
use a secrete way to indicate this version has been fixed for bad block problem
proscend/prosrc/www/src/index.html.src | 1 +
1 file changed, 1 insertion(+)
順手寫了 wiki
可以放一些後續會需要的訊息
可以寫信感謝 mistrastar 了
Dear Jeffary,
非常感謝你積極的協助
目前手邊這兩台不良品已經解決了 bad block 的問題了
等我們 release 新的 firmware 後我會 mail 給你們來 re-work 那些不良的庫存
再次感謝你們即時又積極的協助
BR
Jeffrey
回到 M330 - feature/lighttpd
- Procuts/Vendor = M330/0_GENERIC
透過 tftp 來得到需要的檔案
root@M330:~# cp -r /www/ /tmp/
root@M330:~# cd /tmp/
root@M330:/tmp# tftp -g -r web_x509_lighttpd.sh 192.168.1.113
root@M330:/tmp# tftp -g -r lighttpd.conf 192.168.1.113
root@M330:/tmp# chmod 755 web_x509_lighttpd.sh
root@M330:/tmp# ./web_x509_lighttpd.sh
Generating a 2048 bit RSA private key
............+++
...+++
writing new private key to '/tmp/icos/web/lighttpd.pem'
-----
root@M330:/tmp# lighttpd -f /tmp/lighttpd.conf
root@M330:/tmp# 1970-01-01 00:02:36: (log.c.166) server started
root@M330:/tmp#
M330 - feature/lighttpd - 'Service > SNMP'
commit ac22b4aab423756811cf7ea7c11d13a5d0ff3ac2
Refs: [feature/lighttpd]
Author: jeffrey <[email protected]>
Date: Tue Jul 2 15:42:41 2019 +0800
feature/lighttpd - 'Service > SNMP'
snmp.cgi
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
proscend/prosrc/webcgi/snmp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
M330 - feature/lighttpd - 'Service > TR069'
commit 513fc7a9d95ec9e261f45474a8c77df99f5333a2
Refs: [feature/lighttpd], {origin/feature/lighttpd}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 15:46:24 2019 +0800
feature/lighttpd - 'Service > TR069'
cwmp.cgi
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help);
proscend/prosrc/webcgi/cwmp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
M330 - feature/lighttpd - 'Service > Dynamic DNS'
commit 797c30e2c72ff6f726158aa2f9d1da67bfbab341
Refs: [feature/lighttpd], {origin/feature/lighttpd}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 15:49:43 2019 +0800
feature/lighttpd - 'Service > Dynamic DNS'
ddns.cgi
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help);
proscend/prosrc/webcgi/ddns.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
M330 - feature/lighttpd - 'Service > VRRP'
commit 3a3e035a01f62358c26fe8a206a9471dbd5a2057
Refs: [feature/lighttpd], {origin/feature/lighttpd}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 15:53:04 2019 +0800
feature/lighttpd - 'Service > VRRP'
vrrp.cgi
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help);
proscend/prosrc/webcgi/vrrp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
M330 - feature/lighttpd - 'Service > MQTT'
commit 397cc323cbf118098228d5435acc8cbcb07bd409
Refs: [feature/lighttpd], {origin/feature/lighttpd}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 15:56:03 2019 +0800
feature/lighttpd - 'Service > MQTT'
mqtt.cgi
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help);
proscend/prosrc/webcgi/mqtt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
M330 - feature/lighttpd - 'Service > UPnP'
commit 881bc41b18e9f277e8441a25201da0627b063393
Refs: [feature/lighttpd], {origin/feature/lighttpd}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 15:59:13 2019 +0800
feature/lighttpd - 'Service > UPnP'
upnp.cgi
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help);
proscend/prosrc/webcgi/upnp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
M330 - feature/lighttpd - 'Service > SMTP'
commit 39e171d6c4e11cbe7cd4703a01cec1bbd297ed69
Refs: [feature/lighttpd], {origin/feature/lighttpd}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 16:02:10 2019 +0800
feature/lighttpd - 'Service > SMTP'
smtp.cgi
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help);
proscend/prosrc/webcgi/smtp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
M330 - feature/lighttpd - 'Service > IP Alias'
commit 4c70c806ea6485425cf146a906a316c6d59f930d
Refs: [feature/lighttpd], {origin/feature/lighttpd}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 16:41:19 2019 +0800
feature/lighttpd - 'Service > IP Alias'
ip_alias.cgi
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply)
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help);
use the full path '/usr/sbin/icos/RouteStatus.sh' instead of 'RouteStatus.sh'
proscend/prosrc/webcgi/ip_alias.c | 8 ++++----
proscend/prosrc/webcgi/route.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
M330 - feature/lighttpd - 'Management > Identification' and 'Management > Administration'
commit 79175ec599e33984dc29b236a6341a14d1357838
Refs: [feature/lighttpd], {origin/feature/lighttpd}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 16:47:19 2019 +0800
feature/lighttpd - 'Management > Identification' and 'Management > Administration'
system.cgi
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config);
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply);
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _status);
proscend/prosrc/webcgi/system.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
M330 - feature/lighttpd - 'Management > SSH'
commit 863654c9e88d936529a3107977a375c29330bcd0
Refs: [feature/lighttpd], {origin/feature/lighttpd}
Author: jeffrey <[email protected]>
Date: Tue Jul 2 16:49:37 2019 +0800
feature/lighttpd - 'Management > SSH'
ssh.cgi
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config);
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply);
- jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help);
proscend/prosrc/webcgi/ssh.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
再來是一個挑戰 - 'Management > Firmware'
參考 M300 的紀錄
-
20190529_jeffrey
- 當初 upload 是透過 iweb 做的
-
20190530_jeffrey
- 傳一個 5MB 的檔案會回傳 413 -
Request Entity Too Large
- 以下兩篇說到 lighttpd v1.4.36 在 file upload 時會有問題
- 成功把 lighttpd 從 1.4.36 升級成 1.4.53
- 傳一個 5MB 的檔案會回傳 413 -
-
20190531_jeffrey
- finish 'Management > Firmware'
目前 M330 上 lighttpd 版本是 1.4.30 (ssl)
root@M330:/tmp/www/cgi-bin# lighttpd -v
lighttpd/1.4.30 (ssl) - a light and fast webserver
Build-Date: Jun 19 2019 01:51:39
希望能直接閃過 file upload 的問題
發現傳一個超過 64KB 的檔案我就會得到 413 - Request Entity Too Large
實驗後發現我只要多加一行 server.upload-dirs = ( "/tmp" )
到 lighttpd 的 config 即可
以下的 config 可以成功上傳一個 14MB 大的檔案
server.document-root = "/tmp/www/"
server.bind = "0.0.0.0"
server.port = 3000
$SERVER["socket"] == "[::]:3000" { }
$SERVER["socket"] == "0.0.0.0:3443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/icos/web/lighttpd.pem"
}
$SERVER["socket"] == "[::]:3443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/icos/web/lighttpd.pem"
}
server.modules = ( "mod_rewrite", "mod_cgi" )
index-file.names = ( "index.html" )
mimetype.assign = (
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".txt" => "text/plain",
)
cgi.assign = ( ".cgi" => "" )
url.rewrite = (
"^/api/([a-zA-Z]+)[0-9a-zA-Z=.?]*$" => "/cgi-bin/api.cgi?act=$1",
)
server.upload-dirs = ( "/tmp" )
明天繼續