How to compile Linux kernel for Orange Pi Zero

In the article Arch Linux on Orange Pi Zero, I wrote about Arch Linux distribution on Orange Pi Zero. Now, I will describe, how to compile own linux kernel for this development platform. But please note, this article is not for newbies. It is necessary to know, how to compile linux kernel, install it by hand and what is DT.

Steps

  1. Download Toolchain
  2. Download kernel source code
  3. Download WiFi driver source code
  4. Configuration of kernel
  5. Compilation of kernel
  6. Compilation of WiFi driver
  7. Installation
  8. Device Tree preparation
  9. U-Boot (optional)
  10. Make SD card bootable

Prerequisites

We need to install Git version control system tools to out GNU/Linux distribution.

X86/X64 GNU/Linux system – everything will be cross-compiled.

Toolchain, kernel and WiFi driver

Just now, we need to download and install toolchain, kernel source code and WiFi driver source code.

For the following, we will use directory /data/OrangePi on our GNU/Linux system.

Now, create /data/OrangePI/download.sh script with content:

Make it executable and execute. After some minutes, we have all prepared and ready for compiling.

Kernel

The /data/OrangePI/linux-sunxi directory contains Linux kernel tree patched by sunxi. It includes patches for ARM SoCs from Allwinner Technology.

You can use my own configuration as a template. Save following content as file named .config, and run make -j9 ARCH=arm oldconfig.