cage-kiosk / cage

A Wayland kiosk
https://www.hjdskes.nl/projects/cage
MIT License
1.23k stars 80 forks source link

Cage Buildroot minimal configuration for Qemu testing #384

Open fjosegalan opened 1 day ago

fjosegalan commented 1 day ago

Hello

I am playing around with Cage doing some test for a webroser launched over cage using Buildroot. Based on the sample for RPI, I tried to replicate the buildroot config for Qemu and do the tests, but I am unable no launch due to some graphics library not working... I know this is not an issue itself, but somebody has some hint to continue with Cage over qemu? This is my buildroot config:

BR2_x86_64=y
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y
BR2_GCC_VERSION_14_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_WGET="wget --no-check-certificate -nd -t 3"
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_TPOP_OS_PATH)/patches"
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_TARGET_GENERIC_HOSTNAME="dimc_qemu"
BR2_TARGET_GENERIC_ISSUE="Welcome to TetraPak Operator Panel OS"
BR2_INIT_SYSTEMD=y
BR2_TARGET_GENERIC_ROOT_PASSWD="tpopadmin"
BR2_SYSTEM_DHCP="eth0"
BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin"
BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL_TPOP_OS_PATH)/board/tp_qemu/dimc_qemu/usertable.txt"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_TPOP_OS_PATH)/board/tp_qemu/dimc_qemu/rootfs_overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_TPOP_OS_PATH)/board/tp_qemu/dimc_qemu/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_TPOP_OS_PATH)/board/tp_qemu/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.32"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_TPOP_OS_PATH)/board/tp_qemu/dimc_qemu/linux.config"
BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
BR2_PACKAGE_CAGE=y
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_LLVM=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL=y
BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL=y
BR2_PACKAGE_MESA3D_VULKAN_DRIVER_SWRAST=y
BR2_PACKAGE_MESA3D_OSMESA_GALLIUM=y
BR2_PACKAGE_MESA3D_OPENGL_GLX=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y
BR2_PACKAGE_XORG7=y
BR2_PACKAGE_GNUTLS=y
BR2_PACKAGE_LIBDRM_INTEL=y
BR2_PACKAGE_LIBDRM_RADEON=y
BR2_PACKAGE_LIBDRM_AMDGPU=y
BR2_PACKAGE_LIBDRM_NOUVEAU=y
BR2_PACKAGE_LIBDRM_VMWGFX=y
BR2_PACKAGE_LIBDRM_ETNAVIV=y
BR2_PACKAGE_LIBVDPAU=y
BR2_PACKAGE_WLROOTS_X11=y
BR2_PACKAGE_WLROOTS_XWAYLAND=y
BR2_PACKAGE_YAJL=y
BR2_PACKAGE_LIBTIRPC=y
BR2_PACKAGE_CLANG=y
BR2_PACKAGE_ELFUTILS=y
BR2_PACKAGE_LIBCLC=y
BR2_PACKAGE_LIBSECCOMP=y
BR2_PACKAGE_LINUX_PAM=y
BR2_PACKAGE_LLVM_AMDGPU=y
BR2_PACKAGE_LLVM_RTTI=y
BR2_PACKAGE_QEMU=y
BR2_PACKAGE_QEMU_SYSTEM=y
BR2_PACKAGE_DNSMASQ=y
BR2_PACKAGE_EBTABLES=y
BR2_PACKAGE_IPROUTE2=y
BR2_PACKAGE_IPTABLES=y
BR2_PACKAGE_NMAP=y
BR2_PACKAGE_NMAP_NCAT=y
BR2_PACKAGE_RADVD=y
BR2_PACKAGE_SEATD_BUILTIN=y
BR2_PACKAGE_SEATD_DAEMON=y
BR2_PACKAGE_SYSTEMD_LOGIND=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_SIZE="1024M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_MESON_TOOLS=y
BR2_PACKAGE_HOST_PKGCONF=y
BR2_PACKAGE_HOST_QEMU=y
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y

And I launch Qemu with a device virtio-gpu

qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user -device virtio-gpu

Any suggestion is welcome!!!!

Many thanks in advance

Fran

emersion commented 1 day ago

but I am unable no launch due to some graphics library not working...

What is the full log of these errors, when you try to start cage?

fjosegalan commented 1 day ago

Hello emersion,

If I login as root on my builroot Qemu compilation, compiled with the config I stated previously I get this error while I try to run the init sample "/usr/bin/cage /usr/bin/gtk3-widget-factory":

00:00:00.000 [../cage.c:295] XDG_RUNTIME_DIR is not set in the environment

Then I set this variable manually for test purposes as:

export XDG_RUNTIME_DIR=/run/user/1000

Run the same cage test command for Cage "/usr/bin/cage /usr/bin/gtk3-widget-factory" got this answer:

libEGL warning: egl: failed to create dri2 screen
00:00:00.547 [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "DRI2: failed to create screen"
libEGL warning: egl: failed to create dri2 screen
00:00:00.583 [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "DRI2: failed to create screen"
libEGL warning: NEEDS EXTENSION: falling back to kms_swrast
00:00:01.357 [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_PARAMETER (0x300c), message: "eglQueryDeviceStringEXT"
00:00:01.359 [EGL] command: eglQueryDeviceStringEXT, error: EGL_BAD_PARAMETER (0x300c), message: "eglQueryDeviceStringEXT"
pci id for fd 23: 1234:1111, driver (null)
MESA-LOADER: failed to open bochs-drm: /usr/lib/dri/bochs-drm_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/dri, suffix _dri)
00:00:01.403 [render/egl.c:312] Software rendering detected, please use the WLR_RENDERER_ALLOW_SOFTWARE environment variable to proceed
00:00:01.406 [render/egl.c:554] Failed to initialize EGL context
00:00:01.407 [EGL] command: eglMakeCurrent, error: EGL_NOT_INITIALIZED (0x3001), message: "eglMakeCurrent"
00:00:01.408 [render/gles2/renderer.c:679] Could not initialize EGL
00:00:01.434 [../cage.c:550] Unable to open Wayland socket: Invalid argument

For sure is not a matter of Cage, and it is a matter of my config... But I don´t know what to check due to I am not an expert on mesa drivers and so on....

Regards, Thanks in advance

Fran