MX-760HD AdvancedToolchain
From MvixCommunity
Contents |
Introduction
What else to do with the toolchain? Clearly, the "hello world" program doesn't make life much easier with that media player. So here are a few other things to try.
UClinux
A good starting point to find useful programs is the uclinux homepage http://www.uclinux.org. The complete distribution can be downloaded from http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20070130.tar.gz. This package contains different versions of the the uclinux kernel, as well as a directory user/... with the common utilities like ftp, inet, and so on.
telnetd
The telnet server is already available with the original firmware in form of the telnet implementation that comes with busybox. It just needs to be added to /etc/inittab:
::once:/usr/sbin/telnetd &
Note that this telnetd only supports /etc/passwd authentication, it does not support shadow passwords. If you want to set a telnet password, add your crypt()-hashed password to /etc/passwd
httpd
To build the http server, you simply run make in the user/httpd directory. To set the correct compilation options, you can either specify the environment variables CC=arm-elf-gcc and LDFLAGS=-elf2flt or add these parameters to the Makefile. The root of your webserver is also specified in the Makefile. You may want to change that to
HTTPD_DOCUMENT_ROOT = /tmp/ide/part1/...
to show only the media files on your mvix. Start the http server with ./httpd &. To see if it's running, you can type top, and check that there is an entry httpd:
.
A running server can be found here: http://www.kolbu.com/mvix/way/
inetd
One way of enabling ftp access is to start the server via the inet service. Use the same compilation options and launch make in the user/inetd directory. Note that you might need to fiddle around with the autoconf.h header file included from inetd.c. But it's straighforward. By default, inetd reads the config file /etc/inetd.conf and uses the ports defined in /etc/services.
ftpd
It seems, the ftpd that comes with the uclinux distribution (ftpd from gnu inetutils) is not overly compatible with the toolchain. Life is much easier with the newer version of the server that can be downloaded from http://ftp.gnu.org/gnu/inetutils/. To build the package, provide the environment variable LDFLAGS=-elf2flt and run ./configure --host=arm-uclinux-elf. If everything runs fine, this should generate the Makefiles.
Depending on the inetutils version (here: inetutils-1.5), you then need to run make in the lib and libinetutils sub-directories.
Finally change to the ftpd directory and build the binaries with make.
ftpd authenticates the users using /etc/passwd by default. If the /etc/shadow password is set to 'x', it uses shadow passwords, so be sure to add your md5-hashed password to /etc/shadow
Running the ftpd server via inetd
Running the ftp server in daemon mode is not as straighforward as launching it with ftpd -D. At least it didn't work in my case. However, you can first start inetd and launch the ftp server from there. In order to do that, you can add an entry to /etc/inittab, which after editing should look like this
# Startup the system ::once:/usr/sbin/inetd & ::once:/usr/curacao/curacao
Last thing to do, is adding the /etc/inetd.conf script. I use
ftp stream tcp nowait root /usr/sbin/ftpd -d
Of course, one also needs to make sure the binaries inetd and ftpd are at the correct location.
With this configuration, you should be able to get a response from the server when connecting via ftp. Something like
Connected to 192.168.100.3.
220 way FTP server (GNU inetutils 1.5) ready.
But you're probably not able to log in, because there is no valid user account defined in /etc/passwd and /etc/shadow. To remedy the situation, you can add two accounts in /etc/shadow
ftp::10933:0:99999:7::: mvix:wn8evjj9EZ.4.:10933:0:99999:7:::
and /etc/passwd
ftp:x:0:0:user:/:/bin/sh mvix:wn8evjj9EZ.4.:0:0:root:/:/bin/sh
Note that by adding the ftp account, you allow anonymous logins. The password for user "mvix" is "Test".
Unfortunately, this server configuration is not very reliable (connections drop unexpectedly, or downloaded files have zero size). Interestingly, this doesn't happen when connecting from the media player itself, i.e., by doing ftp localhost. A solution would be greatly appreciated.
Setting / Changing Passwords
The OpenEM86XX distribution's build process includes a script that allows to interactively set/change the /etc/shadow file to set/change the passwords.
To generate a password as required for the /etc/passwd file, you can use the htpasswd utility that is shipped with the Apache web server. This utility can also generate the MD5-hashed passwords as recommended for /etc/shadow entries.
For more informations about shadow passwords, see Wikipedia: Shadow Password.
What Else Can Be Built?
Rsync could be useful for backup (but probably not as straightforward), samba would be nice (but probably too big), ctorrent or enhanced ctorrent (http://www.rahul.net/dholmes/ctorrent/) could be interesting, ...

