This document describes how to build OpenIMP for different targets.
- Prerequisites
- Building for Host (Development)
- Cross-Compiling for Ingenic Devices
- Build Outputs
- Installation
- Troubleshooting
- GCC compiler
- Make
- pthread library
- Standard C library
- MIPS cross-compiler toolchain (mipsel-linux-gcc)
- Make
- Access to the Buildroot toolchain
To build for your local machine (useful for development and testing):
make clean
makeThis will create:
lib/libimp.so- Shared librarylib/libimp.a- Static librarylib/libsysutils.so- SysUtils shared librarylib/libsysutils.a- SysUtils static library
The easiest way to cross-compile for Ingenic T31 devices:
./build-for-device.shThis script will:
- Set up the cross-compilation environment
- Clean previous builds
- Build all libraries with the MIPS toolchain
- Strip debug symbols for smaller binaries
- Display build information
If you need more control or want to build for a different platform:
# Set up environment
export CROSS_COMPILE=mipsel-linux-
export PATH=/path/to/toolchain/bin:$PATH
# Clean and build
make clean
make CROSS_COMPILE=mipsel-linux- PLATFORM=T31
# Optional: Strip debug symbols
make CROSS_COMPILE=mipsel-linux- stripYou can specify the target platform with the PLATFORM variable:
T21- Ingenic T21T23- Ingenic T23T31- Ingenic T31 (default)C100- Ingenic C100T40- Ingenic T40T41- Ingenic T41
Example:
make CROSS_COMPILE=mipsel-linux- PLATFORM=T40After a successful build, you'll find the following in the lib/ directory:
-
libimp.so (136KB stripped) - Main IMP library
- System module
- Encoder module
- FrameSource module
- Audio module
- OSD module
- IVS module
- Hardware encoder integration
- VBM (Video Buffer Manager)
- DMA allocator
-
libsysutils.so (66KB stripped) - System utilities library
- Basic system utilities
- libimp.a (139KB) - Static version of libimp
- libsysutils.a (1.7KB) - Static version of libsysutils
To install to a custom location:
make install PREFIX=/path/to/installDefault installation paths:
- Headers:
$(PREFIX)/include/imp/and$(PREFIX)/include/sysutils/ - Libraries:
$(PREFIX)/lib/
To deploy to an Ingenic device:
# Copy libraries to device
scp lib/libimp.so root@device:/usr/lib/
scp lib/libsysutils.so root@device:/usr/lib/
# Copy headers (if needed for development)
scp -r include/imp root@device:/usr/include/
scp -r include/sysutils root@device:/usr/include/file lib/libimp.soExpected output for MIPS:
lib/libimp.so: ELF 32-bit LSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, stripped
ls -lh lib/Expected sizes (stripped):
- libimp.so: ~136KB
- libsysutils.so: ~66KB
mipsel-linux-readelf -d lib/libimp.so | grep NEEDEDExpected dependencies:
- libpthread.so.0
- librt.so.1
- libc.so.0
If you get "command not found" errors:
# Verify toolchain path
export PATH=/home/matteius/output/wyze_cam3_t31x_gc2053_rtl8189ftv/per-package/toolchain-external-custom/host/bin/:$PATH
# Verify compiler exists
which mipsel-linux-gccThe build may show some warnings about:
- Unused parameters (normal for stub functions)
- Array bounds (expected due to structure size differences)
- Unused functions (normal for helper functions)
These warnings are expected and don't affect functionality.
If you encounter issues, try a clean build:
make clean
./build-for-device.shDefault flags (can be overridden):
-Wall -Wextra- Enable warnings-O2- Optimization level 2-fPIC- Position independent code (for shared libraries)-DPLATFORM_T31- Platform-specific defines
To add custom compiler flags:
make CFLAGS="-Wall -O3 -DCUSTOM_DEFINE"For active development:
- Edit source files in
src/ - Rebuild:
make - Test locally (if possible)
- Cross-compile:
./build-for-device.sh - Deploy to device
- Test on device
For production builds, consider:
- Strip symbols:
make strip(already done by build script) - Optimize for size:
make CFLAGS="-Os -fPIC -Iinclude -DPLATFORM_T31" - Link-time optimization: Add
-fltoto CFLAGS
- README.md - Project overview
- IMPLEMENTATION_SUMMARY.md - Implementation details
- include/imp/ - API headers