默认分类

交叉编译mips架构softfloat busybox ptunnel dropbear

这里使用sasaga/rsdk-lexra-toolchain:1.0 docker镜像编译

拉取镜像docker pull sasaga/rsdk-lexra-toolchain:1.0
创建容器docker run -v /root/:/mnt -it sasaga/rsdk-lexra-toolchain:1.0
重新进入容器docker exec -it eb83b6fa2f5e /bin/sh
容器使用的debian 8,apt update 提示404,编辑容器apt 源文件/etc/apt/sources.list,将版本名称改为oldstable

deb http://deb.debian.org/debian oldstable main
deb http://deb.debian.org/debian oldstable-updates main
deb http://security.debian.org oldstable/updates main

这里下载busybox-1.13.4版本

cd ~
wgethttps://busybox.net/downloads/busybox-1.13.4.tar.bz2
tar xvf busybox-1.13.4.tar.bz2
make defconfig
make menuconfig
编译busybox-1.7.0出错
busybox-1.7.0$make menuconfig
Makefile:405:* mixed implicit and normal rules: deprecated syntax
Makefile:1242:* mixed implicit and normal rules: deprecated syntax
make:* No rule to make target ‘menuconfig’. Stop.

原因:版本过久

解决方法:
a.修改busybox-1.7.0 顶层Makefile 405行:
config%config: scripts_basic outputmakefile FORCE
改为:
%config:scripts_basic outputmakefile FORCE
b.修改busybox-1.7.0 顶层Makefile 1242行:
/%/: prepare scripts FORCE
改为:
%/:prepare scripts FORCE

增加交叉编译器参数和静态编译

 Busybox Settings --->
    Build Options --->
        () Cross Compiler prefix
                    mips-linux-
     [*] Build BusyBox as a static binary (no shared libs)

遇到编译不过的,找到找报错applet,去掉报错applet勾选

make -j 8 完成编译

dropbear

拉取cd ~ ; git clone https://github.com/mkj/dropbear.git ; cd dropbear
编译./configure --host=mips --disable-zlib --disable-syslog LDFLAGS=-static --disable-openpty
生成hostkey文件./dropbearkey -t rsa -f /tmp/hostkey -s 1024
运行dropbear,-a参数允许远程端口转发绑定到0.0.0.0/tmp/dropbear -r /tmp/hostkey -a -F

ptunnel

拉取libpcap和ptunnelwget https://codeload.github.com/the-tcpdump-group/libpcap/zip/refs/heads/libpcap-0.9 ; git clone https://github.com/f1vefour/ptunnel.git
编译libpcap这里使用0.9版本 ./configure --host=mips --with-pcap=linux
修改Configure文件,将6272行修改为if test $ac_cv-linux-vers = 2.6.30; then
make完成编译
将libpcap.a文件复制到 /toolchain/lib

编译ptunnel,修改Makefile文件

CFLAGS          = -Wall -g -I/usr/include -I/usr/mips-linux-gnu/include -static
ptunnel: $(PT_OBJS)
        $(CC) -static -o $@ $^ $(LDOPTS) `[ -e /usr/include/selinux/selinux.h ] && echo -lselinux`

export PATH=/toolchain/bin/:$PATH
make

回复

This is just a placeholder img.