Commit 3f51be44 authored by Sami Nurmenniemi's avatar Sami Nurmenniemi

Build using artik rootfs

parent 2c4d6f0c
# Docker file for building qt for Artik530.
# See https://developer.artik.io/documentation/developer-guide/multimedia/qt5-530.html
FROM ubuntu:16.04
ARG USERID=1000
ARG SYSROOTDIR=/home/builder/artik530_sysroot
WORKDIR /home/builder
# Enable armhf packages
# - sources.list enables source and armhf repositories
RUN dpkg --add-architecture armhf
ADD target_files/sources.list /etc/apt/sources.list
# Enable source packages and update system to the latest
RUN sed -Ei 's/^# deb-src/deb-src/' /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get update
# Get required packages. It takes long time, so do it here so that
# modifying the rest of this file does not take that long
RUN apt install -y wget
# Install required packages. See https://wiki.qt.io/Building_Qt_5_from_Git
RUN apt-get install -y \
crossbuild-essential-armhf \
freetds-dev:armhf \
libasound2-dev:armhf \
libdbus-1-dev:armhf \
libegl1-mesa-dev:armhf \
libgles2-mesa-dev:armhf \
libgstreamer1.0-dev:armhf \
libgstreamer-plugins-base1.0-dev:armhf \
libglu1-mesa-dev:armhf \
libharfbuzz-dev:armhf \
libicu-dev:armhf \
libjpeg-dev:armhf \
libmysqlclient-dev:armhf \
libpng16-dev:armhf \
libpq-dev:armhf \
libsqlite3-dev:armhf \
libssl-dev:armhf \
libx11-xcb-dev:armhf \
libxcb-xinerama0-dev:armhf \
libxi-dev:armhf \
libxrender-dev:armhf \
binutils \
bison \
bzip2 \
flex \
gcc \
g++ \
gdb \
git \
pax \
pkg-config \
python \
python2.7-dev \
texinfo \
unzip \
xz-utils
RUN apt-get clean
qemu-user-static \
crossbuild-essential-armhf \
fakechroot \
libc6-i386 \
wget \
gperf
RUN apt build-dep qt5-default -y
RUN apt clean
# Create the build user
RUN useradd -u $USERID builder
# Add files needed for building and change their ownership
ADD /target_files/prepare_artik_qt5.sh /home/builder
ADD /target_files/configure_artik_qt5.sh /home/builder
ADD /target_files/build_artik_qt5.sh /home/builder
ADD /target_files/0001-qtbase-mkspec-add-artik-device-conf.patch /home/builder
RUN chown -R builder:builder /home/builder
# Change to correct user and build dir. Build must be exposed from the
......
#!/bin/bash
# Deploy qt5 to Artik530 device
# Give target device IP address as an argument
set -eu
function print_usage() {
echo "./deploy_to_device.sh IP_ADDR"
}
if [ $# -ne 1 ]
then
print_usage
exit -1
fi
IP_ADDR=$1
rsync -rtvl ../build/qt5_install/ root@$IP_ADDR:/qt5
......@@ -2,7 +2,7 @@
set -eu
function print_usage() {
echo "./docker_exec.sh \"configure|build|debug|debugroot\""
echo "./docker_exec.sh \"prepare|configure|build|debug|debugroot\""
}
if [ $# -ne 1 ]
......@@ -11,7 +11,11 @@ then
exit -1
fi
if [ "$1" = "configure" ]
if [ "$1" = "prepare" ]
then
docker run -it --user root -v $PWD/../build:/home/builder/build artik_qt_builder ../prepare_artik_qt5.sh
exit 0
elif [ "$1" = "configure" ]
then
DOCKER_CMD=../configure_artik_qt5.sh
elif [ "$1" = "build" ]
......
#!/bin/bash
# Setup Artik530 device
# Give target device IP address as an argument
set -eu
function print_usage() {
echo "./setup_device.sh IP_ADDR"
}
if [ $# -ne 1 ]
then
print_usage
exit -1
fi
if [ ! -e "qt-ubuntu-32bit.zip" ]
then
echo "Please download qt-ubuntu-32bit.zip from https://developer.artik.io/downloads/qt-ubuntu-32bit/download"
echo "and place it in $PWD"
exit -1
fi
IP_ADDR=$1
echo "Preparing Artik 530 device."
echo "If you don't want to input ssh password several times, do following"
echo "ssh root@$IP_ADDR \"mkdir .ssh; chmod 700 .ssh\""
echo "scp ~/.ssh/id_rsa.pub root@$IP_ADDR:.ssh/authorized_keys"
echo "ssh root@$IP_ADDR \" chmod 600 .ssh/authorized_keys"
echo "Updating Artik 530"
ssh root@$IP_ADDR "apt update; apt upgrade -y; apt install -y rsync"
echo "Setting Qt environment"
scp target_files/kms.json root@$IP_ADDR
ssh root@$IP_ADDR "echo export QT_QPA_PLATFORM=eglfs >> /etc/profile"
ssh root@$IP_ADDR "echo export QT_QPA_EGLFS_KMS_CONFIG=~/kms.json >> /etc/profile"
ssh root@$IP_ADDR "echo export LD_LIBRARY_PATH=/qt5/lib/ >> /etc/profile"
ssh root@$IP_ADDR "echo export QT_PLUGIN_PATH=/qt5/plugins >> /etc/profile"
echo "Deploying graphics binaries"
unzip qt-ubuntu-32bit.zip -d qt-ubuntu-32bit
scp qt-ubuntu-32bit/* root@$IP_ADDR:
ssh root@$IP_ADDR "rm libdrm-dev*.deb"
ssh root@$IP_ADDR "dpkg --remove --force-depends libdrm-dev:armhf"
ssh root@$IP_ADDR "apt install -y libdrm-dev; apt upgrade -y"
ssh root@$IP_ADDR "dpkg -i libwayland*.deb"
From 49b4238a8ea3512981b6164de0ba463f78fea55a Mon Sep 17 00:00:00 2001
From: Chanho Park <chanho61.park@samsung.com>
Date: Sat, 11 Nov 2017 03:01:43 +0900
Subject: [PATCH] qtbase: mkspec: add artik device conf
This patch adds artik device configurations for artik710(aarch64) and
artik530(armhf).
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
---
.../devices/linux-artik-aarch64-g++/qmake.conf | 27 ++++++++++++++++++++
.../linux-artik-aarch64-g++/qplatformdefs.h | 1 +
.../mkspecs/devices/linux-artik530-g++/qmake.conf | 29 ++++++++++++++++++++++
.../devices/linux-artik530-g++/qplatformdefs.h | 1 +
4 files changed, 58 insertions(+)
create mode 100644 qtbase/mkspecs/devices/linux-artik-aarch64-g++/qmake.conf
create mode 100644 qtbase/mkspecs/devices/linux-artik-aarch64-g++/qplatformdefs.h
create mode 100644 qtbase/mkspecs/devices/linux-artik530-g++/qmake.conf
create mode 100644 qtbase/mkspecs/devices/linux-artik530-g++/qplatformdefs.h
diff --git a/qtbase/mkspecs/devices/linux-artik-aarch64-g++/qmake.conf b/qtbase/mkspecs/devices/linux-artik-aarch64-g++/qmake.conf
new file mode 100644
index 000000000000..22a5476a7150
--- /dev/null
+++ b/qtbase/mkspecs/devices/linux-artik-aarch64-g++/qmake.conf
@@ -0,0 +1,27 @@
+include(../common/linux_device_pre.conf)
+QT_QPA_DEFAULT_PLATFORM = eglfs
+
+QMAKE_INCDIR += \
+ $$[QT_SYSROOT]/usr/include
+
+QMAKE_LIBDIR += \
+ $$[QT_SYSROOT]/usr/lib \
+ $$[QT_SYSROOT]/lib/aarch64-linux-gnu \
+ $$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu
+
+QMAKE_LFLAGS += \
+ -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \
+ -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \
+ -Wl,-rpath-link,$$[QT_SYSROOT]/lib/aarch64-linux-gnu
+
+QMAKE_LIBS += -lrt -lpthread -ldl
+
+DISTRO_OPTS += aarch64
+QMAKE_CFLAGS += -march=armv8-a -mtune=cortex-a53
+
+EGLFS_DEVICE_INTEGRATION = eglfs_kms
+QMAKE_INCDIR_EGL += $$[QT_SYSROOT]/usr/include
+QMAKE_LIBS_EGL += -lEGL -lGLESv2
+QMAKE_LIBS_OPENGL_ES2 += $${QMAKE_LIBS_EGL}
+
+load(qt_config)
diff --git a/qtbase/mkspecs/devices/linux-artik-aarch64-g++/qplatformdefs.h b/qtbase/mkspecs/devices/linux-artik-aarch64-g++/qplatformdefs.h
new file mode 100644
index 000000000000..99e9a2792329
--- /dev/null
+++ b/qtbase/mkspecs/devices/linux-artik-aarch64-g++/qplatformdefs.h
@@ -0,0 +1 @@
+#include "../../linux-g++/qplatformdefs.h"
diff --git a/qtbase/mkspecs/devices/linux-artik530-g++/qmake.conf b/qtbase/mkspecs/devices/linux-artik530-g++/qmake.conf
new file mode 100644
index 000000000000..19f98363bf63
--- /dev/null
+++ b/qtbase/mkspecs/devices/linux-artik530-g++/qmake.conf
@@ -0,0 +1,29 @@
+include(../common/linux_device_pre.conf)
+QT_QPA_DEFAULT_PLATFORM = eglfs
+
+QMAKE_INCDIR += \
+ $$[QT_SYSROOT]/usr/include
+
+QMAKE_LIBDIR += \
+ $$[QT_SYSROOT]/usr/lib \
+ $$[QT_SYSROOT]/lib/arm-linux-gnueabihf \
+ $$[QT_SYSROOT]/usr/arm-linux-gnueabihf
+
+QMAKE_LFLAGS += \
+ -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \
+ -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \
+ -Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabihf
+
+QMAKE_LIBS += -lrt -lpthread -ldl
+
+DISTRO_OPTS += hard-float
+QMAKE_CFLAGS +=-march=armv7-a -mcpu=cortex-a9 -mfpu=neon
+
+EGLFS_DEVICE_INTEGRATION = eglfs_kms
+QMAKE_INCDIR_EGL += $$[QT_SYSROOT]/usr/include
+QMAKE_LIBS_EGL += -lEGL -lGLESv2
+QMAKE_LIBS_OPENGL_ES2 += $${QMAKE_LIBS_EGL}
+
+include(../common/linux_arm_device_post.conf)
+
+load(qt_config)
diff --git a/qtbase/mkspecs/devices/linux-artik530-g++/qplatformdefs.h b/qtbase/mkspecs/devices/linux-artik530-g++/qplatformdefs.h
new file mode 100644
index 000000000000..99e9a2792329
--- /dev/null
+++ b/qtbase/mkspecs/devices/linux-artik530-g++/qplatformdefs.h
@@ -0,0 +1 @@
+#include "../../linux-g++/qplatformdefs.h"
--
2.7.4
#!/bin/sh
JOBS=`nproc`
echo "Build qt5 for Artik 530"
cd qt5-build
make -j 4 && make -j 4 install
make -j $JOBS && make -j $JOBS install
#!/bin/sh
set -eu
INSTALLDIR=$PWD/qt5_install
TARGETDIR=/qt5
SYSROOTDIR=$PWD/artik530_sysroot
# Patch qt5
if [ ! -e qt5/qtbase/mkspecs/devices/linux-artik530-g++/qmake.conf ]
then
echo "Patching qt"
cd qt5
patch -p 1 < /home/builder/0001-qtbase-mkspec-add-artik-device-conf.patch
cd ..
fi
echo "Configure qt5 for Artik 530"
mkdir -p qt5-build
cd qt5-build
MAKEFLAGS="-j4" ../qt5/configure -confirm-license \
-extprefix "$INSTALLDIR" \
-prefix "$TARGETDIR" \
-sysroot "/" \
-device linux-arm-generic-g++ \
-device-option CROSS_COMPILE=arm-linux-gnueabihf- \
-device-option DISTRO_OPTS=hard-float \
-opensource \
-pkg-config \
-plugin-sql-mysql \
-plugin-sql-psql \
-plugin-sql-sqlite \
-no-sql-sqlite2 \
-plugin-sql-tds \
-system-sqlite \
-platform linux-g++ \
-system-zlib \
-system-libpng \
-system-libjpeg \
-openssl \
-no-rpath \
-verbose \
-optimized-qmake \
-dbus-runtime \
-no-strip \
-no-separate-debug-info \
-qpa xcb \
-xcb \
-glib \
-icu \
-accessibility \
-compile-examples \
-no-directfb \
-gstreamer 1.0 \
-no-sql-ibase \
-nomake examples \
-nomake tools \
-opengl es2
MAKEFLAGS="-j`nproc`" ../qt5/configure \
-v \
-confirm-license \
-opensource \
-release \
-shared \
-accessibility \
-glib \
-optimized-qmake \
-no-pch \
-system-sqlite \
-no-directfb \
-opengl es2 \
-eglfs \
-kms \
-skip qtwebengine \
-sysroot $SYSROOTDIR \
-device linux-artik530-g++ \
-device-option CROSS_COMPILE=arm-linux-gnueabihf- \
-no-use-gold-linker \
-prefix /usr/local/qt5 \
-extprefix "$INSTALLDIR" \
-make libs
{
"device": "/dev/dri/card0",
"hwcursor": false,
"outputs": [
{
"name": "LVDS1",
"mode": "1024x600"
},
{
"name": "UNKNOWN1",
"mode": "1080x1920"
},
{
"name": "HDMI1",
"mode": "1920x1080"
}
]
}
#!/bin/sh
set -eu
SYSROOTDIR=$PWD/artik530_sysroot
# This script needs to be run as root for chroot to work correctly.
echo "Downloading Artik 530 sysroot"
#wget https://github.com/SamsungARTIK/ubuntu-build-service/releases/download/release%2FA530_os_3.3.0/ubuntu-arm-artik530-rootfs-0530GC0F-44U-DD60-20180406.010001-dccbb9d00a8aa1eade1a5604ee0cd7e7.tar.gz
wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py
chmod +x sysroot-relativelinks.py
echo "Setting up Artik 530 sysroot"
rm -rf $SYSROOTDIR
mkdir -p $SYSROOTDIR
fakeroot tar xf ubuntu-arm-artik530-rootfs-0530GC0F-44U-DD60-20180406.010001-dccbb9d00a8aa1eade1a5604ee0cd7e7.tar.gz -C $SYSROOTDIR
cp /usr/bin/qemu-arm-static $SYSROOTDIR/usr/bin
cp /etc/resolv.conf $SYSROOTDIR/etc/resolv.conf
chroot $SYSROOTDIR apt update
chroot $SYSROOTDIR locale-gen en_US.UTF-8
chroot $SYSROOTDIR apt install -y build-essential libfreetype6-dev
chroot $SYSROOTDIR apt build-dep -y qt5-default
./sysroot-relativelinks.py $SYSROOTDIR
apt update
locale-gen en_US.UTF-8
apt install build-essential libfreetype6-dev
apt build-dep qt5-default
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment