Litchi Pie nano (f1c100s) manually transplanted QT4.8.7

Litchi Pie nano (f1c100s) manually transplants QT4.8.7
Hardware environment:
1. Lychee pie nano (f1c100s)

Article directory

  • 1. Concept clarification (must read)
  • 2. Use buildroot to build the root file system
    • 1. Target options
    • 2.ToolChain
    • 3. System configuration
    • 4. Compile (make)
  • 3. Start transplanting Qt4.8.7
    • 1. Download the source code and unzip it
    • 2. Modify qmake.conf
    • 3. Configure
    • 4. Compile (make)
    • 5. Install (make install)
    • 6. Copy qt4.8.7_armlib to the board
  • 4. Start testing
  • 5. Report an error
    • Error 1
    • Error 2
  • 6. Summary

1. Concept clarification (must read)

Please read this first!
Please look at this first!
Please look at this first!

1. Regarding the cross-compilation tool chain of f1c100s, I use this arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu .tar.bz2, hereafter called arm-none-linux-gnueabi;

wget https://sourcery.mentor.com/GNUToolchain/package12813/public/arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu. tar.bz2

Okay, Why this, the answer is I don’t know either. At present, I can only run the application compiled using this and put it on the board;
2. Why is the Qt versionQt4.8.7, not Qt5.9 or something else? First of all, it must be clear that the same tool chain is used to build the root file system and compile Qt applications later using buildroot, which is the one introduced above; however, the gcc version of arm-none-linux-gnueabi is 4.8.3, and then You need to understand the gcc version requirements of the ported QT version; however, the gcc version requirement of Qt5.9 is greater than 4.8, so Conclusion : For f1c100s using this tool chain, both Qt4.8.7 and Qt5.9 are OK; I chose Qt4.8.7 because Qt5.9 cannot be found; >

3. Summary: Deciding which cross-compilation tool chain to use and which version of Qt to transplant depends on which Soc to use; for this f1c100s, this is what I considered; so this f1c100s transplant The solution for qt is: buildroot uses an external tool chain, and does not check the Qt package under buildroot, but transplants it manually; Anyway, it is the relationship between the tool chain gcc version and the Qt version. After clarifying it yourself, It should be possible to mix and match at will; there is no fixed choice;
4. Insertion: How to configure the tool chain, the steps are as follows:

# Download tool chain
wget https://sourcery.mentor.com/GNUToolchain/package12813/public/arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
# Decompression tool chain
tar -xvf arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
# Execute the following three instructions to use it anywhere, but it is not permanent
# Change the third path to your path
export ARCH=arm
export CROSS_COMPILE=arm-none-linux-gnueabi-
export PATH=$PATH:/home/book/licheePi-f1c100s/arm-2014.05/bin
# Test
arm-none-linux-gnueabi-gcc -v

2. Use buildroot to build the root file system

Enter the buildroot directory:

#Execute make distclean first
make distclean

#Then execute make menuconfig to enter the graphical configuration interface
make menuconfig

Mainly lies in the configuration of the tool chain part. This buildroot uses an existing external tool chain, which is the tool chain introduced above;

1. Target options

Configuration as shown;

2. ToolChain

Note, How to write the Toolchain path: The normal toolchain path is to the /bin directory, that is, /home/book/licheePi-f1c100s/arm-2014.05/ bin, but “/bin” needs to be removed here;
Note, How to write Toolchain prefix: The prefix of this toolchain is arm-none-linux-gnueabi; $(ARCH) = arm, so add -none- after it Just linux-gnueabi, don’t add a “-” at the end;
Note, How to view gcc version: Just like above: arm-none-linux-gnueabi-gcc -v;
Note, How to view the kernel header series: View in the tool chain directory,

vi /home/book/licheePi-f1c100s/arm-2014.05/arm-none-linux-gnueabi/libc/usr/include/linux/version.h

3. System configuration

Configuration as shown;
Customization of username, password, and welcome message;

4. Compile (make)

After compilation, the root file system is under output/images/ in the buildroot root directory;

3. Start porting Qt4.8.7

The installation of source code generally consists of three steps: configure, compile, and install.

1. Download the source code and unzip it

# Download source code
wget https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz

# Unzip the source code
tar -xvf qt-everywhere-opensource-src-4.8.7.tar.gz

2. Modify qmake.conf

# Enter the Qt source code root directory and modify qmake.conf
vi mkspecs/linux-arm-gnueabi-g + + /qmake.conf

Just change it to your own tool chain prefix

3. Configuration

Execute in the source code root directory

./configure -release -xplatform linux-arm-gnueabi-g + + -prefix /opt/qt4.8.7_armlib -opensource -confirm-license -qt-sql-sqlite -qt-gfx-linuxfb -plugin-sql -sqlit -no-qt3support -no-phonon -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -no-declarative-debug -qt-zlib -no-gif -qt-libtiff -qt-libpng -no-libmng -qt-libjpeg -no-rpath -no-pch -no-3dnow -no-avx -no-neon -no-openssl -no-nis -no-cups -no -dbus -embedded arm -platform linux-g++ -little-endian -qt-freetype -no-opengl -no-glib -nomake demos -nomake examples -nomake docs

-release: compile the release version of Qt;
-xplatform: The following linux-arm-gnueabi-g++ is the path, so this points to the configuration directory of the cross-compilation tool chain. The tool chain used later when compiling Qt source code will go to mkspecs/linux-arm-gnueabi- Read the configuration file under g++/, which is the qmake.conf just modified; [Personal understanding]
-platform: Not added here because the default is linux-g++. This should not be confused with the one above. This is used to compile qmake, because you need to use qmake to generate Qt projects and Makefiles. In fact, it is to specify your cross-compilation platform. Host, simply put, is the platform for you to write and compile programs; [Quoting other people’s original words]
-prefix: Specify the installation directory;
-opensource: compile the open source version of Qt;

4. Compile (make)

Execute in the source code root directory

make -jx # x depends on your cpu

5. Install (make install)

Execute in the source code root directory

make install

After the installation is completed, you can check it in the specified installation directory. Later, you need to copy the entire qt4.8.7_armlib folder to the /opt/ directory under the board;

Insert: The process of compiling Qt applications is: copy the entire program to the virtual machine, use qmake in the Qt installation directory to generate the Makefile, and then execute the make compiler program;
However, qmake is in the bin directory of the Qt installation directory;

#qmake Generate Makefile example
/opt/qt4.8.7_armlib/bin/qmake xxx.pro

6. Copy qt4.8.7_armlib to the board

I used an SD card to boot, because the flash of the Lychee Pi nano is not enough to hold the root file system of the current size;
Therefore, when copying the root file system to the second partition of the SD card, copy /opt/qt4.8.7_armlib to the /opt/ directory of the new root file system;
Please refer to this article for how to boot the SD card;

4. Start testing

1. Just put the entire simple Qt program into a virtual machine. Mine is this:

2. Execute qmake in the project directory

# qmake in the Qt installation directory
/opt/qt4.8.7_armlib/bin/qmake xxx.pro

3. make compiler

# You will see that there is an extra Makefile after qmake.
# Make directly
make

4. Copy the project to the board and execute it. Add -qws when executing.

Run successfully!

5. Error reporting

Of course, I didn’t succeed the first time;

Error 1

QLock::QLock: Cannot create semaphore /tmp/qtembedded-0/QtEmbedded-0 'd' (38, Function not implemented)
Cannot get display lock

If a similar error occurs, please recompile the Linux kernel and replace it. The kernel needs to check:
General setup > System V IPC

Error 2

./xxx: not found

When this kind of error occurs, there is a high probability that the tool chains used to compile buildroot and compile Qt applications are different; my initial mistake was this, and it took me a long time; if you don’t follow this article Yes, then you can try to use an external cross-compilation tool chain when compiling buildroot, and specify the same tool chain for compiling Qt source code, and finally compile the Qt application using the same tool chain; instead of using the built-in buildroot Tool chain, then use buildroot’s built-in tool chain to compile Qt source code and compile Qt applications; this is for f1c100s;

6. Summary

The above is my personal understanding. If there is any vague explanation of terms or wrong interpretation of concepts, please correct me! Please also ask questions and discuss them together!
Key reference articles are listed here:
1. Run the QT build process on linux of f1c100S (lichepi_nano)
2. Allwinner F1C100s usage record: u-boot & linux & rootfs compilation and burning test (based on SD card)
3. Cross compile tslib and QT4.8.7 with embedded V3s, and use Qt Creator to compile the project

syntaxbug.com © 2021 All Rights Reserved.