一半君的总结纸

听话只听一半君

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
nvarm 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

# 把汉化版的www复制到tomato源码中覆盖
rsync -rpv --ignore-times  ~/github/tomato-gui/*  ~/tomato/release/src-rt/router/www/  --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

新错误

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
    

    修复方法见这里

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)

下载连接:
tomato-K26USB-1.28.RT-N5x-CN-MIPSR2-140-hg320-Max-64K.trx hg320 64k nvram max 版
tomato-K26-1.28.RT-N5x-CN-MIPSR2-140-netcore-q3-Max.trx q3 max 版
tomato-K26USB-1.28.RT-N5x-CN-MIPSR2-140-n66u-AIO-64K.trx n66u 64k nvram AIO 版
tomato-K26ACUSB-1.28.RT-N5x-CN-MIPSR2-140-AIO-64K.trx ac66u 64k nvram AIO 版

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

Advertisements

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

  1. ek66 八月 11, 2017 @ 10:34 下午

    lz辛苦,感谢提供汉化。

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: