This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
development:toolchain [2015/05/19 09:10] – [Toolchain] hess | development:toolchain [2020/03/19 10:46] – fachet | ||
---|---|---|---|
Line 2: | Line 2: | ||
Many or even most tasks can be implemented using the integrated [[sdk:sdk | SDK]] with the C-like scripting language and the router API functions. | Many or even most tasks can be implemented using the integrated [[sdk:sdk | SDK]] with the C-like scripting language and the router API functions. | ||
===== Toolchain ===== | ===== Toolchain ===== | ||
- | However, if for some reasons you want or have to cross-compile a C application, | + | However, if for some reasons you want or have to cross-compile a C application, |
- | [[ftp:// | + | [[ftp:// |
- | This toolchain | + | The toolchains |
a assembler and linker ([[https:// | a assembler and linker ([[https:// | ||
a [[wp>C standard library]] ([[http:// | a [[wp>C standard library]] ([[http:// | ||
- | for NetModule Routers | + | for NetModule Routers. |
+ | |||
+ | The following Cross-Compilation toolchains are available: | ||
+ | |||
+ | * [[ftp:// | ||
+ | * [[ftp:// | ||
+ | * [[ftp:// | ||
For further introduction to GCC please refer to [[http:// | For further introduction to GCC please refer to [[http:// | ||
+ | **Please be ware that NetModule can not support systems with customer extensions.** | ||
==== Getting Started ==== | ==== Getting Started ==== | ||
- | 1. Download and install the toolchain on your Linux x86 PC | + | 1. Download and install the corresponding |
<code bash> | <code bash> | ||
- | wget ftp:// | + | wget ftp:// |
tar -xvf toolchain-ppc-4.4.5-x86_64.tar.bz2 -C /opt | tar -xvf toolchain-ppc-4.4.5-x86_64.tar.bz2 -C /opt | ||
export PATH=$PATH:/ | export PATH=$PATH:/ | ||
Line 42: | Line 50: | ||
3. Compile it | 3. Compile it | ||
+ | |||
+ | __PowerPC: | ||
<code bash> | <code bash> | ||
powerpc-openwrt-linux-gcc -Wall hello.c -o hello | powerpc-openwrt-linux-gcc -Wall hello.c -o hello | ||
+ | </ | ||
+ | |||
+ | __ARM:__ | ||
+ | <code bash> | ||
+ | arm-openwrt-linux-gcc -Wall hello.c -o hello | ||
</ | </ | ||
4. Copy it to the router (e.g. via SCP) and run it. | 4. Copy it to the router (e.g. via SCP) and run it. | ||
+ | |||
+ | ==== Example: Compile a program from Source ==== | ||
+ | This example shows you how to compile a program from source. The program in this example is [[https:// | ||
+ | |||
+ | __PowerPC__ | ||
+ | <code bash> | ||
+ | wget https:// | ||
+ | tar -xzf jq-1.5.tar.gz | ||
+ | cd jq-1.5 | ||
+ | CC=powerpc-openwrt-linux-gcc ./configure --host=powerpc --disable-maintainer-mode | ||
+ | make | ||
+ | </ | ||
+ | |||
+ | __ARM__ | ||
+ | <code bash> | ||
+ | wget https:// | ||
+ | tar -xzf jq-1.5.tar.gz | ||
+ | cd jq-1.5 | ||
+ | CC=arm-openwrt-linux-gcc ./configure --host=arm --disable-maintainer-mode | ||
+ | make | ||
+ | </ | ||
+ | |||
+ | **Note:** Patch required to fix y0, y1, j0 and j1 related build issue on uClibc \\ | ||
+ | Our default uClibc configuration does not have DO_XSI_MATH=y, | ||
+ | |||
+ | We can now check the file type and we see, that the program has been compiled for PowerPC. Now we can copy '' | ||
+ | <code bash> | ||
+ | file jq | ||
+ | jq: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked (uses shared libs), with unknown capability 0x41000000 = 0x13676e75, with unknown capability 0x10000 = 0xb0402, not stripped | ||
+ | </ | ||
===== Oracle Virtual Box Image ===== | ===== Oracle Virtual Box Image ===== | ||
- | For small projects or if you don't have a Linux environement you can also use the very small [[ftp://public: | + | For small projects or if you don't have a Linux environement you can also use the very small [[ftp:// |