使用环境:Linux klppc-virtual-machine 4.15.0-112-generic #113~16.04.1-Ubuntu SMP Fri Jul 10 04:37:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
1.执行命令
sudo apt-get update
sudo apt-get upgrade
2.安装arm-linux-gnueabihf-gcc
1.下载编译器
链接:https://pan.baidu.com/s/1rx7fcxSVteAs3VR-Oj4_KA?pwd=djmq
提取码:djmq
2.安装vim
sudo apt-get install vim
3.mkdir ~/armgcc
sudo vim .bashrc
在末尾添加:
export PATH=$PATH:/home/klppc/armgcc/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/bin
4.使生效
source ~/.bashrc
3.安装git
sudo apt-get install git
4.下载编译uboot
git clone https://gitee.com/already_use/lichee-pi_u-boot.git -b v3s-current
cd lichee-pi_u-boot/
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_480x272LCD_defconfig
1.以下三个配置选一个
LicheePi_Zero_480x272LCD_defconfig
LicheePi_Zero_800x480LCD_defconfig
LicheePi_Zero_defconfig
sudo apt-get install libncurses5-dev
sudo apt-get install device-tree-compiler
time make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4
5.下载编译linux
1.安装依赖: sudo apt install git wget make gcc flex bison libssl-dev bc kmod
2.下载linux: git clone -b zero-5.2.y --depth 1 https://github.com/Lichee-Pi/linux.git
3.或者百度网盘:
链接:https://pan.baidu.com/s/1o5WoadnUgv6qvwwifd30cQ?pwd=hki6
提取码:hki6
4.修改Makefile
cd linux
vim Makefile
[364]ARCH = arm
[365]CROSS_COMPILE = arm-linux-gnueabihf-
[366]INSTALL_MOD_PATH = out
make licheepi_zero_defconfig
make -j4
make -j4 modules
make modules_install
make dtbs
6.安装根文件系统
1.安装依赖:
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get install libncurses5-dev
sudo apt-get install wget
sudo apt-get install gcc automake autoconf libtool make
2.下载buildroot
wget https://buildroot.org/downloads/buildroot-2017.08.tar.gz
3.解压编译
tar -xvf buildroot-2017.08.tar.gz
cd buildroot-2017.08
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
4.配置系统架构
│ ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ Target Architecture (ARM (little endian)) ---> │ │
│ │ Target Binary Format (ELF) ---> │ │
│ │ Target Architecture Variant (cortex-A7) ---> │ │
│ │ Target ABI (EABIhf) ---> │ │
│ │ Floating point strategy (VFPv4) ---> │ │
│ │ ARM instruction set (ARM) --->
5.配置外部工具链
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ Toolchain type (External toolchain) ---> │ │
│ │ *** Toolchain External Options *** │ │
│ │ Toolchain (Custom toolchain) ---> │ │
│ │ Toolchain origin (Pre-installed toolchain) ---> │ │
│ │ () Toolchain path (NEW) │ │
│ │ ($(ARCH)-linux-gnueabihf) Toolchain prefix │ │
│ │ External toolchain gcc version (6.x) ---> │ │
│ │ External toolchain kernel headers series (4.6.x) ---> │ │
│ │ External toolchain C library (glibc/eglibc) ---> │ │
│ │ [*] Toolchain has SSP support? (NEW) │ │
│ │ [*] Toolchain has RPC support? (NEW) │ │
│ │ [*] Toolchain has C++ support? │ │
│ │ () Extra toolchain libraries to be copied to target (NEW) │ │
│ │ [ ] Copy gdb server to the Target (NEW) │ │
│ │ *** Host GDB Options *** │ │
│ │ [ ] Build cross gdb for the host │ │
│ │ *** Toolchain Generic Options *** │ │
│ │ [ ] Copy gconv libraries (NEW) │ │
│ │ [*] Enable MMU support │ │
│ │ () Target Optimizations │ │
│ │ () Target linker options │ │
│ │ [ ] Register toolchain within Eclipse Buildroot plug-in
6.安装依赖:
sudo apt-get install g++ patch cpio python unzip rsync bc
7.编译:make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4
生成的根文件系统在 /nfsroot/buildroot-2017.08/output/images/rootfs.tar
8.系统烧写
1.TF卡分区:使用gparted 分为三个区
第一个预留1M字节烧写uboot
dd if=/dev/sdb of=u-boot-sunxi-with-spl.bin bs=1024 seek=8
第二个fat16 100M 存放设备树 boot.scr zImage
直接在linux里拷贝
第三个ext2 解压根文件系统到这
直接解压到这里
注意:boot.scr找不到直接下载buildroot22里面整体构建生成的
经过修改:
注意打印串口为0
mkimage -A arm -T script -O linux -d boot.txt boot.scr
9.qt5.12.12移植
1.安装依赖:
sudo apt-get install lsb-core lib32stdc++6
sudo apt-get update
sudo apt-get install autoconf automake libtool
2.下载tslib
git clone https://github.com/kergoth/tslib
tar -xvf tslib
cd tslib
mkdir armtslib
3.编译tslib
./configure --host=arm-linux-gnueabihf ac_cv_func_malloc_0_nonnull=yes --cache-file=arm-linux.cache -prefix=/nfsroot/armtslib
make
make install
4.修改qt的qmake
1.mkdir qtinstall
2.修改 /nfsroot/qt-everywhere-src-5.12.12/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
QMAKE_CXXFLAGS += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = arm-linux-gnueabihf-gcc
QMAKE_CXX = arm-linux-gnueabihf-g++
QMAKE_LINK = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++
# modifications to linux.conf
QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_NM = arm-linux-gnueabihf-nm -P
QMAKE_STRIP = arm-linux-gnueabihf-strip
load(qt_config)
5.配置qt
./configure -prefix /nfsroot/qtinstall \
-opensource \
-confirm-license \
-release \
-strip \
-shared \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-c++std c++11 \
--rpath=no \
-pch \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdoc \
-skip qtgamepad \
-skip qtlocation \
-skip qtmacextras \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtwayland \
-skip qtwebengine \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-make libs \
-make examples \
-nomake tools -nomake tests \
-gui \
-widgets \
-dbus-runtime \
--glib=no \
--iconv=no \
--pcre=qt \
--zlib=qt \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
-linuxfb \
--xcb=no \
-tslib \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-I/nfsroot/armtslib/include \
-L/nfsroot/armtslib/lib \
-recheck-all
6.编译qt
make -j4
make install
7.移植qt
移动 armtslib qtinstall 到根文件系统的 usr/lib
复制编译器的库 /home/klppc/armgcc/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/lib 到usr/lib
在 /etc/profile添加:
export TSLIB_ROOT=/usr/lib/armtslib
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export LD_PRELOAD=$TSLIB_ROOT/lib/libts.so
export QT_ROOT=/usr/lib/qtinstall
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event1
export QT_QPA_FONTDIR=/usr/share/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms
export QML2_IMPORT_PATH=$QT_ROOT/qml
export QT_QPA_FB_TSLIB=1
启动示例:
./usr/lib/qtinstall/examples/widgets/animation/animatedtiles
固件链接:
链接:https://pan.baidu.com/s/1WZjVKzG9Hbo_xQWDZZ-8IQ?pwd=vc33
提取码:vc33
linux+uboot+buildroot+qt+tslib软件包链接:
链接:https://pan.baidu.com/s/1ZR1l_q33wrDT8xiYcWWAIw?pwd=bgsx
提取码:bgsx
注:链接中使用的linux4.13.y这个内核版本驱动比较全面,建议使用sun8i-v3s-licheepi-zero-dock.dtb这个设备树文件,以上需要编译的软件包已经配置好,直接make即可,qt和tslib怎么放和怎么设置环境变量请参考【正点原子】I.MX6U移植Qt5.12.9_V1.1.pdf。
参考资料:【正点原子】I.MX6U移植Qt5.12.9_V1.1.pdf