<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rooting and Custom Rom on Ivon's Blog</title><link>https://ivonblog.com/en-us/categories/rooting-and-custom-rom/</link><description>Recent content in Rooting and Custom Rom on Ivon's Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</managingEditor><webMaster>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</webMaster><copyright>You are welcome to share articles of Ivon's Blog (ivonblog.com). Please include the original URL when citing articles, and abide by CC BY-NC-ND 4.0 license. For commercial use, please write an e-mail to me.</copyright><lastBuildDate>Mon, 26 Feb 2024 17:00:00 +0800</lastBuildDate><atom:link href="https://ivonblog.com/en-us/categories/rooting-and-custom-rom/index.xml" rel="self" type="application/rss+xml"/><item><title>[Root] Running Docker, Flatpak and Waydroid containers on Android phone with Termux</title><link>https://ivonblog.com/en-us/posts/sony-xperia-5-ii-docker-kernel/</link><pubDate>Mon, 26 Feb 2024 17:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/sony-xperia-5-ii-docker-kernel/</guid><description>&lt;p&gt;&lt;a href="https://ivonblog.com/posts/sony-xperia-5-ii-docker-kernel/" target="_blank" rel="noreferrer"&gt;🇹🇼 中文版&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There are various ways of running Docker containers on Android. First, Docker will not work in proot. And because Android kernel lacks the features which are required by dockers to run, even with root permission you still cannot run docker in chroot environment.&lt;/p&gt;
&lt;p&gt;The non-rooted method of running Dockers on Android is to set up a virtual machine and install docker in it, see &lt;a href="https://gist.github.com/oofnikj/e79aef095cd08756f7f26ed244355d62" target="_blank" rel="noreferrer"&gt;oofnikj - Docker on Termux in a VM&lt;/a&gt;. However this method is freaking slow.&lt;/p&gt;
&lt;p&gt;In order to run Docker containers on Android without virtual machine and chroot (which means native and better performance), we must our Android phone and compile a custom kernel for it.&lt;/p&gt;
&lt;p&gt;My Device: Sony Xperia 5 II (pdx206). LineageOS 20 (Android 13). The source code of the kernel is available on my &lt;a href="https://github.com/ivon852/android_kernel_sony_pdx206_docker" target="_blank" rel="noreferrer"&gt;Github repository&lt;/a&gt;.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt="Docker containers running on Android phone"
 src="https://ivonblog.com/posts/sony-xperia-5-ii-docker-kernel/images/Screenshot-20230203-183742-Termux.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Check kernel compatibility
 &lt;div id="1-check-kernel-compatibility" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-check-kernel-compatibility" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;First I rooted my Sony Xperia 5 II. Then I installed LineageOS 20.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install &lt;a href="https://ivonblog.com/en-us/posts/how-to-use-termux/" target="_blank" rel="noreferrer"&gt;Termux&lt;/a&gt;. Then execute Moby&amp;rsquo;s script to check kernel&amp;rsquo;s compatibility o running docker.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install wget tsu
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wget https://raw.githubusercontent.com/moby/moby/master/contrib/check-config.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chmod +x check-config.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sed -i &lt;span class="s1"&gt;&amp;#39;1s_.*_#!/data/data/com.termux/files/usr/bin/bash_&amp;#39;&lt;/span&gt; check-config.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ./check-config.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;The missing configs will be displayed. Take notes of these red missing configs (especially configs under &lt;code&gt;Generally Necessary&lt;/code&gt;), we have to enable them during kernel compliation.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/posts/sony-xperia-5-ii-docker-kernel/images/Screenshot-20230203-155832-Termux.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 class="relative group"&gt;2. Compile custom Android kernel
 &lt;div id="2-compile-custom-android-kernel" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-compile-custom-android-kernel" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;In 2021, I had &lt;a href="https://ivonblog.com/en-us/posts/run-docker-natively-on-android/" target="_blank" rel="noreferrer"&gt;built a docker compatible kernel&lt;/a&gt; for Xiaomi Redmi Note 5 Pro (whyred). But at that time I built the kernel out of source tree (standalone) and it was hardly to done for other devices. Therefore, this time I decide to build the kernel with the source tree.&lt;/p&gt;
&lt;p&gt;There is an offcial &lt;a href="https://download.lineageos.org/pdx206" target="_blank" rel="noreferrer"&gt;LineageOS port of pdx206&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We need a 64-bit Linux PC to compile the kernel. Ubuntu would be a good choice, however I use Arch Linux.&lt;/p&gt;
&lt;p&gt;First follow the steps of &lt;a href="https://wiki.lineageos.org/devices/pdx206/build" target="_blank" rel="noreferrer"&gt;Build for pdx206 - LineageOS wiki&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After syncing the code of LineageOS, we can build the kernel only. A &lt;code&gt;boot.img&lt;/code&gt; will be generated after compliation.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Enter the compliation environment.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;source&lt;/span&gt; build/envsetup.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;breakfast pdx206&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Go to the directory of kernel. Generate &lt;code&gt;.config&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/android/lineage/kernel/sony/sm8250/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;ARCH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;arm64
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;make pdx206_defconfig&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Start menu configuration&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;make menuconfig&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;
&lt;p&gt;A menu will pop up. Find the missing configs which listed in Moby&amp;rsquo;s script and enable them. Use Arrow keys to move, press Space to enable/disable configs. Don&amp;rsquo;t forget to hit Save before exit.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;We can search the configs. For example, to find &lt;code&gt;CONFIG_IP_VS&lt;/code&gt;, type &lt;code&gt;/&lt;/code&gt; and type the config name, it shall tell you where it is.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/posts/sony-xperia-5-ii-docker-kernel/images/Screenshot-20230203-202035.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;According to the &lt;code&gt;prompts&lt;/code&gt; of &lt;code&gt;CONFIG_IP_VS&lt;/code&gt;, we know it is located at Networking Support -&amp;gt; Networking options -&amp;gt; Network packet filtering framework (Netfilter) -&amp;gt; IP virtual server support.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/posts/sony-xperia-5-ii-docker-kernel/images/Screenshot-20230203-202049.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Some configs such as &lt;code&gt;CONFIG_CGROUP_HUGETLB&lt;/code&gt; are not available in Android kernel because the kernel of the device is too old.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;CONFIG_BINFMT_MISC&lt;/code&gt; should also be enabled in order to run x86 apps (or docker images) on ARM.&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/sony-xperia-5-ii-docker-kernel/featured.webp"/></item><item><title>KingRoot is a malware. Do not root your phone using this app</title><link>https://ivonblog.com/en-us/posts/kingroot-is-a-malware/</link><pubDate>Sat, 18 Nov 2023 18:30:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/kingroot-is-a-malware/</guid><description>&lt;p&gt;&lt;a href="https://ivonblog.com/en-us/posts/kingroot-is-a-malware/" &gt;閱讀中文版文章&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;KingRoot (also known as KingoRoot or Root Master) is a one-click Root tool developed by Chinese developers. It claims that you can obtain Android Root permissions by simply installing the APP.&lt;/p&gt;
&lt;p&gt;However, Kingroot is generally considered to be malicious software.&lt;/p&gt;
&lt;p&gt;Yes, KingRoot is not a mainstream Root method. The most common Root method in 2023 is to use Magisk.&lt;/p&gt;
&lt;p&gt;In the following I would discusses the reasons why Magisk is better than KingRoot and explains why not to use KingRoot to root your phone.&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Why should you use Magisk instead of KingRoot
 &lt;div id="1-why-should-you-use-magisk-instead-of-kingroot" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-why-should-you-use-magisk-instead-of-kingroot" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;

&lt;h3 class="relative group"&gt;1.1. Security
 &lt;div id="11-security" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#11-security" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;p&gt;Magisk was released around 2016. It is an open source software developed by a Taiwanese developer, topjohnwu. Magisk is based on SuperSU. Magisk is always free, does not collect data, and is still being actively developed.&lt;/p&gt;
&lt;p&gt;Magisk&amp;rsquo;s official website and source code are located at &lt;a href="https://github.com/topjohnwu/Magisk" target="_blank" rel="noreferrer"&gt;Github&lt;/a&gt;. Anyone can check what the program behind it has done.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;KingRoot appeared around 2013. It is a closed-source software developed by Chinese developers. And KingRoot has mobile and PC versions.&lt;/p&gt;
&lt;p&gt;According to &lt;a href="https://baike.baidu.com/item/%E4%B8%80%E9%94%AEroot/3797349" target="_blank" rel="noreferrer"&gt;Related reports cited by Baidu Baike&lt;/a&gt;, KingRoot can root many mobile phones through exploits&amp;hellip; But! Those phones were from 10 years ago, and the vulnerabilities exploited by KingRoot were basically useless after Android 5.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/kingroot-is-a-malware/images/Screenshot_20231118_183018.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;What’s even more ridiculous is that KingRoot now has several “official websites”, and I don’t know which one is real. The KingRoot APKs on the Internet may not be published by the original developer. Some of them may collect the mobile phone&amp;rsquo;s geographical location. You don&amp;rsquo;t know what data is collected behind it. They may also push advertisements or even contain viruses.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/kingroot-is-a-malware/images/Screenshot_20231118_182845.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;There are some discussions about KingRoot on the Internet:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.quora.com/Is-Kingroot-safe" target="_blank" rel="noreferrer"&gt;Is Kingroot safe? - Quora&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.reddit.com/r/androidroot/comments/78914h/spyware_kingroot_kingoroot_iroot_etc/" target="_blank" rel="noreferrer"&gt;Spyware: KingRoot, KingoRoot, iRoot, etc - r/androidroot Reddit&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In 2017, XDA Developers concluded after a long discussion: &amp;ldquo;KingRoot is a adware and malware.&amp;rdquo;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://xdaforums.com/t/kingroot-malware-adware-root.3563090/" target="_blank" rel="noreferrer"&gt;KingRoot Malware/Adware root!! - XDA&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Chinese users on ZhiHu even called KingRoot &amp;ldquo;rogue software&amp;rdquo;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.zhihu.com/question/35558864/" target="_blank" rel="noreferrer"&gt;如何科学，安全，有效地卸载Kingroot？？ - 知乎&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this case, KingRoot is definitely more insecure than Magisk.&lt;/p&gt;

&lt;h3 class="relative group"&gt;1.2. Differences in Root methods
 &lt;div id="12-differences-in-root-methods" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#12-differences-in-root-methods" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;p&gt;Magisk is systemless root. It only modifies boot.img and does not touch the Android system files. Therefore, there is still the possibility of OTA updates after installing Magisk.&lt;/p&gt;
&lt;p&gt;Refer to the &lt;a href="https://ivonblog.com/posts/android-general-flashing-rom/" target="_blank" rel="noreferrer"&gt;How to root Android phone&lt;/a&gt; I wrote. The standard method is to unlock the phone bootloader and flash Magisk to obtain Root permissions. Any device with Android 6 or above can be rooted with Magisk.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/kingroot-is-a-malware/images/magisk.png"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;The principle of KingRoot is similar to the ancient apps such as &amp;ldquo;Baidu One-click Root&amp;rdquo; and &amp;ldquo;360Root&amp;rdquo;. KingRoot use the method of SueprSU in the ancient Android 2.3 era to root your phone, that is, to put the su file into the Android system.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/kingroot-is-a-malware/images/kingroot.png"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;But what to do if there is no custom recovery? KingRoot can only exploit Android system vulnerabilities to obtain root permissions. XDA once reported that &lt;a href="https://www.xda-developers.com/dirty-cow-exploit-linux-android-zniu/" target="_blank" rel="noreferrer"&gt;KingRoot exploits the ZNIU vulnerability&lt;/a&gt; to obtain root privileges.&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/kingroot-is-a-malware/featured.png"/></item><item><title>How to Get Full Control of Your Android Phone</title><link>https://ivonblog.com/en-us/posts/how-to-get-full-control-of-your-android-phone/</link><pubDate>Tue, 20 Dec 2022 00:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/how-to-get-full-control-of-your-android-phone/</guid><description>&lt;p&gt;Have you ever wanted to get rid of bloatware on your phone or change the appearance of the User Interface?
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/how-to-get-full-control-of-your-android-phone/images/BE5QfdL.png"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;figcaption&gt;Android. Wikipedia&lt;/figcaption&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Most of manufacturers of Android phones do not allow users to do these. If users “break” the rules, their warranty will be void and null. Because manufacturers consider these hidden features are dangerous and will eventually brick, or break phones. However, users should have rights to decide what they want to have on their phone instead of being forced to install unnecessary apps. “Root” means granting the highest permission of your phone, which can let you access all functions that are prohibited before. Magisk is the most popular and easiest rooting method in the world currently. The main steps of phone rooting process involves three main steps:&lt;/p&gt;
&lt;p&gt;(1) Unlocking bootloader&lt;/p&gt;
&lt;p&gt;(2) Installing Custom Recovery&lt;/p&gt;
&lt;p&gt;(3) Flashing Magisk and Root Manager&lt;/p&gt;
&lt;p&gt;Android Operating system is based on Linux which use its permission and file-system ownership. Generally, users can do things according to their user permissions, such as installing a new app, but they cannot modify system settings. While the root user, also known as super user, is able to access to any files or folders in the system. Despite Google removed the superuser function from Android OS, there are ways to bring it back.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Unlocking Bootloader
 &lt;div id="unlocking-bootloader" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#unlocking-bootloader" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Unlocking bootloader allows users to install custom firmware on and root their phones. Bootloader is a program that started at computer booting which will load software to memory, then it can boot into operating system. Unfortunately, bootloader on most Android phones are locked by Original Equipment Manufacturers(OEM) to prevent users from granting root permission. Usually, OEMs like Xiaomi, Samsung, Asus will release official tools for consumers to unlock bootloader, while Sony and Huawei do not. Unlocking bootloader can be done by booting the phone into “fastboot mode” and connecting the phone to a computer. Finally, the unlocking tool will unlock bootloader automatically.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Installing Custom Recovery
 &lt;div id="installing-custom-recovery" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#installing-custom-recovery" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Users can modify system settings directly by installing third-party recovery. Recovery is a program for emergency use when the phone is unable to boot into OS. The original recovery provided by OEMs has limited features: rebooting or erasing user data. Therefore, it is recommended to flash a third-party recovery. TWRP and Clockwork are two most famous custom recoveries which can install, in a more formal term, flash Magisk into the system. Besides, they both have Graphical User Interface instead of Command Lines, which is easier for users to interact with. To install custom recoveries, simply flash them via Android Driver Bridge Tool on the computer.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Flashing Magisk and Root Manager
 &lt;div id="flashing-magisk-and-root-manager" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#flashing-magisk-and-root-manager" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;A good root manager is necessary for a rooted phone. Magisk works by repacking boot.img to grant “systemless root” which means Google Safety Check will less likely to detect it. Besides, a root manager is needed. When a app is trying to grant root permission, the manager app will pop up a window which let user allow or reject its request. Therefore, users should save files in the internal storage in advanced. First, boot into recovery by pressing volume up and power button at the same time, click “install ” to flash magsik.zip into the system. Second, rebbot into the system and install Magisk manager.apk.&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/how-to-get-full-control-of-your-android-phone/featured.png"/></item><item><title>[Root] Running docker container on Redmi Note 5 Pro</title><link>https://ivonblog.com/en-us/posts/run-docker-natively-on-android/</link><pubDate>Fri, 29 Jul 2022 14:12:46 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/run-docker-natively-on-android/</guid><description>&lt;p&gt;&lt;a href="https://ivonblog.com/posts/run-docker-natively-on-android/" target="_blank" rel="noreferrer"&gt;🇹🇼 中文版&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It is possibe to run docker containers on Android phone with a custom kernel which enable cgroups and other missing features.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/posts/run-docker-natively-on-android/images/MHbSYmhq.png"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Video&lt;/p&gt;




&lt;div style="position: relative; padding-bottom: 56.25%; overflow: hidden;"&gt;
 &lt;iframe style="position: absolute; width: 100%; height: 100%;"
 src="http://www.youtube.com/embed/XDvDYRxtZHY" allowfullscreen frameborder="0" loading="lazy"&gt;
 &lt;/iframe&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;My deivce: Xiaomi Redmi Note 5 (whyred)&lt;/li&gt;
&lt;li&gt;Phone OS: Lineage OS 18 (Android 11). Rooted.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can download my pre-compiled kernel here if you own the device: &lt;a href="https://github.com/ivon852/android_kernel_xiaomi_whyred_docker" target="_blank" rel="noreferrer"&gt;https://github.com/ivon852/android_kernel_xiaomi_whyred_docker&lt;/a&gt;&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Check if the device supports docker features
 &lt;div id="1-check-if-the-device-supports-docker-features" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-check-if-the-device-supports-docker-features" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;The device must be rooted. Install &lt;a href="https://ivonblog.com/en-us/posts/how-to-use-termux/" target="_blank" rel="noreferrer"&gt;Termux&lt;/a&gt; and check if your device supports docker:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install wget
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wget https://raw.githubusercontent.com/moby/moby/master/contrib/check-config.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chmod +x check-config.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sed -i &lt;span class="s1"&gt;&amp;#39;1s_.*_#!/data/data/com.termux/files/usr/bin/bash_&amp;#39;&lt;/span&gt; check-config.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ./check-config.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;You will see many red &amp;ldquo;missing&amp;rdquo;&amp;quot; under &amp;ldquo;Generally Necessary&amp;rdquo;. So we must enable them in the following steps.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/posts/run-docker-natively-on-android/images/jjtppyjd.jpg"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 class="relative group"&gt;2. Download and modify the kernel
 &lt;div id="2-download-and-modify-the-kernel" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-download-and-modify-the-kernel" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Xiaomi phone is easy for flashing custom roms. Also there are many third-party kernel for them. Sometimes the code is more reliable than the official ones.&lt;/p&gt;
&lt;p&gt;So I choose &lt;a href="https://github.com/radcolor/android_kernel_xiaomi_whyred" target="_blank" rel="noreferrer"&gt;RAD kernel&lt;/a&gt; to begin with.&lt;/p&gt;
&lt;p&gt;My computer operating system is Lubuntu 20.04. You may need a Linux VM for compiling the kernel on Windows.&lt;/p&gt;
&lt;p&gt;Now, please wathc fossfrog&amp;rsquo;s guide to learn how to compile a custom kernel:




&lt;div style="position: relative; padding-bottom: 56.25%; overflow: hidden;"&gt;
 &lt;iframe style="position: absolute; width: 100%; height: 100%;"
 src="http://www.youtube.com/embed/mYp_NnY1jNs" allowfullscreen frameborder="0" loading="lazy"&gt;
 &lt;/iframe&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;h2 class="relative group"&gt;3. Enable missing features in kernel
 &lt;div id="3-enable-missing-features-in-kernel" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-enable-missing-features-in-kernel" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;code&gt;make menuconfig&lt;/code&gt; to launch kconfig Enable all missing features in kernel.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/posts/run-docker-natively-on-android/images/1RkwGvTV.jpg"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For exaple, to enable &lt;code&gt;CONFIG_OVERLAY_FS&lt;/code&gt;, press &lt;code&gt;/&lt;/code&gt; in main menu.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/posts/run-docker-natively-on-android/images/2yZjjFFP.jpg"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Inout the config name, it will tell your where it is.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/posts/run-docker-natively-on-android/images/c1gftpDN.jpg"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 &gt;&lt;/figure&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use up and down arrow key to move. Press &lt;code&gt;y&lt;/code&gt; to enable it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, use right and left key to move to &lt;code&gt;Save&lt;/code&gt;. Then move to &lt;code&gt;Exit&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;According to FreddieOliveira&amp;rsquo;s instructions, you also need to modify &lt;code&gt;kernel/Makefile&lt;/code&gt;:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-diff" data-lang="diff"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gh"&gt;diff --git a/kernel/Makefile b/kernel/Makefile
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gh"&gt;index d5c1115..2dea801 100644
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;--- a/kernel/Makefile
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gi"&gt;+++ b/kernel/Makefile
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; $(obj)/configs.o: $(obj)/config_data.h
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# config_data.h contains the same information as ikconfig.h but gzipped.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Info from config_data can be extracted from /proc/config*
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;targets += config_data.gz
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;-$(obj)/config_data.gz: arch/arm64/configs/lavender_stock-defconfig FORCE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gi"&gt;+$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; $(call if_changed,gzip)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; filechk_ikconfiggz = (echo &amp;#34;static const char kernel_config_data[] __used = MAGIC_START&amp;#34;; cat $&amp;lt; | scripts/basic/bin2c; echo &amp;#34;MAGIC_END;&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="7"&gt;
&lt;li&gt;And this &lt;code&gt;net/netfilter/xt_qtaguid.c&lt;/code&gt;：&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-diff" data-lang="diff"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;--- orig/net/netfilter/xt_qtaguid.c 2020-05-12 12:13:14.000000000 +0300
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gi"&gt;+++ my/net/netfilter/xt_qtaguid.c 2019-09-15 23:56:45.000000000 +0300
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; struct proc_iface_stat_fmt_info *p = m-&amp;gt;private;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; struct iface_stat *iface_entry;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;- struct rtnl_link_stats64 dev_stats, *stats;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gi"&gt;+ struct rtnl_link_stats64 *stats;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; struct rtnl_link_stats64 no_dev_stats = {0};
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; current-&amp;gt;pid, current-&amp;gt;tgid, from_kuid(&amp;amp;init_user_ns, current_fsuid()));
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; iface_entry = list_entry(v, struct iface_stat, list);
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gi"&gt;+ stats = &amp;amp;no_dev_stats;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;- if (iface_entry-&amp;gt;active) {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;- stats = dev_get_stats(iface_entry-&amp;gt;net_dev,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;- &amp;amp;dev_stats);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;- } else {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;- stats = &amp;amp;no_dev_stats;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gd"&gt;- }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /*
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * If the meaning of the data changes, then update the fmtX
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; * string.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="8"&gt;
&lt;li&gt;Complile the kernel&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;make -j8&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="9"&gt;
&lt;li&gt;
&lt;p&gt;Repackage the kerenel into boot.img with Android Image Kitchen. Flash boot.img to the phone.&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/run-docker-natively-on-android/featured.png"/></item></channel></rss>