diff --git a/Makefile b/Makefile index db251d2..a0d4256 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ BUILD_DIR ?= build TARGET ?= forge -RUN_ARGS ?= -tf --project=project -is=480 --demo +RUN_ARGS ?= --project=$(PWD)/project -is=576 VERSION ?= invar-$(shell grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' forge-steel/configure.ac) # FILES @@ -40,11 +40,35 @@ $(BUILD_DIR)/$(TARGET): forge-steel/src/main.c forge-steel/hashmap.c/hashmap.c f # ACTIONS -.PHONY: install -install: +.PHONY: remove-passwd +remove-passwd: + sudo passwd -d forge + +.PHONY: apt-install +apt-install: sudo apt update - sudo apt install -y weston libglfw3-dev libgl-dev libasound2-dev libv4l-dev - sudo usermod -a -G render $(shell whoami) + sudo apt install -y weston kitty libglfw3-dev libgl-dev libasound2-dev libv4l-dev + +.PHONY: setup-weston: +setup-weston: + ln -s $(PWD)/system/weston.ini $(XDG_CONFIG_HOME)/weston.ini + +.PHONY: setup-system-services: +setup-system-services: + sudo ln -s $(PWD)/system/getty@tty1.service /etc/systemd/system/getty@tty1.service + sudo systemctl daemon-reload + sudo systemctl enable getty@tty1.service + +.PHONY: setup-user-services: +setup-user-services: + sudo ln -s $(PWD)/system/weston.service /etc/systemd/user/weston.service + sudo ln -s $(PWD)/system/weston.socket /etc/systemd/user/weston.socket + systemctl --user daemon-reload + systemctl --user enable weston seatd + + +.PHONY: install +install: remove-passwd apt-install setup-weston setup-system-services setup-user-services .PHONY: clean clean: @@ -61,6 +85,10 @@ run: $(BUILD_DIR)/$(TARGET) submodule-init: git submodule update --init --recursive +.PHONY: start-weston +start-weston: + weston --shell=kiosk-shell.so --xwayland -- kitty --hold $(BUILD_DIR)/$(TARGET) $(RUN_ARGS) + .PHONY: start start: - weston --shell=kiosk-shell.so --xwayland -- $(BUILD_DIR)/$(TARGET) $(RUN_ARGS) + $(BUILD_DIR)/$(TARGET) $(RUN_ARGS) diff --git a/README.md b/README.md index 57c5143..288ffcd 100644 --- a/README.md +++ b/README.md @@ -43,12 +43,24 @@ sudo apt install mesa-utils libglfw3-dev libgl-dev libasound2-dev libv4l-dev lib * https://raspberry.tips/en/raspberrypi-tutorials/raspberry-pi-overclocking-3-4-5 * https://www.baeldung.com/linux/opengl-check-working * https://ttt.io/glsl-raspberry-pi -* https://drgeoffathome.wordpress.com/2020/02/03/opengl-without-x-on-raspberry-pi-4-part-1/ * https://manpages.org/weston -* wayland.pages.freedesktop.org/weston/toc/kiosk-shell.html +* https://wayland.pages.freedesktop.org/weston/toc/kiosk-shell.html +* https://man.archlinux.org/man/weston.ini.5.html +* https://pimylifeup.com/raspberry-pi-screen-resolution/ +* https://renesas-rz.github.io/rzg_hmi_sdk/v2.3.0.0/wiki/common_change-display-resolution/ +* https://developer.technexion.com/docs/embedded-software/linux/usage-guides/display/setting-hdmi-resolution-in-weston +* https://linuxvox.com/blog/linux-autologin/ ## TODO +Logical + +* Play on start +* Save while running +* + +Physical + * PAL/NTSC switch * Sync in -> fake midi ? * rasp compute diff --git a/system/getty@tty1.service b/system/getty@tty1.service new file mode 100644 index 0000000..b8420c5 --- /dev/null +++ b/system/getty@tty1.service @@ -0,0 +1,49 @@ +[Unit] +Description=Getty on %I +After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target + +# If additional gettys are spawned during boot then we should make +# sure that this is synchronized before getty.target, even though +# getty.target didn't actually pull it in. +Before=getty.target +IgnoreOnIsolate=yes + +# IgnoreOnIsolate causes issues with sulogin, if someone isolates +# rescue.target or starts rescue.service from multi-user.target or +# graphical.target. +Conflicts=rescue.service +Before=rescue.service + +# On systems without virtual consoles, don't start any getty. Note +# that serial gettys are covered by serial-getty@.service, not this +# unit. +ConditionPathExists=/dev/tty0 + +[Service] +ExecStart=-/usr/bin/agetty --autologin forge --noreset --noclear %I ${TERM} +Type=idle +Restart=always +RestartSec=0 +UtmpIdentifier=%I +StandardInput=tty +StandardOutput=tty +TTYPath=/dev/%I +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes +IgnoreSIGPIPE=no +SendSIGHUP=yes + +ImportCredential=tty.virtual.%I.agetty.*:agetty. +ImportCredential=tty.virtual.%I.login.*:login. +ImportCredential=agetty.* +ImportCredential=login.* +ImportCredential=shell.* + +# Unset locale for the console getty since the console has problems +# displaying some internationalized messages. +UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION + +[Install] +WantedBy=getty.target +DefaultInstance=tty1 diff --git a/system/weston.ini b/system/weston.ini new file mode 100644 index 0000000..35a425b --- /dev/null +++ b/system/weston.ini @@ -0,0 +1,6 @@ +[core] +idle-time=0 + +[output] +name=Composite-1 +mode=720x576i diff --git a/system/weston.service b/system/weston.service new file mode 100644 index 0000000..3a55602 --- /dev/null +++ b/system/weston.service @@ -0,0 +1,23 @@ +[Unit] +Description=Weston, a Wayland compositor, as a user service + +# Activate using a systemd socket +Requires=weston.socket +After=weston.socket + +# Since we are part of the graphical session, make sure we are started before +Before=graphical-session.target + +[Service] +Type=notify +TimeoutStartSec=60 +WatchdogSec=20 +# Defaults to journal +#StandardOutput=journal +StandardError=journal + +# add a ~/.config/weston.ini and weston will pick-it up +ExecStart=/usr/bin/weston --modules=systemd-notify.so --shell=kiosk-shell.so --xwayland -- kitty --hold make -C /opt/forge-invar start + +[Install] +WantedBy=graphical-session.target diff --git a/system/weston.socket b/system/weston.socket new file mode 100644 index 0000000..cdaf856 --- /dev/null +++ b/system/weston.socket @@ -0,0 +1,7 @@ +[Unit] +Description=Weston, a Wayland compositor +Documentation=man:weston(1) man:weston.ini(5) +Documentation=https://wayland.freedesktop.org/ + +[Socket] +ListenStream=%t/wayland-0