|
SDK organization
Description
This document describes the organization of the unified SDK
version 2.00 and later. For older versions of the SDK consult
the old documentation page.
Requirements
Please read the install HOWTO.
The AXIS Product Configuration tool
To manage the composition of the SDK the AXIS Product
Configuration tool is used. This tool makes it possible to
select which kernel to use (Linux 2.4 or 2.6), which standard
C library (gclibc or uClibc), which programs to include and
much more. The AXIS Product Configure tool can be run in
several different modes. From a terminal window run “make
menuconfig” to get a menu in the terminal, run “make xconfig”
to get a GUI menu in X or “make config” answer questions in
the terminal.
Makefiles for applications, libraries and the kernel
The SDK is organized in a modular way making it adaptable for
various configurations. The source code is organized in
directories in the SDK root directory according to their type;
apps for applications, libs for libraries, and os for the
Linux kernel. Each application is located in a directory under
the apps directory and each library is located in a directory
under the lib directory. In most cases each application or
library has its own preconfigured Makefile in the directory
that contains the source code, but some applications and
libraries use another method. This method makes use of a
wrapper Makefile to configure and compile an application or a
library. Typically this method is used when the application or
library has to be configured via a configure script prior to
compile time, which is the case for, e.g., the busybox
application and the Linux kernel. These wrapper Makefiles are
in most cases located in the packages directory. For example,
the wrapper Makefile configuring and compiling busybox is
located in the packages/apps/busybox directory while the
wrapper Makefile configuring and compiling the Linux kernel is
located in the packages/os/linux-<kernel version> directory.
In some cases the wrapper Makefile resides in the
apps/application or libs/library directory. For example, that
is the case for the apps/ethtool program, in which directory
you will find a wrapper Makefile and a src directory.
When building a program that has a wrapper Makefile the
wrapper Makefile should be used. For example when configuring
or building the Linux kernel it should be interfaced using the
wrapper Makefile located in either the packages/os/Linux-2.4
or packages/os/linux-2.6. Save yourself for a lot of trouble
and use the wrapper Makefile if it exists.
The top-level Makefile
This Makefile is generated by the “configure” script from the
configurations stored in configuration files in the SDK. Since
this file is automatically generated it should not be edited
by hand. To add own programs, libraries, scripts, etc. make
use of the configure script and the “configure-files/post”
file (which you can read more about below).
When executing the “make” command in the SDK root directory
the complete system is built according to the rules set by the
top-level Makefile. Typically running make in the SDK root
will install each application, library, kernel, script, etc.
that are listed in the SUBSDIRS variable. The installation
target is the target directory in the SDK root directory.
After installing the appropriate files in the target directory
the firmware images are created.
Important files and directories
Below you find a description of important files and
directories found in the SDK root directory.
Product folders
The product folders store the default configuration files for
the preconfigured products. In each folder the following files
are found.
- .devboard_platform - Description of the product.
- defconfig - Configuration for the AXIS configure tool.
- kernelconfig - Kernel configuration for the Linux 2.4 kernel.
- kernelconfig-2.6 - Kernel configuration for the Linux 2.6 kernel.
When a product is configured, from either the install or
configure scripts, these files, except the .devboard_platform
file, are copied to the SDK root. The “defconfig” file is
copied to “SDK root/.config”, a soft link is created from the
SDK root to the “.devboard_platform” file, and the kernel
configurations are simply copied.
.config
File that stores the configuration for the AXIS Product
Configure tool, hence the configuration for the product that the SDK is currently configured for. Observe that
this file is overwritten when changing product to develop for.
Manage this file by using the AXIS Product Configure tool.
configure-files/source/functions
The functions script contains all shell functions that can be used by shell scripts
to generate a Makefile for building products using GNU make.
The most commonly used functions are: fetch and sub. To be
brief fetch fetches a package and extract it into the SDK
directory, sub runs fetch and adds the package to the list of
packages that shall be compiled (the SUBDIRS variable in the
top-level Makefile). For a detailed description on each
function consult the functions manual.
install
This script is used during the first steps of the installation
of the SDK. It makes use of the function script to download
packages and to generate a top-level Makefile. The result is a
minimal installation capable of configuring the SDK. The idea
is to configure the SDK prior to the final installation to
minimize downloading and needed storage.
configure
This script uses functions in the
configure-files/source/functions script to download and
install needed packages as well as creating a top-level
Makefile. The created Makefile is configured to build the
product firmware images according to the configuration files
found in the SDK. This is what happens:
- (Release 2.01 and later) If the file "configure-files/pre" exists, it gets
sourced. Intended for user specific code.
- Configure reads the configuration found in the .config file.
- Configure runs configure-files/common/common which in turn runs
configure-files/devboard/devboard. Both these files select
which packets to be included using the commands sub and
fetch according to the configuration read from .config file.
- (Release 2.01 and later) If the file "configure-files/post" exists, it
gets sourced. Intended for user specific code, mainly for
adding applications and libraries to the firmware images.
- The Makefile is generated.
configure-files/devboard/devboard and configure-files/common/common
Files that are tightly connected to the AXIS Product Configure
tool. Mostly contain if statements to select which packages to
download and include in the firmware image. In SDK release
2.00 customer specific applications often got added in these
files which is not a good idea since these files get
overwritten in case of a SDK update.
configure-files/pre and configure-files/post
These files are intended to be created by the user that needs
to add things that previously had to be entered in the
configure script or in the configure-files/devboard/devboard
or configure-files/common/common files. Making changes in the
configure script, the configure-files/devboard/devboard and
configure-files/common/common files are not a good idea since
updates of the SDK overwrites these files. The pre and post
files are sourced from the configure script (Release 2.01 and
later). The pre file is sourced prior to any other action in
the configure script and the sourcing of the post file precede
the last action (the generation of the Makefile). Hence,
applications and libraries that should be added to the
firmware image should be "sub:ed" in the post file. For
example, if an application, my_app, that reside in apps/my_app
should be added to the image the following line should be
added to the post file: "sub apps/my_app" |