v140出来好久了,该更新下了
编译v140的tomato shibby
因为lz有些特殊需求,见这里和这里,简单的说就是需要64k nvram的max版(hg320用,shibby官网只有AIO的64k版) 或者去掉openvpn的max版(q3用,否则nvram和jffs太小,openvpn配置存不下,ss也放不进jffs)
准备阶段,需要一些工具
dnf install ncurses ncurses-devel bison flex texinfo gmp-devel nettle-devel libtool autogen
lz还从源码安装了automake-1.13 和 1.14, 其中1.13是在编译尝试中看到提示需要1.13, 至于1.14是不是需要忘了
遇到的错误
-
systemd/sd-daemon.h: No such file or directory # 在tor的配置里禁用systemd 所以lz在 release/src/router/Makefile里的 tor/stamp-h1: 的configure命令后面加上了 --enable-systemd=no # 在dnscrypt的配置里禁用systemd 所以在dnscrypt/stamp-h1: 的configure命令后面加上了 --enable-systemd=no
-
/home/oglop/tomato/release/src/router/libnfsidmap/missing: line 81: automake-1.13: command not found WARNING: 'automake-1.13' is missing on your system. You should only need it if you modified 'Makefile.am' or 'configure.ac' or m4 files included by 'configure.ac'. The 'automake' program is part of the GNU Automake package: It also requires GNU Autoconf, GNU m4 and Perl in order to run: # 可是lz系统里只有automake-1.15, repo里没有旧版, 所以只好去下1.13.4的源码自己装
-
syntax error near unexpected token SYSTEMD # 查错要求的技能超出lz能力范围,因为似乎没有用到systemd,所以lz把release/src/router/dnscrypt/configure.ac里关于systemd检测那块禁用了 # 去掉了以下这段 AS_IF([test "x$with_systemd" = "xyes"], [ PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [have_systemd=yes], [ PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon], [have_systemd=yes], [have_systemd=no]) ]) AS_CASE([$with_systemd:$have_systemd], [yes:no], [AC_MSG_ERROR([systemd expected but libsystemd not found -- maybe you need to install the pkg-config and libsystemd-dev packages])], [*:yes], AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Define if libsystemd is available]) ) ])
- 此错误是自带配置r2m没问题以后,测试hg32064k配置时候出现的
autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal configure.ac:71: warning: macro 'AM_PROG_LIBTOOL' not found in library autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/bin/autoconf configure.ac:71: error: possibly undefined macro: AM_PROG_LIBTOOL If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. autoreconf: /usr/bin/autoconf failed with exit status: 1
这似乎是因为lz自行安装了automake 1.13, /usr/local/share/aclocal/目录是空的,macro们都在系统的/usr/share/aclocal/目录下,所以
echo /usr/share/aclocal | sudo tee --append /usr/local/share/aclocal/dirlist
-
mipsel-uclibc-gcc -std=gnu99 -Os -Wall -DLINUX26 -DCONFIG_BCMWL5 -pipe -DBCMWPA2 -funit-at-a-time -Wno-pointer-sign -mtune=mips32 -mips32 -DTCONFIG_NVRAM_64K -I/home/oglop/tomato/release/src-rt/router/libncurses/staged/usr/include -ffunction-sections -fdata-sections -Wall -ffunction-sections -fdata-sections -Wl,--gc-sections -L/home/oglop/tomato/release/src-rt/router/libncurses/staged/usr/lib -fPIC -o nano browser.o chars.o color.o cut.o files.o global.o help.o move.o nano.o prompt.o rcfile.o search.o text.o utils.o winio.o ../lib/libgnu.a -lncurses -ltinfo /home/oglop/tomato/tools/brcm/K26/hndtools-mipsel-uclibc-4.2.4/bin/../lib/gcc/mipsel-linux-uclibc/4.2.4/../../../../mipsel-linux-uclibc/bin/ld: cannot find -ltinfo collect2: ld returned 1 exit status Makefile:1478: recipe for target 'nano' failed
这是因为似乎configure里用的是系统的pkg-config来决定ncurses的libs,lz系统里(fedora 25)的是有tinfo的,而tomato里带的那个没有(src-rt/router/Makefile里对nano没有用autogen.sh)
$ pkg-config --libs ncurses -lncurses -ltinfo
经观测,src-rt/router/nano/configure里写道
NCURSES_LIBS linker flags for NCURSES, overriding pkg-config
而router的Makefile里写有 –disable-utf8
所以加上NCURSES_LIBS="-lncurses" \
应该即可
下载toolchain
git clone -b q3 https://github.com/oglops/tomato.git cd tomato/release/src-rt # 注意toolchain的路径必须是在系统路径的后面而不是前面 export PATH=$PATH:/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin
编译hg320 64k nvram版
# 用tee只是为了让输出显示到console的同时也存到log文件里 make distclean ; rm ~/outputfile; time make V1=RT-N5x- V2=-140-hg320 hg32064k 2>&1 | tee ~/outputfile.txt # 如果想清空临时文件 cd ~/tomato; git checkout .; git clean -xfd; cd -
编译结果
*********************** Fri Jul 14 21:57:41 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 8286.55 Kbytes (8.09 Mbytes) 31.73% of uncompressed filesystem size (26114.08 Kbytes) Inode table size 10822 bytes (10.57 Kbytes) 22.63% of uncompressed inode table size (47819 bytes) Directory table size 11947 bytes (11.67 Kbytes) 52.29% 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-MIPSR2-140-hg320-Max-64K.trx TRX Image: Total Size .... : 9457664 (9236.0 KB) (9.0 MB) Images ...... : 9456612 (0x00904be4) Padding ..... : 1024 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 ........ : 714BEF6F 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: 0x000ECC00 router/mipsel-uclibc/target.image
编译 q3 max定制版
make distclean ; rm ~/outputfile; time make V1=RT-N5x- V2=-140-netcore-q3 r2q3m 2>&1 | tee ~/outputfile.txt
编译结果
*********************** Fri Jul 14 21:21:38 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 5830.75 Kbytes (5.69 Mbytes) 31.19% of uncompressed filesystem size (18695.35 Kbytes) Inode table size 6787 bytes (6.63 Kbytes) 24.55% of uncompressed inode table size (27649 bytes) Directory table size 7765 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-MIPSR2-140-Netcore-Q3-Max.trx TRX Image: Total Size .... : 6942720 (6780.0 KB) (6.6 MB) Images ...... : 6939620 (0x0069e3e4) Padding ..... : 3072 Avail. for jffs : 4MB, 128K CFE : 0 EBs + 0 4MB, 256K CFE : 0 EBs + 0 8MB, 256K CFE : 17 EBs + 4096 Note : Netgear routers have 6 EBs less available! CRC-32 ........ : 70241797 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
刷机测试
之前试过用tomatoedit在windows下把libpcre放进固件里,这样q3才可以用2.5.1以上版本的ss, (为磊科 q3 / ni360 编译带 pcre 的tomato shibby 固件 v138),可是那样很麻烦,所以lz在后来编译的ss中都设置了rpath,把/jffs/libs加了进去,理论上只要把libpcre放那里就行了
lz的q3上的jffs里之前已经有些测试的文件,先备份到电脑,至于其他路由器设置,如果有很多特别设定,用tomato自带的备份configuration file备份下先
# r表示recursive p表示保留permission, 拷到电脑 scp -rp root@192.168.1.1:/jffs jffs-q3 # 刷完以后再拷回去 # r表示recursive p表示保留permission, 拷回 scp -rp jffs-q3/* root@192.168.1.1:/jffs # perp相关命令 # 启用ss这个srv perpctl A ss # 禁用srv perpctl X ss # 显示 perp 监控的进程 perpls
刷之前看了下ss,用的是上次乱搞用tomatoedit整合了libpcre的ss 2.5.6,用的是上次自定义的max版本, jffs空间1226KB
root@unknown:/jffs# ldd ss/ss-server libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x2aac1000) libm.so.0 => /lib/libm.so.0 (0x2ac28000) libpcre.so.1 => /usr/lib/libpcre.so.1 (0x2ac3c000) libz.so.1 => /usr/lib/libz.so.1 (0x2ac88000) libdl.so.0 => /lib/libdl.so.0 (0x2aca6000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2acb9000) libpthread.so.0 => /lib/libpthread.so.0 (0x2acd8000) libc.so.0 => /lib/libc.so.0 (0x2acfa000) ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
刷机之后(lz在升级页面没选清nvram,因为版本跨度不大)jffs空间1216KB
似乎只要如下设置vlan即可,不用再打开Basic-Network页面上的Invert Ports Order设置了
然后看下拷回去的ss
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 (0x2ac29000) libpcre.so.1 => not found libz.so.1 => /usr/lib/libz.so.1 (0x2ac3d000) libdl.so.0 => /lib/libdl.so.0 (0x2ac5b000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2ac6e000) libpthread.so.0 => /lib/libpthread.so.0 (0x2ac8d000) libc.so.0 => /lib/libc.so.0 (0x2acaf000) ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
果然是找不到libpcre的,因为这是lz很久之前编译的ss,而现在lz新编译的固件里也没有用tomatoedit去加libpcre,现在把lz最近新编译的ss 3.0.7拷进去(顺带说一句,lz编译的新版本的tomato适用的ss可以去http://oglopss.github.io/ctng-ss-jekyll/下载)
如果只拷ss-* 那么
root@unknown:/jffs/ss# ldd ss-server libev.so.4 => not found libm.so.0 => /lib/libm.so.0 (0x2aac1000) libsodium.so.18 => /usr/lib/libsodium.so.18 (0x2aad5000) libmbedcrypto.so.0 => not found libpcre.so.1 => not found libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2ab2f000) libpthread.so.0 => /lib/libpthread.so.0 (0x2ab4e000) libc.so.0 => /lib/libc.so.0 (0x2ab70000) ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
如果新建/jffs/lib目录的话,再把下载的ss压缩包里的几个so文件拷进去的话
root@unknown:/jffs/ss# ldd ss-server libev.so.4 => /jffs/lib/libev.so.4 (0x2aac1000) libm.so.0 => /lib/libm.so.0 (0x2aade000) libsodium.so.18 => /usr/lib/libsodium.so.18 (0x2aaf2000) libmbedcrypto.so.0 => /jffs/lib/libmbedcrypto.so.0 (0x2ab4c000) libpcre.so.1 => /jffs/lib/libpcre.so.1 (0x2abab000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2abda000) libpthread.so.0 => /lib/libpthread.so.0 (0x2abf9000) libc.so.0 => /lib/libc.so.0 (0x2ac1b000) ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
测试下ss
root@unknown:/jffs/ss# perpctl A ss-server ss-server: set for activation rescan triggered for activation set on 1 service root@unknown:/jffs/ss# perpls [- --- ---] ss (service not activated) [+ +++ +++] ss-server uptime: 5s/5s pids: 1944/1943 [- --- ---] ss-tunnel (service not activated)
成功!
root@unknown:/jffs/ss# ss-server -h shadowsocks-libev 3.0.7 maintained by Max Lv and Linus Yang usage: ss-server -s Host name or IP address of your remote server. -p Port number of your remote server. -l Port number of your local server. -k Password of your remote server. -m Encrypt method: rc4-md5, aes-128-gcm, aes-192-gcm, aes-256-gcm, aes-128-cfb, aes-192-cfb, aes-256-cfb, aes-128-ctr, aes-192-ctr, aes-256-ctr, camellia-128-cfb, camellia-192-cfb, camellia-256-cfb, bf-cfb, chacha20-ietf-poly1305, salsa20, chacha20 and chacha20-ietf. The default cipher is rc4-md5. [-a ] Run as another user. [-f ] The file path to store pid. [-t ] Socket timeout in seconds. [-c ] The path to config file. [-n ] Max number of open files. [-i ] Network interface to bind. [-b ] Local address to bind. [-u] Enable UDP relay. [-U] Enable UDP relay and disable TCP relay. [-6] Resovle hostname to IPv6 address first. [-d ] Name servers for internal DNS resolver. [--reuse-port] Enable port reuse. [--fast-open] Enable TCP fast open. with Linux kernel > 3.7.0. [--acl ] Path to ACL (Access Control List). [--manager-address ] UNIX domain socket address. [--mtu ] MTU of your network interface. [--mptcp] Enable Multipath TCP on MPTCP Kernel. [--key ] Key of your remote server. [--plugin ] Enable SIP003 plugin. (Experimental) [--plugin-opts ] Set SIP003 plugin options. (Experimental) [-v] Verbose mode. [-h, --help] Print this message.
下面测试hg320,因为hg320的flash较大,而且lz还插了个优盘上去(参考此文 中古神器烽火hg320电信原版刷64k cfe和tomato shibby v138),所以备份和恢复的命令略有不同,可以用rsync(当然scp依然可以)
升级前jffs总空间 6976KB,用的是之前自编译的64k nvram 138版(见这里), 升级后为6912KB
# 这里使用rsync over ssh的前提是路由器上之前已经通过entware安装了rsync rsync --rsync-path=/opt/bin/rsync -avHe ssh root@192.168.3.1:/jffs jffs-hg320 # 之后从电脑拷回路由器则可以用 rsync --rsync-path=/opt/bin/rsync -avHe ssh jffs/* root@192.168.3.1:/jffs
如果jffs页面出现这个,那就只好格式化jffs了,不然可以不用格式化
Error verifying known size of JFFS. Check the logs to see if they contain more details about this error.
共享下lz的jffs内容,压缩了一下,如果你的jffs够大,直接拷进去就有了perp控制的ss了
$ tree /home/oglop/backup/jffs-share/ /home/oglop/backup/jffs-share/ ├── etc │ ├── dnsmasq.d │ │ ├── dnsmasq_list.conf │ │ └── gfwlist2dnsmasq.sh │ ├── perp │ │ ├── ss │ │ │ ├── rc.log │ │ │ └── rc.main │ │ ├── ss-server │ │ │ ├── rc.log │ │ │ └── rc.main │ │ └── ss-tunnel │ │ ├── rc.log │ │ └── rc.main │ └── profile ├── lib │ ├── libev.so.4 │ ├── libmbedcrypto.so.0 │ ├── libpcre.so.1 │ └── libsodium.so.18 ├── perp │ ├── perpboot │ ├── perpctl │ ├── perpd │ ├── perphup │ ├── perpls │ ├── perpok │ ├── perp-setup │ ├── perpstat │ ├── runargs │ ├── runargv0 │ ├── runchoom │ ├── rundetach │ ├── rundeux │ ├── runenv │ ├── runfile │ ├── runlimit │ ├── runlock │ ├── runpause │ ├── runsession │ ├── runtool │ ├── runtrap │ ├── runuid │ ├── sissylog │ ├── tinylog │ └── tinylog_run └── ss ├── obfs-local ├── obfs-server ├── ss-local ├── ss-local-config.json ├── ss-manager ├── ss-nat ├── ss-redir ├── ss-server ├── ss-server-config.json └── ss-tunnel 9 directories, 48 files
其中profile文件里有启动perp的命令,gfwlist2dnsmasq.sh 是自动下载gfwlist并转换为dnsmasq配置文件的脚本,如果空间有限,同时没有那么多网站需要加的话(其实普通人常用网站不就只是google,youtube而已么),手动加些常用的网站就可以了,lz看了下列表,有好多是亚咩蝶网站,所以意义不大
# 如果想用gfwlist的话 ./gfwlist2dnsmasq.sh -s gfwlist -o dnsmasq_list.conf
其中dnsmasq_list.conf的作用是,当网站列表太多,你可能不想一个个从网页界面的dnsmasq配置页面添加,此文件会在路由器启动时被dnsmasq加载
其中perp纯粹是为了提升b格,监控ss之用(当ss挂掉后自动重启他),其实完全可以不用的,如果你只是用于科学上网(只用于客户端,让路由器成为自动科学上网路由器),那其实最少可能只需要如下文件,其中把ss-redir的启动命令放到profile里(当然如果你还要用做server端,让国外的好友们进行逆科学上网的话,则当然还需要ss-server及其配置文件)
├── etc │ └── profile ├── lib │ ├── libev.so.4 │ ├── libmbedcrypto.so.0 │ ├── libpcre.so.1 │ └── libsodium.so.18 └── ss ├── obfs-local ├── ss-local-config.json └── ss-redir 3 directories, 8 files
而如果你的路由器固件里又带有那些so文件的话,可能又可以少拷贝几个,比如libpcre在AIO里是包含了的
如果你想在磊科q3上刷下面连接里的6.9MB的Max版本, 那上面的懒人包是放不进去的,因为我多提供了几个.so文件,用于当其他固件没有这些文件时而且路由器空间大的时候使用,而此max版本的路由器固件里已经有libsodium了,不拷这个文件的话就刚好勉强塞下
root@unknown:/jffs/ss# ldd ./ss-server libev.so.4 => not found libm.so.0 => /lib/libm.so.0 (0x2aac1000) libsodium.so.18 => /usr/lib/libsodium.so.18 (0x2aad5000) libmbedcrypto.so.0 => not found libpcre.so.1 => not found libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2ab2f000) libpthread.so.0 => /lib/libpthread.so.0 (0x2ab4e000) libc.so.0 => /lib/libc.so.0 (0x2ab70000) ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
上面的讨论中没有包括路由器的ss配置,请参考lz的其他折腾文(右上角搜索你懂的关键词)
下载链接:
tomato-K26-1.28.RT-N5x-MIPSR2-140-Netcore-Q3-Max.trx 约6.9MB, 还剩1MB放ss
tomato-K26USB-1.28.RT-N5x-MIPSR2-140-hg320-Max-64K.trx 约9.5MB
jffs-share.tar.gz jffs懒人包,内含perp和最新的ss 3.0.7
所有以往版本ss下载
参考:
Compilation libjson-c fails – v132 有些shibby大大的指南
sudo echo “something” >> /etc/privilegedFile doesn’t work… is there an alternative?
感谢博主还提供Q3固件, 能不能汉化下 ?谢谢
http://www.mediafire.com/file/kh6p7914wkp3ydw/tomato-K26-1.28.RT-N5x-MIPSR2-140-Max-cht-Q3_del-tor.trx
140繁中版,用tomatoedit去掉鸡肋的tor,保留openvpn,将lib内4个文件置入固件中。可透过openvpn over shadowsocks连回墙内机子。jffs未格前显示1600kb。
感谢分享。刷刷看 ̄  ̄)σ
去掉tor后,你也会编辑www下的asp文件么,不然这样直接编辑,tor还是会出现在webui中,此外,你用不着将lib文件置入固件,因为我编译的时候设置了rpath, 他们放在/jffs/lib下也是可以的
另,你的繁体中文版是基于哪个固件的?我最近想搞下直接汉化www下文件的脑残方法,不想大改,科技实力和精力都不足
有哦,也去掉advanced-tor.asp及处理了tomato.js文件。
繁中来源 http://digiland.tw/viewtopic.php?id=2636