Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

sshd on Nios II uClinux with buildroot

I recently built a working sshd for uClinux after a bunch of trouble, so here's a guide for others who want sshd too. I assume that you use the (very nice) buildroot environment on Linux for making your uClinux kernels and roots. See the forum topic on it for how to set it up. To make sshd, here's what I did:

Step 1: Build the openssl package in buildroot (needed by openssh)

- Download the attached openssl.mk and openssl-configure.patch (rename them to that) and put them into buildroot/package/openssl (overwriting the existing openssl.mk).

- Go to the buildroot directory.

- Run buildroot's menuconfig and select openssl: make menuconfig

- Build buildroot: make

Step 2: Build the openssh port in uClinux-dist

- Get the uClinux-dist archive: http://www.uclinux.org/pub/uclinux/dist/uc...0051110.tar.bz2 (http://www.uclinux.org/pub/uclinux/dist/uclinux-dist-20051110.tar.bz2)

- Download the attached openssh-cross.patch (rename it to that) and put it somewhere convenient.

- Extract the uClinux-dist/user/ssh directory and go into it.

- Patch it: patch -p1 < openssh-cross.path

- Make its config.h.in: autoheader

- Configure it: ./configure --host=nios2-linux --with-cflags="-D__uClinux__ -DUSE_VFORK -Dfork=vfork -DHAVE_NANOSLEEP" --with-ldflags="-elf2flt=-s16000"

- Build it: make

- Install it: make install DESTDIR=~/buildroot/build_nios2/root (it will fail with an error in check-config saying that it can&#39;t execute sshd, but this is okay)

Step 3:

- Add the following in your inetd.conf:

ssh    stream    tcp    nowait    root    /sbin/sshd -i

(It doesn&#39;t work if you run it as a standalone daemon.)

Now just make your rootfs/kernel and you&#39;re done.

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Good work tschmelcher. Do you happen to know what version of buildroot you were using for this?