Tuning sysfs

From postmarketOS
Revision as of 15:40, 11 September 2017 by Ollieparanoid (talk | contribs) (note that dumsys.sh permssion denied errors can be ignored)
Jump to: navigation, search
Permission denied errors while running the script are expected and can be ignored

After porting postmarketOS to your device, you might find that still some features don't work. You may need to adjust some values inside the /sys directory.

sysfs is a pseudo file system provided by the Linux kernel that exports information about various kernel subsystems, hardware devices, and associated device drivers from the kernel's device model to user space through virtual files. In addition to providing information about various devices and kernel subsystems, exported virtual files are also used for their configuring.

One approach is comparing the contents of these files when TWRP or LineageOS is running and the same for pmOS.

The following script dumps the content of /sys/devices. Copy it as dumpsys.sh

# dumpsys.sh

walk() {
    for file in $(ls $1); do
        if test -L "$path"; then
        if test -f "$path"; then
            echo "$path"
            cat "$path"
        if test -d "$path"; then
            walk "$path"

others() {
    cat /proc/cpuinfo
    cat /proc/cmdline

walk "$DIR"

Upload it to your device when running TWRP (use adb push) and when running postmarketOS (use scp). Run it and then compare the output.

For TWRP/LineageOS:

adb push dumpsys.sh /
adb shell "sh /dumpsys.sh > /devices-twrp.dump"
adb pull /devices-twrp.dump .

For pmOS:

scp dumpsys.sh user@
# sh dumpsys.sh > devices-pmos.dump
scp user@ .

Then get the differences (example):

diff -u devices-pmos.dump devices-twrp.dump > devices.diff

You could also run it in even in the stock ROM but it is important that you run the same kernel version in postmarketOS then.

Note: On some devices (like Xperia Z) this script will hang on vsync_event files. To continue the script to the next file we just kill the process that processes the vsync_event file:

ps w | grep vsync_event # To find process id of the cat command that was processing vsync_event
kill -SIGTERM <pid> # Kill the process


i9070 port

This way, user drebrez figured out two values needed for the framebuffer configuration for the i9070 port.

echo 16 > /sys/devices/platform/mcde_fb/graphics/fb0/bits_per_pixel
echo 960,1600 > /sys/devices/platform/mcde_fb/graphics/fb0/virtual_size