This document describes how to use the top-level Makefile to build the devboard_lx 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 LX 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_lx software is built using GNU make.
The top-level Makefile, makespec 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_lx 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 makespec file contains the paths to all applications, libraries, packages and files that the devboard_lx 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_lx
The Linux kernel is configured using the menuconfig or xconfig targets of the Makefile in the Linux source code directory:
cd ~/axis/devboard_lx/os/linux make xconfig (or "make menuconfig")
Then use the top-level Makefile to build the kernel and images:
cd ~/axis/devboard_lx 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_lx make kernel make images
To add an application put the source code directory in the devboard_lx/apps directory and add it to the subdirs section in the makespec file (see
How to Write and Build Applications for Linux for details).
Then build it like this:
cd ~/axis/devboard_lx make clinux make install make images
devboard_lx/apps/my_app) you just need to install that application separately before building new images:
cd ~/axis/devboard_lx . ./init_env (or "source ./init_env") cd ~/axis/devboard_lx/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_lx make images
makespec file and run:
cd ~/axis/devboard_lx make install make images
devboard_lx/files directory and add it to the makespec 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_lx/files/usr/html and add the following line at the end of the makespec file:
files/usr/html/my_file.html -m 0644
The option -m 0644 means file access permission 0644 (i.e. rw-r--r--). Then run:
cd ~/axis/devboard_lx 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_lx/files directory, then run:
cd ~/axis/devboard_lx make files make images
devboard_lx/files directory and/or in the makespec file, you cannot use the files target because it just adds files. Use the install target instead:
cd ~/axis/devboard_lx make install make images
The install target removes the entire eroot directory before installing everything listed in makespec 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_lx (set the board in boot mode) ./ktest
To flash a new fimage (except the rescue partition) type:
cd ~/axis/devboard_lx (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_lx (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_lx/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 eroot is removed at the beginning of the install target.
Do not edit or add files manually to the eroot directory, create an application (in devboard_lx/apps), a library (in devboard_lx/libs), a package (in devboard_lx/packages) or a file (in devboard_lx/files) and add it to the makespec file instead.