1 Compilation and pre-built binaries FAQ
2 ======================================
4 What is the best pre-built binary for my system or device?
5 ----------------------------------------------------------
7 None. The best binary is compiled by yourself using a toolchain that is
8 optimized for your system or device in every respect.
11 How do I compile my own binary?
12 -------------------------------
14 On a full blown desktop system this is relativly easy. If not already done so,
15 install a C compiler (e.g. gcc or clang) through your packet manager, e.g.
16 "sudo apt-get install gcc" (Debian/Ubuntu) or "sudo yum install gcc"
19 Then cd to your vlmcsd directory and type "make". vlmcs and vlmcsd will
20 be built right away for your local system.
22 If you installed gcc and it is not the default compiler for your OS or
23 distribution, you may need to type "make CC=gcc" to explicitly select a
27 How do I compile a binary for my embedded device?
28 -------------------------------------------------
30 What you need is cross-compiling toolchain for your device. It consists of a
31 C compiler, libraries, header files and some tools (called binutils). The
32 toolchain must match the device in processor architecture, endianess, ABI,
33 library and header files version, library configuration, ...
35 If the endianess or ABI differs or the version of some library between
36 toolchain and device differs too much, the resulting binary does not run
39 Once you have a proper toolchain (probably found on the Internet for download),
40 unpack it to any directory and type
42 "make CC=/path/to/toolchain/bindir/c-compiler-binary"
44 Building vlmcsd for using a cross-compiling toolchain is as easy as building
45 vlmcsd for your local machine. The only question is, whether this you have
46 a toolchain that actually matches your device.
48 Whenever you change any parameter of the make command line, you must "clean"
49 the source directory from intermediate files and output from previous runs
50 of make. You can do so by typeing "make clean" or force make to behave as if
51 the directory were clean by adding -B to the command line, e.g.
53 "make -B CC=/path/to/toolchain/bindir/c-compiler-binary"
56 I have downloaded several promising toolchains for my device but they all
57 don't work. Can I create my own toolchain?
58 -------------------------------------------------------------------------
60 You can use tools like buildroot or OpenWRT. Both are able to create toolchains
61 for many embedded devices. But this is out of the scope of this document.
62 If you are unable to walk through thousands of configuration options and make
63 the right choice, you may probably want to try the pre-built binaries.
66 How to choose a pre-built binary?
67 ---------------------------------
69 The directory structure for the binaries is
77 +--<endianess> (omitted if CPU or OS does not allow multi-endianess)
81 <C-library> can also be "static". That means no special library is required.
82 Static binaries are much bigger and need more RAM than dynamic binaries but
83 are more likely to run on your system. Use a static binary only, if none of
84 the dynmic binaries run.
86 Don't get confused when a binary is named after an OS or a specific device,
87 e.g. the name contains "openwrt", "tomato" or "Fritzbox". This does not mean
88 that the binary will run only on that OS or on that device. It is a hint only
89 where I got or built the toolchain from.
92 How to determine the endianess of my system?
93 --------------------------------------------
95 - All Intel CPUs (x86, x32, x64) are little-endian only
96 - Windows is little-endian only even if the CPU support big-endian
97 - big-endian ARM is extremely uncommon. You can safely assume little-endian
98 - little-endian PowerPC virtually does not exist since only newer POWER7
99 and POWER8 CPUs support it. Always assume big-endian.
100 - For MIPS both little-endian and big-endian are common. Most Broadcomm and
101 TI chips run little-endian. Most Atheros and Ikanos CPUs run big-endian.
104 echo -n I | od -o | awk 'FNR==1{ print substr($2,6,1)}'
106 This returns 1 for little-endian systems and 0 for big-endian systems. However
107 some devices do not have the od command and thus this method won't work.