Exotic destinationshttp://lab.objoo.org/2015-08-27T11:05:00+02:00Banana pi custom Kernel (Part II, cross compiling)2015-08-27T11:05:00+02:00Yann Duponttag:lab.objoo.org,2015-08-27:Banana pi II.html<p>I'm back ! Long time ago (March 2015) <a class="reference external" href="http://lab.objoo.org/Banana pi.html">in banana pi custom kernel part I, I promised a follow-up</a> to explain how to cleanly compile a kernel for such beasts. This part was delayed, but here it is at last ! So this article is the follow-up of previous article.</p>
<p>I maintain .config for my bestiary of exotic computers : ARM computers (Bananapi, Odroid, Raspberry pi, Dockstar), MIPS (nexx WT3020), Risc-V (qemu and spikes for the moment).</p>
<p>These .config are available on github : <a class="reference external" href="https://github.com/objoo/custom-linux-kernels">https://github.com/objoo/custom-linux-kernels</a></p>
<p>More on that later, for the moment, let's focus on bananapi.</p>
<p>Please note that this particular .config is based on vanilla kernel 4.1 and targeted for particular small server duties (samba, lxc, XFS and ceph/kRBD support). I personally use this for an ARM ceph cluster.</p>
<div class="figure align-right">
<a class="reference external image-reference" href="../images/img_2455.jpg"><img alt="" src="../images/img_2455.jpg" style="width: 400px;" /></a>
<p class="caption">Nice professional looking ceph cluster, ehhh ?</p>
</div>
<p>Please note, there is <strong>NO</strong> video code on this kernel. <strong>Don't</strong> use it if you need a graphical environment.</p>
<p>Allwinner A20 chip powering bananapi is a quite capable processor and <strong>is</strong> able to compile a kernel, but it may take ages. A faster way is to use a more powerful machine, for example a X86 based PC, and use it to generate programs targeted for ARM. That's cross compilation.</p>
<p>Cross compilation is fast, but it's a complex and sometimes tricky process which requires the installation of lots of specific packages (when they're already available on the distribution and specific recompilations when they're not). A clean way to do this and not mess with the installed system is to use docker containers specially for this.</p>
<p>on the same github repository, there are scripts and Dockerfile to build all necessary parts.</p>
<p>On the building computer, git and docker need to be installed. Choose a clean directory, and check there is enough place for docker. Then :</p>
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
2
3</pre></div></td><td class="code"><div class="highlight"><pre><span class="go">git clone git://github.com/objoo/custom-Linux-kernels</span>
<span class="go">cd custom-Linux-kernels/docker/DockerFiles/X86-64/cross/Debian</span>
<span class="go">./build.sh</span>
</pre></div>
</td></tr></table><p>This will take lot of time for the first build, because this script creates a Debian Jessie docker image, with all cross-compile tools. When this image is run, it fetch uboot and Linux git repositories and compiles all with a pre-defined .config. uboot and linux kernel sources are installed on a persistant storage on the host computer, so next runs are far more speedier.</p>
<p>Upon termination of all these processes, you'll find the resulting files in :</p>
<div class="highlight"><pre><span class="go">../build/RESULT</span>
</pre></div>
<p>uboot install is <strong>optional</strong>, it only need to be installed if the current version sd-card is too ancient.</p>
<p>Installation of uboot is :</p>
<div class="highlight"><pre><span class="go">dd if=u-boot-sunxi-with-spl.bin of of=DEVICE_OF_THE_SDCARD bs=1024 seek=8</span>
</pre></div>
<p>Then, install the modules from / (they go to /lib/modules) and install uImage , sun7i-a20-bananapi.dtb in /boot and you're done. No need to build an Initrd.</p>
<p>If all goes well you'll see :</p>
<div class="highlight"><pre><span class="gp">root@banana-one:~#</span> uname -a
<span class="go">Linux banana-one 4.1.6YDoSHM #2 SMP Wed Aug 26 23:24:00 UTC 2015 armv7l GNU/Linux</span>
</pre></div>
<p>Have a nice hack !</p>
Banana pi custom Kernel (Part I)2015-08-26T11:00:00+02:00Yann Duponttag:lab.objoo.org,2015-03-24:Banana pi.html<p>Banana pi is a small ARM Board, quite cheap and capable. It's not the cheapest or fastest board around (I'll probably make an article about odroid C1 later), but it offers a good compromise.
Being built around Allwinner A20, it offers some interesting features : a Native SATA port, and a gigabit ethernet.</p>
<p>In the sick tradition of lots of ARM Soc makers, Linux support is not stellar, and Lemaker only propose a custom 3.4 kernel.
With these kernels, I encountered stability and performance problems. As I wanted to experiment Ceph on this kind of hardware it's problematic.</p>
<p>And that's where (<a class="reference external" href="http://linux-sunxi.org/Main_Page">http://linux-sunxi.org/Main_Page</a>) Linux Sunix community comes to rescue.
These guys (thanks A LOT to them) are leading Linuxmainlining effort (<a class="reference external" href="http://linux-sunxi.org/Linux_mainlining_effort">http://linux-sunxi.org/Linux_mainlining_effort</a>) and this is paying off.
Should I add it's really up to Allwinner to do this kind of job ?</p>
<p>Anyway. we now have all pieces for having a complete vanilla kernel support, at least for all server-relevant components.</p>
<p>---
I use these custom kernels on banana pi , for lxc & ceph (OSD , MON) usage. I promised a guide for compiling a complete kernel + uboot for bananapi.</p>
<p><a class="reference external" href="http://lab.objoo.org/Banana pi II.html">This is explained in banana pi custom kernel part II</a></p>