一、新建文件夹并进入Alexa_hmi_demo目录下

1
2
3
4
5

$ cd /home/pattenkuo/AGL/meta-agl-demo/recipes-demo-hmi
$ mkdir Alexa_hmi_demo
$ cd Alexa_hmi_demo

二、新建Alexa_hmi_demo.bb文件和Alexa_hmi_demo文件夹。

1
2
$ mkdir Alexa_hmi_demo
$ vi Alexa_hmi_demo.bb

Alexa_hmi_demo.bb文件内容如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

SUMMARY = "AGL Reference Alexa_hmi_demo HMI application."
DESCRIPTION = "This application provides the HMI part of the SmartDeviceLink (SDL). It uses Generic HMI provided by SDL project."

SECTION = "apps"

#LICENSE = "GPLv2"
#LIC_FILES_CHKSUM = "file://COPYING;md5=947b2d60ca3872e172034438e9801200"
LICENSE = "CLOSED"
#LIC_FILES_CHKSUM = ""



DEPENDS += "libqtappfw qtquickcontrols2 qtwebsockets qtbase qtwebview qtwebengine"
DEPENDS += "virtual/libhomescreen qlibwindowmanager qtvirtualkeyboard"

inherit qmake5 pkgconfig aglwgt systemd

# Refer local subdirectory for now

#SRCREV = ""

#SRC_URI = ""
SRC_URI += " \
file://*;subdir=git \
"
PN="Alexa_hmi_demo"
S = "${WORKDIR}/git"


# Explicitly specify hmi content and runtime dependencies.



do_install() {
install -d ${D}/usr/share/${PN}

cp -r -f ${WORKDIR}/git/Alexa_hmi/* ${D}/usr/share/${PN}/

}


PATH_prepend = "${STAGING_DIR_NATIVE}${OE_QMAKE_PATH_QT_BINS}:"

三、进入Alexa_hmi_demo目录下,并新建apppackageAlexa_hmi_demo三个文件夹和Alexa_hmi_demo.pro文件

1
2
3
4
5

$ cd Alexa_hmi_demo
$ mkdir app package Alexa_hmi_demo
$ vi Alexa_hmi_demo.pro

Alexa_hmi_demo.pro文件内容如下所示:

1
2
3
4
TEMPLATE = subdirs
SUBDIRS = app package
package.depends += app

四、进入package目录下,并新建config.xmlpackage.pro两个文件并把应用图标icon.svg文件拖入,以下仅演示前两个文件内容,应用图标自己拖入:

1
2
3
4
5

$ cd package
$ vi config.xml
$ vi package.pro

config.xml文件内容如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" id="Alexa_hmi_demo" version="1.0">
<name>Alexa_hmi_demo</name>
<icon src="icon.svg"/>
<content src="bin/Alexa_hmi_demo" type="application/vnd.agl.native"/>
<description>This is a Alexa_hmi demo application for homescreen</description>
<author>junma</author>
<license>APL 2.0</license>
<feature name="urn:AGL:widget:required-api">
<param name="homescreen" value="ws" />
<param name="windowmanager" value="ws" />
</feature>
<feature name="urn:AGL:widget:required-permission">
<param name="urn:AGL:permission::public:no-htdocs" value="required" />
</feature>
</widget>


package.pro文件内容如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

DISTFILES = icon.svg config.xml

copy_icon.target = $$OUT_PWD/root/icon.svg
copy_icon.depends = $$_PRO_FILE_PWD_/icon.svg
copy_icon.commands = $(COPY_FILE) \"$$replace(copy_icon.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_icon.target, /, $$QMAKE_DIR_SEP)\"
QMAKE_EXTRA_TARGETS += copy_icon
PRE_TARGETDEPS += $$copy_icon.target

copy_config.target = $$OUT_PWD/root/config.xml
copy_config.depends = $$_PRO_FILE_PWD_/config.xml
copy_config.commands = $(COPY_FILE) \"$$replace(copy_config.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_config.target, /, $$QMAKE_DIR_SEP)\"
QMAKE_EXTRA_TARGETS += copy_config
PRE_TARGETDEPS += $$copy_config.target

wgt.target = package
wgt.commands = wgtpkg-pack -f -o Alexa_hmi_demo.wgt root

QMAKE_EXTRA_TARGETS += wgt

deploy.files = Alexa_hmi_demo.wgt
deploy.path = /usr/AGL/apps/autoinstall
INSTALLS += deploy

五、进入app目录下,并新建app.priapp.prodeployment.priTestWebEngine.pri四个文件:

1
2
3
4
5
6

$ cd ../app
$ vi app.pri
$ vi app.pro
$ vi deployment.pri

app.pri文件内容如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

TEMPLATE = app
QMAKE_LFLAGS += "-Wl,--hash-style=gnu -Wl,--as-needed"
load(configure)
qtCompileTest(libhomescreen)

config_libhomescreen {
CONFIG += link_pkgconfig
PKGCONFIG += homescreen
DEFINES += HAVE_LIBHOMESCREEN
}

DESTDIR = $${OUT_PWD}/../package/root/bin


app.pro文件内容如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
TARGET = Alexa_hmi_demo
QT = quickcontrols2 websockets dbus qml quick webview webengine webenginewidgets

SOURCES = main.cpp

CONFIG += link_pkgconfig
PKGCONFIG += libhomescreen qlibwindowmanager qtappfw

RESOURCES += qml.qrc

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

# Default rules for deployment.
include(app.pri)

deployment.pri文件内容如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

unix:!android {
isEmpty(target.path) {
qnx {
target.path = /tmp/$${TARGET}/bin
} else {
target.path = /opt/$${TARGET}/bin
}
export(target.path)
}
INSTALLS += target
}

export(INSTALLS)


六、拖入你已写好的Qt项目三个文件main.cppmain.qmlqml.qrc到当前app目录下,代码保密需要,这里不再演示文件内容。

七、把你的网页文件拖进与app同级的Alexa_hmi_demo文件夹下。

八、现在终于可以编译了!进入AGL下的build文件夹下,开始编译吧!

1
2
$ bitbake -c compile -f -v sdl-hmi-demo     //如kernel是 “linux-renesas”

九、成功生成sdl-hmi-demo.wgt安装包,到/home/pattenkuo/AGL/build/tmp/work/aarch64-agl-linux/Alexa_hmi_demo/hmi-demo/build/package目录下可以看到。