The board used is Mini6410. The requirement of OpenSSH includes zlib and OpenSSL. I prepare
- zlib 1.2.8
- OpenSSL 1.0.1e
- OpenSSH 6.4p1
My toolchain is built by crosstool-NG 1.15.2. The toolchain configuration below is modified from arm-unknown-linux-gnueabi.
Arch: armv6
CPU: arm1176jzf-s
FPU: vfp
Linux kernel: 2.6.38.8
binutils: 2.19.1a
gcc: 4.6.3
glibc: 2.11
gmp: 4.3.2
mpfr: 3.0.1
ppl: 0.11.2
cloog: 0.15.11
mpc: 0.9
Next I define three environment variables, HOST
, ROOTFS
and SYSROOT
. HOST
is arm-unknown-linux-gnueabi. ROOTFS
is the root filesystem obviously. SYSROOT
is the directory as the root directory for headers and libraries in the toolchain.
You might add CFLAGS
and LD_LIBRARY_PATH
pointing to your root filesystem so that the cross compiler can find what you have installed. However, I prefer not to set these variables. The alternative is installing those libraries in both SYSROOT
and ROOTFS
.
First, compile zlib
AR=$HOST-ar CC=$HOST-gcc RANLIB=$HOST-ranlib ./configure --prefix=$ROOTFS/usr
make
make install
Second, compile OpenSSL
./Configure linux-armv4 shared zlib-dynamic --prefix=/usr
make CC=$HOST-gcc AR="$HOST-ar r" RANLIB=$HOST-ranlib
make CC=$HOST-gcc AR="$HOST-ar r" RANLIB=$HOST-ranlib INSTALL_PREFIX=$ROOTFS install
Note that --prefix
is set to /usr
instead of $ROOTFS/usr
. The reason is that if you set --prefix
to $ROOTFS/usr
, it will try to access configuration files in $ROOTFS/usr
in runtime on Mini6410, which does not exist. The installation path specified in Makefile is $INSTALL_PREFIX/$PREFIX
, so we use $ROOTFS
for $INSTALL_PREFIX
.
Finally, compile OpenSSH
./confgure --host=$HOST --prefix=/usr
- Remove the variable
STRIP_OPT
and check-config
in the rule install
in Makefile.
make && make DESTDIR=$ROOTFS install
- Boot your Mini6410 and use command
ssh-keygen
to generate host keys.
The reason using /usr
for --prefix
is the same as OpenSSL. If you specify --prefix=$ROOTFS/usr
, you will not be able to execute command scp
.
STRIP_OPT
have to be removed because it is impossible to use /usr/bin/install
on x86-64 to strip binaries on ARM. The rule check-config
will run the generated sshd
on the host, so we have to avoid that.
In the last step, check Makefile and find the rule host-key
. And The next line is @if [ -z "$(DESTDIR)" ] ; then
, which means it does nothing if the length of $(DESTDIR)
is nonzero. Thus, we must generate these keys manually on Mini6410:
ssh-keygen -t rsa1 -f /usr/etc/ssh_host_key -N ""
ssh-keygen -t dsa -f /usr/etc/ssh_host_dsa_key -N ""
ssh-keygen -t rsa -f /usr/etc/ssh_host_rsa_key -N ""
ssh-keygen -t ecdsa -f /usr/etc/ssh_host_ecdsa_key -N ""