[Sipeed LicheeRV 86 Panel Review] III. Building a cross-compilation environment: success and failure
[Copy link]
This post was last edited by zhang1gong on 2022-3-23 16:24
After having a basic understanding of the "Sipeed LicheeRV 86 Panel" hardware and doing simple lighting and flashing experiments, the next step is obviously to build a cross-compilation environment and conduct some substantive evaluation work.
Several friends have already done this work, and their evaluation reports describe the process in detail, including possible "pitfalls" and how to "avoid them". I thought that building a cross-compilation environment would be smooth, but I encountered many problems. The final result was that there were successes and failures. Unfortunately, in general, there were more failures than successes. In the process of trying to solve the problems, I learned a lot about Linux.
1 Success: A simple "hello, world!"
Because I wanted to get familiar with the Linux system through this evaluation, I installed the latest version of "Kali Linux" on a small host that I bought for more than 100 yuan a few years ago. The main operations were done from my desktop computer through SSH remote login of the simulated terminal. The process of installing and configuring the Linux system of the small host went smoothly. Then I deployed D1-SDK, edited the "helloworld.c" file, and ran it according to the steps given in the D1-SDK user manual:
source ~/.local/riscv64-toolchain/environment-setup-riscv64-oe-linux
$CC helloworld.c -o helloworld
This compiles, but with a warning.
In fact, there is a small episode in the middle. When you start running " $CC helloworld.c -o helloworld ", the prompt is:
zsh: no such file or directory: riscv64-linux-gcc -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/zyg/.local/riscv64-toolchain /sysroots/riscv64-oe-linux --no-sysroot-suffix
Just run directly:
riscv64-linux-gcc -o helloworld helloworld.c
The compilation was successful. Later I found that it was a shell problem. The default shell of Kali is zsh, which is very easy to use, but not completely compatible with bash. After switching to bash, compiling with "$CC" was no problem.
The compiled executable code needs to be downloaded to the target machine Sipeed LicheeRV 86 Panel. I used the simulation terminal running on the desktop computer to connect to the kali linux small host and Sipeed LicheeRV 86 Panel through SSH respectively, and then used the "scp " command on the simulation terminal connected to the Sipeed LicheeRV 86 Panel to copy the files on the kali linux small host and run it. No problem.
2 Failed: Compilation of system image
At the end of the tutorial for Sipeed LicheeRV 86 Panel, a solution for compiling a system image through Docker was given. I just attended a class a few days ago and it mentioned Docker, so I gave it a try. According to the instructions in the tutorial, I downloaded and installed the Docker image file. After several attempts, I finally got it running on the Kali Linux mini-host. This Docker image is an Ubuntu system, and the environment for cross-compiling the "Sipeed LicheeRV 86 Panel" system image has been set up. Follow the tutorial to execute the command:
cd ~/sdk/tina-d1-open_new/
source build/envsetup.sh
lunch
make
The compilation process started. The compilation process was very long (maybe because of the low configuration of my small host?), and it must have something to do with running in a container instead of running directly locally. In short, the compilation process took several hours (more than 10 hours?), and finally it was completed! But, but, the compilation failed!
I decided not to use docker. I followed the download and installation instructions on the Allwinner website, downloaded the SDK repository, and built an environment to compile the system image. However, the compilation still failed. At first, it prompted that the "openssl" library was missing. After searching online for solutions, other problems occurred. During this period, I even deleted the local SDK repository and downloaded and installed it again, but it still didn't work. The current situation seems to be that the generated toolchain is wrong. It is probably a problem with a Makefile, but it has not been accurately located.
The problem is still being found, and it is a bit difficult for me.
|