<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pine64 pinebookpro &#8211; Flugphase</title>
	<atom:link href="https://blog.reauktion.de/tag/pine64-pinebookpro/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.reauktion.de</link>
	<description>Die Gedanken sind frei</description>
	<lastBuildDate>Fri, 08 Nov 2019 16:07:01 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Pinebook Pro kernel compilation</title>
		<link>https://blog.reauktion.de/pinebook-pro-kernel-compilation/</link>
		
		<dc:creator><![CDATA[Markus Fritsche]]></dc:creator>
		<pubDate>Fri, 08 Nov 2019 11:48:15 +0000</pubDate>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[pine64 pinebookpro]]></category>
		<guid isPermaLink="false">https://dynamic.reauktion.de/flugphase/?p=2778</guid>

					<description><![CDATA[I am a new, proud owner of a Pinebook Pro. The default OS (Debian stretch) comes with a kernel 4.4.190 (updates to 4.4.196). As there is no IO accounting support in the original kernel, also no btrfs support, I set out to compile a custom kernel on the pinebook pro plus booting it safely. You...]]></description>
										<content:encoded><![CDATA[
<p>I am a new, proud owner of a <a href="https://www.pine64.org/pinebook-pro/">Pinebook Pro</a>. The default OS (Debian stretch) comes with a kernel 4.4.190 (updates to 4.4.196). As there is no IO accounting support in the original kernel, also no btrfs support, I set out to compile a custom kernel on the pinebook pro plus booting it safely.</p>



<p>You will need:</p>



<ul class="wp-block-list"><li>a Pinebook Pro</li><li>an SD Card (at least 8GB)</li><li>patience</li></ul>



<h2 class="wp-block-heading">DISCLAIMER</h2>



<p>These instructions are potentially able to brick your device. There are (somewhat painful) ways to get back from a bricked Pinebook Pro (using the RockChip Flash Tool or the UART console). So, if you never compiled a kernel and actually gotten to start it, you might want to refrain from following this guide.</p>



<h2 class="wp-block-heading">Setting up the SD card</h2>



<p>First, I acquired the original Debian image here: <a href="https://github.com/mrfixit2001/debian_desktop/releases/download/190905/pinebookpro-debian-desktop-mrfixit-190905.img.xz">https://github.com/mrfixit2001/debian_desktop/releases/download/190905/pinebookpro-debian-desktop-mrfixit-190905.img.xz</a>.</p>



<p>This needs to be decompressed and &#8222;flashed&#8220; to your SD card (careful!). Be sure to use the right device, otherwise you might end up bricking your Pinebook Pro&#8230;</p>



<p><code>xz -d pinebookpro-debian-desktop-mrfixit-190905.img.xz</code></p>



<p><code>sudo dd if=pinebookpro-debian-desktop-mrfixit-190905.img of=/dev/mmcblk0</code><br><code>sync</code></p>



<p>Eject and insert the SD card.</p>



<p><code>sudo mount /dev/mmcblk0p1 /mnt/</code><br><code>nano /mnt/extlinux/extlinux.conf </code></p>



<p>Make sure it says <br><code>root=/dev/mmcblk1p2</code><br>in line #8 &#8211; this will load the kernel from SD, but set the root to your EMMC (interal) drive.</p>



<p>Reboot and make sure your device boots up normally. If you already did the update before, you will see that your kernel version now (&#8222;uname -a&#8220;) should be 4.4.190 instead of the updated 4.4.196 on your internal drive.</p>



<h2 class="wp-block-heading">Setting up the build environment</h2>



<p>For this, we will use Debian &#8222;Buster&#8220; on your pinebook pro. How? By using snap &amp; lxd!</p>



<p><code>sudo apt install snapd</code><br><code>sudo snap install lxd</code><br><code>sudo /snap/bin/lxd init</code></p>



<p>Accept all defaults <strong>BUT</strong> for the storage pool &#8211; set up a new pool with storage backend &#8222;dir&#8220;.</p>



<p>Once that&#8217;s done, set up a new Debian Buster container:</p>



<p><code>sudo /snap/bin/lxc launch images:debian/buster myvm</code></p>



<p>Depending on your internet connection, this takes a while. Once that&#8217;s done, we&#8217;re ready to use the container:</p>



<p><code>sudo /snap/bin/lxc exec myvm /bin/bash</code></p>



<p>Now you&#8217;re in a shell in your container. First, you want to install some packages:</p>



<p><code>apt-get install crossbuild-essential-arm64 libncurses-dev git bc ccache nano</code></p>



<p>The kernel is an aarch64-kernel, the system is armhf however &#8211; that&#8217;s why we&#8217;re installing a cross compiler (<a href="http://students.engr.scu.edu/~sschaeck/misc/pinebookpro.html">credits</a>). Edit your ~/.bashrc and add</p>



<p><code>export PATH="/usr/lib/ccache:$PATH"</code></p>



<p>At the bottom, then do</p>



<p><code>. ~/.bashrc</code></p>



<p>That should speed up compilation dramatically.</p>



<h2 class="wp-block-heading">Use the source!</h2>



<p>Make a new directory for your linux kernel, i.e. <code>mkdir ~/src</code>. Change to that directory <code>cd ~/src</code> and download the kernel sources of your choice, i.e. <br><code>git clone https://github.com/mrfixit2001/rockchip-kernel.git linux</code></p>



<p>Copy the existing kernel configuration to your source tree:</p>



<p><code>zcat /proc/config.gz ~/src/linux/.config<br>cd ~/src/linux/<br>make oldconfig</code></p>



<p>Almost set to go!</p>



<p><code>make menuconfig</code></p>



<p>Do your changes, save&#8230; now, compile the kernel:</p>



<p><code>make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j 6 bindeb-pkg</code></p>



<p>And the device tree afterwards:</p>



<p><code>make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j 6 rockchip/rk3399-pinebookpro.dtb</code></p>



<p>Log off from your container by using CTRL-D (or the method of your liking). The kernel is now in (with my names):</p>



<p><code>/var/snap/lxd/common/lxd/containers/myvm/rootfs/root/src</code></p>



<p>We&#8217;re going to install this and move it carefully. Make sure /boot/ isn&#8217;t mounted:</p>



<p><code>sudo umount /boot</code><br><code>sudo mount /dev/mmcblk0p1 /mnt/</code><br><code>sudo dpkg -i --force-architecture /var/snap/lxd/common/lxd/containers/myvm/rootfs/root/src/linux-image-4.4.196-gb9a54c00f_4.4.196-gb9a54c00f_arm64.deb</code><br>(or whatever .deb you just created).</p>



<p><code>cp /mnt/rk3399-pinebookpro.dtb /mnt/rk3399-pinebookpro.dtb.bak</code></p>



<p><code>cp /var/snap/lxd/common/lxd/containers/myvm/rootfs/root/src/linux/arch/arm64/boot/dts/rockchip/rk3399-pinebookpro.dtb /mnt/</code></p>



<p>Copy the kernel to SD card:</p>



<p><code>cp /boot/vmlinuz-4.4.196-gb9a54c00f /mnt/Image</code></p>



<p>Done! Reboot&#8230;</p>



<p>Yes, I know that there are LXD Api functions to work with container files, and working as root is not advised. But for the time being, it &#8222;works for me™&#8220;. </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
