ingamedeo / orangepi3-h6-mainline

Mainline kernel Orange Pi 3 (Allwinner H6) with custom DTS, USB3, WiFi, Ethernet (dwmac_meson8b regulator patch), PCI-E patches. EL2 Hypervisor for quirky PCI-E controller.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

orangepi3-h6-mainline

Mainline kernel Orange Pi 3 (Allwinner H6) with USB3, WiFi, Ethernet, PCI-E patches. EL2 Hypervisor for quirky PCI-E controller.

Content

  • arm-trusted-firmware: ARM Trusted Firmware-A

  • aw-el2-barebone: Allwinner SoCs' 64-bit EL2 barebone hypervisor for PCI-E quirky controller.

  • u-boot-2022.10: Mainline u-boot with native eMMC support.

  • u-boot-2019.04: Mainline u-boot. (not needed)

  • u-boot-el1-hyp: Patched u-boot with BL31 and hypervisor support for PCI-Eb quirky controller.

  • u-boot-el1-hyp-emmc: Patched u-boot with BL31 and hypervisor support for PCI-Eb quirky controller. Support for boot from EMMC 8GB.

  • linux-5.7.4: Mainline kernel + out of tree patches for USB3, WiFi Ethernet, PCI-E controller.

  • configs: u-boot-2019.04 and linux-5.7.4 configuration files.

  • dts: custom dts for the Orange Pi 3 (adds emac support to mainline dts as of 11/16/2022)

  • the experimental/ folder contains a new PCIe sunxi module, gmac patches and a dts for newer kernels.

Instructions

Build environment

  • Ubuntu Linux 18.04.6 LTS

The following packages must be installed:

apt-get install build-essential gcc-aarch64-linux-gnu flex bison libssl1.0-dev python2.7-dev python-minimal swig device-tree-compiler

arm-trusted-firmware

make -j8 CROSS_COMPILE=aarch64-linux-gnu- PLAT=sun50i_h6 PRELOADED_BL33_BASE=0x40010000

aw-el2-barebone

make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

u-boot-el1-hyp-emmc

First copy to the u-boot directory the files bl31.bin from arm-trusted-firmware and el2-bb.bin from aw-el2-barebone and rename the latter to hyp.bin.

cp arm-trusted-firmware/build/sun50i_h6/release/bl31.bin u-boot-el1-hyp-emmc/bl31.bin
cp aw-el2-barebone/el2-bb.bin u-boot-el1-hyp-emmc/hyp.bin
cp configs/u-boot-el1-hyp-config u-boot-el1-hyp-emmc/.config
make -j8 ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8

linux-5.7.4

Compilation:

cp configs/linux-5.7.4-config linux-5.7.4/.config
make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dtbs modules
make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=output modules_install
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=output headers_install INSTALL_HDR_PATH=output/usr

Copy to SD card:

cp -R linux-5.7.4/arch/arm64/boot/Image /media/ingamedeo/<UUID>/boot/
cp -R linux-5.7.4/arch/arm64/boot/dts/* /media/ingamedeo/<UUID>/boot/dtbs/
cp -R linux-5.7.4/output/lib/ /media/ingamedeo/<UUID>/usr/
cp -R linux-5.7.4/output/usr/ /media/ingamedeo/<UUID>/

Booting from eMMC

Before you follow these instructions you must have prepared the partition on the eMMC. Create a single partition and format it (mkfs.ext4 -O ^64bit /dev/mmcblk1p1).

echo 0 > /sys/block/mmcblk1boot0/force_ro
echo 0 > /sys/block/mmcblk1boot1/force_ro
mmc bootbus set single_hs x1 x4 /dev/mmcblk1
mmc bootpart enable 1 1 /dev/mmcblk1
dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk1boot0 bs=4k
dd if=u-boot-sunxi-with-spl.bin of=/dev/dev/mmcblk1 bs=1k seek=8

Addendum for mainline kernel 5.19.8 or later (no PCIe support)

To get the Orange Pi 3 to boot on mainline kernel with u-boot-2022.10. The mainline kernel now includes support for ethernet, USB3, eMMC (but no PCIe support):

  • compile arm-trusted-firmware v2.2, move bl31.bin to the u-boot-2022.10 directory.
  • copy dts/sun50i-h6-orangepi-3.dts to u-boot-2022.10/arch/arm/dts/sun50i-h6-orangepi-3.dts
  • compile u-boot-2022.10.
  • extract ArchLinuxARM-aarch64-latest.tar.gz on the SD card.
  • copy u-boot-2022.10/arch/arm/dts/sun50i-h6-orangepi-3.dtb to the SD card at /boot/dtbs/allwinner/sun50i-h6-orangepi-3.dtb

References

About

Mainline kernel Orange Pi 3 (Allwinner H6) with custom DTS, USB3, WiFi, Ethernet (dwmac_meson8b regulator patch), PCI-E patches. EL2 Hypervisor for quirky PCI-E controller.