因为lz已经汉化过mipsel版本了,现在试下能不能容易的把arm版也汉化了
首先lz fork了tomato-arm的repo
# clone lz fork过的repo git clone --depth 1 git@bitbucket.org:oglop/tomato-arm.git
然后 clone mipsel的汉化www repo, 改个名字
git clone git@github.com:oglops/tomato-gui.git tomato-arm-gui cd tomato-arm-gui git checkout v140
然后改一下.git/config里的origin, 在github上新建一个 tomato-arm-gui repo
# push v140 到remote git push # push master 到remote git checkout master git push
把tomato-arm里的www目录复制到tomato-arm-gui里,覆盖已有内容
# 覆盖master branch里的内容 git checkout master rsync -rpv --ignore-times -C ~/tomato-arm/release/src-rt-6.x.4708/router/www/* ~/github/tomato-arm-gui # 变动的文件很少 $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: Makefile modified: about.asp modified: advanced-vlan.asp modified: basic-network.asp modified: nas-usb.asp modified: qos-settings.asp modified: status-data.jsx modified: status-overview.asp modified: tomato.js no changes added to commit (use "git add" and/or "git commit -a") # commit之后 把改变 merge到 新建的 v140-arm 里 git commit -a -m "replace with tomato-arm files" git checkout v140 git checkout -b v140-arm # 把master merge到 当前branch, 必然有些conflict,不过就几个而已 $ git merge master Auto-merging tomato.js CONFLICT (content): Merge conflict in tomato.js Auto-merging status-overview.asp CONFLICT (content): Merge conflict in status-overview.asp Auto-merging status-data.jsx CONFLICT (content): Merge conflict in status-data.jsx Auto-merging qos-settings.asp CONFLICT (content): Merge conflict in qos-settings.asp Auto-merging nas-usb.asp CONFLICT (content): Merge conflict in nas-usb.asp Auto-merging basic-network.asp CONFLICT (content): Merge conflict in basic-network.asp Auto-merging advanced-vlan.asp CONFLICT (content): Merge conflict in advanced-vlan.asp Auto-merging about.asp CONFLICT (content): Merge conflict in about.asp Automatic merge failed; fix conflicts and then commit the result.
所幸和预料的一样,只有个位数的conflicts需要处理,10min左右就搞定了,至此这个repo已经可以用来汉化 tomato-arm了
tomato-arm编译测试
# 安装可能缺少的lib dnf install elfutils-libelf.i686 uuid-devel libtool-ltdl-devel sudo ln -s ~/tomato-arm/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3 /opt/brcm-arm export PATH=$PATH:/opt/brcm-arm/bin rm ~/ac68e.txt ; make distclean ;time make V1=RT-N5x-CN- V2=-140 ac68e | tee ~/ac68e.txt
错误记录
-
-
make[5]: Entering directory '/run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/router/libbcm' arm-brcm-linux-uclibcgnueabi-gcc -DBCMWPA2 -DBCMQOS -DBCM_DCS -DEXT_ACS -DD11AC_IOTYPES -DNAS_GTK_PER_STA -DPHYMON -DPROXYARP -DTRAFFIC_MGMT -DTRAFFIC_MGMT_RSSI_POLICY -DLINUX26 -DCONFIG_BCMWL5 -DCONFIG_BCMWL6 -DCONFIG_BCMWL6A -DPART_JFFS2_GAP=0UL -pipe -fno-strict-aliasing -DBCMWPA2 -DBCMARM -marm -DTCONFIG_NVRAM_64K -DLINUX_KERNEL_VERSION=132644 -O2 -D__CONFIG_EMF__ -I. -I/run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/include -I/run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/common/include -I/run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/router/shared -Wall -s -O2 -c -o bcmgpio.o bcmgpio.c /run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/../libexec/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/cc1: error while loading shared libraries: libelf.so.1: cannot open shared object file: No such file or directory make[5]: *** [<builtin>: bcmgpio.o] Error 1 make[5]: Leaving directory '/run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/router/libbcm'
看了下工具链,似乎少文件
$ ldd ~/tomato-arm/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/../libexec/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/cc1 linux-gate.so.1 (0xf77ef000) libmpc.so.2 => not found libmpfr.so.4 => not found libgmp.so.10 => not found libdl.so.2 => /lib/libdl.so.2 (0xf77b6000) libelf.so.1 => not found libc.so.6 => /lib/libc.so.6 (0xf760c000) /lib/ld-linux.so.2 (0x56625000)
也许作者编译工具链的时候忘记设置$ORIGIN?
$ chrpath ~/tomato-arm/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/../libexec/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/cc1 /~/tomato-arm/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/../libexec/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/cc1: RPATH=/projects/hnd/tools/linux/hndtools-arm-linux-2.6.36-uclibc-4.5.3/lib
所以在安装之前,设置一下LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/brcm-arm/lib:/usr/local/lib:/usr/lib # 后来发现即使是设了上面的,还是少libelf.so.1,需要装一下 dnf install elfutils-libelf.i686
-
upnpevents.c:23:23: fatal error: uuid/uuid.h: No such file or directory compilation terminated. make[5]: *** [<builtin>: upnpevents.o] Error 1 make[5]: Leaving directory '/run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/router/miniupnpd'
装 uuid-devel
-
src/or/config.c:66:31: fatal error: systemd/sd-daemon.h: No such file or directory compilation terminated. make[6]: *** [Makefile:3579: src/or/config.o] Error 1 make[6]: *** Waiting for unfinished jobs.... make[6]: Leaving directory '/run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/router/tor'
disable systemd in tor configure
-
libtoolize: error: '/usr/share/libtool/COPYING.LIB' not found libtoolize: error: '/usr/share/libtool/Makefile.am' not found libtoolize: error: '/usr/share/libtool/README' not found libtoolize: error: '/usr/share/libtool/configure.ac' not found libtoolize: error: '/usr/share/libtool/aclocal.m4' not found libtoolize: error: '/usr/share/libtool/Makefile.in' not found libtoolize: error: '/usr/share/libtool/config-h.in' not found libtoolize: error: '/usr/share/libtool/configure' not found libtoolize: error: '/usr/share/libtool/libltdl/lt__alloc.h' not found libtoolize: error: '/usr/share/libtool/libltdl/lt__argz_.h' not found libtoolize: error: '/usr/share/libtool/libltdl/lt__dirent.h' not found libtoolize: error: '/usr/share/libtool/libltdl/lt__glibc.h' not found libtoolize: error: '/usr/share/libtool/libltdl/lt__private.h' not found libtoolize: error: '/usr/share/libtool/libltdl/lt__strl.h' not found libtoolize: error: '/usr/share/libtool/libltdl/lt_dlloader.h' not found libtoolize: error: '/usr/share/libtool/libltdl/lt_error.h' not found libtoolize: error: '/usr/share/libtool/libltdl/lt_system.h' not found libtoolize: error: '/usr/share/libtool/libltdl/slist.h' not found libtoolize: error: '/usr/share/libtool/loaders/dld_link.c' not found libtoolize: error: '/usr/share/libtool/loaders/dlopen.c' not found libtoolize: error: '/usr/share/libtool/loaders/dyld.c' not found libtoolize: error: '/usr/share/libtool/loaders/load_add_on.c' not found libtoolize: error: '/usr/share/libtool/loaders/loadlibrary.c' not found libtoolize: error: '/usr/share/libtool/loaders/preopen.c' not found libtoolize: error: '/usr/share/libtool/loaders/shl_load.c' not found libtoolize: error: '/usr/share/libtool/lt__alloc.c' not found libtoolize: error: '/usr/share/libtool/lt__argz.c' not found libtoolize: error: '/usr/share/libtool/lt__dirent.c' not found libtoolize: error: '/usr/share/libtool/lt__strl.c' not found libtoolize: error: '/usr/share/libtool/lt_dlloader.c' not found libtoolize: error: '/usr/share/libtool/lt_error.c' not found libtoolize: error: '/usr/share/libtool/ltdl.c' not found libtoolize: error: '/usr/share/libtool/ltdl.h' not found libtoolize: error: '/usr/share/libtool/slist.c' not found /usr/bin/libtoolize: line 2284: configure.ac: No such file or directory libtoolize: Remember to add 'LT_INIT' to configure.ac. libtoolize: Remember to add 'LTDL_INIT' to configure.ac. libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([../m4])' to configure.ac, libtoolize: and rerunning libtoolize and aclocal. /usr/bin/sed: can't read configure.ac: No such file or directory autoreconf: libtoolize failed with exit status: 1 make[4]: *** [Makefile:2681: dnscrypt/stamp-h1] Error 1
-
需要装下面的package
dnf install libtool-ltdl-devel
-
make[7]: Entering directory '/run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/router/dnscrypt/libltdl' (CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/router/dnscrypt/libltdl/config/missing autoheader) GEN libltdl/lt__argz.h rm -f stamp-h1 touch config-h.in touch: cannot touch 'config-h.in': Permission denied make[7]: *** [Makefile:552: config-h.in] Error 1 make[7]: Leaving directory '/run/media/oglop/BACKUP/github/tomato-arm/release/src-rt-6.x.4708/router/dnscrypt/libltdl'
这样当然是touch不了的了,可是为何会出现此种情况?
$ lrt ~/tomato-arm/release/src-rt-6.x.4708/router/dnscrypt/libltdl lrwxrwxrwx. 1 oglop oglop 30 Sep 13 20:22 config-h.in -> /usr/share/libtool/config-h.in
lz在travis上脑残的把他改成了777,让他能touch
travis ci local image test
因为lz是想放到travis ci上的,所以下面先在travis的ubuntu image里本地测试,这样方便些
# 当然你得有docker先 sudo dnf install docker sudo systemctl start docker # change the image according to the language chosen in .travis.yml $ sudo docker run -it -u travis --name travis quay.io/travisci/travis-ruby /bin/bash # now that you are in the docker image, switch to the travis user if you did not add -u to docker run sudo - travis # 如果不需要本地测试travis,只是把他当作Ubuntu镜像用,则用不着设置ruby # 显示所有可用ruby版本 rvm list # Install a recent ruby (default is 1.9.3) rvm install 2.3.0 rvm use 2.3.0 # 或者把2.3.0设为默认 rvm --default use 2.3.0 # 先装一些需要的package sudo apt-get update sudo apt-get install libgmp-dev nettle-dev libstdc++6 lib32stdc++6 net-tools perl lib32z1-dev libelf1:i386 libltdl-dev # cd ~ git clone --depth 1 https://github.com/oglopss/tomato-arm-ci.git cd tomato-arm-ci . ./.travis.sh pre_build_prep # 安装一些package,并clone tomato-arm repo 和汉化repo cd ~/tomato-arm-ci ./manual-build.sh ac68z # build ac68z target
错误们
-
/home/travis/builds/tomato-arm/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/../lib/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/../../../../arm-brcm-linux-uclibcgnueabi/bin/ld: cannot find -lhogweed /home/travis/builds/tomato-arm/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/../lib/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/../../../../arm-brcm-linux-uclibcgnueabi/bin/ld: cannot find -lgmp /home/travis/builds/tomato-arm/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/../lib/gcc/arm-brcm-linux-uclibcgnueabi/4.5.3/../../../../arm-brcm-linux-uclibcgnueabi/bin/ld: cannot find -lgmp collect2: ld returned 1 exit status make[6]: *** [dnsmasq] Error 1 make[6]: Leaving directory `/home/travis/builds/tomato-arm/release/src-rt-6.x.4708/router/dnsmasq/src'
没有GMP的时候,nettle编译的时候会略过hogweed,所以
sudo apt-get install lib32gmp3
在本机docker镜像测试时,lz还装了libgmp3和nettle-dev, 还有automake 1.15,没验证是不是都需要
-
upnpevents.c:23:23: fatal error: uuid/uuid.h: No such file or directory compilation terminated. make[5]: *** [upnpevents.o] Error 1 make[5]: Leaving directory `/home/travis/builds/tomato-arm/release/src-rt-6.x.4708/router/miniupnpd'
自己去下载安装 uuid, cross compile,并且修改了miniupnpd的Makefile.linux, 强制指定uuid的位置
cd ~ wget https://downloads.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz tar xf libuuid-1.0.3.tar.gz cd libuuid-1.0.3 # sh configure --prefix /usr # 不太确定 ranlib 位置是否要指定为 /opt/brcm-arm/bin/arm-uclibc-ranlib CC=arm-uclibc-gcc CXX=arm-uclibc-g++ AR=arm-uclibc-ar RANLIB=arm-uclibc-ranlib ./configure --host=mipsel-uclibc-linux --prefix=$HOME/uuid-install make sudo make install
-
configure: error: in `/home/travis/tomato-arm/release/src-rt-6.x.4708/router/mysql': configure: error: cannot run test program while cross compiling See `config.log' for more details make[5]: *** [config.status] Error 1 make[4]: *** [mysql] Error 2 make[3]: *** [all] Error 2 make[2]: *** [bin] Error 2 make[1]: *** [z] Error 2 make: *** [ac68z] Error 2
Tips
-
- 当在travis docker images里测试时,如果一开始没有checkout fedora branch的话, 想后来切换,直接这样是不行的
git fetch git checkout fedora
git remote set-branches --add origin fedora
Note:
由于docker默认container最大空间10G,如果不改动,可能会出现空间不够的情况,因为tomato自己就很大了,外加编译过程中会产生大量文件,所以至少设成20G吧
$ cat /lib/systemd/system/docker.service [Unit] Description=Docker Application Container Engine Documentation=http://docs.docker.com After=network.target docker-containerd.service Wants=docker-storage-setup.service Requires=docker-containerd.service rhel-push-plugin.socket registries.service [Service] Type=notify EnvironmentFile=/run/containers/registries.conf EnvironmentFile=-/etc/sysconfig/docker EnvironmentFile=-/etc/sysconfig/docker-storage EnvironmentFile=-/etc/sysconfig/docker-network Environment=GOTRACEBACK=crash ExecStart=/usr/bin/dockerd-current \ --add-runtime oci=/usr/libexec/docker/docker-runc-current \ --default-runtime=oci \ --authorization-plugin=rhel-push-plugin \ --containerd /run/containerd.sock \ --exec-opt native.cgroupdriver=systemd \ --userland-proxy-path=/usr/libexec/docker/docker-proxy-current \ --init-path=/usr/libexec/docker/docker-init-current \ --seccomp-profile=/etc/docker/seccomp.json \ $OPTIONS \ $DOCKER_STORAGE_OPTIONS \ $DOCKER_NETWORK_OPTIONS \ $ADD_REGISTRY \ $BLOCK_REGISTRY \ $INSECURE_REGISTRY \ $REGISTRIES ExecReload=/bin/kill -s HUP $MAINPID TasksMax=8192 LimitNOFILE=1048576 LimitNPROC=1048576 LimitCORE=infinity TimeoutStartSec=0 Restart=on-abnormal [Install] WantedBy=multi-user.target # 而此配置文件说他自己是 docker-storage-setup 生成的 $ cat /etc/sysconfig/docker-storage # Do not edit. This file is auto-generated by docker-storage-setup. DOCKER_STORAGE_OPTIONS= # 但是后来docker-storage-setup改名成为了container-storage-setup # 但是lz试了半天似乎没搞定, 所以使用脑残法直接编辑了上面的文件,虽然他说了不要手动编辑 # lz硬盘没用lvm分区,用的还是中古时代的分区 DOCKER_STORAGE_OPTIONS="--storage-driver=devicemapper --storage-opt dm.basesize=20G" # 设置好以后的效果,但是如果要改动生效,必须删掉所有的image和container,重新来过 $ sudo docker info [sudo] password for oglop: Sorry, try again. [sudo] password for oglop: Containers: 1 Running: 1 Paused: 0 Stopped: 0 Images: 1 Server Version: 1.13.1 Storage Driver: devicemapper Pool Name: docker-253:0-4989893-pool Pool Blocksize: 65.54 kB Base Device Size: 21.47 GB Backing Filesystem: xfs
下载连接:
https://oglopss.github.io/tomato-arm-ci-jekyll/
mega网盘地址: https://mega.nz/#F!hWBwBQrY
Decryption key: !bG1X3-CN2mfcEDpVs2a8G
未完待续
参考:
Tomato ARM compile procedure
“Cannot update paths and switch to branch at the same time”
Container Storage Setup
Chapter 1. Managing Storage with Docker-formatted Containers
能否详细写一写编译tomato_arm的过程?
Lz上面已经记录了使用travis ci里的ubuntu时遇到的错误们,如果你用的是其他系统,那只能视具体错误是什么,随机应变了