Project Overview | Install Guide | User Guide | System Guide | Contributing | Images | Demo Video
Documentation (postmarketOS Stable) | Documentation (postmarketOS edge) | Documentation (Development Version)
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 tinydm
and the configuration can be found in the tinydm
ticket page.
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)
To manage user daemons in an unified way we got the sxmo_daemons.sh
script:
$ sxmo_daemons.sh start a_daemon_name sleep 60
$ sxmo_daemons.sh list
a_daemon_name
$ sxmo_daemons.sh running a_daemon_name
a_daemon_name is still running
$ sxmo_daemons.sh stop a_daemon_name
Every daemons that run on the sxmo system are initiated in the "start" hook or at specific moments. See daemons more as a way to manage easily asynchronous works more than system daemons.
Here are some default daemons:
idle_locker
: An idle monitor that will eventuall move the phone in a deepest statelisgd
: The touch gesture daemon that trigger actionsmodem_monitor
: Listen to modem manager dbus signals to manage sms, incoming calls, etc…wob
: The progress status bar that appear when increasing/decreasing volume/brightnessnotification_monitor
: Listen to new notifications and trigger UI popupsnetwork_monitor
: Will update the status bar componentsstatusbar_periodics
: Will update some status bar components periodicallydesktop_widget
: The background text oclock, either conky or wayout,mmsd
: The mms daemons manager that works with modem managermenu_mode_toggler
: A little daemon that change the sway mode to "menu" when openning a menudesktop_notifier
: The popup notifier, either dunst or makoTo manage the status bar, sxmo relies on sxmo_status.sh
. This script allow us to add, change or remove displayed components.
$ sxmo_status.sh add 10-foo foo
$ sxmo_status.sh show
foo
$ sxmo_status.sh add 20-bar bar
$ sxmo_status.sh show
foo bar
$ sxmo_status.sh add 15-int -
$ sxmo_status.sh show
foo - bar
$ sxmo_status.sh del 10-foo
$ sxmo_status.sh show
- bar
$ printf world | sxmo_status.sh add 10-hello
world - bar
Most of the sxmo status bar component are configured by "statusbar" hook. Some periodic components (the time by example) are triggered by the hook as a daemon "statusbar_periodics".
Some parts of the sxmo code are wrapped in hooks. If the user got the hook in their ~/.config/sxmo/hooks/
then this hook is used instead.
You can copy the default hooks from /usr/share/sxmo/default_hooks
and modify, extend or remove some behaviors.
A list of the default hooks can be found in the User Guide.
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.
To support multiple devices, Sxmo relies on a device profile system that defines multiple device names for Sxmo to source.
git clone https://git.sr.ht/~mil/sxmo-utils
.
To obtain ssh access, see USB Network - postmarketOS wiki.sxmo-utils/scripts/deviceprofiles/README.md
for what
to name the device profile file and what environmental
variables to set in the device profile file.sxmo-utils/scripts/deviceprofiles
directory has deviceprofiles
for other devices. Feel free to look through those as a referenceThe edge version of postmarketOS is recommended to create a device profile because sxmo-utils' master branch is most likely to work with edge. sxmo-utils can work on stable but you need to be willing to debug issues with sxmo-utils.
Once you have edited device's device profile, you can activate the profile by:
doas apk add libx11-dev xproto linux-headers
Note: for people reading this in the future, the makedepends may have changed. Please install the makedepends listed in this file: https://git.alpinelinux.org/aports/tree/community/sxmo-utils/APKBUILD
alpine-sdk
which will install make
and let you use aports:doas apk add alpine-sdk
Change into the root of the sxmo-utils
directory and run doas make install
. You may need to reboot or restart sway/dwm and superd.
sshing into your device, you should now get:
deviceprofile file /usr/bin/<NEXUS-7-DEVICE-TREE-COMPATIBLE-STRING>.sh loaded.
If you get that, Sxmo has successfully loaded the device profile you made.
Feel free to edit sxmo-utils/deviceprofiles/your-device.sh
, run
doas make install
inside sxmo-utils, and reboot till everything you
want working works.
If everything works, please contribute your changes https://sxmo.org/contribute
Please do not be scared of git send-email. If you post too much to our mailing list while learning how to use it, we dont mind and will fix it up. We need Sxmo on more devices!
If you need realtime help in this process, please join irc:
commit 89ea52759abab986fdd119a75c83f6bbc2ec9398 Author: Maarten van Gompel <proycon@anaproy.nl> Date: 2024-03-09T13:14:52+01:00 fixed svkbd link to upstream