|
主机 ubuntu 12.10cubieboard sdcard安装linaro ubuntu12.04
在主机安装交叉编译环境,12.04用的是gcc4.6
apt-get build-essential gcc-4.6-arm-linux-gnueabihf
以下操作在主机上
wget http://jaist.dl.sourceforge.net/ ... /zlib-1.2.7.tar.bz2
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
wget http://mirror.yongbok.net/OpenBS ... penssh-6.1p1.tar.gz
1.交叉编译zlib
tar xf zlib-1.2.7.tar.bz2
cd zlib-1.2.7
修改zlib的Makefile如下:
CC=arm-linux-gnueabihf-gcc-4.6
LDSHARED=arm-linux-gnueabihf-gcc-4.6 -shared -Wl,-soname,libz.so.1,--version-script,zlib.map
CPP=arm-linux-gnueabihf-gcc-4.6 -E
AR=arm-linux-gnueabihf-ar
./configure --prefix=/data/source/arm/openssh/install/zlib-1.2.7/usr
make && make install
2.交叉编译openssl
tar xf openssl-1.0.1c.tar.gz
cd openssl-1.0.1c
./Configure --prefix=/data/source/arm/openssh/install/openssl-1.0.1c/usr os/compiler:arm-linux-gnueabihf-gcc-4.6
make && make install
3.交叉编译openssh
tar xf openssh-6.1p1.tar.gz
cd openssh-6.1p1
./configure --host=arm-linux-gnueabihf --with-libs --with-zlib=/data/source/arm/openssh/install/zlib-1.2.7 --with-ssl-dir=/data/source/arm/openssh/install/openssl-1.0.1c --disable-etc-default-login CC=arm-linux-gnueabihf-gcc-4.6 AR=arm-linux-gnueabihf-ar --prefix=/data/source/arm/openssh/install/openssh-6.1p1
修改Makefile,将下行注释掉,不然会报错strip: Unable to recognise the format of the input file
#STRIP_OPT=-s
make && make install
4.将生成的二进制文件拷贝到sdcard上对应的目录
cp -r /data/source/arm/openssh/install/openssh-6.1p1/* /media/sdcard/
cp -r /data/source/arm/openssh/install/zlib-1.2.7/* /media/sdcard/
cp -r /data/source/arm/openssh/install/openssl-1.0.1c/* /media/sdcard/
以下在sdcard上操作
cd /media/sdcard/usr/sbin
1.ln -s ../../sbin/sshd sshd
2.修改/etc/rc.local,添加系统自启动运行生成key
/usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N ""
/usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""
/usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
/usr/bin/ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ""
3.将主机上的如下文件复制到sdcard上相应目录
cp /etc/init.d/ssh /media/sdcard/etc/
cp /etc/default/ssh /media/sdcard/etc/
cp /etc/init/ssh.conf /media/sdcard/etc/
cp /etc/network/if-up.d/openssh-server /media/sdcard/etc/
4.修改以上文件内容,将/usr/sbin替换成/sbin
5.添加ssh用户,分别编译如下文件
/media/sdcard/etc/passwd
sshd:x:113:65534::/var/run/sshd:/usr/sbin/nologin
/media/sdcard/etc/shadow
sshd:*:15659:0:99999:7:::
/media/sdcard/etc/group
ssh:x:112:
以上编译和安装完成
将sdcard插到cubieboard上,加电启动即可
|
|