The distribution of uClinux provided on the customised Ubunu ISO that accompanies this guide is customised for the BF548-EZKIT and this guide. This involves changes such as by making it produce a 128MB ext2 image by default. Below is the list of modifications made to the distribution. It is available in the folder ”/home/uclinux/Blackfin” on the custom Ubuntu ISO.

Some important things to note about uClinux if you have never used it before include its file system structure, its memory management, process forking, and several bf548-ezkit specific gpio. This section will quickly make you aware of these aspects so you have a starting point for further investigation.

The typical file system structure for uClinux is as follows. You're free to add/change it as you see fit, but be aware that some applications require hard coded paths (such as /lib/ and /lib/modules/).

/bin - (Binaries) This directory contains the executable binaries for programs that were selected in the application configuration window when compiling the kernel.

/dev - (Devices) On the target system this directory will contain the device files for the system.

/etc - (Etc.) This directory contains various system configuration files.

/home - (Home) This directory provides a location for system users to store their files.

/var - (Various) Unlike the other directories which exist on the device /dev/root, this directory exists on the device /dev/ram0, this makes it the only writable directory as the other directories exist on a read-only file system.

Memory management is quite different on the Blackfin uClinux distribution than the standard linux distribution. This is because the Blackfin has a limited MMU (Memory Management Unit) and so there is no virtual memory addressing and a very limited MPU (Memory Protection Unit). You can read more about this at Memory in the Kernel but the most important thing to note is that means memory fragmentation can easily occur especially if an application leaks memory, and so you will find that your distribution cannot allocate large blocks of memory after it has been running for awhile. The recommended way to avoid this problem is to allocate your necessary memory early on start up.

A possible way to help free up memory between launching applications if necessary, is to use the drop_cache method. This method involves dropping the pagecache, dentries and inode to free up memory that was being used for cache. To run this method you would just run the following command on the Blackfin:

Another side effect of not having a full fledged MMU means the Blackfin does not support fork() calls. While it does have an alternative, vfork(), this does not work exactly the same and you will find that your threads do not run in parallel. There is one workaround to get past this hurdle and it involves invoking vfork and in the child thread, running another program and terminating the thread so as to have invoked a seperate process that will run in parallel. This work around is described in the article found on living_without_forks however most application development for simple projects will not need it.

When configuring your distribution with kconfig, the saved configurations are config/.config and linux-2.6.x/.config and to preserve your settings incase of backups etc, these are the two configuration files to save.

There are several ways to invoke your programs or scripts upon board start up, one of the most common ways is to edit the romfs/etc/rc file to add the bash script commands as this script is called upon system start.

To make uClinux boot when the board is turned on will require modifying the autoboot and bootcmd variables in U-Boot. You can learn more about this on U-Boot Environment

You can recompile U-Boot so that these variables are the defaults, you can learn more about this on Customizing U-Boot