Project Overview | Documentation | Documentation (Development Version) | Install Guide | User Guide | Contributing | Images | Demo Video
This document describes various aspects of how Sxmo runs and is configured.
Start-up Process
Event Handling
Notifications
init=/init.sh rw console=tty0 console=ttyS0,115200 earlycon=uart,mmio32,0x01c28000 panic=10 consoleblank=0 loglevel=1 cma=256M PMOS_NO_OUTPUT_REDIRECT PMOS_FORCE_PARTITION_RESIZE pmos_boot=/dev/mmcblk${bootdev}p1 pmos_root=/dev/mmcblk${bootdev}p2
sun50i-a64-pinephone-1.1
or sun50i-a64-pinephone-1.2
, depending on the hardware version, as the flattened device tree blob (FDT/DTB) file.uInitrd-postmarketos-allwinner
) and kernel (vmlinuz-postmarketos-allwinner
) are loaded.The default PinePhone boot priority is first the SD card and then the eMMC so inserting your own SD card with your preferred release will result in the phone booting your image.
After the kernel is booted, the init.sh
script in initial RAM disk runs. This performs various low-level startup and setup tasks, mostly relating to partitions and filesystems. This largely relies on the busybox binary present in the initial RAM disk. When completed the script exec's a switch_root to the root filesystem and starts /sbin/init
which is just a symlink to BusyBox.
When called as init
, busybox will use /etc/inittab
for its configuration, if present. Note, busybox has its own interpretation of inittab
syntax. The /etc/inittab
included in the filesystem specifies the following:
/sbin/getty
on /dev/tty[1-6]
for virtual consoles, and on the /tty/S0
for the serial console.sysvinit
actions first, waiting for completion
/sbin/openrc sysinit
/sbin/openrc boot
wait
actions next, waiting for completion
/sbin/openrc default
-- this is the "actual" init./sbin/reboot
/sbin/openrc shutdown
.OpenRC init system is a dependency-based init system that manages system init scripts and the associated services.
Named runlevels in OpenRC are stored in directories under /etc/runlevels
. When called with a runlevel as an argument, /sbin/openrc
loads the init scripts in the runlevel's directory, and then run them in alphabetical order, unless a script has dependency information, in which case the order is changed to provide a valid start-up sequence.
/etc/local.d/
directoryDetails on xdm
and the login widget configuration can be found in the xdm
man page.
/usr/sbin/xdm
runs with the arguments specified by the variable $xdm_opts
, which is set in /etc/conf.d/xdm
. Currently, the $xdm_opts
variable is empty./usr/lib/X11/Xsetup_0
script runs to assist in setting up the screen the user sees along with the xlogin widget.
/usr/lib/X11/xdm/wallpaper.jpg
will be set as the background for the login screen./usr/lib/X11/xdm/welcome.ogg
will be played as the startup sound./etc/X11/xdm/Xresources
, including colors, fonts, dimensions, and optional logo./usr/lib/X11/Xstartup
script runs, which registers the user's session using sessreg
.xdm
runs the /usr/lib/X11/Xsession
script, which simply hands off control to /usr/sbin/sxmo_xinit.sh
.When the user logs out, xdm
will run /usr/lib/X11/Xreset
which currently only deregisters the user. Then the X server is reset and Xsetup_0
is run again.)
This script, located at /usr/sbin/sxmo_xinit.sh
, sets up the basic interface for Sxmo:
sources /usr/bin/sxmo_common.sh
to set common environment/shell variables
envvars() - this function sets up environment variables by:
/etc/profile
- system-wide variables - This just sources /etc/profile.d/*.sh
/etc/profile.d/sxmo.sh
which mostly sets XDG path variables.locale.sh
, gawk.sh
~/.profile
- per-user variables - not present by defaultsetupxdgdir()
$XDG_RUNTIME_DIR
and $XDG_CACHE_HOME
(see basedir specification)xdefaults() - performs basic X startup/setup
/usr/share//sxmo/alsa/default_alsa_sound.conf
/usr/share/sxmo/appcfg/xmodmap_caps_esc
to map caps-lock key to control instead.xsetroot
to set desktop background gridxset
to turn off screensaver and disable DPMS EnergyStar features
sxmo_screenlock
which calls xset dpms force on
when unblanking the screen.$HOME/.Xresources
daemons()
$XDG_CONFIG_HOME/sxmo/conky.conf
/usr/share/sxmo/appcfg/conky.conf
autocutsel
for both CLIPBOARD (default) and PRIMARYsxmo_statusbar.sh
sxmo_statusbar.sh
instancestartdwm()
dbus-run-session
to start
dunst
using config file /usr/share/sxmo/appcf/dunst.conf
sxmo_notificationmonitor.sh
sxmo_lisgdstart.sh
- gesture daemon$XDG_CONFIG_HOME/sxmo/xinit
, if present.dwm
Various processes are started when certain events occur, rather than always being run at startup or login. Some of the most significant ones are listed below:
The keys and button presses which dwm responds to are specified at compile-time in the config.h
for sxmo-dwm
. See the userguide for a description.
The built-in responses to screen gestures that are specified at compile-time in config.h
for lisgd
, are overridden by command-line specifications in sxmo_lisgdstart.sh. See the userguide for a description.
A variety of system activities trigger udev events which are matched by rules in /etc/udev/rules.d/
and /usr/lib/udev/rules.d
.
/etc/udev/rules.d
:
50-firmware.rules
- (pkg: postmarketos-base)
50-sxmo.rules
- (pkg: sxmo-utils)
/usr/bin/sxmo_statusbarupdate.sh
on power supply plug events/usr/lib/udev/rules.d
:
10-dm.rules
- (pkg: device-mapper-udev)10-pinephone-proximity.rules
- (pkg: device-pine64-pinephone)
11-dm-lvm.rules
- (pkg: device-mapper-udev)11-dm-mpath.rules
- (pkg: multipath-tools)11-dm-parts.rules
- (pkg: multipath-tools)13-dm-disk.rules
- (pkg: device-mapper-udev)56-multipath.rules
- (pkg: multipath-tools)66-kpartx.rules
- (pkg: multipath-tools)68-del-part-nodes.rules
- (pkg: multipath-tools)70-wifi-pm.rules
- (pkg: device-pine64-pinephone)
80-libinput-device-groups.rules
- (pkg: libinput-libs)80-modem-eg25.rules
- (pkg: eg25-manager)
/usr/bin/eg25-configure-usb
when the modem device is loaded (?)80-modemmanager-pmos.rules
- (pkg: modemmanager)
rpmsg
-related variables (see notes in this patch)90-libinput-fuzz-override.rules
- (pkg: libinput-libs)90-modem-eg25.rules
- (pkg: device-pine64-pinephone)
/usr/bin/pinephone_setup-modem
when modem device is added95-dm-notify.rules
- (pkg: device-mapper-udev)99-triggerhappy.rules
- (pkg: triggerhappy)
Notifications to the user are created by calling /usr/bin/sxmo_notificationwrite.sh
with the appropriate arguments. These arguments are:
$NOTIFDIR
as specified in /usr/bin/sxmo_common.sh
.The last 3 arguments are written out by sxmo_notificationwrite.sh
, with one per line (though the message text can be multi-line, I think.) into the notification file specified by the first argument.
When created, notifications in $NOTIFDIR
will be processed by /usr/bin/sxmo_notificationmonitor.sh
.
When started, sxmo_notificationmonitor.sh
will scan and display any notifications in the directory specified in $NOTIFDIR
, then will begin monitoring that directory for any new notification files.
If a new notification is detected, the following actions are taken by the handlenewnotiffile() function:
"$XDG_CONFIG_HOME"/sxmo/hooks/notification
, if present; otherwise, it makes the phone vibrate.dunstify
.inotifywait
and upon the report of any event, the notification file is removed.Pending notifications can be viewed by running /usr/bin/sxmo_notificationsmenu.sh
either from a terminal or from the system menu. This script displays the notification times (hh:mm) and the associated messages using dmenu
. If selected, the action specified in the notification file is performed and the notification is removed.