找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 29944|回复: 91

每台openwrt路由器都是编程器(二),大麦DW33D 当做Nand 编程器

  [复制链接]
发表于 2020-5-20 10:41 | 显示全部楼层 |阅读模式
本帖最后由 jiuweiljp 于 2023-9-9 12:06 编辑

一、前言:
      之前发了一个帖子每台openwrt路由器都是编程器有网友提到大麦DW33D,发现这个配置不错,有NOR也有NAND Flash,内存也大256MB
闲鱼弄了一个非giga版的。
      先说说这次为什么选用dw33d,因为4300v1 实在不适合,4300改造后虽然有双flash但nor flash只是作为u-boot用,系统只能运行在nand 上,
而4300 只有128MB memory,在文件操作用很容易溢出缓存,nana dump与write过程中要注意缓存的使用情况,如果缓存快满要清理(原帖提到过),
在清理缓存前要将载有系统的nand flash 换上去,不然就会报错。
     dw33d呢就没有这个问题,系统运行在nor flash 上,nand 只作为rootfs_data 用,内存还大不少(256MB),还有16GB的TF卡,把程序放到TF卡上
运行静态编译的程序,热机换nand 没有报错情况。


二、硬件篇:
    上次改造nand 编程座很痛苦,还容易弄坏网件4300 V1的焊盘,这次我就想了一个办法用FPC座加排线。
1、所需材料如下:
(1)、编程座
     

(2)、转接板
        这个转接板我改造过,与上图的编程座针脚有点对不上,需要将插针解焊下来(较麻烦要小心保留焊盘),
        在电路板反面焊上插针(厂家有心了,反面的焊盘能对上这个编程座),可参看完成后的照片。
        在TB上也可买到空白电路板自己焊,FPC座焊接麻烦点,但不用解焊插针了。

   
(3)、24Pin排线
   注意排线有两种(同面的和反面的),我这次用的是同面的。
  

(4)、FPC座
  这种座也有两种,翻盖式与抽屉式,注意事项见图中的文字。







2、改造过程如下
(1)贴高温胶布


(2)脱焊NAND芯片,清理焊盘,焊盘留的焊锡一定要饱满(我这个就不太好),那个FPC座上路由的基板后,
        针脚不能紧贴到焊盘上有很小的缝隙,如果焊盘留的锡不饱满还要加锡,特别容易连脚。



(3)不要拖焊
TB买的座质量太次了,温度高一点塑料就化了,拖焊容易弄坏FPC座及焊盘




(4)用点焊,且要固定FPC座
   见下图我的焊盘坏了3个焊盘,还好这3个不用。注意:PFC座一定要固定在基板上,很重要。





另FPC座另外一边用胶固定,注意下使用的胶不能导电



(5)硬件完成图,注意事项见图



(二)软件篇

1、先说说原厂的U-boot吧,原厂的U-boot功能很齐全,但有个功能它如果发现你自己改了固件,在启动的时候
会将MTD7(backup,没错这个backup存储的就是原厂固件的备份),将你的固件恢复回到原厂,有个奇怪的现象恢复原厂后你用opkg安装的软件还在。

2、原厂的固件功能也很齐全,基本够用了,简单改下软件源可以自己安装opkg软件,但backup分区是锁定的,且没有暂时没有办法解锁。
     但原厂的固件有个问题如果你的没有安装nand 或nand 坏了,那在启动过程中就会卡死。(我后来仔细排查了下原厂的固件只用mtd6 (在nand上)挂rootfs_data
     而第三方opwenrt 会将 nor的部分区域也挂成rootfs_data,也就是说第三方固件会有2个rootfs_data)
  1. =========dw33d 原厂 启动
  2. 0x000000000000-0x000000040000 : "u-boot"
  3. 0x000000040000-0x000000050000 : "u-boot-env"
  4. 0x000000050000-0x000000e80000 : "rootfs"
  5.                                 mtd: partition "rootfs" set to be root filesystem
  6. 0x000000e80000-0x000000ff0000 : "kernel"
  7. 0x000000ff0000-0x000001000000 : "art"
  8. 0x000000050000-0x000000fe0000 : "firmware"
  9.                                 ath79-nand ath79-nand: AR71xx/AR9xxx Qualcomm-Atheros NAND FLash Controller driver, Version 1.0

  10. (c) 2010 Atheros Communications, Ltd.
  11.                                 NAND device: Manufacturer ID: 0x2c, Chip ID: 0xf1 (Micron NAND 128MiB 3,3V 8-bit)
  12.                                 Bad block table found at page 65472, version 0x01
  13.                                 Bad block table found at page 65408, version 0x01
  14.                                 2 cmdlinepart partitions found on MTD device ath79-nand
  15.                                 Creating 2 MTD partitions on "ath79-nand":
  16. 0x000000000000-0x000006000000 : "rootfs_data"
  17. 0x000006000000-0x000008000000 : "backup"

  18. >cat /proc/mtd     (可以看到只有一个rootfs_data)
  19. dev:    size   erasesize  name
  20. mtd0: 00040000 00010000 "u-boot"
  21. mtd1: 00010000 00010000 "u-boot-env"
  22. mtd2: 00e30000 00010000 "rootfs"
  23. mtd3: 00170000 00010000 "kernel"
  24. mtd4: 00010000 00010000 "art"
  25. mtd5: 00f90000 00010000 "firmware"
  26. mtd6: 06000000 00020000 "rootfs_data"
  27. mtd7: 02000000 00020000 "backup"
复制代码
  1. ==========OpenWrt R8.1.11 启动 nor+nand flash
  2. [    0.916110] 0x000000000000-0x000000040000 : "u-boot"
  3. [    0.922662] 0x000000040000-0x000000050000 : "u-boot-env"
  4. [    0.929651] 0x000000050000-0x000000e80000 : "rootfs"
  5. [    0.935912] mtd: device 2 (rootfs) set to be root filesystem
  6. [    0.941738] 1 squashfs-split partitions found on MTD device rootfs
  7. [    0.948011] 0x000000950000-0x000000e80000 : "rootfs_data"
  8. [    0.955141] 0x000000e80000-0x000000ff0000 : "kernel"
  9. [    0.961792] 0x000000ff0000-0x000001000000 : "art"
  10. [    0.968139] 0x000000050000-0x000000ff0000 : "firmware"
  11. [    0.975786] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xf1
  12. [    0.982271] nand: AMD/Spansion NAND 128MiB 3,3V 8-bit
  13. [    0.987395] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
  14. [    0.995108] Scanning device for bad blocks
  15. [    1.002349] Bad eraseblock 37 at 0x0000004a0000
  16. [    1.007026] random: fast init done
  17. [    1.054195] Bad eraseblock 586 at 0x000004940000
  18. [    1.093755] 2 cmdlinepart partitions found on MTD device ar934x-nfc
  19. [    1.100115] Creating 2 MTD partitions on "ar934x-nfc":
  20. [    1.105331] 0x000000000000-0x000006000000 : "rootfs_data"
  21. [    1.112537] 0x000006000000-0x000008000000 : "backup"

  22. >cat /proc/mtd       (可以看到有二个rootfs_data)
  23. dev:    size   erasesize  name
  24. mtd0: 00040000 00010000 "u-boot"
  25. mtd1: 00010000 00010000 "u-boot-env"
  26. mtd2: 00e30000 00010000 "rootfs"
  27. mtd3: 00530000 00010000 "rootfs_data"
  28. mtd4: 00170000 00010000 "kernel"
  29. mtd5: 00010000 00010000 "art"
  30. mtd6: 00fa0000 00010000 "firmware"
  31. mtd7: 06000000 00020000 "rootfs_data"
  32. mtd8: 02000000 00020000 "backup"
复制代码
不知道大家注意没有这两个固件nand控制器的驱动有点不同(ath79-nand,ar934x-nfc)不知道有什么区别,有谁知道望告知,谢!

3、因为原厂u-boot的问题还是刷breed吧,方法我就不说了,在原厂u-boot中用TTL可以刷,用解锁固件也也可以刷,方法见下文
     大麦dw33d NAND固件安装方法和一些技巧

4、使用的固件也有一定要求因为要解锁mtd7(backup)所以版本不能低,
     怎么用具体可看
不同官方或自制的openwrt版中刷uboot和art。

     LEDE 17.01.0 以后的版本才有Kmod-mtd-rw插件,使用这个插件可以一次性解锁所有mtd。
     在论坛找了半天找到一个合适的固件 ,其它文件名称中有nand字样的固件,虽然较多但我没有选用(这些固件可能在nand上运行系统)

(更新)大麦路由DW33D自编译Lean大openwrt R8.1.11固件


    上面这个openwrt固件有点问题wifi 的5g模块(ath10K)启动加载很费时间,启动过程很漫长(300多秒才能完),估计有兼容的问题
    我把这个固件中的5g模块去掉了(启动时间30秒)。
     

    解锁mtd分区,安装kmod-mtd-rw插件要对核心版本及MD5值,该固件的核心版本是 4.9.138,与官方发行版本对不上,
    但问题不大,能找到 kmod-mtd-rw_4.9.131的版本,强制安装就可以了
  1. opkg --nodeps install kmod-mtd-rw_4.9.131+git-20160214-1_mips_24kc.ipk
  2.       显示结果
  3.       Installing kmod-mtd-rw (4.9.131+git-20160214-1) to root...
  4. Configuring kmod-mtd-rw.
复制代码
  1. cp /lib/modules/4.9.131/* /lib/modules/4.9.138/.
复制代码
  1. insmod mtd-rw.ko i_want_a_brick=1
  2. 显示结果
  3.     [11947.837117] mtd-rw: mtd0: setting writeable flag
  4.     [11947.841854] mtd-rw: mtd1: setting writeable flag
  5.     [11947.846555] mtd-rw: mtd5: setting writeable flag
  6.     [11947.849888] mtd-rw: mtd8: setting writeable flag
复制代码
可以看到所有mtd已经解锁了。

5、软件我使用的是buildroot 2020.2的正式版,这个buildroot是一款强大的toolchain,
     我之前编译的4300 的u-boot就用的它(用的版本2009.11)。
     在buildroot 中也有很多工具比如下面我要提到的mtd-utils(版本2.1.1),我做了静态编译。
     拷贝到TF卡、u盘中就可以用,不需要任何库支持。

6、我发现在mtd-utils 中有nanddump nandwrite nandtest 不同的版本命令有所不同,
     使用时要特别注意。
     (1 )buildroot (版本2009.11)中的 nanddump (版本1.29)
  1. nanddump $Revision: 1.29 $

  2. Usage: nanddump [OPTIONS] MTD-device
  3. Dumps the contents of a nand mtd partition.

  4.            --help               display this help and exit
  5.            --version            output version information and exit
  6. -f file    --file=file          dump to file
  7. -i         --ignoreerrors       ignore errors
  8. -l length  --length=length      length
  9. -n         --noecc              read without error correction
  10. -o         --omitoob            omit oob data
  11. -b         --omitbad            omit bad blocks from the dump
  12. -p         --prettyprint        print nice (hexdump)
  13. -s addr    --startaddress=addr  start address
复制代码
     (2)DW33D原厂固件用安装源nanddump (版本 1.31)
  1. nanddump 1.31

  2. Usage: nanddump [OPTIONS] MTD-device
  3. Dumps the contents of a nand mtd partition.

  4.            --help               Display this help and exit
  5.            --version            Output version information and exit
  6.            --bb=METHOD          Choose bad block handling method (see below).
  7. -a         --forcebinary        Force printing of binary data to tty
  8. -c         --canonicalprint     Print canonical Hex+ASCII dump
  9. -f file    --file=file          Dump to file
  10. -l length  --length=length      Length
  11. -n         --noecc              Read without error correction
  12. -o         --omitoob            Omit OOB data (default in next release)
  13.            --oob                Dump OOB data (current default)
  14. -p         --prettyprint        Print nice (hexdump)
  15. -q         --quiet              Don't display progress and status messages
  16. -s addr    --startaddress=addr  Start address

  17. --bb=METHOD, where METHOD can be `padbad', `dumpbad', or `skipbad':
  18.     padbad:  dump flash data, substituting 0xFF for any bad blocks (default)
  19.     dumpbad: dump flash data, including any bad blocks
  20.     skipbad: dump good data, completely skipping any bad blocks

  21. Deprecated options:
  22. The following options are being replaced by --bb=METHOD flags or being
  23. removed entirely. Do not continue to use these options.
  24. -b         --omitbad            Omit bad blocks from the dump (DEPRECATED)
  25. -N         --noskipbad          Read without bad block skipping

  26. Notes on --omitbad and --bb=skipbad:
  27. * `omitbad' and `skipbad' are very similar; we are deprecating `--omitbad'
  28.   in favor of `--bb=skipbad'.
  29. * With either option, we stop dumping data when we encounter a bad block
  30.   and resume dumping at the next good block. However, with `omitbad', we
  31.   count the bad block as part of the total dump length, whereas with
  32.   `skipbad', the bad block is skipped, that is, not counted toward the
  33.   total dump length.

  34. Note on --oob, --omitoob:
  35.   To make nanddump act more like an inverse to nandwrite, we are changing
  36.   the default OOB behavior. In the next release, nanddump will not dump
  37.   OOB data by default. We will leave both the `--omitoob' and `--oob'
  38.   options, but to mirror nandwrite, the short option `-o' will then stand
  39.   for `--oob', not `--omitoob'. Please adjust your usage accordingly.
复制代码
(3)buildroot (版本2020.2)中的 nanddump (版本2.1.1)
  1. nanddump (mtd-utils) 2.1.1

  2. Usage: nanddump [OPTIONS] MTD-device
  3. Dumps the contents of a nand mtd partition.

  4. -h         --help               Display this help and exit
  5.            --version            Output version information and exit
  6.            --bb=METHOD          Choose bad block handling method (see below).
  7. -a         --forcebinary        Force printing of binary data to tty
  8. -c         --canonicalprint     Print canonical Hex+ASCII dump
  9. -f file    --file=file          Dump to file
  10. -l length  --length=length      Length
  11. -n         --noecc              Read without error correction
  12.            --omitoob            Omit OOB data (default)
  13. -o         --oob                Dump OOB data
  14. -p         --prettyprint        Print nice (hexdump)
  15. -q         --quiet              Don't display progress and status messages
  16. -s addr    --startaddress=addr  Start address
  17.            --skip-bad-blocks-to-start
  18.                                 Skip bad blocks when seeking to the start address

  19. --bb=METHOD, where METHOD can be `padbad', `dumpbad', or `skipbad':
  20.     padbad:  dump flash data, substituting 0xFF for any bad blocks
  21.     dumpbad: dump flash data, including any bad blocks
  22.     skipbad: dump good data, completely skipping any bad blocks (default)
复制代码

7、 如果怀疑在启动的时候系统写nand,拷贝源nand芯片最好不要在启动前安装到弹跳座上(避免破坏原始nand的内容),

      在固件启动完成后将源nand芯片热操作(带电操作)换上去。
      这个只是怀疑,我后来简单测试了下这个固件启动时不对nand进行写操作,也就是说可以在冷机情况下换nand芯片,安全很多。

      方法:用nanddump 读源nand芯片内容  
  1. >./nanddump --bb=dumpbad -n -o -l 0x2000000 -f mtd7_32mb_noecc_oob_dumpbad /dev/mtd7
  2. Block size 131072, page size 2048, OOB size 64
  3. Dumping data starting at 0x00000000 and ending at 0x02000000...
复制代码
      解释:使用非校验方式拷贝数据,坏块不跳过,拷贝oob数据,长度32MB(dw33d这个分区很大有96MB一般来说不用拷贝完全,个人随意吧)
      这种方法可以避免使用5998的nand控制器的校验功能,在上一篇帖子中我采用这种方式,用网件wndr 4300 v1上可以救活使用arm cpu的机器。
      注意事项:
      请dump多次然后用md5sum比较下存盘md5值看是否相同,如果不同这个原片的品质就不太好,我测试用的一个芯片虽然没有坏区,但dump多次
      有几次md5值就不同(当时有点担心是qca9558 nand驱动或 nand控制器的问题),后来换了一个品质好的芯片多次dump后比较值,就没问题了。
      如果多次dump效果不理想,但我发现只要不是太烂的nand芯片肯定有几次md5值是相同的,采用哪个相同md5值的文件作为源文件吧。
      :这个工具看来可以简单测试下芯片的质量,呵呵。

8、 然后擦除目标nand,有很多方法擦除,我也没有太仔细的比较。
  1. >mtd erase /dev/mtd7
  2. 系统命令(推荐)擦除时如果有坏块就跳过
  3. (执行完后所有的数据为FF)
复制代码
  1. >./flash_erase /dev/mtd7 0x0 768
  2.    768  是96MB*1024/128KB=768

  3. 推荐使用该方法,也可以用 -N (不跳过坏块)过程中可以知道坏块的位置,例如:

  4. ./flash_erase -N /dev/mtd7 0x0 768
  5. Erasing 128 Kibyte [url=home.php?mod=space&uid=162986]@[/url] 4a0000 --  4 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 37 (mtd7)
  6.         error 5 (Input/output error)
  7. flash_erase: error!: /dev/mtd7: MTD Erase failure
  8.              error 5 (Input/output error)
  9. Erasing 128 Kibyte @ 4940000 -- 76 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 586 (mtd7)
  10.         error 5 (Input/output error)
  11. flash_erase: error!: /dev/mtd7: MTD Erase failure
  12.              error 5 (Input/output error)
  13. Erasing 128 Kibyte @ 5fe0000 -- 100 % complete
  14. (执行完后所有的数据为FF)
复制代码
  1. >./flash_erase -j /dev/mtd7  0x0 768
  2. 用jffs2格式化
  3. (执行完后数据区为FF,但每偏移0x20000处第一oob有数据变化)
复制代码
  1. >./mtd_debug erase /dev/mtd7 0x0 0x6000000                                   
  2. (执行完后所有的数据为FF,不推荐,好像有坏块就擦除不过去)
复制代码

   8、nandwrite(写nand flash)
  1. >./nandwrite -n -o -m /dev/mtd7 mtd7_32mb_noecc_oob_dumpbad
复制代码
         解释:使用非校验方式拷贝,并且文件带oob,如果有坏块就make它,
                   这种方法可以避免使用9558 nand控制器的ecc校验。也就是硬拷贝。
      
         写完后在备份一次,然后比较两个文件是否相同
  1. >./nanddump --bb=dumpbad -n -o -l 0x2000000 -f mtd7_32mb_noecc_oob_dumpbad_cmp /dev/mtd7
  2. >cmp mtd7_32mb_noecc_oob_dumpbad mtd7_32mb_noecc_oob_dumpbad_cmp
  3. 或者用md5sum 比较也行
  4. >md5sum mtd7*
复制代码
   
9、最后介绍下nandtest这个命令,这个命令是测试nand用的。

     这个命令有写数据能功能,所以在原nand 上一定不要使用这个命令,加-k参数也不行,会破坏oob。
  1. >./nandtest  /dev/mtd7
复制代码
     我发现执行完成后 所有的数据为都有变化,包括oob
  1. >./nandtest -k  /dev/mtd7  
复制代码
     解释:-k 是保持测试完后nand的数据不发生改变
     但我发现测试完后主体数据没有变化,但oob有变化,可能测试后重新校验了。
  1. >./nandtest -s -m /dev/mtd7
复制代码
这个是测试失败后标记坏块,非常有用的命令,新买的nand可以用它测试下。

小技巧:可以用这个命令在目标芯片上产生数据,然后多次dump比较md5值,如果相同,可以理解为这个芯片的品质不错,可以作为目标芯片用。

我参考了下面的文章,较详细,可看。
MTD应用学习札记
mtd-utils命令简介
技术文档
http://www.linux-mtd.infradead.org/doc/general.html
下载地址,回复可见
游客,如果您要查看本帖隐藏内容请回复


文件说明:
1、kmod-mtd-rw                          让openwrt mtd所有分区能写的插件(4.9.131)

2、OpenWrtR8.1.11_firmware.rar  这是去除ath10K还安装了kmod-mtd-rw插件的固件,使用时只用载入模块就行了,我也安装了 nand-utils(版本2.0.2)
                                                   另外:系统密码password,非常有可能换nand芯片后,安装的kmod-mtd-rw模会丢失,自己再安装下吧,
                                                   并且kmod-ath10k这个模块会回来,opkg remove kmod-ath10k 删掉它就行了。

3、buildroot2020_2.tar.gz             是buildroot 静态编译的mtd-utils (版本2.1.1)

                                                   这个工具包内的工具很多(UBI工具也有,各位自己看吧),有空再介绍,这个工具只能在mips大端的cpu上用,MTK CPU的是MIPS 小端的,不能用。

另外坛友jspeng 编译的固件不错推荐下,文章地址如下

https://www.right.com.cn/forum/thread-4034857-1-1.html




========================
后记:breed的作者提到过Atheros 9344 与qca 9558 nand的校验算法相同,我用自己编译的4300 V1的u-boot文件,用DW33D
使用nandwrite -a (Use auto OOB layout)写进芯片,结果没有问题,4300 V1顺利启动到u-boot。
也测试过写的时候只使用 -n 参数故意不写oob 数据,4300 v1无法启动,这说明了9344启动U-boot也要读取ecc校验支持。
-----------------------------
这次采用的方法与上一帖相同,就是在硬件改造的地方,有点货(对大家的动手能力有点要求,但至少不用一根根焊漆包线了,漆包线焊接非常非常痛苦),
在TB上用了3个商家才弄齐了货。
软件部分就是自己静态编译了mtd-utils
-----------------------------
15楼有点内容,有空可看


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

评分

参与人数 2恩山币 +2 收起 理由
wux*** + 1 不要怂、就是干!
koa*** + 1 这个年轻人不讲武德,耗子尾汁!

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
发表于 2023-10-25 16:59 | 显示全部楼层
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-9-22 23:40 | 显示全部楼层
jiuweiljp 发表于 2023-9-21 12:35
这个东西非常依赖固件中的nand flash 驱动,你仔细看看启动的时候控制台信息,看识别正不正确。
如果有能 ...

芯片是可以正常识别的,也能正常读取,只是写入的时候有问题,试了两个正常的华邦芯片都这样。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2023-9-21 12:35 | 显示全部楼层
victor2002 发表于 2023-9-20 23:11
大佬,还有一个,就是对华邦的nand貌似兼容性不好,通过flash_erase可以正常擦除,但通过nandwrite写进去 ...

这个东西非常依赖固件中的nand flash 驱动,你仔细看看启动的时候控制台信息,看识别正不正确。
如果有能力还可以自己修改这块(nand 芯片支持)的代码,不是很难,但需要查下芯片手册,或者移植也行。
另外Winbond 算大厂了,老驱动应该也能用,是不是你芯片买的有问题

点评

芯片是可以正常识别的,也能正常读取,只是写入的时候有问题,试了两个正常的华邦芯片都这样。  详情 回复 发表于 2023-9-22 23:40
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-9-20 23:11 | 显示全部楼层
jiuweiljp 发表于 2023-9-9 12:01
https://www.right.com.cn/forum/f ... &tid=2116187&page=1

你可以仔细看看这个帖子的第二楼及后面的问 ...

大佬,还有一个,就是对华邦的nand貌似兼容性不好,通过flash_erase可以正常擦除,但通过nandwrite写进去的数据不对,写其他品牌的nand目前没发现问题,不兼容的都是华邦的。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-9-10 01:16 | 显示全部楼层
jiuweiljp 发表于 2023-9-9 12:01
https://www.right.com.cn/forum/f ... &tid=2116187&page=1

你可以仔细看看这个帖子的第二楼及后面的问 ...

看了后确实解惑了,原来不是大小端的问题,是这款主控的问题,读写都做了一次反序,也就是说用其他编程器备份的raw数据,必须反序后才能用大麦写入。
用大麦备份的raw数据可用直接用大麦写进去,但需要反序后才能用其他编程器写入。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2023-9-9 12:01 | 显示全部楼层
victor2002 发表于 2023-9-8 22:06
谢谢,我猜也是要写入反序的数据才能在mtk7621上正常读取,不过没有实测。 ...

https://www.right.com.cn/forum/f ... &tid=2116187&page=1

你可以仔细看看这个帖子的第二楼及后面的问答
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-9-8 22:06 | 显示全部楼层
jiuweiljp 发表于 2023-9-7 16:04
你读出的数据翻序了,写数据的时候可能再翻会去。你可以试一下。另外使用软件hexwork shop可以大小端翻转 ...

谢谢,我猜也是要写入反序的数据才能在mtk7621上正常读取,不过没有实测。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2023-9-7 16:04 | 显示全部楼层
victor2002 发表于 2023-8-31 01:13
读写部分oob部分数据是没问题的,读出跟写入的也一致。只是mtk7621的nand放到大麦里面读的话,读出的数据 ...

你读出的数据翻序了,写数据的时候可能再翻会去。你可以试一下。另外使用软件hexwork shop可以大小端翻转。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-8-31 01:13 | 显示全部楼层
jiuweiljp 发表于 2023-8-30 14:05
时间长了有点忘记了,  ,我印象中拷贝的时候复制oob并忽略ecc校验,写flash的时候把oob数据也写进去,并 ...

读写部分oob部分数据是没问题的,读出跟写入的也一致。只是mtk7621的nand放到大麦里面读的话,读出的数据会出现反序,估计也要把反序的数据刷进空nand,才能放到mtk里启动。我猜是mips和mipsel造成的,不知是否有命令能实现大小端反序。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2023-8-30 14:05 | 显示全部楼层
本帖最后由 jiuweiljp 于 2023-8-30 14:10 编辑
victor2002 发表于 2023-8-19 20:21
读取命令:
nanddump --bb=dumpbad -n -o -s 0x0 -l 0x80000 -f uboot-backup.img /dev/mtd7

时间长了有点忘记了,  ,我印象中拷贝的时候复制oob并忽略ecc校验,写flash的时候把oob数据也写进去,并忽略ecc。
我干过跨平台写入【arm(小端)的设备】
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-8-19 20:21 | 显示全部楼层
jiuweiljp 发表于 2023-8-19 12:35
读写命令用的什么参数

读取命令:
nanddump --bb=dumpbad -n -o -s 0x0 -l 0x80000 -f uboot-backup.img /dev/mtd7

写入命令:
flash_erase -N /dev/mtd7 0x0 4
nandwrite -n -o -m /dev/mtd7 /tmp/uboot-7621.img
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2023-8-19 12:35 | 显示全部楼层
victor2002 发表于 2023-7-30 12:11
试了下用大麦读写mtk的nand,发现因为大小端问题,导致原机闪存在大麦上读出是反序的,估计正序的编程器固 ...

读写命令用的什么参数
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-7-30 12:11 | 显示全部楼层
试了下用大麦读写mtk的nand,发现因为大小端问题,导致原机闪存在大麦上读出是反序的,估计正序的编程器固件写进去也不能使用,这有解决方法吗?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-4-17 16:23 | 显示全部楼层
这玩法有点意思了。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-26 20:38

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表