Compiling tsctl

From embeddedTS Manuals

The latest source code can always be found on GitHub.

Once you have downloaded the source code, unpack it somewhere that the compiler can find it. For tsctl, it is recommended to compile directly on the board you are going to use, both to avoid issues with cross-compilers and to make it easier to get the dependencies needed to compile.

Before compiling tsctl, you will need to make sure that you have the following Debian packages installed (using `apt-get install <pkgname>` from the fullboot prompt to install any missing dependencies):

  • libbz2-dev, used for decompressing the dioctl.config files
  • libreadline5-dev used by the tsctl shell for provide command editing and history

If you encounter difficulties installing Debian packages, you may need to update your board to point to the correct URL. See Lenny installing software.

Note: You can avoid the need for the libreadline5-dev dependency and forgo tsctl shell command editing and history if you prefix your build with "READLINE=no". This can alleviate situations where it is difficult or impossible to install libreadline5-dev.

Note: You can avoid the need for the libbz2-dev dependency if you prefix your build with "BZ2=no". You will need to first enter the dioctl.config/ directory and run "./mkdioctlconfig nocompress" to re-generate uncompressed config files. The resulting binary will be larger than would be the case if bz2 compression of the config files was used.

After dependencies are installed, you will need to let the build process know about what architecture you are running. Currently there are only two defined: "cavium" and "noncavium". The "cavium" architecture only applies to Cavium CN2132 CPU boards (e.g. the TS-4500 and TS-75XX boards); "noncavium" covers everything else. The distinction is mainly made because the "cavium" architecture does not have the branch-exchange instructions and thus binaries generated for non-cavium boards will fault when these instructions are encountered. Unless you need the "cavium" architecture you don't have to do anything for this step, because "noncavium" is the default. If you are compiling for "cavium", prepend the "make" command with "ARCH=cavium ".

Next, decide whether or not you want to compile with debug symbols. Normally this is not needed, but if you are experiencing any issues with tsctl it can be helpful to have these symbols for core dumps or to run under gdb. To enable debug symbols, prepend the "make" command with "DEBUG=1 ".

If you want to build a binary that supports all architectures your compiler can target, then just run "make" with any (additional) assignments prepending it. However it is also possible to create a smaller binary that only supports the architectures you wish. The word "architecture" in this context means a single Technologic Systems board, whether it be a CPU board, base board, or PC-104 peripheral board. To define what architectures to compile support for, prepend an assignment to the "SUPPORT" variable making it equal all the boards to support. For instance, to support only the TS-4700 with a TS-81x0 base board, use "SUPPORT='4700 81x0'". Consult the provided Makefile for the names of the architectures available; the default assignment is within the first 20 lines.