Close

T113 Buildroot Cross-compilation Toolchain Replacement Methods

forlinx-embeddedforlinx embedded wrote 7 days ago • 4 min read • Like

Cross-compilation Toolchain Location:

OK113i-linux-sdk/out/t113_i/ ok113i/longan/buildroot/host/bin/arm-linux-gnueabihf-gcc

Before executing the method below, please delete the out directory and decompress the cross-compilation tool chain in the lower path of the source code./buildroot/buildroot-201902/dl/toolchain-external-linaro-arm/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz

1. Modify mkcmd.sh and mkcommon.sh according to the patch modification method in the figure.

Modify mkcmd.sh and mkcommon.sh

2. Go back to the sdk path and execute the following command:

forlinx@ubuntu:~/shuishui/OK113i-linux-sdk$ ./build.sh config

T113 Buildroot Cross-compilation Toolchain Replacement Methods

It is modified to emmc or NAND version according to the actual board configuration.

3. Next, execute the following command to enter the configuration of buildroot.

T113 Buildroot Cross-compilation Toolchain Replacement Methods

Enter toolchain

T113 Buildroot Cross-compilation Toolchain Replacement Methods

Modify the relevant options as shown in the figure below:

T113 Buildroot Cross-compilation Toolchain Replacement Methods

Enter target options

T113 Buildroot Cross-compilation Toolchain Replacement Methods

Because hard-float is needed, the highlighted part in the diagram needs to be modified to EABIhf.

T113 Buildroot Cross-compilation Toolchain Replacement Methods

Save and exit after setting.

Enter the following path to compile.

T113 Buildroot Cross-compilation Toolchain Replacement Methods

./build.sh

Full compilation may require an error with an environment variable, resulting in a failure to compile.

T113 Buildroot Cross-compilation Toolchain Replacement Methods

If this problem occurs, execute the following instructions and compile the buildroot.

export LD_LIBRARY_PATH=""

In the middle of compiling buildroot, you may encounter an error as shown in the following figure.

T113 Buildroot Cross-compilation Toolchain Replacement Methods

If these errors are encountered, you can find the corresponding source code and compile it through the tools in the decompressed cross-compilation chain. Subsequently, place the compiled executable file in the bin path and the library file in the lib path. Finally, continue executing ./build.sh until compilation is successful. After compiling successfully, return to the SDK path, perform full compilation build. sh, and then pack the image.

Next, write a test program to verify whether the cross-compilation chain can be successfully replaced. Here, you need to compare the program compiled with the original compilation chain with the program cross-compiled with the current compilation chain.

T113 Buildroot Cross-compilation Toolchain Replacement Methods

The part highlighted in the diagram is a program compiled using our original cross-compilation chain. It can be observed that it does not run normally. "Test" is a program compiled using the tools from the replaced cross-compilation chain, which runs normally. Additionally, the relevant information of the two programs can be determined using the ''strings'' tool.

T113 Buildroot Cross-compilation Toolchain Replacement Methods
Like

Discussions