wiki:mycroft-gui-mark-2_20.04_standalone

Mycroft Mark2 GUI using Ubuntu 20.04 server, Mycroft GUI standalone app

This is based on the very helpful build log of user AIIX that he published on https://github.com/AIIX/Documentation/blob/master/Custom-RPI4-MycroftImage.md The focus of this guide is to install the Mycroft GUI as a standalone app without KDE plasma nano. If you want to run it as a plasma nano app then follow this guide Mycroft GUI Mark2 - GUI using system QT/KF

Install Linux

Use the current Ubuntu server 20.04 using 64-bit architecture from https://ubuntu.com/download/raspberry-pi Follow the installation guide at https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview including the initial Wifi setup

user

  • sudo useradd mycroft -g users -G sudo -m -s /bin/bash
  • sudo passwd mycroft
  • sudo nano /etc/group

(add mycroft to all groups like ubuntu)

From now on work as user mycroft

update / initial apt setup

  • sudo apt-get update && sudo apt-get dist-upgrade -y
  • sudo apt install git gnupg wget curl apt-transport-https software-properties-common

Do the next steps as root:

  • sudo su -

Add KDE Neon gpg key:

  • wget -qO - 'http://archive.neon.kde.org/public.key' | sudo apt-key add -

Add the repository

  • echo "deb https://archive.neon.kde.org/unstable focal main" > /etc/apt/sources.list.d/neon.list
  • apt-get update

exit root by pressing Ctrl-D.

swap

This is optional but will be a good idea on RP3

  • sudo fallocate -l 2G /swapfile
  • sudo chmod 600 /swapfile
  • sudo mkswap /swapfile
  • sudo swapon /swapfile
  • sudo nano /etc/fstab

add

/swapfile               none            swap    sw                              0 0

ramdisk

  • sudo mkdir /ramdisk
  • sudo nano /etc/fstab

add

tmpfs                   /ramdisk        tmpfs   rw,nodev,nosuid,size=20M        0 0

systemd target

switch once to multi-user target

  • sudo systemctl isolate multi-user.target

make default

  • sudo systemctl set-default multi-user.target

autologon user mycroft

  • sudo systemctl edit getty@tty1.service

to create/edit and change it to the following content

[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin mycroft %I $TERM
Type=idle

mycroft core

  • sudo apt-get install git python3 python3-dev python3-setuptools libtool libffi-dev libssl-dev autoconf automake bison swig libglib2.0-dev portaudio19-dev mpg123 screen flac curl libicu-dev pkg-config libjpeg-dev libfann-dev build-essential jq
  • cd ~
  • git clone https://github.com/MycroftAI/mycroft-core
  • cd mycroft-core
  • ./dev_setup.sh

Mycroft GUI

  • sudo apt install -y git-core g++ cmake cmake-extras cmake-data extra-cmake-modules kio-dev gettext pkg-config pkg-kde-tools qtbase5-dev qtdeclarative5-dev libkf5notifications-data libkf5notifications-dev qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-controls qml-module-qtwebsockets qml-module-qt-websockets qml-module-qtquick-layouts build-essential libqt5webkit5 libqt5webkit5-dev libkf5i18n-data libkf5i18n-dev libkf5i18n5 qml-module-qtgraphicaleffects libqt5dbus5 libkf5dbusaddons-dev libdbus-1-dev libdbus-glib-1-dev libkf5kio-dev libqt5websockets5-dev libqt5webview5-dev qtmultimedia5-dev libkf5plasma-dev plasma-workspace-dev
  • cd ~
  • git clone https://github.com/MycroftAI/mycroft-gui/
  • cd mycroft-gui && mkdir build && cd build
  • cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
  • make -j2
  • sudo make install

QML Lottie

  • cd ~
  • git clone https://github.com/kbroulik/lottie-qml
  • cd lottie-qml && mkdir build && cd build
  • cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
  • make -j2
  • sudo make install

pi config.txt

edit the file /boot/firmware/usercfg.txt and add the following parameters

dtoverlay=vc4-fkms-v3d
disable_overscan=1

After this reboot. Check after a reboot that you do have the devices card0 and card1 in /dev/dri/ otherwhise starting mycroft-gui-app will fail with the message "Could not find DRM device!"

test mycroft-gui-app

Test the GUI app using the commands:

export QT_QPA_PLATFORM=eglfs
mycroft-gui-app

this should start the GUI app in landscape mode. You can rotate the screen using the --rotateScreen 90 option. But this is not fully functional and I will add a seperate wiki entry for this.

Automatic start of the mycroft-gui app

There are several options to automatically start the GUI. You could just add the commands to .bashrc but I prefer to start it via a user systemd service

  • mkdir -p ~/.config/systemd/user
  • nano ~/.config/systemd/user/mymycroftgui.service

with the content:

[Unit]
Description=start mycroft-gui
After=network.target

[Service]
Type=simple
Environment="QT_QPA_PLATFORM=eglfs"
ExecStart=/usr/bin/mycroft-gui-app

[Install]
WantedBy=default.target

then start it

  • systemctl start --user mymycroftgui

and enable the automatic start with

  • systemctl enable --user mymycroftgui

Other topics

mycroft.conf

to change the enclosure setting edit mycroft.conf (I prefer to do this in the system config at /etc/mycroft/mycroft.conf) sudo mkdir -p /etc/mycroft sudo nano /etc/mycroft/mycroft.conf and make it look something like this (enclosure, ipc_path, skills)

{
  "enclosure": {
    "platform": "mycroft_mark_2",
    "platform_build": 1
  },
  "ipc_path": "/ramdisk/mycroft/ipc/",
  "skills": {
     "priority_skills": ["mycroft-pairing", "mycroft-volume", "mycroft-mark-2"]
  }
}

Sound

See Mycroft Mark II - Sound

Screen rotation fix

To get a proper working screen rotation the patch screen rotation pull request needs to be applied. In the meantime it can be built from my fork

  • cd ~
  • mv mycroft-gui mycroft-gui.ori
  • git clone https://github.com/guhl/mycroft-gui/
  • cd mycroft-gui && mkdir build && cd build
  • cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
  • make -j2
  • sudo make install

change the ExecStart in ~/.config/systemd/user/mymycroftgui.service to:

ExecStart=/usr/bin/mycroft-gui-app --rotateScreen 90 --hideTextInput
Last modified 8 months ago Last modified on 02/24/21 21:47:44