https://wiki.postmarketos.org/api.php?action=feedcontributions&user=Ityt&feedformat=atompostmarketOS - User contributions [en]2024-03-28T15:10:26ZUser contributionsMediaWiki 1.39.6https://wiki.postmarketos.org/index.php?title=User:Ityt&diff=17001User:Ityt2021-02-03T18:13:57Z<p>Ityt: </p>
<hr />
<div>{{My devices}}<br />
{{Owns device|Motorola_Moto_G4_Play_(motorola-harpia)|XT1602; Plasma-mobile unstable, Phosh stable}}<br />
{{Owns device|Xiaomi_Mi_3_(xiaomi-cancro)|Display not working}}</div>Itythttps://wiki.postmarketos.org/index.php?title=User:Ityt&diff=17000User:Ityt2021-02-03T18:10:42Z<p>Ityt: </p>
<hr />
<div>{{My devices}}<br />
{{Owns device|Motorola_Moto_G4_Play_(motorola-harpia)|Plasma-mobile unstable, Phosh stable}}<br />
{{Owns device|Xiaomi_Mi_3_(xiaomi-cancro)|Display not working}}</div>Itythttps://wiki.postmarketos.org/index.php?title=User:Ityt&diff=16998User:Ityt2021-02-03T17:45:47Z<p>Ityt: Created page with "{{My devices}}"</p>
<hr />
<div>{{My devices}}</div>Itythttps://wiki.postmarketos.org/index.php?title=Installing_pmbootstrap&diff=16976Installing pmbootstrap2021-02-01T19:21:16Z<p>Ityt: /* Tab completion */ Arch linux installation of argcomplete</p>
<hr />
<div>{{note|Running postmarketOS, Alpine or Void Linux? Grab pmbootstrap straight from your distribution's package manager (e.g. <code>apk add pmbootstrap</code>)!}}<br />
<br />
== Requirements ==<br />
* <code>python</code> >=3.6<br />
* <code>openssl</code> or alternative(like <code>libressl</code>)<br />
* Depending on the installation method:<br />
** <code>pip3</code> (possibly shipped with Python)<br />
** <code>git</code><br />
<br />
Alpine Linux users also need to install <code>coreutils</code> and <code>procps</code>:<br />
<syntaxhighlight lang="shell-session"><br />
$ apk add python3 coreutils procps<br />
</syntaxhighlight><br />
<br />
== pmaports.git ==<br />
pmbootstrap will automatically clone the [https://gitlab.com/postmarketOS/pmaports/ pmaports.git] repository during <code>pmbootstrap init</code> to the work dir of your choice, and afterwards you can look up the full path with <code>pmbootstrap config aports</code>. See [[git workflow]] for more information.<br />
<br />
== Installing automatically ==<br />
=== Latest release with pip ===<br />
pmbootstrap is up on [https://pypi.org/project/pmbootstrap/ pypi] now, so it can be installed with:<br />
<syntaxhighlight lang="shell-session"><br />
$ pip3 install --user pmbootstrap<br />
</syntaxhighlight><br />
<br />
You may need to reload your configuration by running <code>source ~/.profile</code>.<br />
<br />
That's it. The steps below are for alternative methods of installing <code>pmbootstrap</code>. Read on at [[#Tab completion]] if you are interested.<br />
<br />
==== Updating ====<br />
<br />
Updating to the latest version of pmbootstrap can be done like this:<br />
<br />
<syntaxhighlight lang="shell-session"><br />
$ pip3 install --user --upgrade pmbootstrap<br />
</syntaxhighlight><br />
<br />
=== Latest development version from git ===<br />
==== Download pmbootstrap ====<br />
<syntaxhighlight lang="shell-session"><br />
$ git clone https://gitlab.com/postmarketOS/pmbootstrap.git<br />
</syntaxhighlight><br />
<br />
==== Install ====<br />
<syntaxhighlight lang="shell-session"><br />
$ cd pmbootstrap && python3 setup.py install<br />
</syntaxhighlight><br />
<br />
== Installing manually ==<br />
<br />
This setup is useful for hacking on pmbootstrap code, because you are directly running the code from your git tree. No need to run setup.py after each change.<br />
<br />
==== Download pmbootstrap ====<br />
<syntaxhighlight lang="shell-session"><br />
$ git clone https://gitlab.com/postmarketOS/pmbootstrap.git<br />
</syntaxhighlight><br />
<br />
==== Create a link ====<br />
If the directory <code>~/.local/bin</code> does not already exist, create it with:<br />
<syntaxhighlight lang="shell-session"><br />
$ mkdir -p ~/.local/bin<br />
</syntaxhighlight><br />
<br />
Create a symbolic link in <code>~/.local/bin</code> named <code>pmbootstrap</code>:<br />
<syntaxhighlight lang="shell-session"><br />
$ ln -s "$PWD/pmbootstrap/pmbootstrap.py" ~/.local/bin/pmbootstrap<br />
</syntaxhighlight><br />
<br />
==== Test installation ====<br />
To test that pmbootstrap is installed correctly, open a new terminal and run:<br />
<syntaxhighlight lang="shell-session"><br />
$ pmbootstrap --version<br />
</syntaxhighlight><br />
<br />
If this returns something like <code>pmbootstrap: command not found</code> instead of a version number, ensure that the following lines are in <code>~/.profile</code> (zsh: <code>~/.zprofile</code>): <br />
<syntaxhighlight lang="shell"><br />
# set PATH so it includes user's private bin if it exists<br />
if [ -d "$HOME/.local/bin" ] ; then<br />
PATH="$HOME/.local/bin:$PATH"<br />
fi<br />
</syntaxhighlight><br />
Then open a new terminal and try again.<br />
<br />
== Tab completion ==<br />
[https://en.wikipedia.org/wiki/Command-line_completion Tab completion] is an optional feature that saves you time by automatically filling in the rest of a command when you press the tab key. You can also see a list of possible commands by double pressing the tab key.<br />
<br />
Install [https://kislyuk.github.io/argcomplete argcomplete] with:<br />
<syntaxhighlight lang="shell-session"><br />
$ pip3 install --user argcomplete<br />
</syntaxhighlight><br />
<br />
Alternatively you can use your distro package manager to install <code>argcomplete</code>, for example in Ubuntu:<br />
<syntaxhighlight lang="shell-session"><br />
$ sudo apt install python-argcomplete<br />
</syntaxhighlight><br />
in Gentoo:<br />
<syntaxhighlight lang="shell-session"><br />
$ sudo emerge dev-python/argcomplete<br />
</syntaxhighlight><br />
in Arch Linux:<br />
<syntaxhighlight lang="shell-session"><br />
$ sudo pacman -S python-argcomplete<br />
</syntaxhighlight><br />
<br />
Next, do one of the following depending on the shell you use.<br />
<br />
==== Bash ====<br />
Add the following line to <code>~/.bashrc</code>:<br />
<syntaxhighlight lang="shell"><br />
eval "$(register-python-argcomplete pmbootstrap)"<br />
</syntaxhighlight><br />
<br />
Then reload your configuration by opening a new terminal or by running <code>source ~/.bashrc</code>.<br />
<br />
==== Zsh ====<br />
Add the following lines to <code>~/.zshrc</code>:<br />
<syntaxhighlight lang="shell"><br />
autoload bashcompinit<br />
bashcompinit<br />
eval "$(register-python-argcomplete pmbootstrap)"<br />
</syntaxhighlight><br />
<br />
Then reload your configuration by opening a new terminal or by running <code>source ~/.zshrc</code>.<br />
<br />
== Troubleshooting during installation==<br />
===ERROR: We have split the aports repository from the pmbootstrap repository (#383). Please run 'pmbootstrap init' again to clone it===<br />
According to [https://www.reddit.com/r/postmarketOS/comments/hkop88/pmbootstrap_setup/ this reddit post] you need to :<br />
- Delete ~/.config/pmbootstrap.cfg => command rm <br />
- Delete ~/.local/var/pmbootstrap<br />
- Run the pmbootstrap init again<br />
<br />
In command line :<br />
rm ~/.config/pmbootstrap.cfg<br />
rm -r ~/.local/var/pmbootstrap<br />
pmbootstrap init<br />
<br />
<br />
== See also ==<br />
* {{MR|1656}} implement bash tab completion<br />
<br />
[[Category:Guide]]</div>Itythttps://wiki.postmarketos.org/index.php?title=Troubleshooting:kernel&diff=16971Troubleshooting:kernel2021-02-01T17:30:50Z<p>Ityt: /* Kernel compilation: thumb conditional instruction should be in IT block */ The user should use kconfig edit to disable a kernel feature.</p>
<hr />
<div>Here are some common kernel compilation problems listed. For debugging a kernel that compiles, but does not boot, see [[Troubleshooting:boot]].<br />
<br />
== How to create a patch ==<br />
Patching a kernel is as simple as putting a <code>.patch</code> file in your <code>aports/device/linux-vendor-flavor</code> folder and adding the patch name to the <code>source</code> variable in your <code>APKBUILD</code> file. See also: [[Patching]].<br />
<br />
== undefined reference to kgsl_iommu_sync_lock ==<br />
<pre>drivers/built-in.o:(.data.rel+0x68c): undefined reference to kgsl_iommu_sync_lock'<br />
drivers/built-in.o:(.data.rel+0x690): undefined reference to kgsl_iommu_sync_unlock'</pre><br />
You need to apply the [https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/linux-lg-mako/02_gpu-msm-fix-gcc5-compile.patch gpu-msm-fix-gcc5-compile.patch] patch.<br />
<br />
== How can I boot the kernel with some specific arguments? ==<br />
You can configure <code>CONFIG_CMDLINE</code> so that the arguments are permanent or change it in boot time using fastboot or pmbootstrap, for example:<br />
<br />
<pre>fastboot boot -c &quot;console=ttyHSL0,115200,n8&quot; ...<br />
<br />
pmbootstrap flasher boot --cmdline &quot;PMOS_NO_OUTPUT_REDIRECT&quot;</pre><br />
== MSM framebuffer doesn't work ==<br />
We found out that removing the 3D driver support makes the MSM framebuffer. See {{MR|66}}.<br />
<br />
<pre>CONFIG_MSM_KGSL=n</pre><br />
== PTY allocation request failed ==<br />
<pre>PTY allocation request failed on channel 0<br />
-ash: a: unknown operand</pre><br />
Go to [[kernel configuration]], you have probably missed <code>CONFIG_DEVTMPFS</code>!<br />
<br />
== Kernel compilation: (some header file): No such file or directory ==<br />
Busybox' <code>zip</code> implementation does not extract symlinks. There are two workarounds. One is to use another archive type (typically kernel sources are downloaded from GitHub, where you can also get the source as <code>.tar.gz</code> - simply by changing the extension in the URL).<br />
<br />
The other workaround is to add <code>unzip</code> to the makedepends, so it uses the original unzip instead of the busybox version.<br />
<br />
(This has been fixed in busybox in the meantime.)<br />
<br />
== Kernel compilation: thumb conditional instruction should be in IT block ==<br />
<pre><br />
arch/arm/crypto/aesbs-core.S:449: Error: thumb conditional instruction should be in IT block -- `addeq r6,r6,#0x10'<br />
arch/arm/crypto/aesbs-core.S:904: Error: thumb conditional instruction should be in IT block -- `addeq r6,r6,#0x10'<br />
arch/arm/crypto/aesbs-core.S:2100: Error: thumb conditional instruction should be in IT block -- `subne r9,#0x10'<br />
</pre><br />
<br />
You can fix it by disabling <code>CONFIG_CRYPTO_AES_ARM_BS</code> with:<br />
<source lang="bash">pmbootstrap kconfig edit</source><br />
Then go to <code>Cryptographic API</code> and disable <code>Bit sliced AES using NEON instructions</code>.<br />
<br />
On some other devices, like Huawei P7, you might also need to disable all CRYPTO flags containing ARM (<code>CONFIG_CRYPTO_{algorithm name}_ARM</code>), which are ARM NEON optimizations.<br />
<br />
This was first noticed in {{MR|144|pmaports}}.<br />
<br />
== Kernel compilation: BusyBox lzma compression fails ==<br />
In case you get the following output:<br />
<br />
<pre>LZMA arch/arm/boot/compressed/piggy.lzma<br />
lzma: unrecognized option: 9<br />
BusyBox v1.26.2 (2017-06-11 06:37:13 GMT) multi-call binary.<br />
<br />
Usage: lzma -d [-cf] [FILE]...<br />
<br />
Decompress FILE (or stdin)<br />
<br />
-d Decompress<br />
-c Write to stdout<br />
-f Force</pre><br />
In the BusyBox version shipped with Alpine Linux, only lower compression levels are enabled (to reduce the binary size). The kernel you're building is configured to compress with LZMA at the highest compression level. Pick one of the following solutions:<br />
<br />
* Add <code>xz</code> to the <code>makedepends=</code> line. Then the &quot;real&quot; lzma binary will be used instead of the Busybox version. This is '''recommended''', because then your kernel will get built most similar to how it is built elsewhere, so you have the lowest risk of introducing a reason for the kernel not to boot (because the kernel is too big in size or something like that)<br />
* Reduce the compression ratio by adding [https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/linux-samsung-i9070/02_reduce_lzo_compression.patch this patch]. This will not introduce any dependency, but increase the kernel size.<br />
* Use another compression algorithm (run <code>pmbootstrap menuconfig linux-...</code> and change it there). Gzip should work, but will produce a big kernel, because pmbootstrap currently installs a workaround to always use the fastest compression method (<code>-1</code>), when the most compressing one (<code>-9</code>) is chosen. This will increase the kernel size the most.<br />
<br />
== Kernel compilation: Error: .err encountered in assembler messages ==<br />
If compilation errors out on something like this in logs:<br />
<pre><br />
/tmp/ccmAkEIJ.s: Assembler messages:<br />
/tmp/ccmAkEIJ.s:2280: Error: .err encountered<br />
</pre><br />
Then [https://wiki.postmarketos.org/wiki/Downstream_kernel_specific_package#GCC_version older version of GCC] should be used for compilation.<br />
<br />
== Android Kernel compilation fails on warnings (not on errors) (-Werror) ==<br />
Don't even bother fixing all those warnings, there are too many of them and we don't want the outdated Android kernels in the long run anyway! When you generate your kernel APKBUILD with <code>pmbootstrap init</code>, then you should have code in the <code>prepare()</code> that automatically removes the <code>-Werror</code> parameter in all Makefiles.<br />
<br />
Example from [https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/linux-asus-z00vd/APKBUILD linux-asus-z00vd]:<br />
<source lang="bash"><br />
# Remove -Werror from all makefiles<br />
local i<br />
local makefiles="$(find . -type f -name Makefile)<br />
$(find . -type f -name Kbuild)"<br />
for i in $makefiles; do<br />
sed -i 's/-Werror-/-W/g' "$i"<br />
sed -i 's/-Werror//g' "$i"<br />
done<br />
</source><br />
<br />
== Building the kernel with Android's build system ==<br />
It might be useful for debugging to build Android's kernel with Android's build system.<br />
<br />
You can follow the LineageOS building guide for your device (see [https://wiki.lineageos.org/devices/titan/build this] for titan device as example).<br />
<br />
The process should be similar for other devices:<br />
<br />
<source lang="bash"># make some directories<br />
mkdir -p ~/bin<br />
mkdir -p ~/android/lineage<br />
<br />
# download the 'repo' tool<br />
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo<br />
chmod a+x ~/bin/repo<br />
<br />
# clone LineageOS<br />
cd ~/android/lineage<br />
~/bin/repo init -u https://github.com/LineageOS/android.git -b cm-14.1<br />
<br />
# Download the rest of dependencies (this will take a while and about *TODO* GB of disk space)<br />
~/bin/repo sync<br />
<br />
# now prepare the build for your device (replace 'titan' with the device you want to for the kernel for)<br />
source build/envsetup.sh<br />
breakfast titan<br />
<br />
# Now instead of following the rest of the guide (which will compile both Android and the kernel<br />
# for your device), simply compile the kernel:<br />
mka kernel<br />
<br />
# This command will also generate the device tree, initramfs and boot.img images<br />
mka bootimage</source><br />
You can check the <code>$OUT</code> environment variable and cd into it. In the case of titan the interesting generated files are:<br />
<br />
* <code>~/android/lineage/out/target/product/titan/boot.img</code> (boot image ready to be flashed: kernel + initramfs)<br />
* <code>~/android/lineage/out/target/product/titan/dt.img</code> (device trees)<br />
* <code>~/android/lineage/out/target/product/titan/kernel</code> (linux image)<br />
* <code>~/android/lineage/out/target/product/titan/ramdisk.img</code> (compressed initramfs)<br />
<br />
The defconfig used is available at <code>~/android/lineage/kernel/motorola/msm8226/arch/arm/configs/titan_defconfig</code><br />
<br />
== Error: selected processor does not support ARM mode `smc #0' ==<br />
Try this patch: https://github.com/imoseyon/leanKernel-galaxy-nexus/pull/6<br />
<br />
== X11 does not work on Qualcomm devices ==<br />
Try apply this [https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/linux-xiaomi-santoni/fix-xorg-mdss-update-fb-info.patch patch].<br />
<br />
== TLS (SSL/HTTPS) is broken! ==<br />
If you see messages like these, when trying to access HTTPS pages, read on:<br />
<pre><br />
Connecting to pastebin.com (104.20.209.21:443)<br />
ssl_client: pastebin.com: TLS connect failed<br />
wget: error getting response: Connection reset by peer<br />
</pre><br />
<br />
You are probably running an older kernel (pre 3.17), which does not yet have the "getrandom" syscall. This is required by modern openssl/libressl versions (Alpine was on libressl for a long time, then switched back to openssl). Check your kernel version, and if that is the case, and [[the Mainline Kernel|mainlining]] is not feasible for you, consider backporting the getrandom syscall like done in {{MR|69|pmaports}}. This issue was discussed in {{issue|107|pmaports}}.<br />
<br />
== CROSS_COMPILE_ARM32 not defined or empty ==<br />
Try unset CONFIG_COMPAT_VDSO from your kernel config.<br />
<br />
== External resources ==<br />
*[http://docs.halium.org/en/latest/porting/common-kernel-build-errors.html Halium Docs]</div>Ityt