我想在CentOS 7上为我的路由器(netcore q3,中国制造)交叉编译shadowsocks。所以我得到了crosstools-ng,我ssh到路由器,并得到以下信息(路由器在番茄固件1.28上.0000 MIPSR2-131 K26 Max by shibby),我使用How to build a cross compiler for your Raspberry Pi作为参考
$less /proc/cpuinfo
system type : Broadcom BCM53572 chip rev 1 pkg 8
processor : 0
cpu model : MIPS 74K V4.9
BogoMIPS : 149.50
cpu MHz : 300
wait instruction : no
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : no
hardware watchpoint : yes
ASEs implemented : mips16 dsp
shadow register sets : 1
VCED exceptions : not available
VCEI exceptions : not available
unaligned_instructions : 0
我还从/ lib
复制了一个.so文件$ scp root@router:/lib/libc.so.0 .
[oglop@localhost tmp]$ readelf -h libc.so.0
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: MIPS R3000
Version: 0x1
Entry point address: 0x6d50
Start of program headers: 52 (bytes into file)
Start of section headers: 260672 (bytes into file)
Flags: 0x50001007, noreorder, pic, cpic, o32, mips32
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 5
Size of section headers: 40 (bytes)
Number of section headers: 18
Section header string table index: 17
路由器上的/ lib文件
root@unknown:/tmp/home/root# ls /lib
ld-uClibc.so.0 libgcc_s.so.1 libutil.so.0
libc.so.0 libm.so.0 modules
libcrypt.so.0 libnsl.so.0 openvpn_plugin_auth_nvram.so
libdl.so.0 libpthread.so.0
我可以从这两个获得所有信息吗?我应该选择哪个样品? 所以从.so文件:
endianness : little endian
bitness: ?
abi: ?
target os: linux or bare-metal?
c library: glibc, musl or uClibc ?
...
我想我应该从mips-unknown-linux-uclibc
开始并将其更改为小端?
[oglop@localhost tmp]$ ct-ng list-samples | grep mips
[G.X] mips64el-n32-linux-uclibc
[G.X] mips64el-n64-linux-uclibc
[G..] mips-ar2315-linux-gnu
[G..] mipsel-sde-elf
[G..] mipsel-unknown-linux-gnu
[G..] mips-malta-linux-gnu
[G..] mips-unknown-elf
[G..] mips-unknown-linux-uclibc
root@unknown:/tmp/home/root# cat /proc/version
Linux version 2.6.22.19 (root@tomato) (gcc version 4.2.4) #16 Tue Aug 4 00:16:31 CEST 2015
我试图弄清楚番茄使用的libc版本,但是
root@unknown:/tmp/home/root# /lib/libc.so.0
Segmentation fault
root@unknown:/tmp/home/root# ldd --version
-sh: --version: not found
或者我可以从github上的番茄源shibby分支获得我需要的信息吗?