一.下载以下文件用于交叉编译
> zlib-1.2.8.tar.gz
> openssl-1.0.1h.tar.gz
> openssh-7.9p1.tar.gz
二.交叉编译zlib-1.2.8
1. ./configure --prefix=/home/bixiao/arm-linux-gnueabihf/zlib-1.2.8
2. 修改Makefile:
CC=arm-linux-gnueabihf-gcc
AR=arm-linux-gnueabihf-ar rc
CPP=arm-linux-gnueabihf-gcc -E
LDSHARED=arm-linux-gnueabihf-gcc
3. make -j4
4. make install
三.交叉编译openssl-1.0.1h.tar.gz
1. ./Configure --prefix=/usr/local/ssl os/compiler:arm-linux-gnueabihf
2. 修改Makefile:
OpenSSL的Makefile中的CFLAG项中加入-fPIC
3. make -j4
4. make install
四. 交叉编译openssh-7.9p1.tar.gz
1. ./configure --host=arm-linux-gnueabihf --with-libs --with-zlib=/home/bixiao/arm-linux-gnueabihf/zlib-1.2.8-install/ --with-ssl-dir=/usr/local/ssl/ --disable-etc-default-login CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar
2. make(不需要make install)
五. 目标文件放入板子中运行
1. copy文件
2. ssh_host_*_key生成:
ssh-keygen -t rsa -f ssh_host_rsa_key -N ""
ssh-keygen -t dsa -f ssh_host_dsa_key -N ""
ssh-keygen -t ecdsa -f ssh_host_ecdsa_key -N ""
ssh-keygen -t rsa1 -f ssh_host_key -N ""
3. 修改/usr/local/etc/sshd_config
4. 测试,运行/usr/local/sbin/sshd