µClinux Configuration for m68k-elf on a uCdimm
This document is already a bit older, it's the first uClinux distribution that I did...
Thanks to Daniel Haensse at this point for his suggestion to use his
Dragonix Distribution.
OK, this is one big package, but it takes the load off configuring the toolchain and the libs
Get the package, un-tar-gz everything into /opt/dragonix and set the PATH to include
/opt/dragonix/toolchain/bin/ so the kernel will find the gcc, ld, etc. for the elf tools.
After that, you can configure and build the kernel:
su - cd /opt/dragonix/uClinux make xconfig
Here you can set the target and customize the kernel. I'd recommend leaving the userland stuff
alone at first, I got lots of compile errors along the way changing anything here, don't know
why yet. I have chosen uClibc and not uC-libc. The latter uses the new uC-libc, the
latter uses the old one. Use the new one, please :)
After finishing the kernel stuff, and exiting the TK graphics, do:
make dep make clean make linux
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/Lineo/uCdimm. The newer uClinux distro has the path vendors/Arcturus/uCdimm. Mine looks somewhat like this:
# /opt/dragonix/uClinux/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 # /bin/mount -t nfs 192.168.25.5:/home/uclinux /usr # (got a NFS v3<->v2 problem? See below) # I need a portmap daemon with the NFS client?! portmap & # (inetd is started via /etc/inittab) # /sbin/inetd & cat /etc/motd exit 0
Now I did a:
# mkdir /tftpboot # (Ok, only one, the path is nicer for minicom later on) # make subdirs # make romfs # make image.bin
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. Of course, the whole process can also be achieved with the single make command. To examine the romfs image, I did a:
# mount -r -o loop -t romfs /opt/dragonix/uClinux/images/romfs.img /mnt/romfs
Also, to make things easier, I added a line to my /etc/fstab like this:
# /etc/fstab # /opt/dragonix/uClinux/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 not work with some
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 #
I have problems with my agetty, it gives me the motd and the login: but typing anything will have no effect. Therefore I use telnet. Error messages do appear on the console, though.
Obstacles I've encountered
Upon trying to mount an NFS share from an NFS server you get the error message:
mount -t nfs 192.168.25.5:/home/uclinux /usr call_verify: server accept status: 2 call_verify: server accept status: 2 RPC: garbage, exit EIO nfs_get_root: getattr error = 5 [hangs]
This means that the server does not support NFS v3, just v2. You will have to enable this in the Kernel on the host machine (under File Systems -> Network File Systems)
What happens in the build process when make xconfig is called?
I've tried to look into this a bit, to understand what is happening and how it enables me to write my own applications using the elf tools.
The make config process
The command make config will start the kernel configuration dialog, depending on
the way it was called. (See linux-2.4.x/scripts/Configure).
Starting at the main directory (in my case /opt/dragonix/uClinux/
after configuration has been done, you will find a file called .config
which contains the basic vendor settings, in my case (I left out all the commented out parts for simplicity:
CONFIG_DEFAULTS_LINEO_UCDIMM=y CONFIG_DEFAULTS_KERNEL_2_4=y CONFIG_DEFAULTS_OLDUCLIBC=y CONFIG_VENDOR=Lineo CONFIG_PRODUCT=uCdimm CONFIG_LINUXDIR=linux-2.4.x CONFIG_LIBCDIR=uClibc
Note the last line, it says uClibc which actuall refers to the uClibc.
This is chosen through the configuration option uClibc.
The so-calledolder uC-libc is chosen via the option uC-libc.
Sort of confusing...
The content of this file is quite obvious, I believe, and it is being used by the
Makefile in the main directory to compile the kernel, build the romfs and the
userland stuff and finally, image.bin.
If you look into Makefile at the place where is says core stuff at the top,
you will see the .config being included, meaning that the
variables that have been set here are used for the build process.
The config process and the "cleaning"
A lot of things happen when you change any of the settings in the top-level configuration.
After the make dep, the main file which is invoked here is the
config/setconfig which cleans, copies and mangles all sort of things.
Looking at the output of this process, you can see that
the environment is set up for the kernel version, the uClibc and a lot of other things.
So there has been taken a lot of work-load off you with this script :) Thanks David.
The next script that gets called from linux-2.4.x/Makefile is
/bin/sh scripts/Configure -d arch/m68knommu/config.in which
does the kernel configuration itself.
More to come...
Configuration for the m68-elf compiler
If you look into the main directory, you will find a link:
config.arch -> vendors/Lineo/uCdimm/config.arch
This is the architechture specific stuff that the compiler and linker uses to compile all
the programs. Look at this closely! I got thrown off when trying to roll my own programs
from "somewhere else".
Thanks to TomW, I am starting to understand the build process a bit better, including getting
to know the gcc options that are needed for a program to
compile properly. Note there is a Baudrate setting in the config.arch
which is set to 9600 but should be 19200:
# CONSOLE_BAUD_RATE = 9600 CONSOLE_BAUD_RATE = 19200