T113 Buildroot Cross-compilation Toolchain Replacement Methods

Forlinx

Apr 23, 2023
107
Joined
Apr 23, 2023
Messages
107
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.


file.php



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


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


file.php


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.


file.php


Enter toolchain

file.php


Modify the relevant options as shown in the figure below:

file.php


Enter target options

file.php


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

file.php


Save and exit after setting.

Enter the following path to compile.

file.php


./build.sh


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

file.php


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.

file.php


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.

file.php


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.

file.php


 

Attachments

  • P1.png
    P1.png
    750.1 KB · Views: 0
  • P2.png
    P2.png
    122.9 KB · Views: 0
  • P3.png
    P3.png
    445.9 KB · Views: 0
  • P4.png
    P4.png
    269.9 KB · Views: 0
  • P5.png
    P5.png
    443 KB · Views: 0
  • P6.png
    P6.png
    1,001.3 KB · Views: 0
  • P7.png
    P7.png
    205.1 KB · Views: 0
  • P8.png
    P8.png
    188.4 KB · Views: 0
  • P9.png
    P9.png
    243.8 KB · Views: 0
  • P10.png
    P10.png
    767.4 KB · Views: 0
  • P11.png
    P11.png
    794.9 KB · Views: 0
  • P12.png
    P12.png
    824.3 KB · Views: 0
  • P13.png
    P13.png
    814.7 KB · Views: 0
  • P14.png
    P14.png
    657.8 KB · Views: 0
  • P15.png
    P15.png
    729 KB · Views: 0
  • P16.png
    P16.png
    83.8 KB · Views: 0
  • P17.png
    P17.png
    72.7 KB · Views: 0
  • P18.png
    P18.png
    78.1 KB · Views: 0
  • P19.png
    P19.png
    446.8 KB · Views: 0
Top