1. 编译zlib
wget https://www.zlib.net/zlib-1.2.12.tar.gz
# 编译命令
export CC=arm-fullhanv3-linux-uclibcgnueabi- ./configure --prefix=/home/hxf0223/tmp/ssh/target
make -j && make install
2. 编译openSSL
wget https://github.com/openssl/openssl/archive/refs/tags/openssl-3.0.2.tar.gz
# 编译命令
./Configure linux-generic32 no-asm shared no-async --prefix=/home/hxf0223/tmp/ssh/target/ CROSS_COMPILE=arm-fullhanv3-linux-uclibcgnueabi- CC=gcc
3. 编译openSSH
wget https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.0p1.tar.gz
# 编译命令
./configure --host=arm-fullhanv3-linux-uclibcgnueabi --enable-static LIBS="pthread" --with-libs --with-zlib=/home/hxf0223/tmp/ssh/target --with-ssl-dir=/home/hxf0223/tmp/ssh/target --disable-etc-default-login CC=arm-fullhanv3-linux-uclibcgnueabi-gcc AR=arm-fullhanv3-linux-uclibcgnueabi-ar
make -j # 不执行install
4. 打包
grep -rIL . # 找出bin档,并复制到target/bin目录
参考
- 移植openssh到arm-linux
- Build OpenSSH with static linked zlib and OpenSSL libraries