tomato shibby v140 界面中文化及乱搞(烽火hg320 / 磊科Q3 / Asus N66U / AC66U)

在这里提到AdvancedTomato有相对比较完善的汉化,但是shibby一直没有,虽然有各位大神尝试过ML版本,加入dict支持,但是很多说明文字不好直接翻译,而且大神们都比较忙,没有人工校对,造成翻译文字部分文不对题,前几天偶然看到有v137 AIO的硬上版翻译(直接提取固件里的www文件夹,进行翻译,费力不讨好),lz决定回馈大众,使用经典脑残法翻译(直接替换源码中字符串),因为大部分中古路由器只有8MB flash,如果加上translation module,势必进一步减少jffs空间,而lz希望剩余空间尽可能大点,以便于放ss,而且lz不希望精简Max固件

lz使用kdiff3工具把 V137 AIO 硬上版翻译直接merge到v140的源码里(也是脑残法),花去很长一段时间…

尝试在apache上测试

apache 配置

cd /etc/httpd/conf.d
cp userdir.conf z-userdir-local.conf

修改配置,去掉注释

UserDir enabled oglop
UserDir public_html
systemctl restart httpd

# 这样感觉不好,不过我是临时测试
chmod 711 /home/oglop
chmod 755 /home/oglop/public_html

# 把我想测试的界面文件放到指定目录下
cp -r ~/github/tomato-gui-backup-rsync ~/public_html/tt

# SELinux设置
sudo setsebool -P httpd_enable_homedirs on
chcon -R -t httpd_sys_content_t /home/oglop/public_html

然后你就可以 http://localhost/~oglop/tt/about.asp 测试了,不过似乎好像有些菜单看不到,所以lz还是上机器测试了

尝试在hg320上测试
scp ~/github/tomato-gui-backup-rsync/* root@192.168.1.3:/jffs/www/

配置页面里把页面设置到/jffs/www,话说应该也可以临时改,不存进nvram,每次想测试的时候临时set一次
万一挂了可以这样改回来, ssh进去之后

# 恢复默认
nvram set web_dir=default

# 设为/jffs/www
nvram set web_dir=jffs

# 如果想永久保存修改
nvram commit

# 如果你改成了/jffs/www, 下面这个应该返回jffs
nvram get web_dir

# 重启apache
service httpd restart

下面开始在线测试,虽然hg320目前刷的是自定义max版,而且界面文件是未“编译”之前的源码里的,显然有很多内容没有移除,可以想象的到很多菜单显示是错误的,所以我不会在测试的时候更改设置并保存, 以免把nvram搞乱套,但至少这样能发现主菜单上的明显错误

ssh root@192.168.1.3

# 因为lz之前插了优盘,装了entware
opkg update
opkg install nano

nano编辑的时候发现不是特别方便,因为快捷键很奇怪

ctrl + w # 搜索
alt + w # 下一个搜索
alt + u # undo

所以lz决定一边看着路由器上的测试页面,一边在笔记本上编辑,然后把修改过的文件拷过去,所以

# 如果想把所有改动过的文件拷到路由器
git status --porcelain | awk '{print $2}' | xargs -I {} scp {} root@192.168.1.3:/jffs/www/

# 临时建个alias, 传文件过去
alias jffs='f(){ scp "$@" root@192.168.1.3:/jffs/www ; unset -f f; }; f'

期间参考了好几个版本的翻译,当然也有tomato-arm的翻译,不过不幸的是,似乎字典里很多翻译是错的(似乎是机翻),而且很多意思完全错误,比如这条,就完全搞反了

测试编译
# 安装一些依赖库
dnf install ncurses ncurses-devel bison flex texinfo gmp-devel nettle-devel libtool autogen libstdc++.i686

# clone lz修改过的repo, 下面提到的错误均已被修复
git clone -b q3 https://github.com/oglops/tomato.git
sudo ln -s ~/tomato/tools/brcm /opt/brcm

# clone 汉化文件repo
git clone -b v140 https://github.com/oglops/tomato-gui.git

# 把汉化版的www复制到tomato源码中覆盖
rsync -rpv --ignore-times ~/tomato-gui/* ~/tomato/release/src-rt/router/www/ --exclude .git
# 或者用 -C 代替 --exclude .git

# 编译
cd ~/tomato/release/src-rt
export PATH=$PATH:/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin

make distclean ; rm ~/hg320.txt; time make V1=RT-N5x-CN- V2=-140-hg320 hg32064k 2>&1 | tee ~/hg320.txt

新错误(已经在repo中解决)

rm -rf $backupdir; exit $rc
glib.texi:111: raising the section level of @subsection which is too low
glib.texi:168: raising the section level of @subsection which is too low
glib.texi:221: raising the section level of @subsection which is too low
glib.texi:239: raising the section level of @subsection which is too low
glib.texi:269: raising the section level of @subsection which is too low
glib.texi:293: raising the section level of @subsection which is too low
glib.texi:323: raising the section level of @subsection which is too low
glib.texi:374: raising the section level of @subsection which is too low
glib.texi:398: raising the section level of @subsection which is too low
Makefile:273: recipe for target 'glib.info' failed

貌似是因为texinfo版本太高

$ dnf --showduplicates list texinfo
Installed Packages
texinfo.x86_64 6.1-4.fc25 @updates
Available Packages
texinfo.x86_64 6.1-3.fc25 fedora
texinfo.x86_64 6.1-4.fc25 @updates
texinfo.x86_64 6.1-4.fc25 updates

当然可以试着降低texinfo版本,不过也可以干脆将glib.texi里的@subsection全部换成@section,然后重新生成glib.info 见这里

sed -i -e 's/@subsection/@section/g' docs/glib.texi
makeinfo -o docs/glib.info docs/glib.texi

这个错误似乎不影响编译完成

../libtool: line 85: -R: command not found

不过lz准备用脑残法在configure完之后把他给替换了 见这里

sed -i -e 's/STRIP=\(.*\)/STRIP="\1"/g' ./libtool

tips:
如果桌面右键菜单不能弹出 任务栏无反应

killall plasmashell && kstart plasmashell

编译之后刷入hg320进行测试,貌似正常,此www文件夹按理说应该适用于v140任何版本(AIO, Max, VPN…)的固件,因为编译过程中会裁切去不需要的部分

*********************** Mon Jul 31 22:48:58 PDT 2017 ************************
1.28.0000 MIPSR2-140-hg320 K26 USB Max-64K
Creating little endian 3.0 filesystem on /home/oglop/tomato/release/src-rt/router/mipsel-uclibc/target.image, block size 65536.

Little endian filesystem, data block size 65536, compressed data, compressed metadata, compressed fragments
Filesystem size 8291.08 Kbytes (8.10 Mbytes)
31.75% of uncompressed filesystem size (26113.91 Kbytes)
Inode table size 10778 bytes (10.53 Kbytes)
22.54% of uncompressed inode table size (47819 bytes)
Directory table size 11949 bytes (11.67 Kbytes)
52.30% of uncompressed directory table size (22849 bytes)
No duplicate files removed
Number of inodes 1475
Number of files 1216
Number of fragments 91
Number of symbolic links 196
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 63
Number of uids 1
root (0)
Number of gids 0

Creating TRX: image/tomato-K26USB-1.28.RT-N5x-CN-MIPSR2-140-hg320-Max-64K.trx

TRX Image:
Total Size .... : 9461760 (9240.0 KB) (9.0 MB)
Images ...... : 9461732 (0x00905fe4)
Padding ..... : 0
Avail. for jffs :
4MB, 128K CFE : 0 EBs + 0
4MB, 256K CFE : 0 EBs + 0
8MB, 256K CFE : 0 EBs + 0
Note : Netgear routers have 6 EBs less available!
CRC-32 ........ : 194E3BA9
128K Blocks ... : 73 (0x00000049)
64K Blocks ... : 145 (0x00000091)
Offsets:
0: 0x0000001C lzma-loader/loader.gz
1: 0x00000AD8 /home/oglop/tomato/release/src-rt/linux/linux-2.6/arch/mips/brcm-boards/bcm947x
2: 0x000ED000 router/mipsel-uclibc/target.image

编译q3自定义max版

make distclean ; rm ~/q3.txt; time make V1=RT-N5x-CN- V2=-140-netcore-q3 r2q3m 2>&1 | tee ~/q3.txt

*********************** Mon Jul 31 23:16:34 PDT 2017 ************************
1.28.0000 MIPSR2-140-netcore-q3 K26 Max
Creating little endian 3.0 filesystem on /home/oglop/tomato/release/src-rt/router/mipsel-uclibc/target.image, block size 65536.

Little endian filesystem, data block size 65536, compressed data, compressed metadata, compressed fragments
Filesystem size 5835.36 Kbytes (5.70 Mbytes)
31.21% of uncompressed filesystem size (18695.74 Kbytes)
Inode table size 6781 bytes (6.62 Kbytes)
24.53% of uncompressed inode table size (27649 bytes)
Directory table size 7764 bytes (7.58 Kbytes)
56.26% of uncompressed directory table size (13801 bytes)
No duplicate files removed
Number of inodes 857
Number of files 640
Number of fragments 70
Number of symbolic links 166
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 51
Number of uids 1
root (0)
Number of gids 0

Creating TRX: image/tomato-K26-1.28.RT-N5x-CN-MIPSR2-140-netcore-q3-Max.trx

TRX Image:
Total Size .... : 6946816 (6784.0 KB) (6.6 MB)
Images ...... : 6943716 (0x0069f3e4)
Padding ..... : 3072
Avail. for jffs :
4MB, 128K CFE : 0 EBs + 0
4MB, 256K CFE : 0 EBs + 0
8MB, 256K CFE : 17 EBs + 0
Note : Netgear routers have 6 EBs less available!
CRC-32 ........ : 726CE59E
128K Blocks ... : 53 (0x00000035)
64K Blocks ... : 106 (0x0000006A)
Offsets:
0: 0x0000001C lzma-loader/loader.gz
1: 0x00000AD8 /home/oglop/tomato/release/src-rt/linux/linux-2.6/arch/mips/brcm-boards/bcm947x
2: 0x000EC400 router/mipsel-uclibc/target.image
试编译 n66u 64k nvram版
make distclean ; rm ~/n66u.txt; time make V1=RT-N5x-CN- V2=-140-n66u r64z 2>&1 | tee ~/n66u.txt

出现过的错误们

  • mysql 编译错误
    sql_yacc.yy: In function 'int MYSQLparse()':
    sql_yacc.yy:58: error: too few arguments to function 'int MYSQLlex(void*, void*)'
    sql_yacc.cc:14844: error: at this point in file
    sql_yacc.yy:1519: error: 'yythd' was not declared in this scope
    

    这是因为系统里bison版本过高, 去koji.fedoraproject.org下载个<3.0版本的

    $ rpm -qa | grep bison
    bison-3.0.4-4.fc24.x86_64

    # 从koji下载旧版的rpm
    dnf downgrade ~/Downloads/bison-2.7-3.fc20.x86_64.rpm

  • transmission 编译错误
    cd transmission && CC=mipsel-uclibc-gcc STRIP='mipsel-uclibc-strip' \
    autoreconf && \
    CFLAGS="-Os -Wall -fno-delete-null-pointer-checks -funit-at-a-time \
    --param large-function-growth=800 --param max-inline-insns-single=3000 \
    -ffunction-sections -fdata-sections" \
    LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections -fPIC \
    -L/home/oglop/tomato/release/src-rt/router/zlib -L/home/oglop/tomato/release/src-rt/router/openssl -L/home/oglop/tomato/release/src-rt/router/libcurl/lib/.libs -L/home/oglop/tomato/release/src-rt/router/libevent/.libs" \
    HAVE_CXX=yes \
    ./configure --host=mipsel-linux --build=x86_64-redhat-linux --target=mipsel-linux --host=mipsel-linux --build=x86_64-linux-gnu --prefix=/usr --disable-nls \
    --enable-lightweight --enable-largefile --enable-utp --without-gtk \
    LIBCURL_CFLAGS="-I/home/oglop/tomato/release/src-rt/router/libcurl/include" \
    LIBCURL_LDFLAGS="-L/home/oglop/tomato/release/src-rt/router/libcurl/lib/.libs/" \
    LIBCURL_LIBS="-lcurl" \
    LIBEVENT_CFLAGS="-I/home/oglop/tomato/release/src-rt/router/libevent/include" \
    LIBEVENT_LDFLAGS="-L/home/oglop/tomato/release/src-rt/router/libevent/.libs" \
    LIBEVENT_LIBS="-levent" \
    OPENSSL_CFLAGS="-I/home/oglop/tomato/release/src-rt/router/openssl/include" \
    OPENSSL_LDFLAGS="-L/home/oglop/tomato/release/src-rt/router/openssl" \
    OPENSSL_LIBS="-lcrypto -lssl" \
    ZLIB_CFLAGS="-I/home/oglop/tomato/release/src-rt/router/zlib" \
    ZLIB_LDFLAGS="-L/home/oglop/tomato/release/src-rt/router/zlib" \
    ZLIB_LIBS="-lz"
    m4/glib-gettext.m4:39: error: m4_copy: won't overwrite defined macro: glib_DEFUN
    m4/glib-gettext.m4:39: the top level
    autom4te: /usr/bin/m4 failed with exit status: 1
    aclocal: error: echo failed with exit status: 1
    autoreconf: aclocal failed with exit status: 1
    Makefile:2261: recipe for target 'transmission/stamp-h1' failed
    make[4]: *** [transmission/stamp-h1] Error 1
    

    修复方法见这里

  • 测试wndr64的时候出现错误

    FATAL: drivers/net/wl/wl_high: sizeof(struct usb_device_id)=24 is not a modulo of the size of section __mod_usb_device_table=140.
    Fix definition of struct usb_device_id in mod_devicetable.h
    make[5]: *** [__modpost] Error 1
    make[4]: *** [modules] Error 2
    make[3]: *** [kernel] Error 2
    make[2]: *** [all] Error 2
    make[1]: *** [bin] Error 2
    make: *** [wndr64] Error 2
    

    这个问题由bwq518大神提出过,由shibby大神解答于此, 需要revert这个commit,在github镜像上是这个commit 其实你需要的是这个, 由shibby大神在这里提到

    所以

    git show 46f7c5f0da4204eb61ff5108c7dd7a835df39576 -- release/src-rt/linux/linux-2.6/include/linux/mod_devicetable.h | git apply -R
    

ac66u 编译测试 (Broadcomm wireless driver 6.x)

cd ~/tomato/release/src-rt-6.x
make distclean ; rm ~/ac66u.txt; time make V1=RT-N5x-CN- V2=-140 ac66z 2>&1 | tee ~/ac66u.txt

错误

make[4]: Leaving directory '/home/oglop/tomato/release/src-rt-6.x/ctools'
ctools/objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S /home/oglop/tomato/release/src-rt-6.x/linux/linux-2.6/vmlinux ctools/piggy
ctools/lzma_4k e ctools/piggy ctools/vmlinuz-lzma
ctools/lzma_4k: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

似乎是lzma_4k这个工具找不到一个so文件

cd ~/tomato/release/src-rt-6.x/ctools
$ ldd ./lzma_4k
linux-gate.so.1 (0xf7705000)
libstdc++.so.6 => not found
libm.so.6 => /lib/libm.so.6 (0xf767d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf765f000)
libc.so.6 => /lib/libc.so.6 (0xf7484000)
/lib/ld-linux.so.2 (0x5663a000)

可是lz是装了他的,感觉是需要32bit版本

$ rpm -qa | grep libstdc++
libstdc++-6.3.1-1.fc25.x86_64
libstdc++-devel-6.3.1-1.fc25.x86_64

$ dnf install libstdc++.i686

这次可以了,lz把这个需求加到顶部的依赖库安装列表里了

$ ldd ./lzma_4k
linux-gate.so.1 (0xf7785000)
libstdc++.so.6 => /lib/libstdc++.so.6 (0xf75cf000)
libm.so.6 => /lib/libm.so.6 (0xf7578000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf755a000)
libc.so.6 => /lib/libc.so.6 (0xf737f000)
/lib/ld-linux.so.2 (0x565c5000)

update 09/21/2017:
因为lz最开始使用的翻译是别人从编译好的固件里提取出来的,所以每行开头的\t和空白行都在编译过程中被删除了(以节省空间),但是这样造成了lz通过merge汉化的文件也没有这些\t,所以代码格式很乱,lz用了个脑残方法,逐行比较原版文件和汉化过的文件,然后把少的\t加了回去,当然这个前提是假定汉化文件没有增加或者减少行,除了汉化部分文字不同以外,所有的不同都只存在于缩进里,commit见这里

下载链接:
https://oglopss.github.io/tomato-ci-jekyll/

lz移除了之前dropbox的下载链接,因为lz后来把编译放到travis ci上,期间lz又数次更新了翻译repo,而没有在本机再次编译,在上面的连接里是最新版本

hg320 AIO 效果图

repo 地址:
https://github.com/oglops/tomato-gui
https://github.com/oglops/tomato

参考:
Per-user web directories
Apache HTTP Server - Fedora
Apache Userdir with SELinux on Fedora 26/25, CentOS/RHEL 7.3/6.9
How do I create an alias where the arguments go in the middle?
zh_CN.dict - tomato-arm by tsynik

raising the section level of @subsection which is too low

compilation error for mysql - downgrade bison
Work around "error: m4_copy: won't overwrite defined macro: glib_DEFUN" on
Debian Bug report logs - #820785 transmission: FTBFS: m4/glib-gettext.m4:39: error: m4_copy: won't overwrite defined macro: glib_DEFUN

tomato shibby v140 界面中文化及乱搞(烽火hg320 / 磊科Q3 / Asus N66U / AC66U)”的一个响应

  1. 您好,请问能做一个hg320 32k nvram的固件吗?
    我的路由器uboot是最早的32k,看论坛貌似没法刷64k固件。会成砖?

    1. r2m 版本就是 32k nvram的 max 版本,hg320可以用,我之所以要自己编译一个64k nvram的版本是因为 shibby 没有编译 64k 的max版,你可以去最新一篇blog里的github pages里的travis ci build列表里下载 r2m 版本,mega网盘里也有
      edit:看了下Makefile,似乎r2m没有usb,而且我自定义版和m:不一样,我有空会帮你build一个32k的hg320的
      edit2: 已经build了,hg320 build参数那个就是32k的, hg32064k是64k的

  2. 大神,EA6500 V1版硬件类似AC66U,那么是否也可以涮:tomato-K26ACUSB-1.28.RT-N5x-CN-MIPSR2-140-AIO-64K.trx ac66u 64k nvram AIO 版 ?

      1. 感谢大神回复。作为菜鸟,但依然对找一款适合自己需要功能的固件不死心,现在死了。还是用恩山BWQ518原版主的基于124的14年固件吧。总比原厂固件好。再次感谢。

      1. 好的。我也忘了啥时下载了。不过看到你HG320固件后就去涮了,138版本是正常的,140的试了2次,我是用于一个星期重启一次,后在CRON中手动设置。另外大神,回到32K ROM有没简单的方法?谢谢。

      2. 我猜需要刷回32k的cfe,但是我没试过, 所以… 我不知道. edit:我试了下用ttl线刷回32k cfe,然后再刷32k的固件,可以成功刷回

  3. 请教楼主,我刚买了一台电信原版的HG320,还没加电,现在想由shibby的TT,是不是下载这个页面内的固件,清一下NVRAM,就可以直接刷了?并不需要更换CFE吧,因为我也不打算刷磊科等OS,我觉得TT就非常好用。

    1. 我当时也是按网上搜的教程来的,我记得是可以的,你可以搜搜看,但是我第一次免拆机刷的时候是先刷dd mini才刷tt的,你可以参考这里.
      刷64k nvram CFE的作用仅仅是为了如果日后想使用openvpn的时候,有足够的空间可以存配置文件,或者自己有什么简单配置想存在nvram里,如果你没有这些使用需求的话,不刷也可以,自己编译的目的只是为了多塞些功能进去,我只需要1mb剩余jffs空间放ss,再说他可以插优盘,我只是想要充分利用所有空间而已,虽然大部分功能我用不着

  4. 电信原版HG320,用TFTP刷tomato-K26USB-1.28.RT-N5x-CN-MIPSR2-140-Mega-VPN.trx后,仍然是电信登录界面,没有任何变化。

  5. 经过验证,电信原版直接刷你的固件后,RESET键失效,再也不提示TTL100了。
    但从论坛中看到,电信原版直接刷shibby固件是可以的,你的固件也对shibby的内容进行了修改,并不是完全的只改WEBUI,是不是?

    1. 我没有对固件进行任何修改,github pages上那些只改了webui,你可以去github上的commit历史看我改了什么,没有任何功能改动

      1. 那此时我该怎么做呢?有什么办法可以搞成功吗?比如说,我再买一个原版的HG320,要怎么刷才能刷上呢?

      2. 你意思是砖了?可以买个usb ttl线救砖,可以参考这里,当然这是砖的不行了的情况,无论多砖这样都可以救活.一般用不到这一步

  6. 大大你好,请问磊科Q3想用ss应该刷哪个固件,r2q3m还是r2q3v。 根据r2q3v的描述,Netcore q3 build VPN with JFFS,似乎是在jffs里放了东西,可以我刷完之后却什么也没找到。请问大大是什么原因,非常感谢。

    1. 我那样命名的意思是相比较默认的vpn版而言,加入了jffs功能,默认的vpn版是没有jffs功能的,这些功能都只是在编译的时候的开关而已,因为我想jffs空间大一点,那我自然得找个小尺寸的固件比如vpn版,然后编译的时候开启jffs,那r2q3m版自然是max版本再开启了jffs,显然他的jffs可用空间比vpn版小,因为max版里带更多的功能。综上,如果你想要max版里的功能,jffs也足够用了(假设你只想放个ss上去),那就用r2q3m;如果你不需要max里那些,vpn版就足够了,而且想在jffs里放更多东西,那就r2q3v版

  7. 为什么刷了支持AC的固件,2.4G没有N选项,5.8G只有A选项没有C选项,看到驱动是支持的

留下评论