diff options
-rw-r--r-- | classes/internal-build.bbclass | 1 | ||||
-rw-r--r-- | recipes-qt/b2qt-addons/qdbd.bb | 79 | ||||
-rw-r--r-- | recipes-qt/b2qt-addons/qdbd/defaults | 3 | ||||
-rwxr-xr-x | recipes-qt/b2qt-addons/qdbd/qdbd-init.sh | 117 | ||||
-rw-r--r-- | recipes-qt/b2qt-addons/qdbd/qdbd.service | 13 | ||||
-rw-r--r-- | recipes-qt/packagegroups/packagegroup-b2qt-embedded-addons.bb | 1 |
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 | |||
30 | DESCRIPTION = "Qt Debug Bridge Daemon" | ||
31 | SECTION = "devel" | ||
32 | LICENSE = "The-Qt-Company-DCLA-2.1" | ||
33 | LIC_FILES_CHKSUM = "file://qdbd/main.cpp;md5=37093977d3f09e6366def8955c8c71e6;beginline=1;endline=18" | ||
34 | |||
35 | inherit qmake5 | ||
36 | |||
37 | SRC_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 | |||
43 | SRCREV = "02a7d1ab030b83feb3300df5149b9ec0518975f4" | ||
44 | BRANCH = "master" | ||
45 | PV = "0.1+git${SRCPV}" | ||
46 | |||
47 | DEPENDS = "qtbase" | ||
48 | RRECOMMENDS_${PN} += "kernel-module-usb-f-fs kernel-module-usb-f-rndis" | ||
49 | |||
50 | S = "${WORKDIR}/git" | ||
51 | |||
52 | EXTRA_QMAKEVARS_PRE = "CONFIG+=daemon_only" | ||
53 | |||
54 | do_configure_append() { | ||
55 | if [ -n "${ADB_PRODUCTID}" ]; then | ||
56 | sed -i -e 's/PRODUCT=.*/PRODUCT=${ADB_PRODUCTID}/' ${WORKDIR}/defaults | ||
57 | fi | ||
58 | } | ||
59 | |||
60 | do_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 | |||
72 | INITSCRIPT_NAME = "qdbd-init.sh" | ||
73 | INITSCRIPT_PARAMS = "defaults 96" | ||
74 | |||
75 | SYSTEMD_SERVICE_${PN} = "qdbd.service" | ||
76 | # adbd is started by default instead of qdbd | ||
77 | SYSTEMD_AUTO_ENABLE = "disable" | ||
78 | |||
79 | inherit 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 @@ | |||
1 | VENDOR=0x18d1 | ||
2 | PRODUCT=0x0000 | ||
3 | SERIAL=$(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 | ############################################################################### | ||
39 | MANUFACTURER="The Qt Company" | ||
40 | PRODUCT_STRING="Boot2Qt Ethernet/RNDIS connection" | ||
41 | |||
42 | DAEMON=/usr/bin/qdbd | ||
43 | CONFIGFS_PATH=/sys/kernel/config | ||
44 | |||
45 | GADGET_CONFIG=$CONFIGFS_PATH/usb_gadget/g1 | ||
46 | |||
47 | . /etc/default/qdbd | ||
48 | |||
49 | function 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 | |||
58 | function disable_gadget() { | ||
59 | echo "" > $GADGET_CONFIG/UDC | ||
60 | } | ||
61 | |||
62 | case "$1" in | ||
63 | start) | ||
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 | ;; | ||
90 | stop) | ||
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 | ;; | ||
104 | restart) | ||
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 | ||
116 | esac | ||
117 | exit 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] | ||
2 | Description=Qt Debug Bridge Daemon | ||
3 | After=network.target | ||
4 | Before=adbd.service | ||
5 | Conflicts=adbd.service | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | ExecStart=/usr/bin/qdbd-init.sh start | ||
10 | ExecStop=/usr/bin/qdbd-init.sh stop | ||
11 | |||
12 | [Install] | ||
13 | WantedBy=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 | " |