This document describes how to use the top-level Makefile to build the devboard_82 software.
Before you read this document you need to have the following installed:
The above is described in the document How to Install the Developer Board 82 Software. Examples in this document assumes that you have installed the source code tree in a directory called axis in your home directory. If this is not the case, just keep it in mind and use your own installation directory instead of ~/axis in the examples.
The devboard_82 software is built using GNU make. The top-level Makefile and ptablespec files are used to provide
information about how the product should be built. The Makefile contains several
targets that can be built by typing:
make targetat the shell prompt in the
devboard_82 directory. By using several
targets (instead of just one do-it-all target) you can make a faster rebuild
after changing the source code. The most frequently used targets are kernel
(builds the Linux kernel), install (builds and installs libraries,
applications and packages) and images (builds the images for network
booting the developer board). The most frequently performed task during
development are:
You will use different targets depending on what you want to do.
The Makefile file contains the paths to all applications,
libraries, packages and files that the devboard_82 product consists of.
The ptablespec file contains information about locations and
sizes of the flash partitions.
Change working directory to the product directory in your source code tree:
cd ~/axis/devboard_82
The first thing that needs to be built are the applications in the tools/build directory. These are used through out the reset of the installation. Simply type:
make tools
The Linux kernel is configured using the menuconfig or xconfig targets of the Makefile in the Linux source code directory:
cd ~/axis/devboard_82/os/linux make xconfig (or "make menuconfig")
Then use the top-level Makefile to build the kernel and images:
cd ~/axis/devboard_82 make kernel make images
When you have modified source code in the Linux kernel that does not require reconfiguring the kernel you just have to rebuild it like this:
cd ~/axis/devboard_82 make kernel make images
To add an application put the source code directory in the devboard_82/apps
directory and add it to the "SUBDIRS" section in the Makefile (see How to Write and Build
Applications for Linux for details). Then build it like this:
cd ~/axis/devboard_82 make cris-axis-linux-gnu make install make images
devboard_82/apps/my_app)
you just need to install that application separately before building new images:
cd ~/axis/devboard_82 . ./init_env (or "source ./init_env") cd ~/axis/devboard_82/my_app make install
Note that you must source the init_env files to do this. Then
use the top-level Makefile to build the kernel and images:
cd ~/axis/devboard_82 make images
Makefile
file and run:
cd ~/axis/devboard_82 make install make images
devboard_82/files
directory and add it to the Makefile file (not in the subdirs
section). If you, for example, want to add the file my_file.html to
the directory /usr/html on the developer board, put it in the
directory ~/axis/devboard_82/files/usr/html and add the following
line under the "LOCALS" section of the Makefile file:
"files/usr/html/my_file.html 0644"
The option 0644 means file access permission 0644 (i.e.
rw-r--r--). Then run:
cd ~/axis/devboard_82 make files make imagesYou can run
make install instead of make files but you
don't have to (make install also does a make files
among other things).
devboard_82/files directory,
then run:
cd ~/axis/devboard_82 make files make images
devboard_82/files directory
and/or in the Makefile file, you cannot use the files
target because it just adds files. Use the install target instead:cd ~/axis/devboard_82 make install make images
The install target removes the entire target/cris-axis-linux-gnu
directory before installing everything listed in the Makefile again.
kimage and fimage.
The kimage contains the linux kernel and the read-only root
partition (cramfs). The fimage contains a complete flash image
(rescue partition, partition table, decompressor, compressed kernel, read-only
root partition and JFFS partition). They can be transfered to the board using
one of four scripts:
ktest: network boots the kimage from RAM.
kflash: writes the kernel and read-only root partition to
flash.
flashit: writes all of the fimage except the
rescue partition to flash.
flashitall: writes the entire fimage to flash.
Before you run any of these scripts you should first put your devboard in
boot mode by pressing the boot button, pressing and releasing the reset
button and then releasing the boot button (i.e. the boot button must be kept
down while resetting the developer board). The ktest and flashit
scripts are the most useful. The rescue partition contains the serial number
which is used as the ethernet address, so you probably do not want to overwrite
that, i.e. don't use the flashitall script unless you really
want to overwrite the rescue partition. To test a new kernel type:
cd ~/axis/devboard_82 (set the board in boot mode) ./ktest
To flash a new fimage (except the rescue partition) type:
cd ~/axis/devboard_82 (set the board in boot mode) ./flashit
If your ethernet interface (on your PC) is not eth0 the use the -d
option to the scripts. For example run flashit on eth1 like this:
cd ~/axis/devboard_82 (set the board in boot mode) ./flashit -d eth1
Since having to source init_env everytime you start a new shell can be very annoying, it is recommended that you put the following in the rc-file of your shell (i.e. ~/.bashrc if you are using bash):
# Set INITENV to the file name of your init_env file. INITENV=~/axis/devboard_82/init_env if test -f $INITENV ; then . $INITENV fiThat way the environment variables will be set in all shells you start. Note that you may not want to do this if you are working on multiple products, since you then may mistakenly use the wrong environment variables.
There are other, less frequently used targets in the Makefile. Run make
help to get a detailed list.
make
install. The edited file will the be removed since the entire
target/cris-axis-linux-gnu directory is removed at the beginning of the install target. Do not edit or add files
manually to the target/cris-axis-linux-gnu directory, create an application (in devboard_82/apps),
a library (in devboard_82/libs), a package (in devboard_82/packages)
or a file (in devboard_82/files) and add it to the Makefile
file instead.