1. 交叉编译环境:
export ARCH=armexport SUBARCH=armexport PATH=/opt/FriendlyARM/toolschain/4.5.1/bin:$PATHexport CROSS_COMPILE=/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-
2. 安装依赖环境:
sudo aptitude install zlib1g-dev libssl-dev
3. 编译 zlib for ARM: 版本[zlib-1.2.8.tar.gz]
./configure --prefix=/opt/FriendlyARM/zlibmake -j4 -e \"CC=arm-linux-gcc" \"AR=arm-linux-ar" \"CPP=arm-linux-gcc -E" \"LDSHARED=arm-linux-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"make install # 要求/opt目录的所有者为当前用户
4. 编译 openssl: 版本[openssl-1.0.1e.tar.gz]
unset CROSS_COMPILE #必须执行的命令!./Configure --prefix=/opt/FriendlyARM/openssl os/compiler:arm-linux-gccmake -j4make install
5. 编译 openssh: openssh-6.3p1.tar.gz
./configure --prefix=/opt/FriendlyARM/openssh \--host=arm-linux \--with-zlib=/opt/FriendlyARM/zlib \--with-ssl-dir=/opt/FriendlyARM/openssl \CC=arm-linux-gccmake -j4 # 不需要make install,安装不上的!!
>>在PC打包ssh成为一个tar包:
#!/bin/sh -tmpdir=tmp_armprefix=/opt/FriendlyARM/opensshmkdir $tmpdirmkdir -p $tmpdir/$prefix/etcmkdir -p $tmpdir/$prefix/binmkdir -p $tmpdir/$prefix/etcmkdir -p $tmpdir/$prefix/libexecmkdir -p $tmpdir/$prefix/sbinssh-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 ""cp ssh_host_*_key $tmpdir/$prefix/etc/cp scp sftp ssh ssh-add ssh-agent ssh-keygen ssh-keyscan $tmpdir/$prefix/bin/cp moduli ssh_config sshd_config $tmpdir/$prefix/etc/cp sftp-server ssh-keysign $tmpdir/$prefix/libexec/cp sshd $tmpdir/$prefix/sbin/cd $tmpdirtar zcf ssh_arm.tgz /opt/FriendlyARM/openssl /opt/FriendlyARM/zlib *
>>把tar包拷贝至ARM板后,安装过程:
#!/bin/sh -# run on armtar zxf ssh_arm.tgz -C /echo 'PATH=/opt/FriendlyARM/openssh/bin:/opt/FriendlyARM/openssh/sbin:$PATH' >> /etc/profileecho 'sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin' >> /etc/passwdsource /etc/profile
>> 效果展示:先在ARM板上执行 /opt/FriendlyARM/openssh/sbin/sshd
这表明已经成功通过ssh连接至ARM开发板了。
参考资料:
1.