blob: 377a45d69c5e3c4a0130b9949529101ca77bbdb3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>postmarketOS</title>
<meta name="description" content="Aiming for a 10 year life-cycle for smartphones">
<meta name="keywords" content="postmarketOS">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all">
<link rel="canonical" href="https://postmarketos.org/wiki/Tuning-sysfs/">
<link href="/pmosweb/static/css/tachyons.min.css" rel="stylesheet">
<link href="/pmosweb/static/css/main.css" rel="stylesheet">
</head>
<body>
<div class="mw7 center">
<div class="cf ph2-ns">
<a class="title" href="/">
<h1 class="f2 lh-title">
<img src="/pmosweb/static/img/recycle.png"></img>
<span>postmarketOS</span>
</h1>
</a>
<div class="menu">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/wiki/">Wiki</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</div>
<h1>Tuning sysfs</h1>
<p>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.</p>
<p>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.</p>
<p>One approach is comparing the contents of these files when TWRP or LineageOS is running and the same for pmOS.</p>
<p>The following script dumps the content of /sys/devices. Copy it as <code>dumpsys.sh</code></p>
<pre class="codehilite"><code class="language-shell">#!/bin/sh
# dumpsys.sh
DIR="/sys/devices"
walk() {
for file in $(ls $1); do
path="$1/$file"
if test -L "$path"; then
continue
fi
if test -f "$path"; then
echo "$path"
cat "$path"
fi
if test -d "$path"; then
walk "$path"
fi
done
}
others() {
cat /proc/cpuinfo
cat /proc/cmdline
}
walk "$DIR"
others</code></pre>
<p>Upload it to your device when running TWRP (use <code>adb push</code>) and when running postmarketOS (use <code>scp</code>). Run it and then compare the output.</p>
<p>For TWRP/LineageOS:</p>
<pre class="codehilite"><code class="language-shell">adb push dumpsys.sh /
adb shell "sh /dumpsys.sh > /devices-twrp.dump"
adb pull /devices-twrp.dump .</code></pre>
<p>For pmOS:</p>
<pre class="codehilite"><code class="language-shell">scp dumpsys.sh user@172.16.42.1:~
# sh dumpsys.sh > devices-pmos.dump
scp user@172.16.42.1:~/devices-pmos.dump .</code></pre>
<p>Then get the differences:</p>
<pre class="codehilite"><code class="language-shell">diff -u devices-pmos.dump devices-twrp.dump > devices.diff</code></pre>
<p>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.</p>
<h2>Examples</h2>
<h3>i9070 port</h3>
<p>This way, user <code>drebrez</code> figured out two values needed for the framebuffer configuration for the i9070 port.</p>
<pre class="codehilite"><code class="language-shell">echo 16 > /sys/devices/platform/mcde_fb/graphics/fb0/bits_per_pixel
echo 960,1600 > /sys/devices/platform/mcde_fb/graphics/fb0/virtual_size</code></pre>
</div>
</div>
</body>
</html>
|