summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2016-11-08 16:23:29 +0200
committerKari Oikarinen <kari.oikarinen@qt.io>2016-11-10 09:49:41 +0000
commit2f5230bc3e92e1b31e90be9812581ae3997b8a27 (patch)
tree8ddc17ae59281dcd5c3fcf9c17c2537bbd305180
parent24a9325d9b81f4aa37f8b5814527d3c170529c18 (diff)
downloadmeta-boot2qt-2f5230bc3e92e1b31e90be9812581ae3997b8a27.tar.gz
Add qdbd to the images
It's only included in internal builds, since the repository is not public. qdbd not started by default, ADB is still the default. It can be started with `systemctl start qdbd`. It can be started in future boots with `systemctl enable qdbd`. Task-number: QTBUG-56069 Change-Id: I71340cdb31de823e1375986d34f2f07e7be5971b Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
-rw-r--r--classes/internal-build.bbclass1
-rw-r--r--recipes-qt/b2qt-addons/qdbd.bb79
-rw-r--r--recipes-qt/b2qt-addons/qdbd/defaults3
-rwxr-xr-xrecipes-qt/b2qt-addons/qdbd/qdbd-init.sh117
-rw-r--r--recipes-qt/b2qt-addons/qdbd/qdbd.service13
-rw-r--r--recipes-qt/packagegroups/packagegroup-b2qt-embedded-addons.bb1
6 files changed, 214 insertions, 0 deletions
diff --git a/classes/internal-build.bbclass b/classes/internal-build.bbclass
index ecee863..ffd38c1 100644
--- a/classes/internal-build.bbclass
+++ b/classes/internal-build.bbclass
@@ -34,6 +34,7 @@ python enable_internal_build () {
34 except: 34 except:
35 return 35 return
36 36
37 e.data.setVar('ENABLE_QDBD', "1")
37 e.data.setVar('ENABLE_QTQUICKCOMPILER', "1") 38 e.data.setVar('ENABLE_QTQUICKCOMPILER', "1")
38 e.data.setVar('SSTATE_MIRRORS', "file://.* http://yocto-cache.ci.local/sstate-caches/${DISTRO_CODENAME}/PATH") 39 e.data.setVar('SSTATE_MIRRORS', "file://.* http://yocto-cache.ci.local/sstate-caches/${DISTRO_CODENAME}/PATH")
39 e.data.setVar('PREMIRRORS', "\ 40 e.data.setVar('PREMIRRORS', "\
diff --git a/recipes-qt/b2qt-addons/qdbd.bb b/recipes-qt/b2qt-addons/qdbd.bb
new file mode 100644
index 0000000..b1c9a0d
--- /dev/null
+++ b/recipes-qt/b2qt-addons/qdbd.bb
@@ -0,0 +1,79 @@
1############################################################################
2##
3## Copyright (C) 2016 The Qt Company Ltd.
4## Contact: https://www.qt.io/licensing/
5##
6## This file is part of the Boot to Qt meta layer.
7##
8## $QT_BEGIN_LICENSE:GPL$
9## Commercial License Usage
10## Licensees holding valid commercial Qt licenses may use this file in
11## accordance with the commercial license agreement provided with the
12## Software or, alternatively, in accordance with the terms contained in
13## a written agreement between you and The Qt Company. For licensing terms
14## and conditions see https://www.qt.io/terms-conditions. For further
15## information use the contact form at https://www.qt.io/contact-us.
16##
17## GNU General Public License Usage
18## Alternatively, this file may be used under the terms of the GNU
19## General Public License version 3 or (at your option) any later version
20## approved by the KDE Free Qt Foundation. The licenses are as published by
21## the Free Software Foundation and appearing in the file LICENSE.GPL3
22## included in the packaging of this file. Please review the following
23## information to ensure the GNU General Public License requirements will
24## be met: https://www.gnu.org/licenses/gpl-3.0.html.
25##
26## $QT_END_LICENSE$
27##
28############################################################################
29
30DESCRIPTION = "Qt Debug Bridge Daemon"
31SECTION = "devel"
32LICENSE = "The-Qt-Company-DCLA-2.1"
33LIC_FILES_CHKSUM = "file://qdbd/main.cpp;md5=37093977d3f09e6366def8955c8c71e6;beginline=1;endline=18"
34
35inherit qmake5
36
37SRC_URI = "git://codereview.qt-project.org/tqtc-boot2qt/qdb;branch=${BRANCH};protocol=ssh \
38 file://defaults \
39 file://qdbd.service \
40 file://qdbd-init.sh \
41 "
42
43SRCREV = "02a7d1ab030b83feb3300df5149b9ec0518975f4"
44BRANCH = "master"
45PV = "0.1+git${SRCPV}"
46
47DEPENDS = "qtbase"
48RRECOMMENDS_${PN} += "kernel-module-usb-f-fs kernel-module-usb-f-rndis"
49
50S = "${WORKDIR}/git"
51
52EXTRA_QMAKEVARS_PRE = "CONFIG+=daemon_only"
53
54do_configure_append() {
55 if [ -n "${ADB_PRODUCTID}" ]; then
56 sed -i -e 's/PRODUCT=.*/PRODUCT=${ADB_PRODUCTID}/' ${WORKDIR}/defaults
57 fi
58}
59
60do_install_append() {
61 install -m 0755 ${WORKDIR}/qdbd-init.sh ${D}${bindir}/
62 install -m 0755 -d ${D}${sysconfdir}/init.d
63 ln -s ${bindir}/qdbd-init.sh ${D}${sysconfdir}/init.d/
64
65 install -m 0755 -d ${D}${systemd_unitdir}/system
66 install -m 0644 ${WORKDIR}/qdbd.service ${D}${systemd_unitdir}/system/
67
68 install -m 0755 -d ${D}${sysconfdir}/default
69 install -m 0644 ${WORKDIR}/defaults ${D}${sysconfdir}/default/qdbd
70}
71
72INITSCRIPT_NAME = "qdbd-init.sh"
73INITSCRIPT_PARAMS = "defaults 96"
74
75SYSTEMD_SERVICE_${PN} = "qdbd.service"
76# adbd is started by default instead of qdbd
77SYSTEMD_AUTO_ENABLE = "disable"
78
79inherit update-rc.d systemd
diff --git a/recipes-qt/b2qt-addons/qdbd/defaults b/recipes-qt/b2qt-addons/qdbd/defaults
new file mode 100644
index 0000000..1ff78fb
--- /dev/null
+++ b/recipes-qt/b2qt-addons/qdbd/defaults
@@ -0,0 +1,3 @@
1VENDOR=0x18d1
2PRODUCT=0x0000
3SERIAL=$(hostname)-$(sed -e 's/://g' /sys/class/net/eth0/address)
diff --git a/recipes-qt/b2qt-addons/qdbd/qdbd-init.sh b/recipes-qt/b2qt-addons/qdbd/qdbd-init.sh
new file mode 100755
index 0000000..446ea3f
--- /dev/null
+++ b/recipes-qt/b2qt-addons/qdbd/qdbd-init.sh
@@ -0,0 +1,117 @@
1#! /bin/sh
2###############################################################################
3## Copyright (C) 2016 The Qt Company Ltd.
4## Contact: http://www.qt.io/licensing/
5##
6## This file is part of the Boot to Qt meta layer.
7##
8## $QT_BEGIN_LICENSE:BSD$
9## You may use this file under the terms of the BSD license as follows:
10##
11## "Redistribution and use in source and binary forms, with or without
12## modification, are permitted provided that the following conditions are
13## met:
14## * Redistributions of source code must retain the above copyright
15## notice, this list of conditions and the following disclaimer.
16## * Redistributions in binary form must reproduce the above copyright
17## notice, this list of conditions and the following disclaimer in
18## the documentation and/or other materials provided with the
19## distribution.
20## * Neither the name of The Qt Company Ltd nor the names of its
21## contributors may be used to endorse or promote products derived
22## from this software without specific prior written permission.
23##
24##
25## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36##
37## $QT_END_LICENSE$
38###############################################################################
39MANUFACTURER="The Qt Company"
40PRODUCT_STRING="Boot2Qt Ethernet/RNDIS connection"
41
42DAEMON=/usr/bin/qdbd
43CONFIGFS_PATH=/sys/kernel/config
44
45GADGET_CONFIG=$CONFIGFS_PATH/usb_gadget/g1
46
47. /etc/default/qdbd
48
49function initialize_gadget() {
50 # Initialize gadget with first UDC driver
51 for driverpath in /sys/class/udc/*; do
52 drivername=`basename $driverpath`
53 echo "$drivername" > $GADGET_CONFIG/UDC
54 break
55 done
56}
57
58function disable_gadget() {
59 echo "" > $GADGET_CONFIG/UDC
60}
61
62case "$1" in
63start)
64 modprobe libcomposite
65 # Gadget configuration
66 mkdir -p $GADGET_CONFIG
67 echo $VENDOR > $GADGET_CONFIG/idVendor
68 echo $PRODUCT > $GADGET_CONFIG/idProduct
69 mkdir -p $GADGET_CONFIG/strings/0x409
70 echo $MANUFACTURER > $GADGET_CONFIG/strings/0x409/manufacturer
71 echo $PRODUCT_STRING > $GADGET_CONFIG/strings/0x409/product
72 echo ${SERIAL:0:32} > $GADGET_CONFIG/strings/0x409/serialnumber
73 mkdir -p $GADGET_CONFIG/configs/c.1/strings/0x409
74 echo "USB Ethernet + QDB" > $GADGET_CONFIG/configs/c.1/strings/0x409/configuration
75 mkdir -p $GADGET_CONFIG/functions/rndis.usb0
76 mkdir -p $GADGET_CONFIG/functions/ffs.qdb
77 ln -sf $GADGET_CONFIG/functions/rndis.usb0 $GADGET_CONFIG/configs/c.1
78 ln -sf $GADGET_CONFIG/functions/ffs.qdb $GADGET_CONFIG/configs/c.1
79 # Function fs mountpoints
80 mkdir -p /dev/usb-ffs
81 chmod 770 /dev/usb-ffs
82 mkdir -p /dev/usb-ffs/qdb
83 chmod 770 /dev/usb-ffs/qdb
84 mount -t functionfs qdb /dev/usb-ffs/qdb -o uid=0,gid=0
85 shift
86 start-stop-daemon --start --quiet --exec $DAEMON -- $@ &
87 sleep 1
88 initialize_gadget
89 ;;
90stop)
91 disable_gadget
92 start-stop-daemon --stop --quiet --exec $DAEMON
93 sleep 1
94 umount /dev/usb-ffs/qdb
95 rm $GADGET_CONFIG/configs/c.1/rndis.usb0
96 rm $GADGET_CONFIG/configs/c.1/ffs.qdb
97 rmdir $GADGET_CONFIG/configs/c.1/strings/0x409
98 rmdir $GADGET_CONFIG/configs/c.1
99 rmdir $GADGET_CONFIG/functions/rndis.usb0
100 rmdir $GADGET_CONFIG/functions/ffs.qdb
101 rmdir $GADGET_CONFIG/strings/0x409
102 rmdir $GADGET_CONFIG
103 ;;
104restart)
105 disable_gadget
106 start-stop-daemon --stop --quiet --exec $DAEMON
107 sleep 1
108 shift
109 start-stop-daemon --start --quiet --exec $DAEMON -- $@ &
110 sleep 1
111 initialize_gadget
112 ;;
113*)
114 echo "Usage: $0 {start|stop|restart}"
115 exit 1
116esac
117exit 0
diff --git a/recipes-qt/b2qt-addons/qdbd/qdbd.service b/recipes-qt/b2qt-addons/qdbd/qdbd.service
new file mode 100644
index 0000000..88806a2
--- /dev/null
+++ b/recipes-qt/b2qt-addons/qdbd/qdbd.service
@@ -0,0 +1,13 @@
1[Unit]
2Description=Qt Debug Bridge Daemon
3After=network.target
4Before=adbd.service
5Conflicts=adbd.service
6
7[Service]
8Type=forking
9ExecStart=/usr/bin/qdbd-init.sh start
10ExecStop=/usr/bin/qdbd-init.sh stop
11
12[Install]
13WantedBy=multi-user.target
diff --git a/recipes-qt/packagegroups/packagegroup-b2qt-embedded-addons.bb b/recipes-qt/packagegroups/packagegroup-b2qt-embedded-addons.bb
index 3d60eed..05dc416 100644
--- a/recipes-qt/packagegroups/packagegroup-b2qt-embedded-addons.bb
+++ b/recipes-qt/packagegroups/packagegroup-b2qt-embedded-addons.bb
@@ -39,4 +39,5 @@ RDEPENDS_${PN} += " \
39 b2qt-launcher \ 39 b2qt-launcher \
40 b2qt-demos \ 40 b2qt-demos \
41 ${@base_contains("DISTRO_FEATURES", "wayland", "democompositor", "", d)} \ 41 ${@base_contains("DISTRO_FEATURES", "wayland", "democompositor", "", d)} \
42 ${@bb.utils.contains("ENABLE_QDBD", "1", "qdbd", "", d)} \
42 " 43 "