Difference between revisions of "Linux kernel on Orange Pi 4"

From Dejvino's Knowledge Base
Jump to navigation Jump to search
Line 5: Line 5:
 
'''Prerequisite:''' [[U-Boot on Orange Pi 4]]
 
'''Prerequisite:''' [[U-Boot on Orange Pi 4]]
  
'''Next steps:''' [[RootFS on Orange Pi 4]]
+
'''Next steps:''' [[rootfs on Orange Pi 4]]
  
 
{{Todo|THIS!}}
 
{{Todo|THIS!}}
 +
 +
== Overview ==
 +
In order to build a [[Linux kernel]] you'll need:
 +
# Linux kernel source
 +
# (optional) Patches to add support for the specific hardware
 +
# Cross-compilation toolchain if building on a different device than [[Orange Pi 4]]
  
 
== Setup ==
 
== Setup ==
 +
=== Linux kernel ===
 
{{Todo|Git clone}}
 
{{Todo|Git clone}}
  
{{Todo|1=
+
=== Kernel patches ===
 +
{{Todo|Switch to a [[Mainline Linux]]. Right now we're using a [[BSP Linux kernel]] which already supports [[Orange Pi 4]].}}
 +
 
 +
=== Cross-compilation ===
 +
This is needed only if you're building on a different architecture, e.g. on an x86_64 computer.
  
'''Cross compilation'''
+
{{Todo|Linaro + instructions?}}
  
 
<pre>CROSS_COMPILE=/path/to/toolchain/bin/aarch64-linux-gnu-</pre>
 
<pre>CROSS_COMPILE=/path/to/toolchain/bin/aarch64-linux-gnu-</pre>
}}
 
  
 
== Compiling ==
 
== Compiling ==

Revision as of 23:27, 27 March 2020

Using Linux kernel on an Orange Pi 4.

This page is focused just on building a kernel. For the related required components, see Linux on Orange Pi 4.

Prerequisite: U-Boot on Orange Pi 4

Next steps: rootfs on Orange Pi 4

TODO: THIS!

Overview

In order to build a Linux kernel you'll need:

  1. Linux kernel source
  2. (optional) Patches to add support for the specific hardware
  3. Cross-compilation toolchain if building on a different device than Orange Pi 4

Setup

Linux kernel

TODO: Git clone

Kernel patches

TODO: Switch to a Mainline Linux. Right now we're using a BSP Linux kernel which already supports Orange Pi 4.

Cross-compilation

This is needed only if you're building on a different architecture, e.g. on an x86_64 computer.

TODO: Linaro + instructions?

CROSS_COMPILE=/path/to/toolchain/bin/aarch64-linux-gnu-

Compiling

TODO: compilation

Generate .config file

cd linux
make ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE rk3399_linux_defconfig

Compile the kernel

CORES=4 # number of CPU cores
make ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE -j${CORES} rk3399-orangepi.img

TODO: Modules? Img to flash? boot.img

Flashing

dd if=boot.img of=sdb seek=32768

Related

External Links

  • Mainline Linux kernel [1]
    • Github mirror [2]
  • Rockchip Kernel [opensource.rock-chips.com/wiki_Rockchip_Kernel]
  • Xunlong BSP kernel [3]
    • instructions for older Orange Pis [4]
    • compilation script [5]
  • Armbian kernel patches [6]