| | 65 | === Venice Notes |
| | 66 | |
| | 67 | Gateworks has not published a Toolchain / SDK and thus it should be built with the OpenWrt instructions on the [wiki:OpenWrt/building] page. |
| | 68 | |
| | 69 | This results in a toolchain in ./staging_dir and for 24.01 imx8m the toolchain will be toolchain-aarch64_cortex-a53_gcc-12.3.0_musl |
| | 70 | |
| | 71 | Once the toolchain is there, use the following commands to compile a Hello World: |
| | 72 | {{{ |
| | 73 | # configure toolchain |
| | 74 | export TOOLCHAIN=toolchain-aarch64_cortex-a53_gcc-12.3.0_musl |
| | 75 | export STAGING_DIR=$PWD/staging_dir |
| | 76 | export ARCH=arm64 |
| | 77 | export CROSS_COMPILE=aarch64-openwrt-linux- |
| | 78 | export PATH=$PATH:$STAGING_DIR/$TOOLCHAIN/bin |
| | 79 | cat << EOF > helloworld.c |
| | 80 | #include <stdio.h> |
| | 81 | #include <stdlib.h> |
| | 82 | |
| | 83 | int main(int argc, char **argv) |
| | 84 | { |
| | 85 | printf("hello world!\n"); |
| | 86 | |
| | 87 | return 0; |
| | 88 | } |
| | 89 | EOF |
| | 90 | ${CROSS_COMPILE}gcc helloworld.c -o helloworld |
| | 91 | }}} |
| | 92 | |
| | 93 | This builds a dynamically linked helloworld which you can inspect as: |
| | 94 | {{{ |
| | 95 | $ file helloworld |
| | 96 | helloworld: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, with |
| | 97 | debug_info, not stripped |
| | 98 | ${CROSS_COMPILE}objdump -x helloworld | grep NEEDED |
| | 99 | NEEDED libgcc_s.so.1 |
| | 100 | NEEDED libc.so |
| | 101 | |
| | 102 | }}} |
| | 103 | |
| | 104 | You can then copy this executable and run this on a board with OpenWrt 24.01 installed |
| | 105 | |