Changes

Jump to navigation Jump to search
= Changing the kernel configuration =
You can change the kernel configuration with pmbootstrap, for the linux-sony-yuga package for example we run:
You can change the kernel configuration with pmbootstrap. On some devices the naming convention is simply linux-<vendor>-<pre class="shell"device>./pmbootstrap.py menuconfig , for the linux-sony-yuga</pre>package for example we run:
<pre class="shell">pmbootstrap kconfig edit sony-yuga</pre> Some devices do not follow this naming convention, in which case you can check what package provided the kernel by running: <pre class="shell">apk info --who-owns /boot/vmlinuz-*</pre> On the pinephone by pine64 you would run: <pre class="shell">pmbootstrap kconfig edit linux-postmarketos-allwinner-5.4.0_git20191204-r1</pre> This gives you a menu where you can select and deselect all kernel configuration options. Press the <code>/</code> key to get a search dialog. After finding something, type the number of the search result to quickly jump to it.
[[File:KernelConfig.png|800px]]
 
If you don't like the terminal user interface, you can also use <code>pmbootstrap kconfig edit -x</code> or <code>pmbootstrap kconfig edit -g</code>. See <code>pmbootstrap kconfig edit -h</code> for details.
== Options aren't always visible! ==
= Useful kernel configuration options =
== Required to be enabled/disabled ==
Enable or disable the following options to get postmarketOS working. Use <code>./pmbootstrap.py kconfig_checkkconfig check</code> to check which options need to be modified.
=== CONFIG_DEVTMPFS ===
-ash: a: unknown operand</pre>
=== CONFIG_DEVTMPFS_MOUNT CONFIG_TMPFS_POSIX_ACL === '''About''' ''This will instruct the kernel to automatically mount the devtmpfs filesystem at /dev, directly after the kernel has mounted the root filesystem. The behavior can be overridden with the commandline parameter: devtmpfs.mount=0|1.''
[https://cateee.net/lkddb/web-lkddb/DEVTMPFS_MOUNT.html Read more...]''' About'''
'''Location in menu'Support POSIX Access Control Lists (ACLs) for tmpfs-based filesystems.''
<pre class="shell>Device Drivers --> Generic Driver Options -[https://cateee.net/lkddb/web-> Automount devtmpfs at /dev, after the kernel mounted the rootfs<lkddb/pre>TMPFS_POSIX_ACL.html Read more...]
'''pmOS specific'''
This option should '''not''' is needed for some UIs (phosh) to be setable to control bluetooth.
=== CONFIG_VT ===
Device Drivers -->
Character Devices -->
Enable TTY --> Virtual Terminal
</pre>
This should always be set, required for full disk encyption.
 
=== CONFIG_EXT4_FS ===
 
'''About'''
 
''This is the next generation of the ext3 filesystem.''
 
[https://cateee.net/lkddb/web-lkddb/EXT4_FS.html Read more...]
 
'''Location in menu'''
 
<pre class="shell">
File systems -->
The Extended 4 (ext4) filesystem
</pre>
 
'''pmOS specific'''
 
This should always be set since pmbootstrap creates an ext4 rootfs.
 
=== CONFIG_UEVENT_HELPER ===
 
'''About'''
 
''The uevent helper program is forked by the kernel for every uevent. Before the switch to the netlink-based uevent source, this was used to hook hotplug scripts into kernel device events. It usually pointed to a shell script at /sbin/hotplug. This should not be used today, because usual systems create many events at bootup or device discovery in a very short time frame. One forked process per event can create so many processes that it creates a high system load, or on smaller systems it is known to create out-of-memory situations during bootup.''
 
[https://cateee.net/lkddb/web-lkddb/UEVENT_HELPER.html Read more...]
 
'''Location in menu'''
 
<pre class="shell">
Device Drivers -->
Generic Driver Options -->
Support for uevent helper
</pre>
 
'''pmOS specific'''
 
This option should always be enabled on pmos kernels that are 3.16+, it's the config option that makes /proc/sys/kernel/hotplug appear.
=== CONFIG_KERNEL_GZIP, CONFIG_KERNEL_XZ, CONFIG_KERNEL_LZO and CONFIG_KERNEL_LZMA ===
Please enable it for postmarketOS, so busybox' syslogd can log to a ringbuffer in the kernel (fixes {{github|808}}).
 
=== CONFIG_USE_VFB===
 
'''About'''
 
''Weston and Plasma Mobile might choose to draw on this virtual frame buffer, just like it happened for the samsung-jflte ({{issue|34|pmaports}}). Disabling the USE_VFB option fixed this, so let's make sure we don't have that option enabled for any kernel.''
 
'''Location in menu'''
 
<pre class="shell">
Device Drivers -->
Graphics supports -->
MSM Framebuffer support -->
MSM Virtual Framebuffer support
</pre>
 
'''pmOS specific'''
 
Please disable it, so we have one less source of failure.
 
=== CONFIG_KINETO_GAN ===
 
'''About'''
 
''Related to a proprietary "T-Mobile's WiFi-Calling" feature. It should not affect normal calls, so it should be safe to disable it.''
 
'''Location in menu'''
 
<pre class="shell">
Device Drivers -->
Network device support -->
Kineto GAN virtual network interface
</pre>
 
'''pmOS specific'''
 
Causes <code>sudo</code>, <code>ip</code> and other commands to hang ({{issue|1513|pmbootstrap}}). Please disable it.
 
=== CONFIG_BLK_DEV_INITRD ===
 
'''About'''
 
''Initial RAM filesystem and RAM disk (initramfs/initrd) support''
 
'''Location in menu'''
 
<pre class="shell">
General setup -->
Initial RAM filesystem and RAM disk (initramfs/initrd) support
</pre>
 
'''pmOS specific'''
 
Required. See {{issue|237|pmaports}} for notes about changing the initramfs compression.
 
=== CONFIG_CGROUPS ===
 
'''About'''
 
''This option adds support for grouping sets of processes together, for use with process control subsystems such as Cpusets, CFS, memory controls or device isolation.''
 
[https://cateee.net/lkddb/web-lkddb/CGROUPS.html Read more...]
 
'''Location in menu'''
 
<pre class="shell">
General setup -->
Control Group support
</pre>
 
'''pmOS specific'''
 
Required for elogind, and therefore necessary to be able to run most desktop environments.
 
=== CONFIG_CRYPTO_XTS ===
 
'''About'''
 
''XTS: IEEE1619/D16 narrow block cipher''
 
[https://cateee.net/lkddb/web-lkddb/CRYPTO_XTS.html Read more...]
 
'''Location in menu'''
 
<pre class="shell">
Cryptographic API -->
XTS support
</pre>
 
'''pmOS specific'''
 
Needed for the default cryptsetup cipher in pmbootstrap (<code>aes-xts-plain64</code>) ({{issue|1940}})
 
=== CONFIG_SAMSUNG_TUI ===
 
'''About'''
 
''Provide methods for TUI such as acquisition of buffer to be used as secure frame buffer in Secure World and synchronization of display and touch device between Normal World and Secure World.''
 
'''Location in menu'''
 
<pre class="shell">
Device Drivers -->
Misc devices -->
TUI HW Handler
</pre>
 
'''pmOS specific'''
 
Needs to be disabled. Prevents device from booting.
 
=== CONFIG_SEC_RESTRICT_ROOTING ===
 
'''About'''
 
''Restrict unauthorized executions with root permission.''
 
'''Location in menu'''
 
<pre class="shell">
Kernel hacking -->
Samsung Rooting Restriction Feature
</pre>
 
'''pmOS specific'''
 
Needs to be disabled. Blocks user from gaining root permissions.
 
=== CONFIG_TZDEV ===
 
'''About'''
 
''Samsung TZ Based Secure OS interface driver''
 
'''Location in menu'''
 
<pre class="shell">
Device Drivers -->
Misc devices -->
Samsung TZ Based Secure OS Support
</pre>
 
'''pmOS specific'''
 
Needs to be disabled. Prevents device from booting.
== Optional ==
'''pmOS specific'''
This is recommended for all 32bit (armhf, armv7, x86) devices. The option is not present on 64bit (aarch64, x86_64) devices, which means we currently can not check for it with <code>pmbootstrap kconfig_check</code>.
Without this option, it is not possible to mount ext4 partitions that have been created with the default settings. The postmarketOS SD card installation uses these default parameters. There doesn't seem to be a point in changing that to work around badly configured kernels: even if the postmarketOS installation did not require this option, you might come across an SD card with ext4, that does not work on your device.
 
=== CONFIG_USB_G_ANDROID ===
No
 
=== CONFIG_FHANDLE ===
 
'''About'''
 
''open by fhandle syscalls''
 
'''Location in menu'''
 
<pre class="shell">
General setup -->
open by fhandle syscalls
</pre>
 
'''pmOS specific'''
 
If USB OTG isn't working for you, try enable this config.
=== CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE ===
Set this if your device needs an appended device tree. If you are unsure, use <code>extract-dtb</code> on an existing kernel image. Not to be confused with <code>CONFIG_ARM_APPENDED_DTB</code>!
= Automatically merging == CONFIG_FW_LOADER_USER_HELPER ==='''About''' ''Enable the firmware sysfs fallback mechanism found in drivers/base/firmware_loader/Kconfig'' '''Location in menu''' <pre class="shell>Device Drivers --> Generic Driver Options --> Firmware loader --> Firmware loading facility (FW_LOADER [=y]) --> Enable the firmware sysfs fallback mechanism</pre> '''pmOS specific''' Prior to kernel version 3.7, the kernel had no capability of finding firmware itself so it had to call out to userspace to find the firmware for it. This changed with kernel 3.7 where the kernel gained "direct loading support" and where the userspace helper was only called as a fallback. In kernel 3.9 this functionality was put behind the kconfig option FW_LOADER_USER_HELPER which is what this patch checks to be enabled. Without this option, the udev rule present in postmarketos-base won't be notified that firmware needs to be loaded and as such can't call firmwareload.sh which loads firmware from /lib/firmware/postmarketos. === CONFIG_KEY_DH_OPERATIONS & CONFIG_CRYPTO_DH & CONFIG_CRYPTO_DES & CONFIG_CRYPTO_USER_API_SKCIPHER=== '''About''' ''These options enables ability to use iwd daemon (wpa_supplicant replacement)'' '''Location in menu''' <pre class="shell>Security Options ---> [*] Enable access key retention support [*] Diffie-Hellman operations on retained keys Cryptographic API ---> [*] Diffie-Hellman algorithm [*] DES and Triple DES EDE cipher algorithms [*] User-space interface for symmetric key cipher algorithms</pre> and these<pre class="shell> CONFIG_CRYPTO_USER_API_HASH CONFIG_CRYPTO_ECB CONFIG_CRYPTO_MD4 CONFIG_CRYPTO_MD5 CONFIG_CRYPTO_CBC CONFIG_CRYPTO_SHA1 CONFIG_CRYPTO_SHA256 CONFIG_CRYPTO_SHA512 CONFIG_CRYPTO_AES CONFIG_CRYPTO_DES CONFIG_CRYPTO_CMAC CONFIG_CRYPTO_HMAC CONFIG_CRYPTO_ARC4</pre>'''pmOS specific'''Enable only on recent mainline kernels. After enabling these options, you can use iwd daemon (better performance) instead of wpa_supplicant. === CONFIG_USER_NS ==='''About''' ''User namespace'' ''Required for BubbleWrap sandboxing used by The GNOME Web (Epiphany) and other software.'' '''pmOS specific''' Phosh environment must have it enabled for Web browser (Epiphany) being functional. '''Location in menu''' <pre class="shell>General setup ---> Namespaces support ---> [*] User namespace</pre> === SECCOMP ==='''About''' ''Enable seccomp to safely compute untrusted bytecode'' ''Required for BubbleWrap sandboxing used by The GNOME Web (Epiphany) and other software.'' '''pmOS specific''' Phosh environment must have it enabled for Web browser (Epiphany) being functional. == Anbox == To enable Anbox support, some options are required === CONFIG_SQUASHFS === '''About''' ''Squashfs is a highly compressed read-only filesystem for Linux. It uses zlib, lzo or xz compression to compress both files, inodes and directories. squashfs is intended for general read-only filesystem use, for archival use (i.e. in cases where a .tar.gz file may be used), and in embedded systems where low overhead is needed.'' '''Anbox specific''' Anbox uses a squashfs to store the Android rootfs. === CONFIG_SQUASHFS_XZ === '''About''' ''Squashfs support for reading squashfs file systems compressed with XZ compression. XZ gives better compression than the default zlib compression, at the expense of greater CPU and memory overhead.'' '''Anbox specific''' Anbox uses a ''xz-compressed'' squashfs. === CONFIG_SQUASHFS_XATTR === '''About''' ''Squashfs support for extended attributes (xattrs). Xattrs are name:value pairs associated with inodes by the kernel configuration or by users (see the [https://www.systutorials.com/docs/linux/man/5-attr/ attr(5)] manual page).'' '''Anbox specific''' For some reason, even if the squashfs is created with <code>-no-xattrs</code>,Anbox seems to fail badly without. === CONFIG_ASHMEM === '''About''' ''The ashmem subsystem is a new shared memory allocator, similar to POSIX SHM but with different behavior and sporting a simpler file-based API.'' ''It is, in theory, a good memory allocator for low-memory devices, because it can discard shared memory units when under memory pressure.'' '''Anbox specific''' Android requires it, so you need it to run Anbox. === CONFIG_BINDER_IPC =='''About''' ''Binder is used in Android for both communication between processes and remote method invocation. This means one Android process can call a method/routine in another Android process, using Binder to identify, invoke and pass arguments between said processes.''
{{note|This hasn't been tested a lot and will probably break something.}}''Anbox specific'''
This is a small python script that will find kernel config thats enabled in one kernel config but not in the otherAndroid uses it to communicate between process. It must be present for Anbox to work. You can use it by running it against the kernel config file in pmbootstrap and a defconfig from an android tree:
<source lang="shell-session">$ diffconfig.py config-postmarketos-mainline.armhf hammerhead_defconfigCONFIG_ZSWAP=yCONFIG_ZPOOL=yCONFIG_Z3FOLDCONFIG_BINDERFS ===y....</source>
It should be save to append the output from the diff command to the existing config*.armhf file to merge the extra kernel config needed for a device into the more generic postmarketOS kernel.Make sure that the outputted diff lines don't contain lines that change the more general kernel options like CONFIG_KERNEL_LZMA and make sure you run the menuconfig command after appending theconfig so the new kernel config is sanitized.''About'''
<source lang="python">#!/usr/bin/env python3def parse_config(raw): result = {} ''Binderfs is a pseudo-filesystem for line in rawthe Android Binder IPC driver which can be mounted per-ipc namespace allowing to run multiple instances of Android.splitlines(): if lineEach binderfs mount initially only contains a binder-control device.startswith("#"): continue if lineIt can be used to dynamically allocate new binder IPC devices via ioctls.strip() == "": continue''
key, value = line.split("=", maxsplit=1) result[key] = value'''Anbox-on-postmarketOS specific'''
return resultIt should '''not''' be set, because binderfs support in Anbox is broken in postmarketOS. For now, we just use regular binder instead because we don't need several binders.
It could be an incompatibility with musl. In <code>sys/ioctl.h</code>, the ioctl function is prototyped as such: <code>int ioctl(int, int, ...);</code>, in accordance to POSIX. On the hand, in the linux programmer manual, ioctl is of type <code>int ioctl(int, unsigned long, ...);</code>. GCC warns about it: "Warning: overflow in conversion from 'long unsigned int' to 'int' change value from 3238552065 to -1056415231", but according to dalias on #musl it should be harmless.
def diff_configs(a, b): result = [] config_a = parse_config(a) config_b = parse_config(b) for key, value in config_b.items(): if key not in config_a: result.append("{}CONFIG_ANDROID_BINDER_DEVICES ==={}".format(key, value)) return result
'''About'''
if __name__ == '__main__': import argparseDefault value for the binder.devices parameter. The binder.devices parameter is a comma-separated list of strings that specifies the names of the binder device nodes that will be created. Each binder device has its own context manager, and is therefore logically separated from the other devices.''
parser = argparse.ArgumentParser(description="defconfig diff utility") parser.add_argument('config_a', type=open) parser.add_argument('config_bAnbox specific''', type=open) args = parser.parse_args()
with argsThis must contain <code>binder</code>, as Anbox expects <code>/dev/binder</code>.config_a It should also contain <code>hwbinder</code> to be future-proof (as it will be required for Android 10). === CONFIG_TMPFS_XATTR === '''About''' Xattr support for tmpfs. '''Anbox specific''' Android requires it because it sets xattr on files in /dev, which is a tmpfs. Otherwise you get errors such as this in <code>/var/lib/anbox/console.log</code> :  libc: fsetxattr failed to set context (u:object_r:dalvik_prop:s0) for "/dev/__properties__/u:object_r:dalvik_prop:s0" libc: fsetxattr failed to set context (u:object_r:config_prop:s0) for "/dev/__properties__/u:object_r:config_prop:s0" === NETFILTER_XT_MATCH_COMMENT === '''About'''  It allows putting comments in iptables rules. It's a dummy module that ignore its <code>--comment= args</code> argument.config_a depends on NETFILTER, NETFILTER_XTABLES and NETFILTER_ADVANCED.read() '''pmOS specific'''
with argsIt is a requirement of anbox-bridge.config_b: b = argssh, which we use in the openRC init script.config_bAnbox won't start without that.read()
diff = diff_configs(a, b) for line in diff: print(line)</source>See also =
= References =* [https://cateee.net/lkddb/web-lkddb/ Linux Kernel Driver Database]* [https://www.cnx-software.com/2013/05/23/how-to-find-configuration-options-quickly-in-make-menuconfig/ How to find configuration options quickly in make menuconfig]
# [https[Category://cateee.net/lkddb/web-lkddb/ Linux Kernel Driver DatabaseTechnical Reference]]
439

edits

Navigation menu