2.6 KiB
2.6 KiB
Cross-Compilation Guide for ARM64
This guide explains how to cross-compile the framebuffer demo for ARM64 (aarch64) architecture, which is used by the R36 Ultra device.
Prerequisites
Install ARM64 Cross-Compiler
On Ubuntu/Debian:
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
sudo apt-get install valac
Verify Installation
aarch64-linux-gnu-gcc --version
Compilation Methods
Method 1: Using the Compile Script (Recommended)
./compile.sh arm64
This will:
- Compile Vala code to C
- Cross-compile C code to ARM64 using
aarch64-linux-gnu-gcc - Create a statically-linked binary for ARM64
Method 2: Manual Cross-Compilation
Step 1: Compile Vala to C
valac --pkg posix -C framebuffer_demo.vala
Step 2: Cross-compile C to ARM64
aarch64-linux-gnu-gcc framebuffer_demo.c -o framebuffer_demo \
$(pkg-config --cflags --libs glib-2.0 gobject-2.0) \
-static
Method 3: Native Compilation (on R36 Ultra)
If you prefer to compile directly on the R36 Ultra device:
./compile.sh
Verifying the Binary
Check the compiled binary architecture:
file framebuffer_demo
Expected output:
framebuffer_demo: ELF 64-bit LSB executable, ARM aarch64, version 1 (GNU/Linux), statically linked, ...
Transferring to R36 Ultra
Using SCP
scp framebuffer_demo user@r36ultra:/home/user/
Using USB/SD Card
- Copy
framebuffer_demoto USB drive or SD card - Insert into R36 Ultra
- Copy to device storage
Running on R36 Ultra
chmod +x framebuffer_demo
sudo ./framebuffer_demo
Troubleshooting
Cross-compiler not found
sudo apt-get install gcc-aarch64-linux-gnu
Missing GLib dependencies
sudo apt-get install libglib2.0-dev
Binary won't run on device
- Ensure you compiled for the correct architecture (ARM64/aarch64)
- Try static linking: add
-staticflag to gcc command - Check device architecture:
uname -m(should showaarch64)
Permission denied on /dev/fb0
sudo ./framebuffer_demo
Static vs Dynamic Linking
Static Linking (Recommended for R36 Ultra)
- Binary includes all dependencies
- Larger file size
- No dependency issues on target device
- Use
-staticflag
Dynamic Linking
- Smaller binary
- Requires compatible libraries on target device
- May have compatibility issues
- Remove
-staticflag
Architecture Information
- R36 Ultra: ARM64 (aarch64)
- Cross-compiler:
aarch64-linux-gnu-gcc - Target: Linux ARM 64-bit