1.依赖软件包
2.设置编译zlib
1 2 3 4 5 6 7 8
| # 配置 $ ./configure # 修改makefile文件,因为我用的交叉编译器是arm-linux-gnueabihf, # 所以把里面的所有相关工具变成arm-linux-gnueabihf-gcc,arm-linux-gnueabihf-ar等 # 把prefix变成想要安装的目录 # 开始编译 $ make $ make install
|
3.编译dropbear
1 2 3 4 5
| # 配置 $ ./configure --with-zlib=刚指定的zlib安装绝对目录 --prefix=指定dropabear的安装绝对目录 CC=arm-linux-gnueabihf-gcc --host=arm # 编译 $ make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" $ make install
|
安装dropbear
把刚指定的目录中的文件安装到目标板中,如果板上原来就有则覆盖即可,没有的话就需要生成key文件
1 2
| # dropbearkey –t rsa –f /etc/dropbear/dropbear_rsa_host_key # dropbearkey –t dss –f /etc/dropbear/dropbear_dss_host_key
|
编译openssl
1 2 3 4 5 6 7 8 9 10
| # 配置 $ mkdir bin $ ./config --prefix=`pwd`/bin no-asm shared # 修改Makefile文件 # 1.PLATFORM 改成arm # 2.CROSS_COMPILE 改成自己的编译器前缀 # 3.把所有的 -m64 flag删掉 # 编译 $ make $ make install
|
编译sftp-server
1 2 3 4 5
| # 解压openssh包与配置 $ autoreconf $ ./configure --host=arm-linux-gnueabihf --with-libs --with-zlib=$(刚编译出来的zlib库安装绝对目录) --with-ssl-dir=$(刚编译出来的ssl库安装绝对目录) --disable-etc-default-login CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar # 只编译sftp服务器 $ make sftp-server
|
安装sftp-server
把sftp-server程序上传到/usr/libexec
中,dropbear会自动调用这程序,sftp-server
只能放在这个目录上,不然sftp用不了