Imbrium Logo

µClinux Configuration for m68k-elf for the uCdimm


Installing and configuring uClinux-dist

First of all, a working cross-compiled gcc and therefore, the binutils package are a prerequisite for being able to build the uClinux package.

You can either try to compile these yourself but this hasn't worked for me yet. I have started documentation in this document to find out how to get and compile these (sorry, unfinished).

To the the toolchain, just download the current binary from here To install the Linux binaries, login as root and run sh ./XXX-elf-tools-20030314.sh.

Get the current uclinux distribution from here and unpack this into e.g. /home/uclinux/.

With the current release, this would be:

	# cd /home/uclinux
	# tar tvzf uClinux-dist-20030522

First, you have to make a reference to your hardware architecture by creating a link thus:

	# cd /home/uClinux-dist/
	# ln -s vendors/Arcturus/uCdimm/config.arch config.arch

Now you can configure your uClinux distribution:

	# cd uClinux-dist
	# make xconfig

Set the target and customize the kernel. I'd recommend leaving the userland stuff alone at first. Choose uClibc and not uC-libc. The latter is the so-called older uClibc. See this article to learn about the difference between the two.

Because everything is vendor specific and I am using the uCdimm, I edited the rc file which later gets copied to romfs/etc/rc to suit my setup. The vendor specific settings for the uCdimm are in vendors/Arcturus/uCdimm. Mine looks somewhat like this:

	# /home/uclinux/uClinux-dist/vendors/Lineo/uCdimm/rc:
	hostname ucdimm
	/bin/expand /etc/ramfs.img /dev/ram0
	mount -t proc proc /proc
	mount -t ext2 /dev/ram0 /var
	mkdir /var/tmp
	mkdir /var/log
	mkdir /var/run
	mkdir /var/lock
	ifconfig lo 127.0.0.1
	route add -net 127.0.0.0 netmask 255.0.0.0 lo
	ifconfig eth0 192.168.25.9 netmask 255.255.255.0 broadcast 192.168.25.255
	route add 192.168.25.9 eth0
	route add default gw 192.168.25.254
	# I need a portmap daemon with the NFS client
	portmap &
	/bin/mount -t nfs 192.168.25.5:/home/uclinux /usr 
	# got a NFS v3<->v2 problem? See below ;)
	# (inetd is started via /etc/inittab) 
	# /sbin/inetd &
	cat /etc/motd
	exit 0

Note that this is just an example, but I guess I won't have to tell you :) Now do a:

	# sudo mkdir /tftpboot # If you haven't yet, of course
	make dep
	make

This will build the userland stuff, the ROM file system via genromfs, and catenate the images together to create the image.bin which is then copied to tftpboot.

To examine the romfs image, do a:

	# mount -r -o loop -t romfs /home/uclinux/uClinux-dist/images/romfs.img /mnt/romfs

Also, to make things easier, I added a line to my /etc/fstab like this:

	# /etc/fstab
	#
	/home/uclinux/uClinux-dist/images/romfs.img /mnt/romfs romfs noauto,ro,loop,user 1 2

This way, you only have to say

	# mount /mnt/romfs

Now I can check and see if the stuff in the romdisk makes any sense and if all the binaries are there, rc is correct, etc. If so, you can start to load image.bin into the uCsimm via Xmodem and using minicom. Do this by typing rx at the B$ boot prompt and then pressing Ctrl-a s in the minicom window, select the file /tftpboot/image.bin and wait for it to complete.

This will unfortunately take some time with 19200 Baud, 115200 Baud will sometimes not work with the uCdimms that I have. After this is done, say program and write the image to Flash. Then do a cold reboot and enter go at the boot prompt.

You should be able to log into the uCdimm, either via agetty or telnet; latter only if telnetd and inetd are compiled, and /etc/inetd.conf contains the telnetd entry) and added to the romfs, which they should be if you did not change the userland or busybox stuff in the Vendor Config.

	login: root
	password: uClinux
	#

passwd Differences in uC-libc and uClibc

Note that the crypt for uC-libc and uClibc are different. In order to use the uClibc on my uCdimm and be able to log in, I had to use a different passwd file, which should be edited to use uClinux as the password as such:

	# passwd for uClibc 0.9.14 and above (I hope):
	passwd ab4yCc1tXmE/Y
	
	# passwd for uClibc 0.9.11:
	passwd abXcDcF4rOTWs
	
	# passwd for uC-libc:
	passwd abvQyXa0CDjIA

To verify this, I have here the passwd.c source which you can compile with glibc, since uClibc uses the same crypt algorithm. I just modified the WORK_DIR #define at the top. To compile and link it using the crypt library, do a:

	$ cc passwd.c -o passwd -lcrypt
	$ ./passwd
	Enter new Unix password: uClinux
	Re-enter new Unix password: uClinux

If you want to run into the shell everytime you boot, or your password problems persist (but they should not) you could modify your inittab entry to be able to run sh without the login as such:

	# vendors/Arcturus/uCdimm/inittab
	# ...
	ttyS0:vt100:/bin/agetty -n -l /bin/sh 19200 ttyS0

That's it for now but more to come for sure.