202 | | For example, if you wanted to build hello-world for laguna: |
203 | | {{{ |
204 | | $ ls staging_dir/toolchain-arm_v6k_gcc-linaro_uClibc-0.9.32_eabi/ |
205 | | arm-openwrt-linux bin info.mk libexec share usr |
206 | | arm-openwrt-linux-uclibcgnueabi include lib sbin stamp |
207 | | $ cat << EOF > hello-world.c |
208 | | #include <stdio.h> |
209 | | |
210 | | int main (int argc, char** argv) |
211 | | { |
212 | | printf("Hello World\n"); |
213 | | return 0; |
214 | | } |
215 | | EOF |
216 | | $ ./staging_dir/toolchain-arm_v6k_gcc-linaro_uClibc-0.9.32_eabi/bin/arm-openwrt-linux-uclibcgnueabi-gcc ../hello-world.c -o hello-world |
217 | | $ file hello-world |
218 | | hello-world: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped |
219 | | }}} |
220 | | |
221 | | * *The STAGING_DIR may need to be set as noted here: [http://wiki.openwrt.org/doc/devel/crosscompile] |
| 202 | Examples: |
| 203 | * Cross-compile hello-world.c for Ventana (imx6) using the OpenWrt 16.02, built in the present working directory: |
| 204 | {{{#!bash |
| 205 | export STAGING_DIR=$PWD/staging_dir |
| 206 | export PATH=$STAGING_DIR/toolchain-arm_cortex-a9+neon_gcc-5.2.0_musl-1.1.12_eabi/bin:$PATH |
| 207 | arm-openwrt-linux-gcc hello-world.c -o hello-world |
| 208 | }}} |
| 209 | * Cross-compile hello-world.c for Laguna (cns3xxx) using the OpenWrt 14.08, built in the present working directory: |
| 210 | {{{#!bash |
| 211 | export STAGING_DIR=$PWD/staging_dir |
| 212 | export PATH=$STAGING_DIR/toolchain-arm_v6k_gcc-linaro_uClibc-0.9.32_eabi/bin:$PATH |
| 213 | arm-openwrt-linux-uclibcgnueabi-gcc hello-world.c -o hello-world |
| 214 | }}} |