In the course of developing and customizing software for your target, you will need to organize various software packages and project components in a comprehensive and easy-to-use directory structure. Table 4-1 shows a suggested directory layout you may find useful. Feel free to modify this structure to fit your needs and requirements. When deciding where to place components, always try to find the most intuitive layout. Also, try to keep your own code in a directory completely separated from all the packages you will download from the Net. This will minimize any confusion regarding the source's ownership and licensing status.
Directory |
Content |
---|---|
bootldr |
The bootloader or bootloaders for your target |
build-tools |
The packages and directories needed to build the cross-platform development toolchain |
debug |
The debugging tools and all related packages |
doc |
All the documentation you will need for your project |
images |
The binary images of the bootloader, the kernel, and the root filesystem ready to be used on the target |
kernel |
The different kernel versions you are evaluating for your target |
project |
Your own source code for this project |
rootfs |
The root filesystem as seen by the target's kernel at runtime |
sysapps |
The system applications required for your target |
tmp |
A temporary directory to experiment and store transient files |
tools |
The complete cross-platform development toolchain and C library |
Of course, each of these directories contains many subdirectories. We will populate these directories as we continue through the rest of the book.
The location of your project workspace is up to you, but I strongly encourage you not to use a system-wide entry such as /usr or /usr/local. Instead, use an entry in your home directory or a directory within the /home directory shared by all the members of your group. If you really want to have a system-wide entry, you may want to consider using an entry in the /opt directory. For the example embedded control system, I have the following layout in my home directory:
$ ls -l ~/control-project total 4 drwxr-xr-x 13 karim karim 1024 Mar 28 22:38 control-module drwxr-xr-x 13 karim karim 1024 Mar 28 22:38 daq-module drwxr-xr-x 13 karim karim 1024 Mar 28 22:38 sysmgnt-module drwxr-xr-x 13 karim karim 1024 Mar 28 22:38 user-interface
Since they all run on different targets, each control system component has a separate entry in the control-project directory in my home directory. Each entry has its own project workspace as described above. Here is the daq-module workspace for example:
$ ls -l ~/control-project/daq-module total 11 drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 bootldr drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 build-tools drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 debug drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 doc drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 images drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 kernel drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 project drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 rootfs drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 sysapps drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 tmp drwxr-xr-x 2 karim karim 1024 Mar 28 22:38 tools
Because you may need to provide the paths of these directories to some of the utilities you will build and use, you may find it useful to create a short script that sets appropriate environment variables. Here is such a script called develdaq for the DAQ module:
export PROJECT=daq-module export PRJROOT=/home/karim/control-project/${PROJECT} cd $PRJROOT
In addition to setting environment variables, this script moves you to the directory containing the project. You can remove the cd command if you would prefer not to be moved to the project directory right away. To execute this script in the current shell so that the environment variables are immediately visible, type:[1]
[1] All commands used in this book assume the use of the sh or bash shell, because these are the shells most commonly used. If you use another shell, such as csh, you may need to modify some of the commands accordingly.
$ . develdaq
Future explanations will rely on the existence of the PROJECT and PRJROOT environment variables.
|