中古神器烽火hg320电信原版刷64k cfe和tomato shibby v138 并在优盘安装entware-ng

淘宝入手了两枚此经典神器用来乱搞,因为有usb口所以未入修改版(增大闪存版),准备插优盘,电信原版是16mb flash, lz入的是电信原版系统

目的是刷64kb的cfe,然后用64k的固件

以下两种方法都可以,如果想拆机,又有ttl线的话(反正也是二手的,下4个螺丝就好),可以如下操作

方法1 高逼格ttl线法(适用于cfe已经不正常的时候)
  1. 拆机,接ttl线,插电后在Putty里按下ctrl-c,此时应该出现cfe命令行提示符,接线方法和putty配置可参考 asus rt-n16 PL2303 TA USB TTL线救砖备忘录
  2. 在putty里刷64k cfe,在tftp软件里放好cfe文件,然后在putty的cfe命令行里执行
    flash -noheader 192.168.1.2:NW235WCFE-64M.bin flash1.boot
    
  3. 重启后再次在Putty里按下ctrl-c,让路由器停在cfe命令行,在浏览器里访问192.168.1.1应该会显示cfe界面,在此处选择64k nvram的tt固件刷入即可
方法2 免拆机法

如果不想拆机,可以按照参考中的教程来做,步骤如下

  1. 打开tftp智能刷机,选择NW235WCFE-64M.bin,选择当ttl=100的时候自动刷机,注意此步不是刷cfe,而是为了让路由器停在cfe页面,和接ttl线后按ctrl-c的目的是一样的
  2. 刷入ddwrt的mini固件,重启
  3. 第一步其实并没有刷入cfe,只是为了刷ddwrt,好让我们下一步ssh登入,现在我们需要进入ddwrt的webui后开启 ssh,用scp命令拷入64k cfe文件到路由器的/tmp

    假设路由器ip是192.168.1.1, 电脑ip是192.168.1.2

    # 假设cfe文件位于当前目录下
    scp NW235WCFE-64M.bin root@192.168.1.2:/tmp
    

    然后用ssh登入路由器

    ssh root@192.168.1.1
    

    登入以后在路由器上执行

    mtd write /tmp/NW235WCFE-64M.bin cfe
    
  4. 重启后,重复步骤1,在浏览器的cfe页面刷入64k nvram的tt固件
方法3 免拆机浏览器刷

方法1 方法2的综合

  1. 打开tftp智能刷机,选择NW235WCFE-64M.bin,选择当ttl=100的时候自动刷机,注意此步不是刷cfe,而是为了让路由器停在cfe页面
  2. 当cfe页面出现后,在浏览器地址栏输入(此时cfe文件名最好短点,比如改名为cfe.bin)
    http://192.168.1.1/do.htm?cmd=flash+-noheader+192.168.1.2:cfe.bin+flash1.boot
    
  3. 等页面刷新完成后重启后应该可以进新刷的cfe页面刷tt固件了

如果不想刷64k cfe,那方法一就没意义了,可以直接使用方法2,而且可以跳过刷dd mini,只执行步骤1和4,直接刷非64k nvram的tt即可。(但是如果没刷64k cfe,直接把电信原版刷成tt以后,又改变主意想刷64k cfe的话,似乎步骤1就无法让路由器停在cfe了,此时可以拆机用ttl线刷-方法1)

Notes:

  • 关于entware的安装,现在entware项目已经停止更新,新项目名为entware-ng
    lz插了个8g优盘上去,什么都没做的时候

    root@unknown:/tmp/home/root# fdisk -l
    
    Disk /dev/sda: 8178 MB, 8178892800 bytes
    1 heads, 62 sectors/track, 257651 cylinders
    Units = cylinders of 62 * 512 = 31744 bytes
    
       Device Boot      Start         End      Blocks  Id System
    /dev/sda1   *           1      257652     7987172   b Win95 FAT32
    Partition 1 does not end on cylinder boundary
    

    lz希望分512mb空间作为swap分区,剩余部分装entware

    # 首先进去根据提示把所有分区都删了,然后创建上述两个分区
    fdisk /dev/sda
    
    #格式化分区,假设sda1是swap分区,sda2是entware分区
    mkswap -L swap /dev/sda1
    mkfs.ext3 -L entware /dev/sda2
    

    修改此文件以使优盘上的分区能自动挂载,但由于文件无法保存,可以有如下两种处理方式

    #device Mountpoint FStype Options Dump Pass#
    LABEL=swap none swap sw 0 0
    LABEL=entware /opt ext3 rw,noatime 1 1
    

    解决方法一,可以把此文件存到nvram里

    nvram setfile2nvram /etc/fstab
    nvram commit
    

    解决方法二,如果不想存nvram,也可以放init script里(Administration > Scripts > Init)

    echo "#device Mountpoint FStype Options Dump Pass#" >> /etc/fstab
    echo "LABEL=swap none swap sw 0 0" >> /etc/fstab
    echo "LABEL=entware /opt ext3 rw,noatime 1 1" >> /etc/fstab
    

    不存文件在nvram里(把文件从nvram里移除)

    nvram unset "FILE:/etc/fstab"
    nvram commit
    

    在USB and NAS设置里要做如下设置
    usb support里要勾选

    [x] Core USB Support
    [x] USB 2.0 Support
    [x] USB Storage Support
    [x] Ex2/Ext3 File Systems Support
    [x] Automount
    

    Run after mounting

    #!/bin/sh
    /opt/etc/init.d/rc.unslung start
    

    Run before unmounting

    #!/bin/sh
    /opt/etc/init.d/rc.unslung stop
    sleep 15
    umount /opt
    

    完成效果如下所示

    root@unknown:/tmp/home/root# fdisk -l
    
    Disk /dev/sda: 8178 MB, 8178892800 bytes
    1 heads, 62 sectors/track, 257651 cylinders
    Units = cylinders of 62 * 512 = 31744 bytes
    
       Device Boot      Start         End      Blocks  Id System
    /dev/sda1               2       16131      500030  82 Linux swap
    /dev/sda2           16132      257651     7487120  83 Linux
    
  • 关于entware的安装,首先采用了一个老版的教程里的安装连接,但最后看到提示说此repo已经不再更新了,需要更新到最新的entware-ng项目
    root@unknown:/tmp/home/root# cd /opt
    root@unknown:/opt# wget -O - http://entware.wl500g.info/binaries/mipselsf/instal
    ler/entware_install.sh | sh
    Connecting to entware.wl500g.info (81.4.123.217:80)
    -                    100% |*******************************|   783   0:00:00 ETA
    Info: Creating folders...
    Info: Opkg package manager deployment...
    Info: Basic packages installation...
    Downloading http://old.entware.net/binaries/mipselsf/Packages.gz.
    Updated list of available packages in /opt/var/opkg-lists/mipselsf.
    Installing uclibc-opt (0.9.32-7) to root...
    Downloading http://old.entware.net/binaries/mipselsf/uclibc-opt_0.9.32-7_mipselsf.ipk.
    Installing libc (0.9.32-2) to root...
    Downloading http://old.entware.net/binaries/mipselsf/libc_0.9.32-2_mipselsf.ipk.
    Installing libgcc (4.6.4-2) to root...
    Downloading http://old.entware.net/binaries/mipselsf/libgcc_4.6.4-2_mipselsf.ipk.
    Installing libstdcpp (4.6.4-2) to root...
    Downloading http://old.entware.net/binaries/mipselsf/libstdcpp_4.6.4-2_mipselsf.ipk.
    Installing libpthread (0.9.32-2) to root...
    Downloading http://old.entware.net/binaries/mipselsf/libpthread_0.9.32-2_mipselsf.ipk.
    Installing librt (0.9.32-2) to root...
    Downloading http://old.entware.net/binaries/mipselsf/librt_0.9.32-2_mipselsf.ipk.
    Installing ldconfig (0.9.32-2) to root...
    Downloading http://old.entware.net/binaries/mipselsf/ldconfig_0.9.32-2_mipselsf.ipk.
    Installing findutils (4.5.14-1) to root...
    Downloading http://old.entware.net/binaries/mipselsf/findutils_4.5.14-1_mipselsf.ipk.
    Configuring ldconfig.
    Configuring libgcc.
    Configuring libc.
    Configuring libpthread.
    Configuring libstdcpp.
    Configuring librt.
    Configuring findutils.
    Configuring uclibc-opt.
    Entware development is continued as Entware-ng.
    Updates are no longer provided for this repo from October 2015.
    
    Please, consider upgrade to Entware-ng by typing
    
    wget -qO - http://pkg.entware.net/binaries/mipsel/installer/upgrade.sh | sh
    
    Don't forget to backup any valuable data before upgrade.
    Info: Congratulations! If there are no errors above then Entware successfully initialized.
    

    如上提示,执行了升级的命令,下次如果再装,就不会这样了,执行最新版的安装命令即可

    root@unknown:/opt# wget -qO - http://pkg.entware.net/binaries/mipsel/installer/u
    pgrade.sh | sh
    This script will upgrade existing Entware packages to Entware-ng.
    Please keep in mind:
    
    * Entware-ng is not compatible with old (7+ years) MIPSr1 devices.
        Please, refer to this list if you are not sure about this router
        http://tomatousb.org/doc:build-types#toc3
    
    * Upgrade will be aborted if you are logged on to this console via ssh/telnet
        daemon from Entware, this services will be stopped during upgrade.
    
    * Some of packages may need to be re-configured after upgrade. You may
        (optionally) backup valuable info from /opt folder before upgrade.
    
    Upgrade will be continued in 30 seconds. Press 'Ctrl+c' to abort
    ...............................starting upgrade!
    [1/4] Trying to stop running services...
    The following packages will be reinstalled after upgrade:
    findutils ldconfig libc libgcc libpthread librt libstdcpp uclibc-opt
    [2/4] Uninstalling existing packages...
    Removing package findutils from root...
    Removing package ldconfig from root...
    Removing package libc from root...
    Removing package libgcc from root...
    Removing package libpthread from root...
    Removing package librt from root...
    Removing package libstdcpp from root...
    Removing package uclibc-opt from root...
    [3/4] Deploying Entware-ng opkg package manager...
    Downloading /opt/bin/opkg... success!
    Downloading /opt/etc/opkg.conf... success!
    Downloading /opt/etc/profile... success!
    Downloading /opt/etc/init.d/rc.func... success!
    Downloading /opt/etc/init.d/rc.unslung... success!
    [4/4] Installing new versions of packages...
    Downloading http://pkg.entware.net/binaries/mipsel/Packages.gz.
    Updated list of available packages in /opt/var/opkg-lists/entware-ng.
    No packages removed.
    Installing ldconfig (1.0.17-1) to root...
    Downloading http://pkg.entware.net/binaries/mipsel/ldconfig_1.0.17-1_mipselsf.ipk.
    Installing findutils (4.6.0-1) to root...
    Downloading http://pkg.entware.net/binaries/mipsel/findutils_4.6.0-1_mipselsf.ipk.
    Installing libc (1.0.17-1) to root...
    Downloading http://pkg.entware.net/binaries/mipsel/libc_1.0.17-1_mipselsf.ipk.
    Installing libgcc (5.4.0-1) to root...
    Downloading http://pkg.entware.net/binaries/mipsel/libgcc_5.4.0-1_mipselsf.ipk.
    Installing libssp (5.4.0-1) to root...
    Downloading http://pkg.entware.net/binaries/mipsel/libssp_5.4.0-1_mipselsf.ipk.
    Package findutils (4.6.0-1) installed in root is up to date.
    Package ldconfig (1.0.17-1) installed in root is up to date.
    Package libc (1.0.17-1) installed in root is up to date.
    Package libgcc (5.4.0-1) installed in root is up to date.
    Installing libpthread (1.0.17-1) to root...
    Downloading http://pkg.entware.net/binaries/mipsel/libpthread_1.0.17-1_mipselsf.ipk.
    Installing librt (1.0.17-1) to root...
    Downloading http://pkg.entware.net/binaries/mipsel/librt_1.0.17-1_mipselsf.ipk.
    Installing libstdcpp (5.4.0-1) to root...
    Downloading http://pkg.entware.net/binaries/mipsel/libstdcpp_5.4.0-1_mipselsf.ipk.
    Unknown package 'uclibc-opt'.
    Configuring ldconfig.
    Configuring libgcc.
    Configuring libc.
    Configuring libpthread.
    Configuring libstdcpp.
    Configuring librt.
    Configuring libssp.
    Configuring findutils.
    Collected errors:
     * opkg_install_cmd: Cannot install package uclibc-opt.
    Done. Found a bug? Please report us at
    https://github.com/Entware-ng/Entware-ng/issues
    

    虽然有一行错误提示,但是没发现明显的不良影响

    新版的安装命令

    wget -O - http://pkg.entware.net/binaries/mipsel/installer/installer.sh | sh
    
    
    
  • 在刷了tomato-K26USB-1.28.RT-N5x-MIPSR2-138-VPN-64K之后,(因为未改装的原版hg320是16mb闪存,刷不了21Mb的AIO 64k版本),测试ss 2.5.6发现,缺少libz.so的依赖
    root@unknown:/jffs/ss# ./ss-server -h
    ./ss-server: can't load library 'libz.so.1'
    
    
    root@unknown:/jffs/ss# ldd ./ss-server
            libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x2aac1000)
            libm.so.0 => /lib/libm.so.0 (0x2ac28000)
            libz.so.1 => not found
            libdl.so.0 => /lib/libdl.so.0 (0x2ac3e000)
            libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2ac51000)
            libpthread.so.0 => /lib/libpthread.so.0 (0x2ac70000)
            libc.so.0 => /lib/libc.so.0 (0x2ac93000)
            ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
    

    如果在优盘上安装entware-ng之后,再安装zlib,并设置LD_LIBRARY_PATH之后,错误更多了,似乎不能这么搞

    opkg install zlib binutils findutils-locate
    
    
    
    root@unknown:/jffs/ss# export LD_LIBRARY_PATH=/opt/lib
    root@unknown:/jffs/ss# ldd ./ss-server
            libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x2aac1000)
            libm.so.0 => /opt/lib/libm.so.0 (0x2ac28000)
            libz.so.1 => /opt/lib/libz.so.1 (0x2ac50000)
            libdl.so.0 => /opt/lib/libdl.so.0 (0x2ac74000)
            libgcc_s.so.1 => /opt/lib/libgcc_s.so.1 (0x2ac88000)
            libpthread.so.0 => /opt/lib/libpthread.so.0 (0x2acae000)
            libc.so.0 => /opt/lib/libc.so.0 (0x2acd4000)
            ld-uClibc.so.1 => /opt/lib/ld-uClibc.so.1 (0x2ad8b000)
            ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
    root@unknown:/jffs/ss# ./ss-server -h
    
    ./ss-server: can't handle reloc type 0x2f
    

    所以正解应该是自行编译64k nvram的Max版本(至少?)的固件,或者看看到底是哪个组件利用到了libz.so,只要编译的时候把他加上,大概就可以了,此外应该还需要加上利用到libpcre的组件,不然就只能最高用到ss 2.5.0了,原因见这里

    这样不行,因为只能替换已有文件

    mount --bind /opt/lib/libz.so.1  /lib/libz.so.1
    

    由于hg320原版有16mb的flash空间,虽然刷不了64kb nvram的21Mb的AIO版本,但大概max版本是绰绰有余的,由于shibby没有提供64kb nvram的max版本下载,lz需要自行编译

    lz fork了github上的tomato镜像,继添加了q3的编译选项后,又添加了64k nvram的max版本的选项

    # 这是原版的
    git clone -b tomato-shibby-RT-AC https://github.com/tomatofirmware/tomato.git
    
    # 如果想用lz的
    git clone -b q3 https://github.com/oglops/tomato.git
    cd ~/tomato
    
    sudo ln -s ~/tomato/tools/brcm /opt/brcm
    export PATH=$PATH:/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin
    
    make distclean ; rm ~/outputfile;  time make V1=RT-N5x- V2=-138-hg320 hg32064k  2>&1 | tee ~/outputfile.txt
    

    T450s笔记本上需时12min
    经验证 ss 2.6.1 可运行

    hg320-64k

    ss2-6-1-on-hg320

    添加了hg32064k的编译选项

    [oglop@localhost]$ make help
    n            Mini-USB - for oruter with 4MB flash and USB port - K24 only
    e            VPN - (standard plus VPN, extra utilities and NTFS support)
    c            BTgui-VPN - (Ext plus BT gui)
    d            Nocat-VPN - (BTgui plus VPN plus Nocat)
    g            Tor-VPN - (BTgui plus VPN plus TOR Project)
    t            BT-VPN - (BT plus VPN)
    b            Big-VPN - (Big plus VPN)
    o            Mega-VPN - (Mega plus VPN plus NOCAT minus NFS)
    z            MIPS Release 15F AIO (for routers +8MB flash)
    i            MiniIPv6 - (IPv6 with no USB support minus CIFS and RIPv1/2)
    j            MiniVPN - (VPN with no USB support minus CIFS and RIPv1/2)
    f            Mini - (no USB support minus CIFS and RIPv1/2)
    v            VPN (no usb) - (VPN with no USB support) / in K26 + IPv6 support
    m            Max (no usb) - (Max with no USB support) / in K26 + IPv6 support
    w            SD-VPN (no usb) - (VPN with SD-MOD and no USB support)
    r2e          MIPS Release 2 VPN
    r2c          MIPS Release 2 BTgui-VPN
    r2d          MIPS Release 2 Nocat-VPN
    r2g          MIPS Release 2 Tor-VPN
    r2t          MIPS Release 2 BT-VPN
    r2b          MIPS Release 2 Big-VPN
    r2o          MIPS Release 2 Mega-VPN (for routers +8MB flash)
    r2z          MIPS Release 2 AIO (for routers +8MB flash)
    r2v          MIPS Release 2 VPN (no usb)
    r2m          MIPS Release 2 Max (no usb)
    r2i          MIPS Release 2 MiniIPv6 (for 4MB flash)
    r2j          MIPS Release 2 MiniVPN (for 4MB flash)
    r2f          MIPS Release 2 Mini (for netgear)
           Linksys E-Series with 4MB Flash(E1000v2/v2.1/E1200v1)
    e1000v2f     Linksys E1000v2-v2.1/Cisco M10v2 Mini
    e1000v2i     Linksys E1000v2-v2.1/Cisco M10v2 MiniIPv6
    e1200v1f     Linksys E1200v1 Mini
    e1200v1i     Linksys E1200v1 MiniIPv6
           Linksys E-Series with 60k Nvram
    n60e         Linksys E-series build VPN
    n60c         Linksys E-series build BTGui-VPN
    n60d         Linksys E-series build BTGui-VPN plus Nocat
    n60g         Linksys E-series build BTGui-VPN plus TOR Project
    n60t         Linksys E-series build BT-VPN
    n60b         Linksys E-series build Big-VPN
    n60o         Linksys E-series build Mega-VPN
    n60z         Linksys E-series build AIO
    n60i         Linksys E-series build Mini for E2500
    n60j         Linksys E-series build MiniIPv6 for E2500
    n60v         Linksys E-series build IPv6-VPN for E2000
    n60m         Linksys E-series build Max for E2000
           Linksys E-Series with 64k Nvram/8MB Flash(E800/E900/E1200v2/E1500)
    n64e         Linksys E-series(64k Nvram) build VPN
    n64c         Linksys E-series(64k Nvram) build BTGui-VPN
    n64d         Linksys E-series(64k Nvram) build BTGui-VPN plus Nocat
    n64g         Linksys E-series(64k Nvram) build BTGui-VPN plus TOR Project
    n64u         Linksys E-series(64k Nvram) build BT
    n64t         Linksys E-series(64k Nvram) build BT-VPN
    n64b         Linksys E-series(64k Nvram) build Big-VPN
    n64o         Linksys E-series(64k Nvram) build Mega-VPN
    n64v         Linksys E-series(64k Nvram) build IPv6-VPN
    n64m         Linksys E-series(64k Nvram) build Max
           Routers with wl_high module
    rtn53        Asus RT-N53 with wl_high module (dualband support)
    e2500        Linksys E2500 with wl_high module (dualband support)
    e3200        Linksys E3200/E2500v3 with wl_high module (dualband support) / max 16MB
    n6           Tenda N6 with wl_high module (dualband support)
    n60          Tenda N60 with wl_high module (dualband support)
           Netgear WNR3500L v2 builds (128MB Flash)
    v2e          Netgear WNR3500Lv2 build VPN
    v2z          Netgear WNR3500Lv2 build AIO
    
    r64e         RT-N66u build VPN
    r64z         RT-N66u build AIO
    
    r2q3m        Netcore q3 build Max without OPENVPN
    r2q3v        Netcore q3 build VPN with JFFS
    
    hg32064k     hg320 build Max 64k nvram
    
    ..etc..      other build configs
    clean        -C router clean
    cleanimage   rm -rf image
    cleantools   clean btools, mksquashfs
    cleankernel  -C Linux distclean (but preserves .config)
    distclean    distclean of Linux & busybox (but preserve .configs)
    prepk        -C Linux oldconfig dep
    

下载链接:
dd-wrt.v24-18024_NEWD-2_K2.6_mini.bin

64k nvram的自定义max版 tomato-K26USB-1.28.RT-N5x-MIPSR2-138-hg320-Max-64K.trx
64k nvram的自定义max版 + pcre tomato-K26USB-1.28.RT-N5x-MIPSR2-138-hg320-Max-64K-pcre.trx

全版本ss libev for tomato下载地址

lz的github repo https://github.com/oglops/tomato

参考:
[分享] HG320路由器盲刷64K CFE NVRAM固件
烽火hg320,从电信原版到tomato115详细刷机教程(更新下载地址)。
Can VLAN GUI port order be corrected? – !! Unknown Port Mapping Using Default!!

出个HG320用TTL线刷CFE教程

github.com/Entware-ng/Entware-ng
Entware-ng – Install on the TomatoUSB

网件3400v2路由器从砖修复, WNDR3400v2 hang on bootloader solved

用TTL线在CFE环境下拯救半砖wrt54g路由器
有 show devices的文件解说

中古神器烽火hg320电信原版刷64k cfe和tomato shibby v138 并在优盘安装entware-ng”的一个响应

  1. entware-ng的wiki中(https://github.com/Entware/Entware/wiki/Install-on-the-TomatoUSB#perform-the-entware-install)说,MIPS devices: not supported by Entware, mips kernel (2.6.22) is to old。
    这个没问题吗?
    我正在用freshTomato,自带的optware源的dbus不能用段错误,正在寻找新方案

    1. 我freshtomato 2018.4的时候装了entware到asus n16上没看到上面写的错误,我现在升级到2018.5了, 我没装什么东西,之前只试过repo里的ss, 不过现在ss libev又出了新版,repo没跟上,我就又用回自己编译的ss了

留下评论