Skip to content

GUI stack

Jessica Clarke edited this page Dec 5, 2022 · 41 revisions

Instructions on how to build CHERI ABI GUI stack.

Kernel part

Use the dev CheriBSD branch.

Morello is ACPI-based platform, but ACPI tables don't currently have any description for graphics devices, so we are temporarily overriding it with an FDT by putting the following in /boot/loader.conf:

dtb_load="YES"
dtb_type="dtb"
dtb_name="/boot/dtb/arm/morello-soc.dtb"

If you have weird/old/non-Full-HD monitor, apply SCMI support:

Note Morello supports full-hd only (this is due to HDMI controller limitations). Your monitor have to support Full-HD or lower. 4K is also fine, in that case the monitor will be initialized for half resolution.

Userspace part

Installing using a package manager

Run:

pkg64c install cheri-desktop
pkg64 install cheri-desktop-hybrid-extras

Running

If you reboot, SDDM should automatically start and let you log in. To run manually from a command line, use:

dbus-run-session startplasma-wayland

Building from source

In CheriBSD we have two local base directories: /usr/local and /usr/local64 for purecap and hybrid applications respectively. While the GUI stack is ported to purecap, the tools needed to build it are not fully ported. So building the pure-capability GUI stack requires hybrid tools. Provide these environment variables for the package system so it knows where to find the tools for building. Add these to /etc/make.conf:

AUTOCONF_CMD=/usr/local64/bin/autoconf
AUTOMAKE_CMD=/usr/local64/bin/automake
AUTORECONF_CMD=/usr/local64/bin/autoreconf
CMAKE_CMD=/usr/local64/bin/cmake
MESON_CMD=/usr/local64/bin/meson
NINJA_CMD=/usr/local64/bin/ninja
WITHOUT_GNOME=yes
CMAKE_PROGRAM_PATH=/usr/local64/bin
DEFAULT_VERSIONS+=python=3.8
DEFAULT_VERSIONS+=python3=3.8
OPTIONS_UNSET=DOCS NLS

Clone cheribsd-ports twice: to /usr/cheribsd-ports and /usr/ports; the first will be used to build purecap packages, and the second for hybrid packages. Alternatively, you can install pre-built hybrid packages from the CheriBSD package repositories.

To build purecap packages, no additional environment variables are needed. To build hybrid packages, set these environment variables before running make:

env LDFLAGS="-fuse-ld=lld" \
    M4=/usr/local64/bin/gm4 \
    LLVM_READELF=/usr/local64/bin/llvm-readelf \
    AS=/usr/local64/bin/clang \
    ARCH=aarch64 MACHINE_ARCH=aarch64 \
    LOCALBASE=/usr/local64 \
    CC=/usr/local64/bin/clang \
    CXX=/usr/local64/bin/clang++ \
    CPP=/usr/local64/bin/clang-cpp13 \
    WASM_CC=/usr/local64/bin/clang13 \
    WASM_CXX=/usr/local64/bin/clang++13 \
    make install

Install purecap tools:

sudo pkg64c install sudo perl5 pkgconf docbook gperf pkg gmake

Install the hybrid tools needed to build the purecap GUI packages:

    sudo pkg64 install python3 cmake llvm llvm-base m4 gdb-cheri gmake \
               rust wasi-compiler-rt13 meson automake ninja git libxslt \
               py38-mako libtool gettext-tools xdg-user-dirs desktop-file-utils

Build and install the purecap GUI packages:

cd /usr/cheribsd-ports/x11/cheri-desktop 
sudo make install BATCH=YES

Build and install the hybrid GUI packages:

cd /usr/ports/x11/cheri-desktop-hybrid-extras
sudo make install BATCH=YES

Obsolete instructions

Run the desktop

Set these env variables

setenv MOZ_ENABLE_WAYLAND 1
setenv XDG_RUNTIME_DIR /tmp/wl
setenv QT_QPA_PLATFORM wayland
setenv KWIN_DRM_DEVICES /dev/dri/card1:/dev/dri/card0
setenv QML_DISABLE_DISK_CACHE 1 # QML disk caching is currently broken
setenv EGL_PLATFORM wayland

Extra env for debugging

setenv EGL_LOG_LEVEL debug
setenv LIBGL_DEBUG verbose
setenv MESA_DEBUG 1

Ensure dbus is started

Add this to your /etc/rc.conf

dbus_enable="YES"

run

sudo /usr/local/etc/rc.d/dbus restart

Run kwin

With this, you should see black screen:

mkdir -p /tmp/wl
sudo chmod 0777 /dev/input/event*
dbus-run-session kwin_wayland

At this point you can run some GUI apps from a separate ssh session. For example foot(1) terminal.

Also ensure that your renderer is panfrost (see startup messages of kwin_wayland in standard output):

OpenGL vendor string:                   Panfrost
OpenGL renderer string:                 Mali-G76 (Panfrost)
OpenGL version string:                  3.1 (Core Profile) Mesa 21.3.8
OpenGL shading language version string: 1.40

Run Plasma5

dbus-run-session plasmashell

Font configuration for foot

If your font looks weird in foot, try to add the following lines to ~/.config/foot/foot.ini as a temporary workaround:

font=monospace:size=10:weight=bold

Example apps to try out.

These could be run from a separate ssh session to the Morello box, or in the Konsole/Foot terminals. Ensure environment variables listed above are set if you run them from an ssh-session.

$ foot
$ dolphin
$ okular
$ kate
$ konsole