Skip to content
No description, website, or topics provided.
C C++ Assembly Objective-C Makefile Shell Other
Branch: orange-pi-5.1
Clone or download
Pull request Compare This branch is 2373 commits ahead, 30871 commits behind torvalds:master.
Ondrej Jirman
Ondrej Jirman Merge remote-tracking branch 'stable/linux-5.1.y' into orange-pi-5.1
* stable/linux-5.1.y: (64 commits)
  Linux 5.1.21
  net: sched: verify that q!=NULL before setting q->flags
  mm: vmscan: scan anonymous pages on file refaults
  block: Limit zone array allocation size
  sd_zbc: Fix report zones buffer allocation
  Revert "kvm: x86: Use task structs fpu field for user"
  KVM: nVMX: Clear pending KVM_REQ_GET_VMCS12_PAGES when leaving nested
  KVM: nVMX: do not use dangling shadow VMCS after guest reset
  ext4: allow directory holes
  ext4: use jbd2_inode dirty range scoping
  jbd2: introduce jbd2_inode dirty range scoping
  mm: add filemap_fdatawait_range_keep_errors()
  ext4: enforce the immutable flag on open files
  ext4: don't allow any modifications to an immutable file
  perf/core: Fix race between close() and fork()
  perf/core: Fix exclusive events' grouping
  perf script: Assume native_arch for pipe mode
  MIPS: lb60: Fix pin mappings
  gpio: davinci: silence error prints in case of EPROBE_DEFER
  gpiolib: of: fix a memory leak in of_gpio_flags_quirks()
  ...
Latest commit 6602da9 Jul 28, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Documentation Merge remote-tracking branch 'stable/linux-5.1.y' into orange-pi-5.1 Jul 26, 2019
LICENSES LICENSES: Add GCC runtime library exception text Jan 16, 2019
arch Merge remote-tracking branch 'stable/linux-5.1.y' into orange-pi-5.1 Jul 28, 2019
block block: Limit zone array allocation size Jul 28, 2019
certs kexec, KEYS: Make use of platform keyring for signature verify Feb 4, 2019
crypto crypto: chacha20poly1305 - fix atomic sleep when using async algorithm Jul 26, 2019
drivers Merge remote-tracking branch 'stable/linux-5.1.y' into orange-pi-5.1 Jul 28, 2019
fs ext4: allow directory holes Jul 28, 2019
include Merge remote-tracking branch 'stable/linux-5.1.y' into orange-pi-5.1 Jul 28, 2019
init initramfs: free initrd memory if opening /initrd.image fails Jun 15, 2019
ipc ipc: prevent lockup on alloc_msg and free_msg Jun 15, 2019
kernel perf/core: Fix race between close() and fork() Jul 28, 2019
lib lib/scatterlist: Fix mapping iterator when sg->offset is greater than… Jul 26, 2019
mm mm: vmscan: scan anonymous pages on file refaults Jul 28, 2019
net Merge remote-tracking branch 'stable/linux-5.1.y' into orange-pi-5.1 Jul 28, 2019
samples samples, bpf: suppress compiler warning Jul 14, 2019
scripts kconfig: fix missing choice values in auto.conf Jul 26, 2019
security integrity: Fix __integrity_init_keyring() section mismatch Jul 26, 2019
sound Merge remote-tracking branch 'stable/linux-5.1.y' into orange-pi-5.1 Jul 26, 2019
tools perf script: Assume native_arch for pipe mode Jul 28, 2019
usr user/Makefile: Fix typo and capitalization in comment section Dec 10, 2018
virt KVM: arm/arm64: Fix emulated ptimer irq injection Jul 14, 2019
.clang-format clang-format: Update with the latest for_each macro list Apr 12, 2019
.cocciconfig scripts: add Linux .cocciconfig for coccinelle Jul 22, 2016
.get_maintainer.ignore Add hch to .get_maintainer.ignore Aug 21, 2015
.gitattributes .gitattributes: set git diff driver for C source code files Oct 8, 2016
.gitignore kbuild: Add support for DT binding schema checks Dec 13, 2018
.mailmap Update Nicolas Pitre's email address Apr 3, 2019
0001-sunxi-h3-Fix-PLL1-setup-to-never-use-dividers.patch Add README.md with information, sample config and u-boot patches May 6, 2019
COPYING COPYING: use the new text with points to the license files Mar 23, 2018
CREDITS Merge tag 'char-misc-5.1-rc1' of git://git.kernel.org/pub/scm/linux/k… Mar 6, 2019
Kbuild Merge tag 'kbuild-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/… Mar 11, 2019
Kconfig kconfig: move the "Executable file formats" menu to fs/Kconfig.binfmt Aug 1, 2018
MAINTAINERS MAINTAINERS: Add entry for Himax HM5065 May 6, 2019
Makefile Linux 5.1.21 Jul 28, 2019
README
README.md Add README.md with information, sample config and u-boot patches May 6, 2019
linux-5.1-32 Add README.md with information, sample config and u-boot patches May 6, 2019
linux-5.1-32-tbs Add README.md with information, sample config and u-boot patches May 6, 2019
linux-5.1-64 Add README.md with information, sample config and u-boot patches May 6, 2019

README.md

Mainline linux kernel for Orange Pi PC/PC2/PC3/One

This kernel tree is meant for:

  • Orange Pi One
  • Orange Pi PC
  • Orange Pi PC 2
  • Orange Pi 3
  • TBS A711 Tablet

You can easily port it to other similar H3/H5 based SBCs by modifying the appropriate board DTS files. Usually these boards are either like Orange Pi One, or like Orange Pi PC, or they don't have CPUX voltage regulation at all, so it should be simple.

Features in addition to mainline:

  • [All] Thermal regulation (if CPU heats above certain temperature, it will try to cool itself down by reducing CPU frequency)
  • [All] Wireguard (https://www.wireguard.com/)
  • [Orange Pi One/PC/PC2] Configure on-board micro-switches to perform system power off function
  • [Orange Pi One/PC/PC2/3] CPU DVFS
  • [Orange Pi 3] Ethernet, WiFi, Bluetooth, HDMI, USB 3.0, Real Time Clock
  • [TBS A711] HM5065 (back camera), Power supply/battery driver, Touch screen, ...

Pre-built u-boot and kernels are available at https://xff.cz/kernels/

You can use this kernel to run a desktop environment on Orange Pi SBCs.

Have fun!

Build instructions

These are rudimentary instructions and you need to understand what you're doing. These are just core steps required to build the ATF/u-boot/kernel. Downloading, verifying, renaming to correct directories is not described or mentioned. You should be able to infer missing necessary steps yourself for your particular needs.

Get necessary toolchains from:

Extract toolchains and prepare the environment:

CWD=`pwd`
OUT=$CWD/builds
SRC=$CWD/u-boot
export PATH="$PATH:$CWD/Toolchains/arm/bin:$CWD/Toolchains/aarch64/bin"

For Orange Pi PC2:

export CROSS_COMPILE=aarch64-linux-gnu-
export KBUILD_OUTPUT=$OUT/.tmp/uboot-pc2
rm -rf "$KBUILD_OUTPUT"
mkdir -p $KBUILD_OUTPUT $OUT/pc2

Get and build ATF from https://github.com/ARM-software/arm-trusted-firmware:

make -C "$CWD/arm-trusted-firmware" PLAT=sun50i_a64 DEBUG=1 bl31
cp "$CWD/arm-trusted-firmware/build/sun50i_a64/debug/bl31.bin" "$KBUILD_OUTPUT"

Use sun50i_a64 for Orange Pi PC2 and sun50i_h6 for Orange Pi 3.

Build u-boot from https://megous.com/git/u-boot/ (opi-v2019.04 branch) with appropriate defconfig (orangepi_one_defconfig, orangepi_pc2_defconfig, orangepi_pc_defconfig, orangepi_3_defconfig, tbs_a711_defconfig). This branch already has all the necessary patches integrated and is configured for quick u-boot/kernel startup.

make -C u-boot orangepi_pc2_defconfig
make -C u-boot -j5

cp $KBUILD_OUTPUT/.config $OUT/pc2/uboot.config
cat $KBUILD_OUTPUT/{spl/sunxi-spl.bin,u-boot.itb} > $OUT/pc2/uboot.bin

Get kernel from this repository and checkout the latest orange-pi-5.1 branch.

Configure kernel by using the prepared configuration for H5 and H6 based Orange Pi boards:

cp linux-5.1-64 .config

Build the kernel:

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
export KBUILD_OUTPUT=$OUT/.tmp/linux-arm64
mkdir -p $KBUILD_OUTPUT $OUT/pc2

make -C linux -j5 clean
make -C linux -j5 Image dtbs

cp -f $KBUILD_OUTPUT/arch/arm64/boot/Image $OUT/pc2/
cp -f $KBUILD_OUTPUT/.config $OUT/pc2/linux.config
cp -f $KBUILD_OUTPUT/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dtb $OUT/pc2/board.dtb

Configure kernel by using the prepared configuration for H3 based Orange Pi boards:

cp linux-5.1-32 .config

Build the kernel:

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export KBUILD_OUTPUT=$OUT/.tmp/linux-arm
mkdir -p $KBUILD_OUTPUT $OUT/pc

make -C linux -j5 clean
make -C linux -j5 zImage dtbs

cp -f $KBUILD_OUTPUT/arch/arm/boot/zImage $OUT/pc/
cp -f $KBUILD_OUTPUT/.config $OUT/pc/linux.config
cp -f $KBUILD_OUTPUT/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dtb $OUT/pc/board.dtb
# Or use sun8i-h3-orangepi-one.dtb for Orange Pi One

Firmware files

You may need some firmware files for some part of the functionality. Those are available at: https://megous.com/git/linux-firmware

You may want to configure CONFIG_EXTRA_FIRMWARE and CONFIG_EXTRA_FIRMWARE_DIR to your liking. Default is to build the firmware files into the kernel.

Kernel lockup issues

If you're getting lockups on boot or later during thermal regulation, you're missing an u-boot patch.

This patch is necessary to run this kernel!

These lockups are caused by improper NKMP clock factors selection in u-boot for PLL_CPUX. (M divider should not be used. P divider should be used only for frequencies below 240MHz.)

This patch for u-boot fixes it:

0001-sunxi-h3-Fix-PLL1-setup-to-never-use-dividers.patch

Kernel side is already fixed in this kernel tree.

Sample configuration

  • linux-5.1-32 file contains working configuration of the kernel for Orange Pi PC/One
  • linux-5.1-32-tbs file contains working configuration of the kernel for TBS A711
  • linux-5.1-64 file contains working configuration of the kernel for Orange Pi PC2/3
You can’t perform that action at this time.