WDS setup cross compiler and download source code

1 cross compiler

lzy@lzy-virtual-machine:~/imx6ull-sdk/ToolChain$ ls -ltr
 Total consumption 16
drwxr-xr-x 12 lzy lzy 4096 10 June 14-20:22 arm-buildroot-linux-gnueabihf_sdk-buildroot
drwxr-xr-x  9 lzy lzy 4096 10 June 14-20:23 gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf
drwxr-xr-x  8 lzy lzy 4096 2 January 2017 gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf

The cross compiler recommended by Wei Dongshan is more complete, but it does not test whether the kernel can be compiled

Weidongshan another cross compiler is not recommended

The cross compiler officially recommended by punctual atom has fewer libraries and can compile the kernel

1.1 storage of environmental variables

The environment variable settings are stored in ~ /. bashrc. After saving, run source ~/.bashrc.

export ARCH=arm

export CC=arm-linux-gnueabihf-gcc
export CROSS_COMPILE=arm-linux-gnueabihf-
export PATH=$PATH:/home/lzy/imx6ull-sdk/ToolChain/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin

# The following three are arm builderoot Linux gnueabihf
#export CC=arm-buildroot-linux-gnueabihf-gcc
#export CROSS_COMPILE=arm-buildroot-linux-gnueabihf-
#export PATH=$PATH:/home/lzy/imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin

1.2 view the cross tool chain include and lib directories

Execute the following command to determine the directory. It will list the header file directory and library_path

echo 'main(){}'| arm-linux-gnueabihf-gcc -E -v -

1.3 add some other libraries, such as cross compiling freetype

For details, refer to the complete manual of embedded Linux application development V4.0_ Weidongshan full series video documents - IMX6ULL development board.pdf (P379)
From the previous section, roughly select the cross compiler header file and dependent library, which can be placed in:


Commands used during compilation
1. Arm linux gnueabihf cross compiler

cp include/* -rf /home/lzy/imx6ull-sdk/ToolChain/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include
cp lib/* -rfd /home/lzy/imx6ull-sdk/ToolChain/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/lib

2. Arm builderoot Linux gnueabihf cross compiler

cp include/* -rf /home/lzy/imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/usr/include/
cp lib/* -rfd /home/lzy/imx6ull-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/arm-buildroot-linux-gnueabihf/sysroot/usr/lib

3. Compile command

#zlib compilation
export CC=arm-linux-gnueabihf-gcc
./configure   --prefix=/home/lzy/imx6ull-sdk/ToolChain/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/
make && make install

#libpng compilation
./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux-gnueabihf --prefix=/home/lzy/imx6ull-sdk/ToolChain/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/
make && make install

#freetype compilation

./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux-gnueabihf CFLAGS=-I/home/lzy/imx6ull-sdk/ToolChain/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include LDFLAGS=-L/home/lzy/imx6ull-sdk/ToolChain/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/lib --prefix=/home/lzy/imx6ull-sdk/ToolChain/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr
make && make install

1.4 /usr/local/lib/libz.so: file not recognized: File format not recognized

This error is prompted in the cross compilation freetype. After review, it is as follows:
/usr/local/lib/libz.so: file not recognized: File format not recognized. The reason for the error is that / usr/local/lib/libz.so is an x86 64 bit architecture and cannot be used on the board, so zlib needs to be newly compiled.

The solution is simple:

# Delete the related files under these two files, but don't delete them indiscriminately
sudo rm -rf /usr/local/lib/libz.* pkgconfig/
sudo rm -rf /usr/local/include/*

# Switch to the include and lib libraries of the cross compiler and delete the files compiled by the original wrong method
# If you can't remember to delete the whole directly, just unzip it again.
# You can also use ls -ltr to view the files recently placed here and select Delete
rm -rf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/ 

# Delete freetype and the two folders it depends on
rm -rf freetype-2.10.2/ libpng-1.6.37/ zlib-1.2.11/

2 download source code

Refer to embedded Linux application development manual V4.0_ Weidongshan full series video documents - IMX6ULL development board (P139)

book@100ask:~$ git clone https://e.coding.net/codebug8/repo.git
book@100ask:~$ mkdir -p 100ask_imx6ull-sdk && cd 100ask_imx6ull-sdk
book@100ask:~/100ask_imx6ull-sdk$ ../repo/repo init -u \
https://gitee.com/weidongshan/manifests.git -b \
linux-sdk -m imx6ull/100ask_imx6ull_linux4.9.88_release.xml --no-repo-verify
book@100ask:~/100ask_imx6ull-sdk$ ../repo/repo sync -j4

Line 1: Download repo
Line 2: create 100ask_ Imx6ull SDK and enter 100ask_ Imx6ull SDK folder.
The third line: I don't understand. It roughly means to use repo and bind the local website?
Line 4: download the source code synchronously

2.1 problems encountered / usr/bin/env: "python": there is no such file or directory

This error occurs when the third line is running. I think it's the python environment variable, but I don't have any idea about how to set it. I have an answer on baiwen.com.

The idea given by the teacher is that a script is not executed, and then I download configuring through P107_ Ubuntu.sh, the command is

book@100ask: ~ $ wget --no-check-certificate -O Configuring_ubuntu.sh \
https://weidongshan.coding.net/p/DevelopmentEnvConf/d/DevelopmentEnvConf/git/raw/master/Configuring_ubuntu.sh &&\
sudo chmod +x Configuring_ubuntu.sh &&\
sudo ./Configuring_ubuntu.sh

If you find the script, you can run it directly in theory, but I am 41~20.04.2-Ubuntu and can't run it directly. Then open the script to see what the specific operations are. After reasonable deliberation, the area is finally locked. The top line command is apt get install python3.8 dosftools mtools python3 setuptools python3 PIP - y to install some software, of which python3.8 is the most important. The following two lines are sudo rm -f /usr/bin/python and ln -s /usr/bin/python3.8 /usr/bin/python, The general meaning is to create a soft link Python under / user/bin / to point to Python 3.8. The following has nothing to do with Python, so just set it.

Tags: Linux

Posted on Fri, 15 Oct 2021 15:23:30 -0400 by WhiteShade6