<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Linux Kernel on Ivon's Blog</title><link>https://ivonblog.com/en-us/tags/linux-kernel/</link><description>Recent content in Linux Kernel 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 from Ivon's blog (ivonblog.com). Please cite the source article URL when sharing. All article content is licensed under a Creative Commons Attribution-ShareAlike 4.0 license, unless otherwise stated. For commercial use, please contact me first.</copyright><lastBuildDate>Sun, 17 Mar 2024 17:00:00 +0800</lastBuildDate><atom:link href="https://ivonblog.com/en-us/tags/linux-kernel/index.xml" rel="self" type="application/rss+xml"/><follow_challenge><feedId>56005902658351104</feedId><userId>1132431067563556864</userId></follow_challenge><item><title>Building a Custom System Image with pmbootstrap and Editing Kernel APKBUILD Settings</title><link>https://ivonblog.com/en-us/posts/pmbootstrap-build-custom-image/</link><pubDate>Sun, 17 Mar 2024 17:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/pmbootstrap-build-custom-image/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;Building your own custom postmarketOS image with custom kernels and settings. Then flash it to the device or build an image.&lt;/p&gt;
&lt;p&gt;In my postmarketOS installation article, I mentioned the method for &lt;a href="https://ivonblog.com/en-us/posts/postmarketos-general-installation" target="_blank" rel="noreferrer"&gt;creating images with pmbootstrap&lt;/a&gt;. In practice, this uses pmbootstrap to download each device&amp;rsquo;s configuration files from the official Gitlab repository, then builds everything by hand with scripts.&lt;/p&gt;
&lt;p&gt;pmbootstrap also provides functionality for porting new devices. Users can add device models themselves and do &lt;a href="https://ivonblog.com/en-us/posts/sony-xperia-5-ii-postmarketos-porting" target="_blank" rel="noreferrer"&gt;porting work&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But today I want to talk about modifying existing device configuration files so you can change the build-time configuration. For example, compiling extra drivers into the Linux kernel or adding default packages. &lt;code&gt;pmbootstrap init&lt;/code&gt; cannot do that for us, so we have to edit the &lt;code&gt;APKBUILD&lt;/code&gt; file.&lt;/p&gt;</description><content:encoded>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;Building your own custom postmarketOS image with custom kernels and settings. Then flash it to the device or build an image.&lt;/p&gt;
&lt;p&gt;In my postmarketOS installation article, I mentioned the method for &lt;a href="https://ivonblog.com/en-us/posts/postmarketos-general-installation" target="_blank" rel="noreferrer"&gt;creating images with pmbootstrap&lt;/a&gt;. In practice, this uses pmbootstrap to download each device&amp;rsquo;s configuration files from the official Gitlab repository, then builds everything by hand with scripts.&lt;/p&gt;
&lt;p&gt;pmbootstrap also provides functionality for porting new devices. Users can add device models themselves and do &lt;a href="https://ivonblog.com/en-us/posts/sony-xperia-5-ii-postmarketos-porting" target="_blank" rel="noreferrer"&gt;porting work&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But today I want to talk about modifying existing device configuration files so you can change the build-time configuration. For example, compiling extra drivers into the Linux kernel or adding default packages. &lt;code&gt;pmbootstrap init&lt;/code&gt; cannot do that for us, so we have to edit the &lt;code&gt;APKBUILD&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;At the end, I also include the steps for installing the modified system and building a postmarketOS image file.&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Find the Device Configuration Files
 &lt;div id="1-find-the-device-configuration-files" 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-find-the-device-configuration-files" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;APKBUILD&lt;/code&gt; file is a script that tells pmbootstrap how to handle the Linux kernel.&lt;/p&gt;
&lt;p&gt;So where do you find the &lt;code&gt;APKBUILD&lt;/code&gt; for the device you want?&lt;/p&gt;
&lt;p&gt;When we run &lt;code&gt;pmbootstrap init&lt;/code&gt;, pmbootstrap clones a copy of the Gitlab repository.&lt;/p&gt;
&lt;p&gt;All device configuration files are located here:
&lt;code&gt;~/.local/var/pmbootstrap/cache_git/pmaports/device/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Every postmarketOS device has corresponding directories beginning with &lt;code&gt;linux-&lt;/code&gt; and &lt;code&gt;device-&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;linux-&lt;/code&gt; directory contains Linux kernel build-related settings.&lt;/p&gt;
&lt;p&gt;The directory beginning with &lt;code&gt;device-&lt;/code&gt; contains the hardware information for that device.&lt;/p&gt;
&lt;p&gt;For example, this is the case for &lt;code&gt;pine64-pinetab2&lt;/code&gt; (note: when this was written, the Pinetab2 APKBUILD had not yet entered the Gitlab repository. I manually cloned this from a pull request):&lt;/p&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;├── device-pine64-pinetab2
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│   ├── APKBUILD
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│   ├── deviceinfo
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│   └── uboot-script.cmd
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└── linux-pine64-pinetab2
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ├── APKBUILD
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; └── config-pine64-pinetab2.aarch64&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Since not every device can use a mainline kernel, each postmarketOS device has its own Linux kernel configuration files. In the postmarketOS design, the Linux kernel for most devices is an APK package called a &amp;ldquo;Downstream kernel specific package&amp;rdquo;, corresponding to the &lt;code&gt;linux-&lt;/code&gt; directory mentioned above.&lt;/p&gt;
&lt;p&gt;For devices already ported into the Gitlab repository, the kernel is usually also included in the postmarketOS edge branch package repository, so there is no need to compile it manually.&lt;/p&gt;
&lt;p&gt;Correspondingly, the directory beginning with &lt;code&gt;device-&lt;/code&gt; is called a &amp;ldquo;Device specific package&amp;rdquo;. This package contains the rest of the configuration files for the device.&lt;/p&gt;
&lt;p&gt;Since we said we want to customize the build configuration, let&amp;rsquo;s actually change something. Every device has an APKBUILD file recording how it is built, and that is what we need to edit.&lt;/p&gt;

&lt;h2 class="relative group"&gt;2. Modify the Kernel APKBUILD
 &lt;div id="2-modify-the-kernel-apkbuild" 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-modify-the-kernel-apkbuild" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;First, finish running &lt;code&gt;pmbootstrap&lt;/code&gt; and specify the build device as &lt;code&gt;pine64-pinetab2&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter the directory &lt;code&gt;~/.local/var/pmbootstrap/cache_git/pmaports/device/linux-pine64-pinetab2&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can see the &lt;code&gt;APKBUILD&lt;/code&gt; file. Its contents are simple enough; anyone who has written bash should be able to understand it.&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;└── linux-pine64-pinetab2
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ├── APKBUILD
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; └── config-pine64-pinetab2.aarch64&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;According to the &lt;a href="https://wiki.postmarketos.org/wiki/Downstream_kernel_specific_package" target="_blank" rel="noreferrer"&gt;official Wiki page for Downstream kernel specific package&lt;/a&gt;, you can add custom build commands to APKBUILD, specify a GCC version, and apply extra patches.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The first thing to care about is how the kernel source code is obtained. For PineTab2, it downloads a tar.gz file from the maintainer&amp;rsquo;s own repository and then hands it to pmbootstrap for compilation.&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;&lt;span class="c1"&gt;# Source&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;_tags&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;v6.6.4-danctnix2&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;_config&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;config-&lt;/span&gt;&lt;span class="nv"&gt;$_flavor&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;$arch&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;source&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;	&lt;/span&gt;&lt;span class="nv"&gt;$pkgname&lt;/span&gt;&lt;span class="s2"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;$_tags&lt;/span&gt;&lt;span class="s2"&gt;.tar.gz::https://github.com/dreemurrs-embedded/linux-pinetab2/archive/&lt;/span&gt;&lt;span class="nv"&gt;$_tags&lt;/span&gt;&lt;span class="s2"&gt;.tar.gz
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;	&lt;/span&gt;&lt;span class="nv"&gt;$_config&lt;/span&gt;&lt;span class="s2"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;builddir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$srcdir&lt;/span&gt;&lt;span class="s2"&gt;/linux-pinetab2-&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;_tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;1&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;_outdir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;out&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;Every time the kernel source URL changes, you usually need to regenerate the hash. Run the command in the terminal and let pmbootstrap calculate the hash automatically and write it back into APKBUILD.&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;pmbootstrap checksum linux-pine64-pinetab2&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;After that, you can work with the kernel source. If you only want to enable a few kernel options, just enter kconfig:&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;pmbootstrap kconfig edit linux-pine64-pinetab2&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;
&lt;p&gt;The kernel options edited in kconfig will be saved to the file beginning with &lt;code&gt;config-&lt;/code&gt; in the same directory.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then try recompiling the kernel. pmbootstrap compiles the kernel through cross-compile inside an ARM chroot.&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;&lt;span class="c1"&gt;# Confirm that the kernel satisfies postmarketOS requirements&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pmbootstrap kconfig check
&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 class="c1"&gt;# Add -j8 during compilation to speed it up&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pmbootstrap build linux-pine64-pinetab2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="10"&gt;
&lt;li&gt;If you want to compile with completely different kernel source code, prepare it yourself in another directory (things inside the chroot are not convenient to access), then use &lt;code&gt;--src&lt;/code&gt; to tell pmbootstrap the kernel source path.&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;pmbootstrap build linux-pine64-pinetab2 --src&lt;span class="o"&gt;=&lt;/span&gt;/home/user/Downloads/linux-pinetab2-kernel&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 class="relative group"&gt;3. Modify the Device APKBUILD
 &lt;div id="3-modify-the-device-apkbuild" 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-modify-the-device-apkbuild" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Enter the directory &lt;code&gt;~/.local/var/pmbootstrap/cache_git/pmaports/device/device-pine64-pinetab2&lt;/code&gt;, which contains the following:&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;├── device-pine64-pinetab2
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│   ├── APKBUILD
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│   ├── deviceinfo
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│   └── uboot-script.cmd&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;
&lt;p&gt;&lt;code&gt;deviceinfo&lt;/code&gt; is mainly hardware information for the device, while &lt;code&gt;APKBUILD&lt;/code&gt; is the device configuration. For the contents, refer to the &lt;a href="https://wiki.postmarketos.org/wiki/Device_specific_package" target="_blank" rel="noreferrer"&gt;Wiki page for Device specific package&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For example, add instructions for installing extra packages to &lt;code&gt;subpackages&lt;/code&gt; (separate multiple packages with spaces). This quotes the Wiki&amp;rsquo;s example: add a subpackage named &lt;code&gt;$pkgname-x11&lt;/code&gt;, then add an &lt;code&gt;x11()&lt;/code&gt; function instructing it to install the &lt;code&gt;xf86-video-qxl&lt;/code&gt; package.&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;&lt;span class="nv"&gt;subpackages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$pkgname&lt;/span&gt;&lt;span class="s2"&gt;-kernel-v0:kernel_v0
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$pkgname&lt;/span&gt;&lt;span class="s2"&gt;-kernel-v2:kernel_v2
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$pkgname&lt;/span&gt;&lt;span class="s2"&gt;-x11
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;&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;x11&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="nv"&gt;install_if&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$pkgname&lt;/span&gt;&lt;span class="s2"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$pkgver&lt;/span&gt;&lt;span class="s2"&gt;-r&lt;/span&gt;&lt;span class="nv"&gt;$pkgrel&lt;/span&gt;&lt;span class="s2"&gt; xorg-server&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="nv"&gt;depends&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;xf86-video-qxl&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	mkdir &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$subpkgdir&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;&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;Next, build the device package.&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;pmbootstrap build device-pine64-pinetab2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 class="relative group"&gt;4. Build the Full System Image
 &lt;div id="4-build-the-full-system-image" 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="#4-build-the-full-system-image" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Time to install the modified system onto the device.&lt;/p&gt;
&lt;p&gt;For the steps to build postmarketOS, see &lt;a href="https://ivonblog.com/en-us/posts/postmarketos-general-installation" target="_blank" rel="noreferrer"&gt;creating images with pmbootstrap&lt;/a&gt;. Usually there are the following build methods:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install to SD card&lt;/li&gt;
&lt;li&gt;Flash with fastboot&lt;/li&gt;
&lt;li&gt;Flash with a flashable package&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The latter two methods are for former Android devices. My PineTab 2 is a development board that supports U-Boot, so writing the system to an SD card or eMMC is enough.&lt;/p&gt;
&lt;p&gt;Insert the SD card into the PC, use lsblk to confirm the partitions, and unmount them.&lt;/p&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;lsblk
&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;sudo umount /mnt/sdcard&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Run the following command to tell pmbootstrap to write the system directly to the SD card partition. You will need to set a password during the process.&lt;/p&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;pmbootstrap install --dev&lt;span class="o"&gt;=&lt;/span&gt;/dev/mmcblk0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;hr&gt;
&lt;p&gt;Alternatively, only create the image file:&lt;/p&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;pmbootstrap install&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Then retrieve the image from the tmp directory:&lt;/p&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;pmbootstrap &lt;span class="nb"&gt;export&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 class="nb"&gt;cd&lt;/span&gt; /tmp/postmarketOS-export
&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;cp *.img /home/user/Downloads&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Manually write the image contents to the SD card with dd:&lt;/p&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;sudo dd &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;pine64-pinetab2.img &lt;span class="nv"&gt;of&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/dev/mmcblk0 &lt;span class="nv"&gt;bs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1M &lt;span class="nv"&gt;status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;progress &lt;span class="nv"&gt;conv&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;fsync&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content:encoded></item></channel></rss>