找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 5860|回复: 9

请教一下uboot刷入固件的问题

[复制链接]
发表于 2019-4-8 11:51 | 显示全部楼层 |阅读模式
本帖最后由 ITdesk 于 2019-4-8 11:54 编辑

前言
        前篇:Linksys ea6350刷入openwrt  https://www.right.com.cn/forum/thread-532598-1-1.html
        前篇我讲到因为之前刷ea6350的时候,openwrt没有适配,那时候的中转固件有问题,后面openwrt适配了以后,重新写入虽然可以正常使用,但很不完美,想过拆机刷uboot,但因为种种原因没办法实现,具体见前篇,这两天想sysupgrade 结果报错了

报错代码
  1. Saving config files...
  2. Commencing upgrade. Closing all shell sessions.
  3. Watchdog handover: fd=3
  4. - watchdog -
  5. killall: telnetd: no process killed
  6. Sending TERM to remaining processes ... uhttpd nlbwmon sh sleep ntpd dnsmasq ubusd logd rpcd netifd odhcpd
  7. Sending KILL to remaining processes ...
  8. Switching to ramdisk...
  9. [  570.562465] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" stops
  10. [  570.652418] UBIFS (ubi0:1): un-mount UBI device 0
  11. Performing system upgrade...
  12. ash: /usr/sbin_printenv: not found
  13. ash: fw_setenv: not found
  14. cannot find target partition
  15. sysupgrade aborted with return code: 256
复制代码


后面有了一个想法,起因我是刷了有问题的中转固件导致那么我把他刷会出厂固件再刷openwrt是否就解决这个问题
因为前篇的关系,硬件上无法动手,那么只能从uboot开刀了,之前没有试过,还是比较大难度的,一个个来吧

uboot支持的命令
  1. (EA6350v3) # help
  2. ?       - alias for 'help'
  3. base    - print or set address offset
  4. bootipq - bootipq from flash device
  5. bootm   - boot application image from memory
  6. bootp   - boot image via network using BOOTP/TFTP protocol
  7. chpart  - change active partition
  8. cmp     - memory compare
  9. cp      - memory copy
  10. crc32   - checksum calculation
  11. devinfo - device specific info handling commands
  12. dhcp    - boot image via network using DHCP/TFTP protocol
  13. dumpipq_data- dumpipq_data crashdump collection from memory
  14. echo    - echo args to console
  15. env     - environment handling commands
  16. exit    - exit script
  17. false   - do nothing, unsuccessfully
  18. fdt     - flattened device tree utility commands
  19. fuseipq - fuse QFPROM registers from memory

  20. go      - start application at address 'addr'
  21. help    - print command description/usage
  22. i2c     - I2C sub-system
  23. imxtract- extract a part of a multi-image
  24. loadb   - load binary file over serial line (kermit mode)
  25. loady   - load binary file over serial line (ymodem mode)
  26. loop    - infinite loop on address range
  27. md      - memory display
  28. mfg     - mfg misc commands
  29. mii     - MII utility commands
  30. mm      - memory modify (auto-incrementing address)
  31. mmc     - MMC sub system
  32. mmcinfo - display MMC info
  33. mtdparts- define flash/nand partitions
  34. mtest   - simple RAM read/write test
  35. mw      - memory write (fill)
  36. nand    - NAND sub-system
  37. nboot   - boot from NAND device
  38. nm      - memory modify (constant address)
  39. pci     - list and access PCI Configuration Space
  40. ping    - send ICMP ECHO_REQUEST to network host
  41. printenv- print environment variables
  42. reset   - Perform RESET of the CPU
  43. run     - run commands in an environment variable
  44. saveenv - save environment variables to persistent storage
  45. setenv  - set environment variables
  46. sf      - SPI flash sub-system
  47. showvar - print local hushshell variables
  48. smeminfo- print SMEM FLASH information
  49. source  - run script from memory
  50. test    - minimal test like /bin/sh
  51. tftpboot- boot image via network using TFTP protocol
  52. tftpput - TFTP put command, for uploading files to a server
  53. true    - do nothing, successfully
  54. uartrd  - uartrd read from second UART
  55. uartwr  - uartwr to second UART
  56. ubi     - ubi commands
  57. upgrade - device specific image upgrade handling command
  58. usb     - USB sub-system
  59. usbboot - boot from USB device
  60. version - print monitor, compiler and linker version
复制代码


Uboot系统变量
  1. (EA6350v3) # pr
  2. altkern=2800000
  3. auto_recovery=yes
  4. baudrate=115200
  5. boot_count=1
  6. boot_part=2
  7. boot_part_ready=3
  8. boot_ver=0.6.0
  9. bootcmd=if test $boot_part = 1; then run bootpart1; else run bootpart2; fi
  10. bootdelay=2
  11. bootpart1=set bootargs $partbootargs && nand read $loadaddr $prikern $kernsize && bootm $loadaddr
  12. bootpart2=set bootargs $partbootargs2 && nand read $loadaddr $altkern $kernsize && bootm $loadaddr
  13. ethact=eth0
  14. ethaddr=60:38:E0:88:8F:6F
  15. flash_type=0
  16. flashimg=tftpboot $loadaddr $image && nand erase $prikern $imgsize && nand write $loadaddr $prikern $filesize
  17. flashimg2=tftpboot $loadaddr $image && nand erase $altkern $imgsize && nand write $loadaddr $altkern $filesize
  18. hw_mac_addr=60:38:E0:88:8F:6F
  19. image=civic.img
  20. imgsize=0x2800000
  21. ipaddr=192.168.1.1
  22. kernsize=300000
  23. loadaddr=0x82000000
  24. machid=8010100
  25. netmask=255.255.255.0
  26. partbootargs=init=/sbin/init rootfstype=squashfs ubi.mtd=11,2048 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro
  27. partbootargs2=init=/sbin/init rootfstype=squashfs ubi.mtd=13,2048 ubi.block=0,0 root=/dev/ubiblock0_0 rootwait ro
  28. prikern=0
  29. serverip=192.168.1.100
  30. stderr=serial
  31. stdin=serial
  32. stdout=serial
  33. sw_version=0.6.0

  34. Environment size: 1203/131068 bytes
复制代码


bootipq的信息
  1. (EA6350v3) # bootipq
  2. do_bootipq@581: call do_boot_unsignedimg()...
  3. do_boot_unsignedimg@454: rootfs_offset=0x300000, rootfs_size=0x2500000
  4. do_boot_unsignedimg@522: runcmd 'nand device 1 && set mtdids nand1=nand1 && set mtdparts mtdparts=nand1:0x2500000@0x300000(fs),${msmparts} && nand read 0x84000000 0 300000
  5. '

  6. NAND read: device 1 offset 0x0, size 0x300000
  7. 3145728 bytes read: OK
  8. Config not availabale
  9. do_boot_unsignedimg@536: ret -1, runcmd 'nand device 1 && set mtdids nand1=nand1 && set mtdparts mtdparts=nand1:0x2500000@0x300000(fs),${msmparts} && nand read 0x84000000 0 300000
  10. '
  11. do_bootipq: boot failed in 2, try the alternate one...
  12. do_boot_unsignedimg@454: rootfs_offset=0x2b00000, rootfs_size=0x2500000
  13. do_boot_unsignedimg@522: runcmd 'nand device 1 && set mtdids nand1=nand1 && set mtdparts mtdparts=nand1:0x2500000@0x2b00000(fs),${msmparts} && nand read 0x84000000 2800000 300000
  14. '

  15. NAND read: device 1 offset 0x2800000, size 0x300000
  16. 3145728 bytes read: OK
  17. Config not availabale
  18. do_boot_unsignedimg@536: ret -1, runcmd 'nand device 1 && set mtdids nand1=nand1 && set mtdparts mtdparts=nand1:0x2500000@0x2b00000(fs),${msmparts} && nand read 0x84000000 2800000 300000
  19. '
复制代码


开机Uboot信息
  1. U-Boot 2012.07 [Barrier Breaker r48529,r48529] (Jul 21 2016 - 09:43:37)

  2. Boot version: v0.6.0 -- IPQ4018.ILQ.1.1.6-CSU1 for the EA6350v3 board

  3. smem ram ptable found: ver: 1 len: 3
  4. DRAM:  256 MiB
  5. get_board_param - machid : 0x8010100
  6. NAND:  spi_nand: spi_nand_flash_probe SF NAND ID 0:ef:aa:21
  7. SF: Detected W25N01GV with page size 2 KiB, total 128 MiB
  8. SF: Detected MX25L1605D with page size 4 KiB, total 2 MiB
  9. ipq_spi: page_size: 0x100, sector_size: 0x1000, size: 0x200000
  10. 130 MiB
  11. MMC:
  12. In:    serial
  13. Out:   serial
  14. Err:   serial
  15. machid: 8010100
  16. flash_type: 0
  17. Net:   In ART, mac0=0xFFFFFFFFFFFF, mac1=0xFFFFFFFFFFFF, mac2=0x6038, mac3=0x603   (mac地址我删掉了几位)
  18. get_eth_mac_address@1407: the base hw_mac_addr='60:38:E0:' is valid!
  19. MAC0 addr:60:38:e
  20. PHY ID1: 0x4d
  21. PHY ID2: 0xd0b1
  22. ipq40xx_qca8075_phy_init: reconfig ethernet LEDs behavior ...
  23. ipq40xx_ess_sw_init done
  24. eth0
  25. board_ledbtn_init: machid 0x8010100 - LEDs/Buttons GPIO initialization...
  26. board_read2sync_bootpart_vars@866: boot_count hunted is 1 and sync it!
  27. main_loop: sw_version 0.6.0
  28. Info - uboot-1.0
  29. LEDs blinking...
  30. Hit any key to stop autoboot:  0
复制代码



继续苦逼的翻nand 的命令

  1. <font color="#ff0000">Nand info 显示可用的NAND设备</font>
  2.    Device 1: nand1, sector size 128 KiB
  3.    Page size      2048 b
  4.    OOB size         64 b
  5.    Erase size   131072 b
  6.    Device 2: nand2, sector size 4 KiB
  7.    Page size       256 b
  8.    OOB size          0 b
  9.    Erase size     4096 b

  10. <font color="#ff0000">Nand device 显示或设置当前设备</font>
  11.    Device 1: nand1, sector size 128 KiB
  12.    Page size      2048 b
  13.    OOB size         64 b
  14.    Erase size   131072 b
复制代码

nand 坏块
  1. (EA6350v3) # nand bad

  2. Device 1 bad blocks:
复制代码





问题也随之而来
     1.出现了两个nand,哪一个才是我想要的??
     2.如何格式化128M的nand,我指的的用nand  erase 而不是nand scrub,因为我对0x100这些还是不怎么理解,原厂固件大小是27,787,264 字节
   3.nand的坏块要如何处理,网上讲的跳过或者替换,标记是怎么实现的,比如如何确定坏块的位置


请各位大大支一下招,非常感谢



我的恩山、我的无线 The best wifi forum is right here.
发表于 2019-5-31 01:51 | 显示全部楼层
你到底想干啥啊?如果是想救砖你直接用tftp救砖的方式救砖不就行了?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-5-31 01:58 | 显示全部楼层
顺便给你说一下这个uboot的刷的方法。这个uboot为了安全起见他存了两份固件在NAND里面,当连续3次都启动失败的时候就会触发恢复逻辑,然后会将NAND抹掉并换上另外一个固件
然后在uboot的env里面你能看到prikern和altkern。然后如果你要刷机的话你直接在你电脑上搭建一个tftpd,目录下面放上固件命名为civic.img,然后手动设置好自己电脑的ip为192.168.1.100
接着执行这一长串命令 tftpboot $loadaddr $image && nand erase $prikern $imgsize && nand write $loadaddr $prikern $filesize
然后就等着他三次fail后切换到这个固件就行了

点评

问题已经解决多谢  详情 回复 发表于 2019-6-19 10:09
好的,非常感谢,咨询一下这个civic.img可以用官网的img文件吗??  详情 回复 发表于 2019-6-18 12:22
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2019-6-18 12:22 | 显示全部楼层
gyc990326 发表于 2019-5-31 01:58
顺便给你说一下这个uboot的刷的方法。这个uboot为了安全起见他存了两份固件在NAND里面,当连续3次都启动失 ...

好的,非常感谢,咨询一下这个civic.img可以用官网的img文件吗??
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2019-6-19 10:09 | 显示全部楼层
gyc990326 发表于 2019-5-31 01:58
顺便给你说一下这个uboot的刷的方法。这个uboot为了安全起见他存了两份固件在NAND里面,当连续3次都启动失 ...

问题已经解决多谢
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-8-12 19:07 来自手机 | 显示全部楼层
如何解决一一

点评

参考3楼 (字数patch)  详情 回复 发表于 2019-8-13 09:31
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2019-8-13 09:31 | 显示全部楼层

参考3楼   (字数patch)

点评

我用了3楼的那串代码,会提示错误,重启后显示kernel错误起不来,虽然重启多几次可以切换到另一个固件,但是要怎样才能成功刷进去呢?烦请指点一二,谢谢  详情 回复 发表于 2023-12-22 01:17
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-12-22 01:17 来自手机 | 显示全部楼层
ITdesk 发表于 2019-8-13 09:31
参考3楼   (字数patch)


我用了3楼的那串代码,会提示错误,重启后显示kernel错误起不来,虽然重启多几次可以切换到另一个固件,但是要怎样才能成功刷进去呢?烦请指点一二,谢谢

本帖子中包含更多资源

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

×

点评

还有,我这台之前刷过潘多拉的,现在先刷成openwrt,在潘多拉直接刷不成功,所以才想说ttl试试  详情 回复 发表于 2023-12-22 15:03
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-12-22 15:03 | 显示全部楼层
夜的第千章 发表于 2023-12-22 01:17
我用了3楼的那串代码,会提示错误,重启后显示kernel错误起不来,虽然重启多几次可以切换到另一个固件, ...

还有,我这台之前刷过潘多拉的,现在先刷成openwrt,在潘多拉直接刷不成功,所以才想说ttl试试
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-12-24 12:56 来自手机 | 显示全部楼层
没事了,搞定了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-26 03:24

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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