<Spec>

  • Ubuntu : ubuntu-18.04.5-desktop-amd64
  • QT version : v4.8.7
  • Cross Compile : gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf
  • TSlib version : v1.22
  • buildroot version : 2021.05.x

이번에는 TSlib 빌드 + QT4 build 하도록 하겠다.

 

tslib와 함께 QT4를 빌드해야 하기 때문에 tslib먼저 빌드 후 QT4를 빌드하도록 하겠다.

<5-1. STM32mp buildroot(Filesystem) + QT4 라이브러리 빌드>에서 생성된 Toolchain을 계속해서 사용한다.

$ pwd
/home/whatmam/STM

 

1. tslib 설치 및 압축 풀기

$ sudo apt-get install m4 autoconf libtool git lib32z1 lib32ncurses5

필요한 package 설치

$ git clone https://github.com/libts/tslib
$ cd tslib

 

2. tslib build

$ mkdir output
$ ./autogen.sh
$ ./configure CC=${PWD}/../Toolchain/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc --host=arm-linux-gnueabihf --prefix=${PWD}/output
$ make
$ make install

 

3. output 확인

$ tree -L 2 output/
output/
├── bin
│   ├── ts_calibrate
│   ├── ts_conf
│   ├── ts_finddev
│   ├── ts_harvest
│   ├── ts_print
│   ├── ts_print_mt
│   ├── ts_print_raw
│   ├── ts_test
│   ├── ts_test_mt
│   ├── ts_uinput
│   └── ts_verify
├── etc
│   └── ts.conf
├── include
│   └── tslib.h
├── lib
│   ├── libts.la
│   ├── libts.so -> libts.so.0.10.4
│   ├── libts.so.0 -> libts.so.0.10.4
│   ├── libts.so.0.10.4
│   ├── pkgconfig
│   └── ts
└── share
    └── man

 

$ file output/bin/ts_calibrate

output 중 임의의 생성된 파일의 정보를 읽어 제대로 빌드되었는지 확인한다.

 

4. QT4 설치 및 압축 풀기

$ wget https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
$ tar -xvf qt-everywhere-opensource-src-4.8.7.tar.gz
$ cd qt-everywhere-opensource-src-4.8.7

 

5. qmake.conf 생성

$ cp -rfvp mkspecs/qws/linux-arm-gnueabi-g++ mkspecs/qws/linux-arm-gnueabihf-g++
$ vi mkspecs/qws/linux-arm-gnueabihf-g++/qmake.conf
#
# qmake configuration for building with arm-none-linux-gnueabi-g++
#

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = ${CROSS_COMPILE}-gcc
QMAKE_CXX               = ${CROSS_COMPILE}-g++
QMAKE_LINK              = ${CROSS_COMPILE}-g++
QMAKE_LINK_SHLIB        = ${CROSS_COMPILE}-g++

# modifications to linux.conf
QMAKE_AR                = ${CROSS_COMPILE}-ar cqs
QMAKE_OBJCOPY           = ${CROSS_COMPILE}-objcopy
QMAKE_STRIP             = ${CROSS_COMPILE}-strip

QMAKE_CXXFLAGS          += $$QMAKE_CFLAGS
QMAKE_INCDIR            += ${TSLIB_OUTPUT}/include
QMAKE_LIBDIR            += ${TSLIB_OUTPUT}/lib
QMAKE_LFLAGS            += -Wl,-rpath-link,${TSLIB_OUTPUT}/lib

load(qt_config)

qmake.conf 작성 시 띄어쓰기에서도 빌드 에러를 유발하기에 유의해서 작성해야 함.

Toolchain에 따라 error가 다르기 때문에 필요한 configure를 qmake.conf에 추가해줘야 한다.

 

6. QT4 build

$ export CROSS_COMPILE=${PWD}/../Toolchain/gcc-linaro-7.5.0-2019.12-i686_arm-linux-gnueabihf/bin/arm-linux-gnueabihf
$ export TSLIB_OUTPUT=${PWD}/../tslib/output
$ ./configure --prefix=${PWD}/output -embedded arm -xplatform qws/linux-arm-gnueabihf-g++ -release -little-endian -host-little-endian -opensource -confirm-license -no-largefile -no-accessibility -no-qt3support -no-multimedia -no-audio-backend -no-phonon -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -no-pch -no-declarative-debug -qt-zlib -qt-libpng -qt-libjpeg -no-nis -no-cups -nomake demos -qt-gfx-transformed -qt-mouse-tslib
		OR
$ ./configure --prefix=${PWD}/output -embedded arm -xplatform qws/linux-arm-gnueabihf-g++ -little-endian -nomake examples -nomake demos -qt-mouse-tslib

$ make 
$ make install

간단하게 옵션을 정리해 본다.

  • --prefix                                               : 옵션 지정된 타깃 보드에 맞춰 qmake 저장될 위치
  • -xplatform qws/linux-arm-gnueabihf-g++   : 전 단계에서 크로스 컴파일러로 수정해준  qws/linux-arm-gnueabihf-g++ 디렉터리에 qmake.conf 파일을 참조하라는 옵션
  • -embedded arm                                    : arm코어 기반의 옵션
  • -little-endian                                        : 타깃 플랫폼이 little endian (LSB first)
  • -nomake examples                                : 예제 제외하고 컴파일
  • -nomake demos                                    : 데몬 제외하고 컴파일

(-nomake examples demos는 빌드 시간 단축을 위해 사용하기로 한다.)
  그 이외에 따로 필요한 경우 , 각종 이미지나 라이브러리에 관련된 옵션 추가한다..

 

7. output 확인

$ tree -L 1 output/
├── bin
├── examples
├── include
├── lib
├── mkspecs
├── plugins
└── translations

qmake와 QT4 라이브러리들을 확인한다.

 

8. Buildroot Filesystem으로 QT4 lib, tslib Copy

먼저 buildroot가 설치된 microSD card PC에 연결하여 mount 시킨다.

$ sudo cp -rfvp ${HOME}/STM/qt-everywhere-opensource-src-4.8.7/output /media/whatmam/rootfs/lib/QT4.8.7
$ sudo cp -rfvp ${HOME}/STM/tslib/output /media/whatmam/rootfs/lib/tslib_1.22
$ sudo chown -Rh root:root /media/whatmam/*
$ umount /media/whatmam/*

현재는 확인을 위해 output 파일을 통째로 넣었지만 추후에 Filesystem 간소화를 위해 필요 없는 파일을 제거하자.

 

 

9. Target Board에서 QT4 examples 실행하여 확인

$ export QT_QWS_FONTDIR='/lib/QT4.8.7/lib/fonts'
$ export LD_LIBRARY_PATH=':/lib/QT4.8.7/lib:/lib/tslib_1.22/lib'
$ export TSLIB_PLUGINDIR='/lib/tslib_1.22/lib/ts'
$ export TSLIB_TSDEVICE='/dev/input/event1'
$ export QWS_MOUSE_PROTO='tslib:/dev/input/event1'
$ export TSLIB_CALIBFILE='/etc/pointercal'
$ export TSLIB_CONFFILE='/lib/tslib_1.22/etc/ts.conf'
$ /lib/QT4.8.7/examples/dialogs/classwizard/classwizard -qws

다음과 같이 필요한 환경 변수를 설정해 주고 QT4예제를 실행시켜서 확인한다.

 

 

QScreenLinuxFb::connect: No such file or directory
Error opening framebuffer device /dev/fb0

 

yocto의 kernel에서는 프레임 버퍼를 더 이상 사용하지 않는다. 

yocto에서는 DRM/KMS (wayland) (/dev/dri/card0)

yocto kernel에서 프레임 버퍼를 활성화시켜 확인할 수 있다. (/dev/fb0)

 

 

kernel defconfig에 DRM_FBDEV_EMULATION=y 추가

 

yocto Filesystem에서 확인할 때는  weston 종료 후 실행하여 확인한다.

$ weston.sh stop

 

'STM32' 카테고리의 다른 글

7. STM32CubeProgrammer  (0) 2021.07.26
6. STM32mp157 Basic mode  (0) 2021.07.23
5-1. STM32mp buildroot(Filesystem) + QT4 라이브러리 빌드  (0) 2021.07.20
4. STM32mp157 u-boot 분석  (0) 2021.07.20
3. STM32mp157 eMMC Booting  (1) 2021.07.19

+ Recent posts