需要文件
zlib、openssl、openssh
參閱:
https://blog.csdn.net/ctbinzi/article/details/5929800
https://blog.csdn.net/v6543210/article/details/83420034
說明代碼
arm-linux-gnueabihf-gcc mkdir /work/ mkdir /work/lib mkdir /work/ssh cd /work/ssh mkdir compressed install source cd /work/ssh/compressed/ tar xvf zlib-1.2.11.tar.gz -C ../source cd ../source/zlib-1.2.11 ./configure --prefix=/work/ssh/install/zlib-1.2.11 vim Makefile CC=arm-gcc AR=arm-ar CPP =arm-gcc -E LDSHARED=arm-gcc make && make install cd /work/ssh/compressed/ tar zxvf openssl-1.1.1f.tar.gz -C ../source cd ../source/openssl-1.1.1f/ setarch i386 ./config no-asm shared --prefix=/work/ssh/install/openssl --cross-compile-prefix=arm-linux-gnueabihf-gcc
去掉Makefile的-m32 make && make install cd /work/ssh/compressed/ tar -zxvf openssh-8.2p1.tar.gz -C ../source/ cd ../source/openssh-8.2p1/ ./configure --host=arm-linux-gnueabihf --with-libs --with-zlib=/work/ssh/install/zlib-1.2.11 --with-ssl-dir=/work/ssh/install/openssl/ --disable-etc-default-login CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar make chmod 0600 ssh_host_key ssh_host_key ssh_host_rsa_key chmod 0644 *
大部分步驟按照第一篇參閱文檔、ssh登錄選項等參考第二篇文檔。首先是要保證sshd能夠在目標板運行。
configure:error:*** working libcrypto not found,check config.log
可能不是說openssl的問題,原來從windows拷貝的openssl目標文件,重新交叉編譯了一遍openssl竟然通過,可能是說,文件的標記(文件屬性)在虛擬機和windows相互傳送時候丟失了。
其它說明
openssh啟動以后,psftp測試,可能是要修改sshd_config文件中override查找字段,設定正確的sftp-server路徑。
sshd對配置文件的權限有要求,應該是600的權限合適。嘗試。
mosquitto交叉編譯
編譯前應該閱讀compiling.txt和config.mk,注意openssl的編譯是前提。如果提示了undefined reference to '__ctype_b'等,找一個最新版本的openssl編譯,把libcrypto等庫文件放到mosquitto所在的文件夾lib下即可。
然后更改config.mk中的prefix路徑,作為最后安裝路徑。然后執行以下代碼,即可。
make WITH_SRV=no CC=mipsel-openwrt-linux-gcc CXX=mipsel-openwrt-linux-gcc LDFLAGS="-L/root/mosquitto-1.6.12/lib -lssl -lcrypto" make install