world leader in high performance signal processing
Trace: » vendors

Managing uClinux Vendor/Board Settings

It is a fact of life that right after you download a uClinux distribution release, spend a few months getting everything working with your custom applications, and custom drivers, that a new release will be available. This will often add a new feature that you are looking for, or include a bug fix that you require. The problem is how to upgrade with minimum effort while ensuring that all your settings are not wiped out in the process.

Configuration Files

There are a few configuration files which control the different parts of the distribution. Keep in mind that none of these files should be modified by hand.

  • uClinux-dist/config.arch - processor specific config file (in our case, it leads to the Blackfin file vendors/config/bfin/config.arch)
  • uClinux-dist/.config - the top level configuration file, which is generated by make menuconfig, which controls the Vendor/Product Selection
  • uClinux-dist/linux-2.6.x/.config - kernel and driver configuration file
  • uClinux-dist/config/.config - vendor/user/libraries configuration file

In the uClinux-dist/vendors/ folder, there are directories for each and every platform that the uClinux distribution supports. Each platform contains a copy of the above files for the default setup which are copied to the above locations as appropriate. For example, for the Analog Devices BF537-STAMP Platform:

  • uClinux-dist/vendors/AnalogDevices/BF537-STAMP/config.archuClinux-dist/config.arch
  • uClinux-dist/vendors/AnalogDevices/BF537-STAMP/config.deviceuClinux-dist/.config
  • uClinux-dist/vendors/AnalogDevices/BF537-STAMP/config.linux-2.6.xuClinux-dist/linux-2.6.x/.config
  • uClinux-dist/vendors/AnalogDevices/BF537-STAMP/config.vendor-2.6.xuClinux-dist/config/.config

Note that the uClibc config file no longer exists as the library that is part of the toolchain is used instead. Also note that config.linux-2.6.x file may not exist for some Analog Devices boards. In this case, the defconfig is taken from the Linux kernel (uClinux-dist/linux-2.6.x/arch/blackfin/configs/BF537-STAMP_defconfig in this example).

For information on how to port the Linux kernel to your board (the files found under uClinux-dist/linux-2.6.x/ and the options that appear in the kernel configuration menu), see the guide specifically for this task of porting the Linux kernel.

Adding Your Board to the uClinux Distribution

The first step in any serious development would be to create your own platform into the make config system. This is a simple matter of creating a new directory, copying in a existing directory that is close, editing some files, and then setting the defaults, and saving them. To select the target, see the section on targets.

To get started, follow these simple steps from inside the uClinux-dist directory.

  1. Create your own vendors directory. We'll use the example Awesome vendor.
    $ mkdir vendors/Awesome
  2. Copy an existing similar board configuration directory. Many examples may be found in the AnalogDevices vendor directory. We'll use the example MyBoard for the board name.
    $ cp -R vendors/AnalogDevices/BF533-STAMP vendors/Awesome/MyBoard
    $ cp -R vendors/AnalogDevices/common vendors/Awesome/
  3. Copy an existing Linux kernel config (if the board dir lacks a config.linux-2.6.x).
    $ cp linux-2.6.x/arch/blackfin/configs/BF533-STAMP_defconfig vendors/Awesome/MyBoard/config.linux-2.6.x

Having done this, the new vendor selection will show up as an option in the menuitem

Vendor/Product Selection --->

. The vendors directory is scanned and any vendor names found are added to the selection list automatically. The boards, based on directory entries, are also added automatically as each vendor selection is made.

When a new vendor / board combination is selected, the uClinux distribution will clean up all files from the previous board and then reconfigure and rebuild the kernel, libraries, and user code based on the default configuration options available for the new vendor / board selection.

Build Config Files

There are other files in this directory, but they should be edited by the make system only. These files are:

  • config.device - the top level uClinux-dist/.config file, used to select targets from the command line. This is used to modify the uClinux-distribution to allow a command line option to set up or build the new target system from a command line. If you copy an existing vendors directory, you should do this by hand, after things are configured. In this case: cp .config vendors/Awesome/MyBoard/config.device
  • config.arch - includes uClinux-dist/vendors/config/bfin/config.arch which sets up all things Blackfin related, including default compiler options, and flags for when using bfin-uclinux-gcc. You should not modify this.
  • config.linux-2.6.x - This is the generated make config for the kernel. When you select your platform, this will be copied into the kernel config system as uClinux-dist/linux-2.6.x/.config, and the appropriate pieces of the kernel will automatically be re-generated.
  • config.uClibc - This is the generated make config for the uClibc. When you select your platform, this will be copied into the uClibc config system. No longer used by Blackfin boards.
  • config.vendor-2.6.x - This is the generated make config for the user applications which is found in uClinux-dist/config/.config, and controls which user applications are built. When you select your platform, this will be copied into the user config system.

This configuration can be modified using the normal Kernel/Library/Defaults SelectionCustomize Kernel Settings and Customize Vendor/User Settings in make menuconfig. Updating these settings will save the configuration data into the uClinux-dist/linux-2.6.x/.config.

Support Files

Now that you have your own vendor/board tree, you might want to customize things further. Changes to files under the vendors directory require manual editing or explicit saving (in the configuration menu).

  • device_table.txt - See the device management page for more information on this file.
  • Makefile - this is the Makefile for this system. It would include system specific configuration. It will create the romfs directory structure, and copy files into it to create the rootfs. Then it will take care of creating all the images.

/etc files

These are files copied straight to the board via the romfs directory.

  • group
  • host.conf
  • hosts - This file describes a number of hostname-to-address mappings for the IP subsystem. It is mostly used at boot time, when no name servers are running. On small systems, this file can be used instead of a “named” name server or a standard DNS server.
  • inetd.conf - Services for the Internet super daemon to startup.
  • inittab - The inittab file describes which processes are started at bootup and during normal operation (e.g. /etc/init.d/boot, /etc/init.d/rc, gettys…). Init distinguishes multiple runlevels, each of which can have its own set of processes that are started. Valid runlevels are 0-6 plus A, B, and C for ondemand entries. For more information check man 5 inittab on a Linux based host.
  • issue - Message displayed before standard login prompts. See man 5 issue for more information.
  • motd - Message of the Day. This prints out at every login.
  • passwd
  • protocols - Mapping of textual names of TCP/IP protocols to numerical values. See man 5 protocols for more information.
  • rc - Script file run at every boot before processing /etc/inittab.
  • services - Mapping of textual names of internet services and the actual port/protocol. See man 5 services for more information.
  • TZ - Time Zone

In the uClinux-dist/vendors/AnalogDevices/BF533-STAMP directory, there are some default files which are used for a web server - you can remove these files if you desire. They are index.html, tuxsit_small.gif, and tux-wink.gif.

$ROMFSINST

When looking through various makefiles, you will notice to add various files to the target file system, the command

$ROMFSINST [options] [src] dst

is used. Normally, $ROMFSINST is defined in the top level ./uClinux-dist/Makefile to be equal to romfs-inst.sh, which is in the ./uclinux-dist/tools directory. It has the following options:

  • -v output actions performed.
  • -e env-var only take action if env-var is set to “y”.
  • -o option only take action if option is set to “y”.
  • -p perms chmod style permissions for dst.
  • -a text append text to dst.
  • -A pattern only append text if pattern doesn't exist in file
  • -l link dst is a link to 'link'.
  • -s sym-link dst is a sym-link to 'sym-link'.

If src is not provided, basename is run on dst to determine the source in the current directory.

Multiple -e and -o options are ANDed together. To achieve an OR affect use a single -e/-o with 1 or more y/n/”” chars in the condition.

if src is a directory, everything in it is copied recursively to dst with special files removed (currently CVS dirs).

Saving uClinux Distribution Settings

When you have a configuration that you would like to ensure is not lost, you can save the settings in the various kernel and user config files by selecting Kernel/Library/Defaults SelectionUpdate Default Vendor Settings in make menuconfig. When doing this, this should be the only option selected.

For the Blackfin kernel: $LINUXDIR will be set to “linux-2.6.x”, $VENDOR will be set to “Awesome”, $PRODUCT will be set to “MyBoard” and $TMP will be set to -2.6.x

Recalling uClinux Distribution Settings

If you have made a mistake when doing make menuconfig it is possible to remove any changes, and go back to previously saved settings. Kernel/Library/Defaults SelectionDefault all settings (lose changes) in make menuconfig. When doing this, this should be the only option selected.

Updating The uClinux Distribution

When updating from one kernel version to a new kernel version, do the following:

  1. download the new kernel version into a new directory, without overwriting your old files.
  2. copy the old configuration files to the new kernel version
    $ cp -R /path/from/old/uClinux-dist/vendors/Awesome /path/to/new/uClinux-dist/vendors/
  3. do a make menuconfig and select the platform you just added. If you have replaced an existing platform, you should recall the kernel settings to ensure that your new settings are properly in the make system. You may be asked some questions if there are new settings that were not previously available in the older kernel. These should be answered, and then you should save the updated defaults to ensure that you don't have to answer these questions again.