== Mycroft Mark2 GUI using system QT5 and KDE framework == 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 He is doing this on Rasbperry 4 while the target here is Raspberry 3B but also on 64-bit. === Install Linux === I tried to do this on Ubuntu 20.04 but failed to bring the SDDM up so I switched back to 18.04 [https://github.com/TheRemote/Ubuntu-Server-raspi4-unofficial/releases/download/v28/ubuntu-18.04.4-preinstalled-server-arm64+raspi4.img.xz] Flash it to sdcard and boot. After first boot login as ubuntu/ubuntu (takes a while until you can do this), change password ==== Wifi ==== * {{{ ls /sys/class/net }}} on RP3 the wifi interface is the wlan0 * {{{ sudo nano /etc/netplan/50-cloud-init.yaml }}} {{{ # network: {config: disabled} network: ethernets: eth0: dhcp4: true optional: true version: 2 wifis: wlan0: optional: true access-points: "ESSID-of-the-Accesspoint": password: "your-password" dhcp4: true }}} ** Remark: ** SDDM is using NetworkManager you can either delete the wifis part from 50-cloud-init.yaml and reconfigure it after autologon. If you leave it there Newtworkmanager will automatically use it. The important thing is that after doing the Scripts/Overlays section below you have /etc/netplan/config.yaml and it contains "renderer: NetworkManager" otherwhise Wifi will not work in SDDM if you still have Wifi in 50-cloud-init.yaml. ==== 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 bionic main" > /etc/apt/sources.list.d/neon.list }}} * {{{ apt-get update }}} exit root by pressing Ctrl-D. ==== swap ==== * {{{ 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 }}} === 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 -sm }}} ==== mimic ==== skipped for now * {{{ wget http://frozenmazegames.se/mimic-arm64_1.2.0.2+1559651054-1.deb }}} * {{{ sudo dpkg -i mimic-arm64_1.2.0.2+1559651054-1.deb }}} === Plasma Nano === ==== Install the system Libraries ==== I will try to come up with a completer list later but I think most of it should be in the dependencies of the following * {{{ sudo apt install sddm kwin-wayland kwin-x11 openssh-server ftp i2c-tools konsole nano plasma-workspace-wayland plasma-workspace plasma-pa plasma-widgets-addons libkf5wallet-bin gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-fluendo-mp3 qml-module-qtmultimedia network-manager plasma-nm konsole plasma-workspace-dev }}} I was not asked for the login manager so I set it manually: * {{{ sudo dpkg-reconfigure sddm }}} ==== build plasma-nano ==== * {{{ sudo apt install cmake kwayland-dev }}} * {{{ cd ~ }}} * {{{ git clone https://github.com/KDE/plasma-nano }}} * {{{ cd plasma-nano }}} * {{{ 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 -j 2 }}} * {{{ sudo make install }}} ==== Mycroft GUI ==== * {{{ sudo apt install -y git-core g++ cmake extra-cmake-modules kio-dev gettext pkg-config pkg-kde-tools qtbase5-dev qtdeclarative5-dev kio-dev libkf5notifications-data libkf5notifications-dev qml-module-qtquick2 qml-module-qtquick-controls2 qml-module-qtquick-controls qml-module-qtwebsockets qml-module-qt-websockets qtdeclarative5-qtquick2-plugin qtdeclarative5-models-plugin cmake cmake-extras cmake-data qml-module-qtquick-layouts libkf5plasma-dev extra-cmake-modules qtdeclarative5-dev build-essential g++ gettext libqt5webkit5 libqt5webkit5-dev libkf5i18n-data libkf5i18n-dev libkf5i18n5 qml-module-qtgraphicaleffects libqt5dbus5 libkf5dbusaddons-dev libdbus-1-dev libdbus-glib-1-dev kio-dev libkf5kio-dev libqt5websockets5-dev libqt5webview5-dev qml-module-qtquick-virtualkeyboard libqt5virtualkeyboard5-dev qtvirtualkeyboard-plugin }}} * {{{ 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 }}} ==== Mycroft-GUI-Mark-2 ==== * {{{ cd ~ }}} * {{{ git clone https://github.com/MycroftAi/mycroft-gui-mark-2 }}} * {{{ cd mycroft-gui-mark-2 && 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 }}} ==== Scripts/Overlays ==== skipped 93-create_ramdisk.sh and 94-create_swap.sh (done manually above) * {{{ cd ~ }}} * {{{ git clone https://github.com/MycroftAI/mycroft-devices }}} * {{{ cd mycroft-devices }}} * {{{ cd scripts }}} * {{{ chmod a+X 03-setup_locale.sh }}} * {{{ sudo ./03-setup_locale.sh }}} Overlays: **Remark** Instead of the following commands, download the file mycroft_scrips_ovl.sh form the attachements [https://www.thinkthinkdo.com/trac/project1/raw-attachment/wiki/mycroft-gui-mark-2_sys/mycroft_scripts_ovl.sh], change it to executable and run it. * {{{ cd ~ }}} * {{{ sudo cp -v ~/mycroft-devices/overlays/base-embedded/etc/xdg/* /etc/xdg/ }}} * {{{ sudo cp -v ~/mycroft-devices/overlays/mark2/etc/xdg/* /etc/xdg/ }}} * {{{ sudo cp -rv ~/mycroft-devices/overlays/mycroft/etc/* /etc/ }}} * {{{ sudo mkdir -p /etc/skel/.local/share/kwalletd }}} * {{{ sudo cp -v ~/mycroft-devices/overlays/base-embedded/etc/skel/.local/share/kwalletd/* /etc/skel/.local/share/kwalletd/ }}} * {{{ sudo cp -v ~/mycroft-devices/overlays/mycroft/etc/sddm.conf.d/* /etc/sddm.conf.d/ }}} * {{{ sudo cp -v ~/mycroft-devices/overlays/base-embedded/etc/profile.d/renderloop.sh /etc/profile.d/ }}} * {{{ sudo mkdir -p /etc/polkit-1/localauthority/50-local.d/ }}} * {{{ sudo cp -v ~/mycroft-devices/overlays/mycroft/etc/polkit-1/localauthority/50-local.d/* /etc/polkit-1/localauthority/50-local.d/ }}} * {{{ sudo cp -v ~/mycroft-devices/overlays/base-embedded/etc/netplan/* /etc/netplan/ }}} * {{{ sudo cp -v ~/mycroft-devices/overlays/mycroft/etc/mycroft/* /etc/mycroft/ }}} === pi config.txt === {{{ # i2c on dtparam=i2c_arm=on # audio on dtparam=audio=on [all] max_framebuffers=2 dtoverlay=vc4-kms-v3d arm_64bit=1 }}} === enable i2c_dev === I did not have an /dev/i2c* device after booting only if I manually loaded i2c_dev so I did * {{{ sudo nano /etc/modules }}} add {{{ i2c_dev }}} In addition add the user mycroft to the i2c group. Then one can use: * {{{ sudo i2cset -y 1 0x4b 30 }}} to make the volume change work == Alternative: Run mycroft-gui QT5 app == The aproach above need a full graphical user interface stack (X11, wayland, SDDM) and this is hard do run on a Raspberry PI 3B. In this alternativ method I will change the systemd target to multi-user.target, enable autologon of user mycroft on console and start the mycroft-gui app === 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 }}} === Start mycroft-gui app === to start the app from the command line use * {{{ QT_QPA_PLATFORM=eglfs mycroft-gui-app }}} to start it automatically using systemd: * {{{ 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 }}}