2.8. Cross-Compiling Applications¶
2.8.1. References¶
- Bootlin slides, chapter Cross-Compiling Toolchains
- Main Buildroot documentation: https://buildroot.uclibc.org/downloads/manual/manual.html
2.8.2. Goals¶
- Cross-compile an application for the target
- Using the Buildroot cross-compiler and sysroot
2.8.3. Steps¶
- Compile a simple C program with the host toolchain, using a Makefile.
- Adapt the Makefile and compile a simple C program with the toolchain from Buildroot:
user@host: ls -l ${BR_PATH}/output/host/usr/bin
- Copy the binary to the target and test it (use the simple SD card image from previous lab).
2.8.4. Questions¶
- Which binaries are present in the toolchain directory?
- Which version of gcc is used?
- Which libc is gcc using?
- Are there other interesting parameters used in the gcc configuration?
- Check the location of the sysroot.
- Show that the generated binary is built for the target architecture using
readelf
:
user@host: readelf -a <binary>
user@host: readelf -h <binary>