Use crosstool-ng to make raspberry pi zero cross compilation tool

crosstool-ng tool

crosstool-ng is designed to help you complete complex tasks such as generating a compiler toolchain. It provides a powerful front-end and build script that allows you to select the functions that need to be completed by the toolchain, and then automatically generate it. In the process, you don't need to understand exactly how these countless tool chains are organized together.

crosstool-ng official website

Components needed:

libstdc (standard C++ library, including shared static libraries)
libtool and make (for basic construction)
GNU MP (for efficient and precise mathematical calculations)
gperf (a perfect hash function generator)
bison (C syntax parser)
flex ( Lexical pattern recognition engine)
ncurses (terminal graphics library)
sed (stream editor)
subversion (client tool for accessing SVN code base)
texinfo (a document generation and parsing tool)

ubuntu installation components:

sudo apt install gcc g++ bison make ncurses-dev texinfo flex fperf libtool sed subversion libgmp-dev libstdc++-dev

Note: The above library name will change

Download crosstool-ng

Enter the crosstool-ng directory:

./configure --prefix=/opt/crosstool-ng
make
make install

Configure cross-compilation tools

Note: You can use crosstool.config in armv6-rpi-linux-gnueabi in the samples folder under the crosstool-ng tool directory

ct-ng menuconfig

Paths and Misc Options

Enable "Try features marked as EXPERIMENTAL" and
set "Prefix directory" to the installation location of the cross-compilation toolchain you want.
Set "Number of parallel jobs" to set the -j parameter in make

Target Options

Note: arm1176jzf-s is the model of Raspberry Pi zero CPU. For details, you can search for the Raspberry Pi map on Baidu.

Settings "Architecture level" may take samples in the default
setting Eitherassembly for CPU is arm1176jzf-s
provided Tune for CPU is arm1176jzf-s
arranged Use specific FPU is vfp
as hardware (FPU) disposed Floating point
setting Default instruction set mode for the arm
to enable Use EABI option

Toolchain Options

Set Tuple's vendor string to rpi

Operating System Options

Set Target OS to
set LInux kernel version for linux

Binary Utilities Options

Set Binary format to ELF
Set binutils version

C Compiler Options

Enable Show linaro versions,
set gcc version to the new version, customizable,
enable c++,
set gcc extra config to --with-float=hard,
enable Link libstdc++ statically into gcc binary

C-library Options

Set C library to eglibc
Set eglibc version

Then exit the save.

Start building

ct-ng build

Note: The current cross-compilation tool made by myself fails to compile the qt source code. The specific problem is that the tool chain is missing something. If you need to cross-compile the qt source code, personal recommendation is to use linaro because the official cross-compilation tool chain is too old.

Guess you like

Origin blog.csdn.net/qq_32312307/article/details/114907522